@fractalpay/fractalpay-next-dev 0.0.306 → 0.0.307

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -39,7 +39,7 @@ var require_package = __commonJS({
39
39
  "package.json"(exports, module) {
40
40
  module.exports = {
41
41
  name: "@fractalpay/fractalpay-next-dev",
42
- version: "0.0.306",
42
+ version: "0.0.307",
43
43
  private: false,
44
44
  type: "module",
45
45
  scripts: {
@@ -4106,7 +4106,8 @@ function FractalOrderSummary({
4106
4106
  cardIcons,
4107
4107
  note,
4108
4108
  secureIcon,
4109
- secureText = "Secure payment powered by Fractal"
4109
+ secureText = "Secure payment powered by Fractal",
4110
+ extra
4110
4111
  }) {
4111
4112
  return /* @__PURE__ */ jsxs8("aside", { className: "fps-summary", children: [
4112
4113
  /* @__PURE__ */ jsx17("div", { className: "fps-logo", children: logo && /* @__PURE__ */ jsx17("img", { src: logo, alt: "" }) }),
@@ -4121,6 +4122,7 @@ function FractalOrderSummary({
4121
4122
  /* @__PURE__ */ jsx17("div", { className: "fps-total-label", children: totalLabel }),
4122
4123
  /* @__PURE__ */ jsx17("div", { className: "fps-total", children: total })
4123
4124
  ] }),
4125
+ extra,
4124
4126
  cardIcons && /* @__PURE__ */ jsxs8("div", { className: "fps-cards", children: [
4125
4127
  /* @__PURE__ */ jsx17("img", { src: cardIcons.visa, alt: "Visa" }),
4126
4128
  /* @__PURE__ */ jsx17("img", { src: cardIcons.mastercard, alt: "Mastercard" }),
@@ -4326,6 +4328,7 @@ function GetPaymentPage(props) {
4326
4328
  const [cashDiscount, setCashDiscount] = useState4(Number(props == null ? void 0 : props.amount));
4327
4329
  const [bankAmount, setBankAmount] = useState4(Number(props == null ? void 0 : props.amount));
4328
4330
  const [bankFeeAmount, setBankFeeAmount] = useState4(0);
4331
+ const [bankSavingsAmount, setBankSavingsAmount] = useState4(0);
4329
4332
  const [paymentData, setPaymentData] = useState4();
4330
4333
  let [tranId, setTranId] = useState4("");
4331
4334
  let [isDebitAdjusted, setIsDebitAdjusted] = useState4(false);
@@ -4434,16 +4437,18 @@ function GetPaymentPage(props) {
4434
4437
  setCashDiscount(cash_discount);
4435
4438
  const cardFeeAmount = Number((Number(props == null ? void 0 : props.amount) - Number(cash_discount || 0)).toFixed(2));
4436
4439
  const bankFeeAmount2 = Number((props == null ? void 0 : props.bankFeeAmount) || 0);
4437
- const bankSavingsAmount = Math.max(bankFeeAmount2 > 0 ? cardFeeAmount - bankFeeAmount2 : cardFeeAmount, 0);
4438
- const bankSavingsText = bankSavingsAmount > 0 ? `Save ${formatUSD(bankSavingsAmount.toFixed(2))}` : "";
4440
+ const bankSavingsAmount2 = Math.max(bankFeeAmount2 > 0 ? cardFeeAmount - bankFeeAmount2 : cardFeeAmount, 0);
4441
+ const bankSavingsText = bankSavingsAmount2 > 0 ? `Save ${formatUSD(bankSavingsAmount2.toFixed(2))}` : "";
4439
4442
  setBankFeeAmount(bankFeeAmount2);
4443
+ setBankSavingsAmount(bankSavingsAmount2);
4440
4444
  console.log({
4441
4445
  cash_discount,
4442
4446
  bankAmount: bankAmount2,
4443
4447
  cardFeeAmount,
4444
4448
  bankFeeAmount: bankFeeAmount2,
4445
- bankSavingsAmount,
4446
- bankSavingsText
4449
+ bankSavingsAmount: bankSavingsAmount2,
4450
+ bankSavingsText,
4451
+ amount: props == null ? void 0 : props.amount
4447
4452
  });
4448
4453
  }
4449
4454
  }, [show, props == null ? void 0 : props.pass_fee, props == null ? void 0 : props.amount, props == null ? void 0 : props.surcharge]);
@@ -5304,7 +5309,7 @@ function GetPaymentPage(props) {
5304
5309
  cardTotal = Number((props == null ? void 0 : props.amount) || 0);
5305
5310
  }
5306
5311
  const surchargeFee = Math.max(cardTotal - baseAmount, 0);
5307
- const isBankView = activetab === "ach";
5312
+ const isBankView = activetab !== "reader" && activeinCard === "list" && !!(selectedCard == null ? void 0 : selectedCard.id) ? (selectedCard == null ? void 0 : selectedCard.card_type) === "Bank" : activetab === "ach";
5308
5313
  const discountNum = Number((props == null ? void 0 : props.discount) || 0);
5309
5314
  const taxNum = Number((props == null ? void 0 : props.tax) || 0);
5310
5315
  const leftTotal = isBankView ? Number(bankAmount || 0) : cardTotal;
@@ -5361,11 +5366,16 @@ function GetPaymentPage(props) {
5361
5366
  { label: "Tax", value: fmtNum(taxNum), muted: true },
5362
5367
  ...showSurchargeLine ? [{ label: "Surcharge", value: formatUSD(surchargeFee.toFixed(2)) }] : []
5363
5368
  ];
5364
- const summaryNote = !hasFee ? null : isBankView ? /* @__PURE__ */ jsx18(FractalSavingsNote, { label: isSurchargeProgram ? "Savings" : "Cash discount savings", amount: formatUSD(surchargeFee.toFixed(2)) }) : isSurchargeProgram ? /* @__PURE__ */ jsxs9("div", { className: "fps-note", children: [
5369
+ const summaryNote = isBankView ? bankSavingsAmount > 0 ? /* @__PURE__ */ jsx18(FractalSavingsNote, { label: isSurchargeProgram ? "Savings" : "Cash discount savings", amount: formatUSD(bankSavingsAmount.toFixed(2)) }) : null : !hasFee ? null : isSurchargeProgram ? bankFeeAmount > 0 ? /* @__PURE__ */ jsxs9("div", { className: "fps-note", children: [
5365
5370
  /* @__PURE__ */ jsx18("b", { children: formatUSD(baseAmount.toFixed(2)) }),
5366
- " if customer pays with debit or by bank (no surcharge)."
5371
+ " if customer pays with debit (no surcharge), or ",
5372
+ /* @__PURE__ */ jsx18("b", { children: formatUSD(Number(bankAmount || 0).toFixed(2)) }),
5373
+ " if by bank."
5367
5374
  ] }) : /* @__PURE__ */ jsxs9("div", { className: "fps-note", children: [
5368
5375
  /* @__PURE__ */ jsx18("b", { children: formatUSD(baseAmount.toFixed(2)) }),
5376
+ " if customer pays with debit or by bank (no surcharge)."
5377
+ ] }) : /* @__PURE__ */ jsxs9("div", { className: "fps-note", children: [
5378
+ /* @__PURE__ */ jsx18("b", { children: formatUSD(Number(bankAmount || 0).toFixed(2)) }),
5369
5379
  " if customer pays by bank (cash discount price)."
5370
5380
  ] });
5371
5381
  const LeftSummary = /* @__PURE__ */ jsx18(
@@ -7475,103 +7485,10 @@ function CardOnFile({ session_token, callback, isloading, onCancel, showChecks,
7475
7485
  import { useEffect as useEffect12, useRef as useRef7, useState as useState7 } from "react";
7476
7486
  import axios6 from "axios";
7477
7487
  import Swal3 from "sweetalert2";
7478
-
7479
- // src/app/components/Atoms/CardBankRadio/CardBankRadio.tsx
7480
- import { Fragment as Fragment14, jsx as jsx27, jsxs as jsxs14 } from "react/jsx-runtime";
7481
- var CardBankRadio = (_a) => {
7482
- var _b = _a, { skydesign = false, savingsText } = _b, props = __objRest(_b, ["skydesign", "savingsText"]);
7483
- const savingsBadgeClass = `frac-saving-badge ${skydesign ? "frac-saving-badge-corner" : "frac-saving-badge-corner frac-saving-badge-with-radio"}`;
7484
- return /* @__PURE__ */ jsx27(Fragment14, { children: /* @__PURE__ */ jsx27(
7485
- "div",
7486
- {
7487
- className: `frac-card-bank-radio ${props.activetab === props.value ? "frac-active" : ""}`,
7488
- onClick: () => props.onChange(props.value),
7489
- role: "radio",
7490
- children: skydesign ? /* @__PURE__ */ jsxs14(Fragment14, { children: [
7491
- /* @__PURE__ */ jsxs14("div", { className: "frac-card-title-main", children: [
7492
- /* @__PURE__ */ jsxs14("div", { className: "box-inner-card-text", children: [
7493
- /* @__PURE__ */ jsx27("img", { src: props.label.toLowerCase() === "card" ? defaultcard : props.label.toLowerCase() === "reader" ? pax : bankNew, className: "frac-payment-type-logo", alt: "" }),
7494
- /* @__PURE__ */ jsx27("div", { className: "frac-card-label-text", children: props.label })
7495
- ] }),
7496
- /* @__PURE__ */ jsx27("div", { className: "frac-card-label", children: /* @__PURE__ */ jsx27("div", { className: "frac-card-label-amount", children: formatUSD(props.amount) }) })
7497
- ] }),
7498
- /* @__PURE__ */ jsx27("div", { children: /* @__PURE__ */ jsx27("input", { name: "paymenttype", checked: props.activetab === props.value, type: "hidden", value: props.value, onChange: (e) => {
7499
- props.onChange(e.target.value);
7500
- } }) })
7501
- ] }) : /* @__PURE__ */ jsxs14(Fragment14, { children: [
7502
- /* @__PURE__ */ jsxs14("div", { className: "frac-card-title-main", children: [
7503
- /* @__PURE__ */ jsx27("img", { src: props.label.toLowerCase() === "card" ? defaultcard : props.label.toLowerCase() === "reader" ? pax : bankNew, className: "frac-payment-type-logo", alt: "" }),
7504
- /* @__PURE__ */ jsxs14("div", { className: "frac-card-label", children: [
7505
- /* @__PURE__ */ jsx27("div", { className: "frac-card-label-text", children: props.label }),
7506
- /* @__PURE__ */ jsx27("div", { className: "frac-card-label-amount", children: formatUSD(props.amount) })
7507
- ] })
7508
- ] }),
7509
- /* @__PURE__ */ jsx27("div", { children: /* @__PURE__ */ jsx27("input", { name: "paymenttype", checked: props.activetab === props.value, type: "radio", value: props.value, onChange: (e) => {
7510
- props.onChange(e.target.value);
7511
- } }) })
7512
- ] })
7513
- }
7514
- ) });
7515
- };
7516
-
7517
- // src/app/components/PartialPayment/PartialPayment.tsx
7518
- import { IoArrowBack } from "react-icons/io5";
7519
-
7520
- // src/app/components/Atoms/CardList/CardList.tsx
7521
- import { Fragment as Fragment15, jsx as jsx28, jsxs as jsxs15 } from "react/jsx-runtime";
7522
- var CardList = ({ listHeading = "Card", ListItems, selectedCard, setSelectedCard, paymentGateway, handleDeleteCard, otherButtonAction, otherButtonLabel, headingClass }) => {
7523
- let trash2 = S3Url + "widget/Trash.svg";
7524
- return /* @__PURE__ */ jsxs15(Fragment15, { children: [
7525
- /* @__PURE__ */ jsx28("h6", { className: headingClass || "card-ach-heading", style: { marginBottom: "10px !important" }, children: listHeading }),
7526
- /* @__PURE__ */ jsxs15("div", { className: "card-lint-div-in", children: [
7527
- /* @__PURE__ */ jsx28("div", { className: "card-list-div", children: ListItems && (ListItems == null ? void 0 : ListItems.length) > 0 && (ListItems == null ? void 0 : ListItems.map((card, index) => {
7528
- let isDisabled = false;
7529
- if (paymentGateway) {
7530
- isDisabled = paymentGateway != (card == null ? void 0 : card.payment_method_type) && (card == null ? void 0 : card.card_type) != "Bank";
7531
- }
7532
- return /* @__PURE__ */ jsxs15("div", { className: "card-list-single-div", children: [
7533
- /* @__PURE__ */ jsxs15("div", { className: "card-number-radio", children: [
7534
- /* @__PURE__ */ jsx28(
7535
- "input",
7536
- {
7537
- disabled: isDisabled,
7538
- type: "radio",
7539
- className: "cardRadio",
7540
- name: "selected_card",
7541
- id: "",
7542
- checked: (selectedCard == null ? void 0 : selectedCard.id) === (card == null ? void 0 : card.id),
7543
- onChange: (e) => setSelectedCard(card)
7544
- }
7545
- ),
7546
- /* @__PURE__ */ jsxs15("label", { htmlFor: "", className: "card-number-last-four", children: [
7547
- "**** ",
7548
- card == null ? void 0 : card.cardlastfourdigit
7549
- ] }),
7550
- (card == null ? void 0 : card.card_type) != "Bank" && /* @__PURE__ */ jsxs15("h6", { className: "card-expiry-date", children: [
7551
- card == null ? void 0 : card.expmonth,
7552
- "/",
7553
- card == null ? void 0 : card.expyear
7554
- ] })
7555
- ] }),
7556
- /* @__PURE__ */ jsxs15("div", { className: "card-number-radio", children: [
7557
- /* @__PURE__ */ jsx28("span", { className: "visa-card", children: /* @__PURE__ */ jsx28("img", { src: getCardType(card == null ? void 0 : card.card_type), alt: "" }) }),
7558
- /* @__PURE__ */ jsx28("span", { className: "visa-card", style: { cursor: "pointer" }, onClick: () => handleDeleteCard(card == null ? void 0 : card.id), children: /* @__PURE__ */ jsx28("img", { src: trash2, alt: "" }) })
7559
- ] })
7560
- ] }, card == null ? void 0 : card.id);
7561
- })) }),
7562
- /* @__PURE__ */ jsxs15("div", { className: "pay-with-other-card", onClick: otherButtonAction, children: [
7563
- otherButtonLabel,
7564
- /* @__PURE__ */ jsx28("img", { src: defaultcard, alt: "" })
7565
- ] })
7566
- ] })
7567
- ] });
7568
- };
7569
-
7570
- // src/app/components/PartialPayment/PartialPayment.tsx
7571
7488
  import { NumericFormat } from "react-number-format";
7572
- import { Fragment as Fragment16, jsx as jsx29, jsxs as jsxs16 } from "react/jsx-runtime";
7489
+ import { Fragment as Fragment14, jsx as jsx27, jsxs as jsxs14 } from "react/jsx-runtime";
7573
7490
  function PartialPayment(props) {
7574
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
7491
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
7575
7492
  const buttonRef = useRef7(null);
7576
7493
  useEffect12(() => {
7577
7494
  if (props.onTriggerPay) {
@@ -7593,15 +7510,14 @@ function PartialPayment(props) {
7593
7510
  const [loading, setLoading] = useState7(false);
7594
7511
  const [loading2, setLoading2] = useState7(false);
7595
7512
  const [loadingIframe, setLoadingIframe] = useState7(false);
7513
+ const [surchargeLookupLoading, setSurchargeLookupLoading] = useState7(false);
7596
7514
  const [errorIframe, setErrorIframe] = useState7("");
7597
7515
  const [error, setError] = useState7("");
7598
7516
  const [success, setSuccess] = useState7(false);
7599
7517
  const [show, setShow] = useState7(false);
7600
7518
  const [activetab, setActive] = useState7("card");
7601
- const [activeList, setActiveList] = useState7("card");
7602
7519
  const [activeinCard, setActiveinCard] = useState7("form");
7603
7520
  const [activeinBank, setActiveinBank] = useState7("form");
7604
- const [activeForm, setActiveForm] = useState7(true);
7605
7521
  const [saveCardInfo, setSaveCardInfo] = useState7(false);
7606
7522
  const [saveACHinfo, setSaveACHinfo] = useState7(false);
7607
7523
  const fractalpayClientKey = props.merchantPublicKey;
@@ -7648,6 +7564,11 @@ function PartialPayment(props) {
7648
7564
  };
7649
7565
  const [paymentData, setPaymentData] = useState7();
7650
7566
  let [tranId, setTranId] = useState7("");
7567
+ const [surchargeResult, setSurchargeResult] = useState7(null);
7568
+ const isSurchargeProgram = Number(paymentData == null ? void 0 : paymentData.surchargeProgram) === 1;
7569
+ const fundingType = (_a = surchargeResult == null ? void 0 : surchargeResult.card_issue_type) == null ? void 0 : _a.toLowerCase();
7570
+ const feeExempt = fundingType === "debit" || fundingType === "prepaid";
7571
+ const cardTotal = isSurchargeProgram && feeExempt ? Number((_b = cashDiscount != null ? cashDiscount : props == null ? void 0 : props.amount) != null ? _b : 0) : Number(aftertaxAmount);
7651
7572
  const showLoader = () => setLoading(true);
7652
7573
  const hideLoader = () => setLoading(false);
7653
7574
  const CalculateCashDiscount = (amount, surcharge) => {
@@ -7660,6 +7581,69 @@ function PartialPayment(props) {
7660
7581
  const originalAmount = +amount + +(amount * surchargeVal);
7661
7582
  return originalAmount;
7662
7583
  };
7584
+ const createSurchargeSession = async () => {
7585
+ var _a2;
7586
+ try {
7587
+ const requestOptions = { method: "POST", redirect: "follow" };
7588
+ const res = await axios6.post(`${masterBaseUrl}api/v1/widget/generate-session`, requestOptions);
7589
+ const data = (_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.data;
7590
+ const public_key_pem = (data == null ? void 0 : data.publicKeyPem) || (data == null ? void 0 : data.public_key_pem);
7591
+ const session_key = data == null ? void 0 : data.session_key;
7592
+ if (!public_key_pem || !session_key) return null;
7593
+ return { session_key, public_key_pem };
7594
+ } catch (err) {
7595
+ console.error("Surcharge session error", err);
7596
+ return null;
7597
+ }
7598
+ };
7599
+ const getSurchargeOptions = () => {
7600
+ var _a2;
7601
+ return {
7602
+ amount: Math.round((partialAmount && !partialError ? Number(partialAmount) : Number((_a2 = cashDiscount != null ? cashDiscount : props == null ? void 0 : props.amount) != null ? _a2 : 0)) * 100),
7603
+ cardholder_billing_zip: (cardData == null ? void 0 : cardData.zipCode) || void 0
7604
+ };
7605
+ };
7606
+ const runCofSurchargeLookup = async (cardId) => {
7607
+ var _a2, _b2;
7608
+ try {
7609
+ const res = await axios6.post(`${baseUrl}surcharge-lookup-cof`, {
7610
+ fractalpayPublicKey: fractalpayClientKey,
7611
+ customer_id: props == null ? void 0 : props.customerId,
7612
+ card_id: cardId,
7613
+ amount: partialAmount && !partialError ? Number(partialAmount) : Number((_a2 = cashDiscount != null ? cashDiscount : props == null ? void 0 : props.amount) != null ? _a2 : 0),
7614
+ cardholder_billing_zip: (cardData == null ? void 0 : cardData.zipCode) || void 0
7615
+ });
7616
+ const data = (_b2 = res == null ? void 0 : res.data) == null ? void 0 : _b2.data;
7617
+ if (!data) return null;
7618
+ return {
7619
+ card_brand: data.card_brand,
7620
+ card_issue_type: data.card_issue_type,
7621
+ surcharge_allowed: data.surcharge_allowed,
7622
+ max_surcharge_percent: data.max_surcharge_percent,
7623
+ max_surcharge_amount: data.max_surcharge_amount
7624
+ };
7625
+ } catch (err) {
7626
+ console.error("COF surcharge lookup failed", err);
7627
+ return null;
7628
+ }
7629
+ };
7630
+ useEffect12(() => {
7631
+ const surchargingOn = Number(paymentData == null ? void 0 : paymentData.surchargeProgram) === 1 && !!(props == null ? void 0 : props.pass_fee);
7632
+ if (!surchargingOn || !(selectedCard == null ? void 0 : selectedCard.id) || selectedCard.card_type === "Bank") {
7633
+ setSurchargeResult(null);
7634
+ return;
7635
+ }
7636
+ let cancelled = false;
7637
+ setSurchargeLookupLoading(true);
7638
+ runCofSurchargeLookup(selectedCard.id).then((result) => {
7639
+ if (cancelled) return;
7640
+ setSurchargeResult(result);
7641
+ setSurchargeLookupLoading(false);
7642
+ });
7643
+ return () => {
7644
+ cancelled = true;
7645
+ };
7646
+ }, [selectedCard == null ? void 0 : selectedCard.id, selectedCard == null ? void 0 : selectedCard.card_type, paymentData == null ? void 0 : paymentData.surchargeProgram, props == null ? void 0 : props.pass_fee]);
7663
7647
  useEffect12(() => {
7664
7648
  if (show) {
7665
7649
  if (props == null ? void 0 : props.pass_fee) {
@@ -7677,6 +7661,7 @@ function PartialPayment(props) {
7677
7661
  setError("");
7678
7662
  setSuccess(false);
7679
7663
  setTranId("");
7664
+ setSurchargeResult(null);
7680
7665
  setAchData({
7681
7666
  name: "",
7682
7667
  routingNumber: "",
@@ -7725,8 +7710,6 @@ function PartialPayment(props) {
7725
7710
  });
7726
7711
  setSelectedReader({});
7727
7712
  setCashDiscount(0);
7728
- setActiveList("card");
7729
- setActiveForm(true);
7730
7713
  setActiveinBank("form");
7731
7714
  setActiveinCard("form");
7732
7715
  setLoading2(false);
@@ -7742,9 +7725,6 @@ function PartialPayment(props) {
7742
7725
  setLoderText("");
7743
7726
  };
7744
7727
  const handleShow = () => setShow(true);
7745
- const handletabchange = (id) => {
7746
- setActive(id);
7747
- };
7748
7728
  const handleCardChange = (field, value) => {
7749
7729
  const name2 = field;
7750
7730
  const numericFields = ["expiryMonth", "expiryYear", "zipCode", "cvv"];
@@ -7850,7 +7830,7 @@ function PartialPayment(props) {
7850
7830
  return Object.keys(errors).length > 0;
7851
7831
  };
7852
7832
  const submitFunc = async (e) => {
7853
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2;
7833
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l, _m, _n;
7854
7834
  e.preventDefault();
7855
7835
  const el = document.activeElement;
7856
7836
  if (el instanceof HTMLElement) {
@@ -7883,7 +7863,7 @@ function PartialPayment(props) {
7883
7863
  response.isCardSave = `${saveCardInfo}`;
7884
7864
  response.isCharge = true;
7885
7865
  response.posSalesIdEncode = (_a3 = paymentData == null ? void 0 : paymentData.orderDetails) == null ? void 0 : _a3.orderId;
7886
- response.partial_amount = partialAmount && !partialError ? partialAmount : aftertaxAmount;
7866
+ response.partial_amount = partialAmount && !partialError ? partialAmount : cardTotal;
7887
7867
  socketClient_default.emit("sendMessage", response);
7888
7868
  let eventName = (_b3 = paymentData == null ? void 0 : paymentData.orderDetails) == null ? void 0 : _b3.orderId;
7889
7869
  socketClient_default.on(eventName, (data) => {
@@ -7926,15 +7906,16 @@ function PartialPayment(props) {
7926
7906
  session_key: (_f2 = (_e2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _e2.data) == null ? void 0 : _f2.session_key
7927
7907
  });
7928
7908
  const card_issue_type = ((_g2 = tokenizeData == null ? void 0 : tokenizeData.bin_lookup_result) == null ? void 0 : _g2.card_issue_type) || null;
7929
- if (card_issue_type === "Debit" && (props == null ? void 0 : props.pass_fee) && (paymentData == null ? void 0 : paymentData.surchargeProgram) == 1) {
7930
- setLoderText("Processing Debit card without fee");
7909
+ const feeExemptCard = ["debit", "prepaid"].includes(String(card_issue_type || "").toLowerCase());
7910
+ if (feeExemptCard && (props == null ? void 0 : props.pass_fee) && (paymentData == null ? void 0 : paymentData.surchargeProgram) == 1) {
7911
+ setLoderText(`Processing ${card_issue_type} card without fee`);
7931
7912
  }
7932
7913
  const reqData = JSON.stringify(__spreadProps(__spreadValues({}, tokenizeData), {
7933
7914
  isSaveCardChecked: saveCardInfo,
7934
7915
  name: cardData == null ? void 0 : cardData.cardName,
7935
7916
  postal_code: cardData == null ? void 0 : cardData.zipCode,
7936
7917
  customer_id: props == null ? void 0 : props.customerId,
7937
- partial_amount: partialAmount && !partialError ? partialAmount : aftertaxAmount,
7918
+ partial_amount: partialAmount && !partialError ? partialAmount : cardTotal,
7938
7919
  card_issue_type
7939
7920
  }));
7940
7921
  const reqData2 = JSON.stringify({
@@ -7975,7 +7956,7 @@ function PartialPayment(props) {
7975
7956
  }
7976
7957
  } catch (err) {
7977
7958
  setLoading2(false);
7978
- setError(((_l2 = (_k2 = err == null ? void 0 : err.response) == null ? void 0 : _k2.data) == null ? void 0 : _l2.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
7959
+ setError(((_l = (_k2 = err == null ? void 0 : err.response) == null ? void 0 : _k2.data) == null ? void 0 : _l.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
7979
7960
  }
7980
7961
  } else {
7981
7962
  try {
@@ -7992,7 +7973,7 @@ function PartialPayment(props) {
7992
7973
  }
7993
7974
  } catch (err) {
7994
7975
  setLoading2(false);
7995
- setError(((_n2 = (_m2 = err == null ? void 0 : err.response) == null ? void 0 : _m2.data) == null ? void 0 : _n2.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
7976
+ setError(((_n = (_m = err == null ? void 0 : err.response) == null ? void 0 : _m.data) == null ? void 0 : _n.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
7996
7977
  }
7997
7978
  }
7998
7979
  }
@@ -8046,7 +8027,7 @@ function PartialPayment(props) {
8046
8027
  }
8047
8028
  };
8048
8029
  const getPaymentDetails = async () => {
8049
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2, _q2, _r2, _s2, _t2, _u2, _v2, _w2, _x2, _y2, _z2, _A;
8030
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A;
8050
8031
  showLoader();
8051
8032
  try {
8052
8033
  const data = {
@@ -8064,7 +8045,7 @@ function PartialPayment(props) {
8064
8045
  let willShowCardForm = true;
8065
8046
  if (((_e2 = (_d2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _d2.data) == null ? void 0 : _e2.card_list) && ((_h2 = (_g2 = (_f2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _f2.data) == null ? void 0 : _g2.card_list) == null ? void 0 : _h2.length) > 0) {
8066
8047
  let banklists = (_k2 = (_j2 = (_i2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _i2.data) == null ? void 0 : _j2.card_list) == null ? void 0 : _k2.filter((card) => (card == null ? void 0 : card.card_type) == "Bank");
8067
- let cardlists = (_n2 = (_m2 = (_l2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _l2.data) == null ? void 0 : _m2.card_list) == null ? void 0 : _n2.filter((card) => (card == null ? void 0 : card.card_type) !== "Bank");
8048
+ let cardlists = (_n = (_m = (_l = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _l.data) == null ? void 0 : _m.card_list) == null ? void 0 : _n.filter((card) => (card == null ? void 0 : card.card_type) !== "Bank");
8068
8049
  if ((cardlists == null ? void 0 : cardlists.length) > 0) {
8069
8050
  setActiveinCard("list");
8070
8051
  willShowCardForm = false;
@@ -8077,17 +8058,17 @@ function PartialPayment(props) {
8077
8058
  } else {
8078
8059
  setActive("card");
8079
8060
  }
8080
- if (((_p2 = (_o2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _o2.data) == null ? void 0 : _p2.paymentDeviceList) && ((_s2 = (_r2 = (_q2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _q2.data) == null ? void 0 : _r2.paymentDeviceList) == null ? void 0 : _s2.length) > 0) {
8081
- setSelectedReader((_u2 = (_t2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _t2.data) == null ? void 0 : _u2.paymentDeviceList[0]);
8061
+ if (((_p = (_o = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _o.data) == null ? void 0 : _p.paymentDeviceList) && ((_s = (_r = (_q = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _q.data) == null ? void 0 : _r.paymentDeviceList) == null ? void 0 : _s.length) > 0) {
8062
+ setSelectedReader((_u = (_t = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _t.data) == null ? void 0 : _u.paymentDeviceList[0]);
8082
8063
  }
8083
- if (willShowCardForm && ((_w2 = (_v2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _v2.data) == null ? void 0 : _w2.paymentGateway) === 31 && ((_y2 = (_x2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _x2.data) == null ? void 0 : _y2.dctoken)) {
8064
+ if (willShowCardForm && ((_w = (_v = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _v.data) == null ? void 0 : _w.paymentGateway) === 31 && ((_y = (_x = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _x.data) == null ? void 0 : _y.dctoken)) {
8084
8065
  setLoadingIframe(true);
8085
8066
  }
8086
8067
  hideLoader();
8087
8068
  } catch (err) {
8088
8069
  console.log(err);
8089
8070
  hideLoader();
8090
- setError(((_A = (_z2 = err == null ? void 0 : err.response) == null ? void 0 : _z2.data) == null ? void 0 : _A.message) || (err == null ? void 0 : err.message) || "Something went wrong");
8071
+ setError(((_A = (_z = err == null ? void 0 : err.response) == null ? void 0 : _z.data) == null ? void 0 : _A.message) || (err == null ? void 0 : err.message) || "Something went wrong");
8091
8072
  }
8092
8073
  };
8093
8074
  const handlechargeCustomer = async (e) => {
@@ -8115,7 +8096,7 @@ function PartialPayment(props) {
8115
8096
  } else if (card_type === "Bank") {
8116
8097
  amount2 = cashDiscount;
8117
8098
  } else {
8118
- amount2 = aftertaxAmount;
8099
+ amount2 = cardTotal;
8119
8100
  }
8120
8101
  let chargeobj = {
8121
8102
  amount: amount2,
@@ -8141,8 +8122,9 @@ function PartialPayment(props) {
8141
8122
  "Content-Type": "application/json"
8142
8123
  };
8143
8124
  setLoading2(true);
8144
- if (card_issue_type == "Debit" && (props == null ? void 0 : props.pass_fee) && (paymentData == null ? void 0 : paymentData.surchargeProgram) == 1) {
8145
- setLoderText("Processing Debit card without fee");
8125
+ const feeExemptCard = ["debit", "prepaid"].includes(String(card_issue_type || "").toLowerCase());
8126
+ if (feeExemptCard && (props == null ? void 0 : props.pass_fee) && (paymentData == null ? void 0 : paymentData.surchargeProgram) == 1) {
8127
+ setLoderText(`Processing ${card_issue_type} card without fee`);
8146
8128
  }
8147
8129
  socketClient_default.emit("sendMessage", { url: chargeurl, body: card_type == "Bank" ? rest : chargeobj, isChargebycard: true });
8148
8130
  socketClient_default.on("charge-by-card", (response) => {
@@ -8205,13 +8187,6 @@ function PartialPayment(props) {
8205
8187
  setError("Something went wrong.");
8206
8188
  }
8207
8189
  };
8208
- const handlepayment = (e) => {
8209
- if (activeList === "card") {
8210
- handlechargeCustomer(e);
8211
- } else if (activeList === "reader") {
8212
- handleChargewithEMV(e);
8213
- }
8214
- };
8215
8190
  useEffect12(() => {
8216
8191
  if (show && fractalpayClientKey) {
8217
8192
  getPaymentDetails();
@@ -8251,7 +8226,6 @@ function PartialPayment(props) {
8251
8226
  confirmButtonText: "OK",
8252
8227
  showConfirmButton: true,
8253
8228
  timer: 1e3,
8254
- // auto-close after 1 second
8255
8229
  timerProgressBar: true,
8256
8230
  customClass: {
8257
8231
  confirmButton: "btn btn-dark"
@@ -8305,11 +8279,6 @@ function PartialPayment(props) {
8305
8279
  return card;
8306
8280
  }
8307
8281
  };
8308
- const getCashDiscount = () => {
8309
- let cashDiscountNew = cashDiscount || 0;
8310
- let diff = Number(aftertaxAmount) - cashDiscountNew;
8311
- return diff.toFixed(0);
8312
- };
8313
8282
  const handlePartialChange = (values) => {
8314
8283
  var _a2, _b2, _c2, _d2;
8315
8284
  if (activetab === "ach") {
@@ -8321,9 +8290,9 @@ function PartialPayment(props) {
8321
8290
  setPartialError("");
8322
8291
  }
8323
8292
  } else {
8324
- if (((_c2 = Number(aftertaxAmount)) == null ? void 0 : _c2.toFixed(2)) < (values == null ? void 0 : values.floatValue) || (values == null ? void 0 : values.floatValue) <= 0) {
8293
+ if (((_c2 = Number(cardTotal)) == null ? void 0 : _c2.toFixed(2)) < (values == null ? void 0 : values.floatValue) || (values == null ? void 0 : values.floatValue) <= 0) {
8325
8294
  setPartialAmount(values == null ? void 0 : values.value);
8326
- setPartialError(`Partial amount cannot exceed ${formatUSD((_d2 = Number(aftertaxAmount)) == null ? void 0 : _d2.toFixed(2))}`);
8295
+ setPartialError(`Partial amount cannot exceed ${formatUSD((_d2 = Number(cardTotal)) == null ? void 0 : _d2.toFixed(2))}`);
8327
8296
  } else {
8328
8297
  setPartialAmount(values == null ? void 0 : values.value);
8329
8298
  setPartialError("");
@@ -8331,30 +8300,136 @@ function PartialPayment(props) {
8331
8300
  }
8332
8301
  };
8333
8302
  useEffect12(() => {
8334
- const baseAmount = activetab === "ach" ? Number(cashDiscount) : Number(aftertaxAmount);
8303
+ const baseAmount2 = activetab === "ach" ? Number(cashDiscount) : Number(cardTotal);
8335
8304
  const partial = Number(partialAmount);
8336
8305
  if (partialAmount) {
8337
- if (partial <= 0 || partial > baseAmount) {
8338
- setPartialError(`Partial amount cannot exceed ${formatUSD(baseAmount.toFixed(2))}`);
8306
+ if (partial <= 0 || partial > baseAmount2) {
8307
+ setPartialError(`Partial amount cannot exceed ${formatUSD(baseAmount2.toFixed(2))}`);
8339
8308
  } else {
8340
8309
  setPartialError("");
8341
8310
  }
8342
8311
  } else {
8343
8312
  setPartialError("");
8344
8313
  }
8345
- }, [activetab, partialAmount, cashDiscount, aftertaxAmount]);
8314
+ }, [activetab, partialAmount, cashDiscount, cardTotal]);
8346
8315
  useEffect12(() => {
8347
8316
  if (typeof FractalTokenizer === "undefined") return;
8348
8317
  const tokenizer = new FractalTokenizer({
8349
8318
  styles: {}
8350
8319
  });
8351
8320
  }, []);
8352
- return /* @__PURE__ */ jsxs16(Fragment16, { children: [
8353
- /* @__PURE__ */ jsx29(DataScript, {}),
8354
- /* @__PURE__ */ jsx29(Chargewidgetstyles, {}),
8355
- /* @__PURE__ */ jsx29(CardBankRadioStyles, {}),
8356
- (paymentData == null ? void 0 : paymentData.paymentGateway) === 32 && /* @__PURE__ */ jsx29(FractalTokenizerScript, { onLoad: () => setTokenizerReady(true) }),
8357
- (paymentData == null ? void 0 : paymentData.paymentGateway) === 31 && /* @__PURE__ */ jsx29(
8321
+ const merchantName = (paymentData == null ? void 0 : paymentData.bname) || (paymentData == null ? void 0 : paymentData.customer_name) || "the merchant";
8322
+ const invoiceNo = String((props == null ? void 0 : props.orderID) || "").replace(/^\s*invoice\s*#?\s*/i, "").trim();
8323
+ const invoiceLabel = invoiceNo ? `Invoice #${invoiceNo}` : "Invoice";
8324
+ const baseAmount = Number((_c = cashDiscount != null ? cashDiscount : props == null ? void 0 : props.amount) != null ? _c : 0);
8325
+ const surchargeFee = Math.max(cardTotal - baseAmount, 0);
8326
+ const isBankView = activetab !== "reader" && activeinCard === "list" && !!(selectedCard == null ? void 0 : selectedCard.id) ? (selectedCard == null ? void 0 : selectedCard.card_type) === "Bank" : activetab === "ach";
8327
+ const discountNum = Number((props == null ? void 0 : props.discount) || 0);
8328
+ const taxNum = Number((props == null ? void 0 : props.tax) || 0);
8329
+ const hasFee = surchargeFee > 0 && !!(props == null ? void 0 : props.pass_fee);
8330
+ const showSurchargeLine = isSurchargeProgram && !isBankView && hasFee;
8331
+ const summarySubtotal = isSurchargeProgram || isBankView ? baseAmount : cardTotal;
8332
+ const fmtNum = (n) => Number(n).toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 });
8333
+ const partialOverride = partialAmount && !partialError ? Number(partialAmount) : null;
8334
+ const methodTotal = isBankView ? Number(cashDiscount || 0) : cardTotal;
8335
+ const effectiveTotal = partialOverride != null ? partialOverride : methodTotal;
8336
+ const hideBank = true;
8337
+ const savedMethods = [...cardList || [], ...hideBank ? [] : bankList || []];
8338
+ const hasSaved = savedMethods.length > 0;
8339
+ const showList = hasSaved && activetab !== "reader" && activeinCard === "list";
8340
+ const availableMethods = [
8341
+ "card",
8342
+ ...!hideBank && (paymentData == null ? void 0 : paymentData.isSkyFiAccount) ? ["ach"] : [],
8343
+ ...(paymentData == null ? void 0 : paymentData.paymentDeviceList) && paymentData.paymentDeviceList.length > 0 ? ["reader"] : []
8344
+ ];
8345
+ const goToList = () => {
8346
+ setActive("card");
8347
+ setActiveinCard("list");
8348
+ setActiveinBank("list");
8349
+ setError("");
8350
+ };
8351
+ const payWithOther = () => {
8352
+ setActive("card");
8353
+ setActiveinCard("form");
8354
+ setActiveinBank("form");
8355
+ setError("");
8356
+ };
8357
+ const switchMethod = (m) => {
8358
+ setActive(m);
8359
+ if (m === "card" || m === "ach") {
8360
+ setActiveinCard("form");
8361
+ setActiveinBank("form");
8362
+ }
8363
+ setError("");
8364
+ };
8365
+ const rightTitle = showList ? "Payment methods" : activetab === "reader" ? "Reader payment" : activetab === "ach" ? "Bank payment" : "Card payment";
8366
+ const showBack = hasSaved && !showList;
8367
+ const MethodToggle = /* @__PURE__ */ jsx27(
8368
+ FractalMethodToggle,
8369
+ {
8370
+ methods: [
8371
+ { value: "card", label: "Card" },
8372
+ ...availableMethods.includes("ach") ? [{ value: "ach", label: "Bank" }] : [],
8373
+ ...availableMethods.includes("reader") ? [{ value: "reader", label: "Reader" }] : []
8374
+ ],
8375
+ active: activetab,
8376
+ onChange: switchMethod
8377
+ }
8378
+ );
8379
+ const summaryLines = [
8380
+ { label: "Subtotal", value: fmtNum(summarySubtotal) },
8381
+ { label: "Discount", value: fmtNum(discountNum), muted: true },
8382
+ { label: "Tax", value: fmtNum(taxNum), muted: true },
8383
+ ...showSurchargeLine ? [{ label: "Surcharge", value: formatUSD(surchargeFee.toFixed(2)) }] : []
8384
+ ];
8385
+ const summaryNote = isBankView ? null : !hasFee ? null : /* @__PURE__ */ jsxs14("div", { className: "fps-note", children: [
8386
+ /* @__PURE__ */ jsx27("b", { children: formatUSD(baseAmount.toFixed(2)) }),
8387
+ " if customer pays with debit or by bank (no surcharge)."
8388
+ ] });
8389
+ const partialInput = (props == null ? void 0 : props.allowPartial) ? /* @__PURE__ */ jsx27(FractalField, { label: "Partial payment", htmlFor: "partialpayment", error: partialError, children: /* @__PURE__ */ jsx27(
8390
+ NumericFormat,
8391
+ {
8392
+ id: "partialpayment",
8393
+ className: "fps-input",
8394
+ prefix: "$",
8395
+ thousandSeparator: true,
8396
+ allowNegative: false,
8397
+ allowLeadingZeros: false,
8398
+ decimalScale: 2,
8399
+ fixedDecimalScale: true,
8400
+ placeholder: "Enter partial amount",
8401
+ value: partialAmount,
8402
+ onValueChange: handlePartialChange
8403
+ }
8404
+ ) }) : null;
8405
+ const LeftSummary = /* @__PURE__ */ jsx27(
8406
+ FractalOrderSummary,
8407
+ {
8408
+ logo: paymentData == null ? void 0 : paymentData.logo,
8409
+ invoiceLabel,
8410
+ lines: summaryLines,
8411
+ total: formatUSD(effectiveTotal.toFixed(2)),
8412
+ cardIcons: isBankView ? null : { visa: visa2, mastercard: mastercard2, amex: americanexp2, discover: discover2 },
8413
+ note: summaryNote,
8414
+ secureIcon: secure2,
8415
+ extra: partialInput
8416
+ }
8417
+ );
8418
+ const AuthText = /* @__PURE__ */ jsxs14("p", { className: "fps-auth", children: [
8419
+ "By paying, you authorize ",
8420
+ merchantName,
8421
+ " to charge ",
8422
+ formatUSD(effectiveTotal.toFixed(2)),
8423
+ " to your ",
8424
+ isBankView ? "account" : "card",
8425
+ ". ",
8426
+ /* @__PURE__ */ jsx27("u", { children: "Refund policy" }),
8427
+ "."
8428
+ ] });
8429
+ return /* @__PURE__ */ jsxs14(Fragment14, { children: [
8430
+ /* @__PURE__ */ jsx27(DataScript, {}),
8431
+ (paymentData == null ? void 0 : paymentData.paymentGateway) === 32 && /* @__PURE__ */ jsx27(FractalTokenizerScript, { onLoad: () => setTokenizerReady(true) }),
8432
+ (paymentData == null ? void 0 : paymentData.paymentGateway) === 31 && /* @__PURE__ */ jsx27(
8358
8433
  DataCapScriptLoader,
8359
8434
  {
8360
8435
  onReady: () => {
@@ -8367,521 +8442,233 @@ function PartialPayment(props) {
8367
8442
  }
8368
8443
  }
8369
8444
  ),
8370
- /* @__PURE__ */ jsxs16(Fragment16, { children: [
8371
- /* @__PURE__ */ jsx29("button", { ref: buttonRef, style: { display: "none" }, className: "paymentBtn", onClick: handleShow, children: "Pay" }),
8372
- /* @__PURE__ */ jsxs16(
8445
+ /* @__PURE__ */ jsx27(Chargewidgetstyles, {}),
8446
+ /* @__PURE__ */ jsx27(CardBankRadioStyles, {}),
8447
+ /* @__PURE__ */ jsx27(FractalWidgetStyles, {}),
8448
+ /* @__PURE__ */ jsxs14(Fragment14, { children: [
8449
+ /* @__PURE__ */ jsx27("button", { ref: buttonRef, style: { display: "none" }, className: "paymentBtn", onClick: handleShow, children: "Pay" }),
8450
+ /* @__PURE__ */ jsxs14(
8373
8451
  CustomModal2_default,
8374
8452
  {
8375
8453
  open: show,
8376
8454
  onClose: handleClose,
8455
+ maxWidth: "760px",
8377
8456
  children: [
8378
- error && /* @__PURE__ */ jsx29("div", { style: { maxHeight: "606px", minHeight: "60vh", padding: "40px" }, children: /* @__PURE__ */ jsx29(ErrorCardMessage_default, { error, onClose: handleClose }) }),
8379
- errorIframe && /* @__PURE__ */ jsx29("div", { style: { maxHeight: "606px", minHeight: "60vh", padding: "40px" }, children: /* @__PURE__ */ jsx29(ErrorCardMessage_default, { error: errorIframe, onClose: () => {
8457
+ error && /* @__PURE__ */ jsx27("div", { style: { maxHeight: "606px", minHeight: "60vh", padding: "40px" }, children: /* @__PURE__ */ jsx27(ErrorCardMessage_default, { error, onClose: handleClose }) }),
8458
+ errorIframe && /* @__PURE__ */ jsx27("div", { style: { maxHeight: "606px", minHeight: "60vh", padding: "40px" }, children: /* @__PURE__ */ jsx27(ErrorCardMessage_default, { error: errorIframe, onClose: () => {
8380
8459
  setErrorIframe("");
8381
8460
  } }) }),
8382
- success && /* @__PURE__ */ jsx29(SuccessMsz, { onClose: handleClose, tranId, isDebitAdjusted }),
8383
- !error && !success && !errorIframe && /* @__PURE__ */ jsxs16(Fragment16, { children: [
8384
- (loading || loading2 || loadingIframe) && /* @__PURE__ */ jsx29(Loader_default, { loading: loading || loading2 || loadingIframe, loaderText }),
8385
- /* @__PURE__ */ jsx29("div", { className: "frac-card-payment-page frac-form", children: /* @__PURE__ */ jsxs16("div", { className: "parent-pay-container", children: [
8386
- /* @__PURE__ */ jsx29("span", { className: "request-payment-close-popup", onClick: handleClose, children: /* @__PURE__ */ jsxs16("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: [
8387
- /* @__PURE__ */ jsx29("g", { clipPath: "url(#clip0_12425_52336)", children: /* @__PURE__ */ jsx29("path", { d: "M9.46585 8.01168L15.6959 1.7814C16.1014 1.37615 16.1014 0.720912 15.6959 0.315659C15.2907 -0.0895946 14.6354 -0.0895946 14.2302 0.315659L7.99991 6.54593L1.76983 0.315659C1.36438 -0.0895946 0.709336 -0.0895946 0.304082 0.315659C-0.101361 0.720912 -0.101361 1.37615 0.304082 1.7814L6.53416 8.01168L0.304082 14.2419C-0.101361 14.6472 -0.101361 15.3024 0.304082 15.7077C0.506045 15.9098 0.771595 16.0114 1.03695 16.0114C1.30232 16.0114 1.56768 15.9098 1.76983 15.7077L7.99991 9.47742L14.2302 15.7077C14.4323 15.9098 14.6977 16.0114 14.9631 16.0114C15.2284 16.0114 15.4938 15.9098 15.6959 15.7077C16.1014 15.3024 16.1014 14.6472 15.6959 14.2419L9.46585 8.01168Z", fill: "#727272" }) }),
8388
- /* @__PURE__ */ jsx29("defs", { children: /* @__PURE__ */ jsx29("clipPath", { id: "clip0_12425_52336", children: /* @__PURE__ */ jsx29("rect", { width: "16", height: "16", fill: "white" }) }) })
8389
- ] }) }),
8390
- /* @__PURE__ */ jsx29("div", { className: "pay-main-logo-res", children: /* @__PURE__ */ jsx29("img", { src: paymentData == null ? void 0 : paymentData.logo, id: "pay-logos" }) }),
8391
- /* @__PURE__ */ jsxs16("div", { className: "pay-container", children: [
8392
- /* @__PURE__ */ jsxs16("div", { className: "pay-header pay-conatiner-one frac-pay-conatiner-one", children: [
8393
- /* @__PURE__ */ jsxs16("div", { className: "pay-conatiner-one-first", children: [
8394
- /* @__PURE__ */ jsxs16("div", { className: "pay-logo-container", children: [
8395
- /* @__PURE__ */ jsx29("div", { className: "pay-main-logo", children: /* @__PURE__ */ jsx29("img", { src: paymentData == null ? void 0 : paymentData.logo, id: "pay-logos" }) }),
8396
- (cardList == null ? void 0 : cardList.length) > 0 && activetab !== "cardList" && /* @__PURE__ */ jsxs16("button", { className: "res-charge-payment-back-btn ", onClick: () => setActive("cardList"), children: [
8397
- " ",
8398
- /* @__PURE__ */ jsx29(IoArrowBack, {}),
8399
- " Back"
8400
- ] })
8401
- ] }),
8402
- /* @__PURE__ */ jsxs16("div", { className: "amt-pay-con", children: [
8403
- /* @__PURE__ */ jsx29("div", { className: "pay-amount-conatiner", children: /* @__PURE__ */ jsx29("small", { className: "pay-payment-amount", children: "Select payment type" }) }),
8404
- /* @__PURE__ */ jsx29("div", { className: "frac-card-bank-radio-main", children: /* @__PURE__ */ jsx29(CardBankRadio, { label: "Card", amount: (_a = Number(aftertaxAmount)) == null ? void 0 : _a.toFixed(2), value: "card", onChange: handletabchange, activetab }) }),
8405
- !loading && (activetab === "card" || activetab === "reader") && (props == null ? void 0 : props.pass_fee) && cashDiscount && cashDiscount > 0 && /* @__PURE__ */ jsxs16("div", { className: "frac-cash-discount-fee", children: [
8406
- /* @__PURE__ */ jsx29("small", { children: (paymentData == null ? void 0 : paymentData.surchargeProgram) == 1 ? "Surcharge" : (paymentData == null ? void 0 : paymentData.showSurcharge) ? "3% Card Fee" : "Cash Discount" }),
8407
- /* @__PURE__ */ jsx29("p", { children: formatUSD((Number(props.amount) - cashDiscount).toFixed(2)) })
8408
- ] }),
8409
- !loading && (props == null ? void 0 : props.pass_fee) && /* @__PURE__ */ jsx29("div", { className: "", children: (activetab === "card" || activetab === "reader") && (props == null ? void 0 : props.pass_fee) && cashDiscount && cashDiscount > 0 && /* @__PURE__ */ jsxs16(
8410
- "div",
8411
- {
8412
- id: "surcharge-program-notice",
8413
- className: "surcharge-program-notice-text",
8414
- children: [
8415
- "A 3% processing surcharge is applied to all credit card transactions. Debit card payments are processed for",
8416
- " ",
8417
- /* @__PURE__ */ jsxs16("span", { className: "surcharge-program-notice-text-att", children: [
8418
- "$",
8419
- Number(cashDiscount).toLocaleString("en-US", {
8420
- minimumFractionDigits: 2,
8421
- maximumFractionDigits: 2
8422
- })
8423
- ] })
8424
- ]
8461
+ success && /* @__PURE__ */ jsx27(SuccessMsz, { onClose: handleClose, tranId, isDebitAdjusted }),
8462
+ !error && !success && !errorIframe && /* @__PURE__ */ jsxs14(Fragment14, { children: [
8463
+ (loading || loading2 || loadingIframe || surchargeLookupLoading) && /* @__PURE__ */ jsx27(Loader_default, { loading: loading || loading2 || loadingIframe || surchargeLookupLoading, loaderText }),
8464
+ /* @__PURE__ */ jsxs14("div", { className: "fps-modal", children: [
8465
+ LeftSummary,
8466
+ /* @__PURE__ */ jsxs14("section", { className: "fps-content", children: [
8467
+ /* @__PURE__ */ jsx27(FractalModalHeader, { title: rightTitle, onBack: showBack ? goToList : void 0, onClose: handleClose }),
8468
+ showList ? /* @__PURE__ */ jsxs14(Fragment14, { children: [
8469
+ /* @__PURE__ */ jsx27(
8470
+ FractalSavedMethods,
8471
+ {
8472
+ sectionLabel: "Cards / bank accounts",
8473
+ items: savedMethods.map((card) => {
8474
+ const isBankCard = (card == null ? void 0 : card.card_type) === "Bank";
8475
+ let isDisabled = false;
8476
+ if (paymentData == null ? void 0 : paymentData.paymentGateway) {
8477
+ isDisabled = (paymentData == null ? void 0 : paymentData.paymentGateway) != (card == null ? void 0 : card.payment_method_type) && !isBankCard;
8425
8478
  }
8426
- ) }),
8427
- (props == null ? void 0 : props.allowPartial) && /* @__PURE__ */ jsxs16("div", { className: "frac-partial-payment-input", children: [
8428
- /* @__PURE__ */ jsx29("label", { htmlFor: "partialpayment", children: "Partial Payment" }),
8429
- /* @__PURE__ */ jsx29(
8430
- NumericFormat,
8431
- {
8432
- prefix: "$",
8433
- className: "form-control",
8434
- value: partialAmount,
8435
- onValueChange: (values) => {
8436
- handlePartialChange(values);
8437
- },
8438
- thousandSeparator: true,
8439
- placeholder: "Enter partial amount",
8440
- allowNegative: false,
8441
- allowLeadingZeros: false,
8442
- decimalScale: 2,
8443
- fixedDecimalScale: true
8444
- }
8445
- ),
8446
- partialError && /* @__PURE__ */ jsx29("span", { className: "error-span", children: partialError })
8447
- ] })
8448
- ] })
8449
- ] }),
8450
- /* @__PURE__ */ jsxs16("div", { className: "pay-conatiner-one-last", children: [
8451
- /* @__PURE__ */ jsx29("img", { src: secure2, alt: "" }),
8452
- /* @__PURE__ */ jsx29("img", { src: pov2, alt: "" }),
8453
- "Secure payments powered by Fractal"
8454
- ] })
8455
- ] }),
8456
- /* @__PURE__ */ jsx29("div", { className: "pay-tab pay-conatiner-two", children: !loading && /* @__PURE__ */ jsx29("div", { className: "col-md-12", children: /* @__PURE__ */ jsxs16("div", { id: "payment-form-div", children: [
8457
- activetab !== "cardList" ? /* @__PURE__ */ jsxs16("div", { className: "frac-charge-payment-back-btn-wrap ", children: [
8458
- (cardList == null ? void 0 : cardList.length) > 0 && /* @__PURE__ */ jsxs16("button", { className: "charge-payment-back-btn ", onClick: () => setActive("cardList"), children: [
8459
- " ",
8460
- /* @__PURE__ */ jsx29(IoArrowBack, {}),
8461
- " Back"
8462
- ] }),
8463
- (paymentData == null ? void 0 : paymentData.isSkyFiAccount) && /* @__PURE__ */ jsxs16("div", { className: "tab", children: [
8464
- /* @__PURE__ */ jsxs16("button", { className: "tablinks", onClick: (e) => {
8465
- handletabchange("card");
8466
- }, style: { border: activetab === "card" ? "1px solid" : "" }, children: [
8467
- /* @__PURE__ */ jsx29("i", { className: "fas fa-credit-card me-2", style: { marginRight: "8px", fontSize: "15px" } }),
8468
- "Card"
8469
- ] }),
8470
- /* @__PURE__ */ jsxs16("button", { className: "tablinks", onClick: (e) => {
8471
- handletabchange("ach");
8472
- }, style: { border: activetab === "ach" ? "1px solid" : "" }, children: [
8473
- /* @__PURE__ */ jsx29("i", { className: "fas fa-university me-2", style: { marginRight: "8px", fontSize: "15px" } }),
8474
- "Bank"
8475
- ] })
8476
- ] }),
8477
- /* @__PURE__ */ jsxs16("div", { className: "res-pay-con", children: [
8478
- /* @__PURE__ */ jsxs16("div", { className: "pay-amount-conatiner", style: { margin: 0 }, children: [
8479
- /* @__PURE__ */ jsx29("small", { className: "pay-payment-amount", children: "Payment Amount" }),
8480
- /* @__PURE__ */ jsxs16("strong", { className: "pay-amount", children: [
8481
- "$",
8482
- (_b = Number(aftertaxAmount)) == null ? void 0 : _b.toFixed(2)
8483
- ] })
8484
- ] }),
8485
- activetab != "ach" && /* @__PURE__ */ jsxs16("div", { children: [
8486
- /* @__PURE__ */ jsxs16("div", { children: [
8487
- /* @__PURE__ */ jsx29("img", { src: visa2, alt: "", width: 35, style: { paddingRight: "5px" } }),
8488
- /* @__PURE__ */ jsx29("img", { src: mastercard2, width: 35, alt: "" })
8489
- ] }),
8490
- /* @__PURE__ */ jsxs16("div", { children: [
8491
- /* @__PURE__ */ jsx29("img", { src: americanexp2, alt: "", width: 35, style: { paddingRight: "5px" } }),
8492
- /* @__PURE__ */ jsx29("img", { src: discover2, width: 35, alt: "" })
8493
- ] })
8494
- ] })
8495
- ] }),
8496
- !loading && numberToBoolean(paymentData == null ? void 0 : paymentData.showSurcharge) ? cashDiscount && cashDiscount > 0 && (props == null ? void 0 : props.pass_fee) ? /* @__PURE__ */ jsxs16("div", { className: "frac-cash-discount-fee", children: [
8497
- /* @__PURE__ */ jsxs16("small", { children: [
8498
- activetab === "card" ? "Cash Discount" : "Cash Discount Savings",
8499
- " "
8500
- ] }),
8501
- /* @__PURE__ */ jsx29("p", { children: formatUSD((Number(aftertaxAmount) - cashDiscount).toFixed(2)) })
8502
- ] }) : null : cashDiscount && cashDiscount > 0 && (props == null ? void 0 : props.pass_fee) && activetab === "card" ? /* @__PURE__ */ jsxs16("div", { className: "frac-cash-discount-fee", children: [
8503
- /* @__PURE__ */ jsxs16("small", { children: [
8504
- activetab === "card" ? "Surcharge" : null,
8505
- " "
8506
- ] }),
8507
- /* @__PURE__ */ jsx29("p", { children: formatUSD((Number(aftertaxAmount) - cashDiscount).toFixed(2)) })
8508
- ] }) : null
8509
- ] }) : /* @__PURE__ */ jsxs16("div", { children: [
8510
- /* @__PURE__ */ jsxs16("h6", { className: "charge-customer-name", style: { marginBottom: "16px !important" }, children: [
8511
- " Charge ",
8512
- paymentData == null ? void 0 : paymentData.customer_name
8513
- ] }),
8514
- /* @__PURE__ */ jsxs16("h6", { className: "card-ach-heading", style: { marginBottom: "10px !important" }, children: [
8515
- " ",
8516
- activeList === "card" ? "Cards/Banks" : "Readers",
8517
- " "
8518
- ] }),
8519
- /* @__PURE__ */ jsxs16("div", { className: "res-pay-con", children: [
8520
- /* @__PURE__ */ jsxs16("div", { className: "pay-amount-conatiner", style: { margin: 0 }, children: [
8521
- /* @__PURE__ */ jsx29("small", { className: "pay-payment-amount", children: "Payment Amount" }),
8522
- /* @__PURE__ */ jsxs16("strong", { className: "pay-amount", children: [
8523
- "$",
8524
- (_c = Number(aftertaxAmount)) == null ? void 0 : _c.toFixed(2)
8525
- ] })
8526
- ] }),
8527
- /* @__PURE__ */ jsxs16("div", { children: [
8528
- /* @__PURE__ */ jsxs16("div", { children: [
8529
- /* @__PURE__ */ jsx29("img", { src: visa2, alt: "", width: 35, style: { paddingRight: "5px" } }),
8530
- /* @__PURE__ */ jsx29("img", { src: mastercard2, width: 35, alt: "" })
8531
- ] }),
8532
- /* @__PURE__ */ jsxs16("div", { children: [
8533
- /* @__PURE__ */ jsx29("img", { src: americanexp2, alt: "", width: 35, style: { paddingRight: "5px" } }),
8534
- /* @__PURE__ */ jsx29("img", { src: discover2, width: 35, alt: "" })
8535
- ] })
8536
- ] })
8537
- ] })
8538
- ] }),
8539
- /* @__PURE__ */ jsxs16("div", { id: "card", style: { display: activetab === "card" ? "block" : "none" }, className: "tabcontent", children: [
8540
- /* @__PURE__ */ jsxs16("div", { className: "frac-card-payment", children: [
8541
- /* @__PURE__ */ jsxs16("div", { className: "frac-heading-card-wrap", children: [
8542
- /* @__PURE__ */ jsx29("div", { className: "frac-backarrow", children: (cardList == null ? void 0 : cardList.length) > 0 && activeinCard === "form" && /* @__PURE__ */ jsxs16("button", { className: "charge-payment-back-btn ", onClick: () => setActiveinCard("list"), children: [
8543
- " ",
8544
- /* @__PURE__ */ jsx29(IoArrowBack, {})
8545
- ] }) }),
8546
- /* @__PURE__ */ jsx29("h6", { className: "frac-card-payment-heading", children: "Card Payment" })
8547
- ] }),
8548
- activetab != "ach" && /* @__PURE__ */ jsxs16("div", { style: { display: "flex", gap: "8px", margin: "8px 0px 19px 0px" }, children: [
8549
- /* @__PURE__ */ jsx29("img", { src: visa2, alt: "", width: 33 }),
8550
- /* @__PURE__ */ jsx29("img", { src: mastercard2, width: 33, alt: "" }),
8551
- /* @__PURE__ */ jsx29("img", { src: americanexp2, alt: "", width: 33 }),
8552
- /* @__PURE__ */ jsx29("img", { src: discover2, width: 33, alt: "" })
8553
- ] })
8554
- ] }),
8555
- activeinCard === "list" ? /* @__PURE__ */ jsxs16(Fragment16, { children: [
8556
- /* @__PURE__ */ jsx29(CardList, { listHeading: "Cards", paymentGateway: paymentData == null ? void 0 : paymentData.paymentGateway, ListItems: cardList, selectedCard, setSelectedCard, handleDeleteCard, otherButtonLabel: "Pay With Other Card", otherButtonAction: () => {
8557
- setActiveinCard("form");
8558
- } }),
8559
- /* @__PURE__ */ jsx29("div", { className: "form-group", style: { padding: "0" }, children: /* @__PURE__ */ jsx29("button", { className: "pay-button", style: { margin: "0px" }, type: "submit", onClick: handlepayment, children: partialAmount && !partialError ? formatUSD((_d = Number(partialAmount)) == null ? void 0 : _d.toFixed(2)) : formatUSD((_e = Number(aftertaxAmount)) == null ? void 0 : _e.toFixed(2)) }) })
8560
- ] }) : (paymentData == null ? void 0 : paymentData.paymentGateway) === 32 ? /* @__PURE__ */ jsxs16(
8561
- "form",
8479
+ return {
8480
+ id: card == null ? void 0 : card.id,
8481
+ primaryText: `**** ${card == null ? void 0 : card.cardlastfourdigit}`,
8482
+ secondaryText: isBankCard ? void 0 : `${card == null ? void 0 : card.expmonth}/${card == null ? void 0 : card.expyear}`,
8483
+ badge: isBankCard ? "BANK" : (card == null ? void 0 : card.card_issue_type) || "CARD",
8484
+ brandLogo: isBankCard ? void 0 : getCardType2(card == null ? void 0 : card.card_type),
8485
+ disabled: isDisabled
8486
+ };
8487
+ }),
8488
+ selectedId: selectedCard == null ? void 0 : selectedCard.id,
8489
+ onSelect: (id) => setSelectedCard(savedMethods.find((c) => (c == null ? void 0 : c.id) === id)),
8490
+ onRemove: (id) => handleDeleteCard(id),
8491
+ removeIcon: trash2,
8492
+ otherLabel: "Pay with other method",
8493
+ onOther: payWithOther,
8494
+ otherIcon: defaultcard2
8495
+ }
8496
+ ),
8497
+ /* @__PURE__ */ jsx27(
8498
+ FractalFooter,
8499
+ {
8500
+ authText: AuthText,
8501
+ disabled: loading2 || !(selectedCard == null ? void 0 : selectedCard.id) || surchargeLookupLoading,
8502
+ onPay: handlechargeCustomer,
8503
+ buttonLabel: `Pay ${formatUSD(effectiveTotal.toFixed(2))} to ${merchantName}`
8504
+ }
8505
+ )
8506
+ ] }) : activetab === "reader" ? (
8507
+ /* ---------- Reader ---------- */
8508
+ /* @__PURE__ */ jsxs14(Fragment14, { children: [
8509
+ MethodToggle,
8510
+ /* @__PURE__ */ jsx27(
8511
+ FractalReaderList,
8562
8512
  {
8563
- id: "paymentForm",
8564
- onSubmit: submitFunc,
8565
- onKeyDown: (e) => {
8566
- if (e.key === "Enter" && loading2) {
8567
- e.preventDefault();
8568
- e.stopPropagation();
8569
- }
8570
- },
8571
- children: [
8572
- /* @__PURE__ */ jsxs16("div", { className: "ach-scrl", style: { minHeight: (paymentData == null ? void 0 : paymentData.isSkyFiAccount) && (cardList == null ? void 0 : cardList.length) > 0 ? "444px" : (paymentData == null ? void 0 : paymentData.isSkyFiAccount) && (cardList == null ? void 0 : cardList.length) == 0 ? "456px" : (cardList == null ? void 0 : cardList.length) > 0 ? "462px" : "520px", overflow: "auto", marginRight: "5px" }, children: [
8573
- /* @__PURE__ */ jsxs16("div", { className: "form-group", children: [
8574
- /* @__PURE__ */ jsx29("label", { htmlFor: "cardHolderName", children: "NAME ON CARD " }),
8575
- /* @__PURE__ */ jsx29("input", { type: "text", className: "form-control", maxLength: 100, placeholder: "John Doe", value: (cardData == null ? void 0 : cardData.cardName) || "", onChange: (e) => {
8576
- const value = e.target.value;
8577
- if (/^[a-zA-Z\s]*$/.test(value)) {
8578
- handleCardChange("cardName", value);
8579
- }
8580
- } }),
8581
- (cardError == null ? void 0 : cardError.cardName) && /* @__PURE__ */ jsx29("span", { className: "error-span", children: cardError == null ? void 0 : cardError.cardName })
8582
- ] }),
8583
- /* @__PURE__ */ jsxs16("div", { className: "form-group", children: [
8584
- /* @__PURE__ */ jsx29("label", { children: "CARD NUMBER" }),
8585
- /* @__PURE__ */ jsx29("div", { className: "toggle-num-wrapper", children: show && (paymentData == null ? void 0 : paymentData.paymentGateway) === 32 && isTokenizerReady && /* @__PURE__ */ jsx29(
8586
- FractalFields_default,
8587
- {
8588
- fractalStyles,
8589
- tokenizerRef
8590
- }
8591
- ) })
8592
- ] }),
8593
- /* @__PURE__ */ jsxs16("div", { className: "form-group", children: [
8594
- /* @__PURE__ */ jsx29("label", { htmlFor: "OrderId", children: "Order ID / Description" }),
8595
- /* @__PURE__ */ jsx29(
8596
- "input",
8597
- {
8598
- type: "text",
8599
- className: "form-control",
8600
- maxLength: 100,
8601
- placeholder: "Order Id",
8602
- disabled: true,
8603
- value: (_f = props == null ? void 0 : props.orderID) != null ? _f : "",
8604
- style: { background: "#F6F6F7", color: "#727272" }
8605
- }
8606
- )
8607
- ] }),
8608
- /* @__PURE__ */ jsxs16("div", { className: "form-group", children: [
8609
- /* @__PURE__ */ jsx29("label", { htmlFor: "zip", children: "ZIP" }),
8610
- /* @__PURE__ */ jsx29("input", { type: "text", className: "form-control", maxLength: 100, placeholder: "000000", value: (_g = cardData == null ? void 0 : cardData.zipCode) != null ? _g : "", onChange: (e) => handleCardChange("zipCode", e.target.value) }),
8611
- (cardError == null ? void 0 : cardError.zipCode) && /* @__PURE__ */ jsx29("span", { className: "error-span", children: cardError == null ? void 0 : cardError.zipCode })
8612
- ] }),
8613
- (props == null ? void 0 : props.customerId) && /* @__PURE__ */ jsx29("div", { className: "form-group", children: /* @__PURE__ */ jsxs16("div", { style: { display: "flex", alignItems: "center", gap: "10px", paddingTop: "10px" }, children: [
8614
- /* @__PURE__ */ jsx29(
8615
- "input",
8616
- {
8617
- type: "checkbox",
8618
- id: "save_card",
8619
- className: "toggle-checkbox",
8620
- checked: saveCardInfo,
8621
- onChange: (e) => setSaveCardInfo(e.target.checked)
8622
- }
8623
- ),
8624
- /* @__PURE__ */ jsx29("label", { htmlFor: "save_card", className: "toggle-label" }),
8625
- /* @__PURE__ */ jsx29("label", { htmlFor: "save_card", children: "Save card for future payments " }),
8626
- /* @__PURE__ */ jsxs16("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: [
8627
- /* @__PURE__ */ jsxs16("g", { clipPath: "url(#clip0_12420_50192)", children: [
8628
- /* @__PURE__ */ jsx29("rect", { width: "20", height: "20", fill: "white" }),
8629
- /* @__PURE__ */ jsx29("circle", { cx: "10", cy: "10", r: "10", fill: "#E0DFE2" }),
8630
- /* @__PURE__ */ jsx29("path", { d: "M9.03406 12.0979V12.0072C9.04055 11.4153 9.10057 10.9443 9.21411 10.5943C9.3309 10.2442 9.49635 9.96102 9.71046 9.74463C9.92457 9.52824 10.1825 9.33095 10.4842 9.15274C10.6788 9.03182 10.854 8.89658 11.0097 8.74702C11.1655 8.59745 11.2887 8.42562 11.3796 8.2315C11.4704 8.03739 11.5158 7.82259 11.5158 7.58711C11.5158 7.3039 11.4477 7.05887 11.3114 6.85203C11.1752 6.64519 10.9935 6.48608 10.7664 6.3747C10.5426 6.26014 10.2928 6.20286 10.017 6.20286C9.76723 6.20286 9.52879 6.25378 9.3017 6.35561C9.07461 6.45744 8.88646 6.61655 8.73723 6.83294C8.588 7.04614 8.50203 7.3214 8.47932 7.65871H7C7.02271 7.08592 7.17032 6.60223 7.44282 6.20764C7.71533 5.80986 8.07543 5.50915 8.52311 5.30549C8.97405 5.10183 9.47202 5 10.017 5C10.6139 5 11.1363 5.10979 11.5839 5.32936C12.0316 5.54574 12.3788 5.84964 12.6253 6.24105C12.8751 6.62928 13 7.08274 13 7.60143C13 7.95784 12.9432 8.27924 12.8297 8.56563C12.7161 8.84885 12.5539 9.10183 12.3431 9.32458C12.1354 9.54733 11.8856 9.74463 11.5937 9.91647C11.3179 10.0851 11.0941 10.2601 10.9221 10.4415C10.7534 10.6229 10.6302 10.8377 10.5523 11.0859C10.4745 11.3341 10.4323 11.6412 10.4258 12.0072V12.0979H9.03406ZM9.76886 15C9.50284 15 9.27413 14.9077 9.08273 14.7232C8.89132 14.5354 8.79562 14.3095 8.79562 14.0453C8.79562 13.7844 8.89132 13.5617 9.08273 13.3771C9.27413 13.1893 9.50284 13.0955 9.76886 13.0955C10.0316 13.0955 10.2587 13.1893 10.4501 13.3771C10.6448 13.5617 10.7421 13.7844 10.7421 14.0453C10.7421 14.2204 10.6967 14.3811 10.6058 14.5274C10.5182 14.6706 10.4015 14.7852 10.2555 14.8711C10.1095 14.957 9.94728 15 9.76886 15Z", fill: "#161616" })
8631
- ] }),
8632
- /* @__PURE__ */ jsx29("defs", { children: /* @__PURE__ */ jsx29("clipPath", { id: "clip0_12420_50192", children: /* @__PURE__ */ jsx29("rect", { width: "20", height: "20", fill: "white" }) }) })
8633
- ] })
8634
- ] }) })
8635
- ] }),
8636
- /* @__PURE__ */ jsxs16("div", { className: "form-group", style: { marginTop: "20px", padding: "0" }, children: [
8637
- (paymentData == null ? void 0 : paymentData.paymentDeviceList) && ((_h = paymentData == null ? void 0 : paymentData.paymentDeviceList) == null ? void 0 : _h.length) > 0 && /* @__PURE__ */ jsx29("button", { type: "button", style: { marginBottom: "10px" }, className: "pay-button", onClick: () => setActiveForm(!activeForm), children: activeForm ? "Pay With Reader" : "Pay With Card" }),
8638
- /* @__PURE__ */ jsx29("button", { type: "submit", style: { margin: 0 }, className: "pay-button", children: partialAmount && !partialError ? formatUSD((_i = Number(partialAmount)) == null ? void 0 : _i.toFixed(2)) : formatUSD((_j = Number(aftertaxAmount)) == null ? void 0 : _j.toFixed(2)) })
8639
- ] })
8640
- ]
8513
+ sectionLabel: "Readers",
8514
+ items: ((paymentData == null ? void 0 : paymentData.paymentDeviceList) || []).map((r) => ({ id: String(r == null ? void 0 : r.id), name: r == null ? void 0 : r.device_name })),
8515
+ selectedId: (selectedReader == null ? void 0 : selectedReader.id) != null ? String(selectedReader == null ? void 0 : selectedReader.id) : void 0,
8516
+ onSelect: (id) => setSelectedReader(((paymentData == null ? void 0 : paymentData.paymentDeviceList) || []).find((r) => String(r == null ? void 0 : r.id) === id)),
8517
+ icon: pax2
8641
8518
  }
8642
- ) : /* @__PURE__ */ jsxs16("form", { id: "PaymentForm", style: { textAlign: "start" }, onSubmit: submitFunc, onKeyDown: (e) => {
8643
- if (e.key === "Enter" && loading2) {
8644
- e.preventDefault();
8645
- e.stopPropagation();
8519
+ ),
8520
+ /* @__PURE__ */ jsx27(
8521
+ FractalFooter,
8522
+ {
8523
+ authText: AuthText,
8524
+ disabled: loading2,
8525
+ onPay: handleChargewithEMV,
8526
+ buttonLabel: `Pay ${formatUSD(effectiveTotal.toFixed(2))} to ${merchantName}`
8646
8527
  }
8647
- }, children: [
8648
- /* @__PURE__ */ jsxs16("div", { className: "ach-scrl", style: { minHeight: (paymentData == null ? void 0 : paymentData.isSkyFiAccount) && (cardList == null ? void 0 : cardList.length) > 0 ? "444px" : (paymentData == null ? void 0 : paymentData.isSkyFiAccount) && (cardList == null ? void 0 : cardList.length) == 0 ? "456px" : (cardList == null ? void 0 : cardList.length) > 0 ? "462px" : "520px", overflow: "auto", marginRight: "5px" }, children: [
8649
- /* @__PURE__ */ jsxs16("div", { className: "form-group", children: [
8650
- /* @__PURE__ */ jsx29("label", { htmlFor: "cardHolderName", children: "NAME ON CARD " }),
8651
- /* @__PURE__ */ jsx29("input", { type: "text", className: "form-control", maxLength: 100, placeholder: "John Doe", value: (cardData == null ? void 0 : cardData.cardName) || "", onChange: (e) => {
8652
- const value = e.target.value;
8653
- if (/^[a-zA-Z\s]*$/.test(value)) {
8654
- handleCardChange("cardName", value);
8655
- }
8656
- } }),
8657
- (cardError == null ? void 0 : cardError.cardName) && /* @__PURE__ */ jsx29("span", { className: "error-span", children: cardError == null ? void 0 : cardError.cardName })
8658
- ] }),
8659
- /* @__PURE__ */ jsx29("div", { className: "form-group", children: /* @__PURE__ */ jsx29(
8660
- DataCapFields,
8661
- {
8662
- isOpen: show,
8663
- tokenKey: paymentData == null ? void 0 : paymentData.dctoken,
8664
- setLoader: setLoadingIframe,
8665
- onError: (msg) => setError(msg || DcLoadingError)
8666
- }
8667
- ) }),
8668
- /* @__PURE__ */ jsxs16("div", { className: "form-group", children: [
8669
- /* @__PURE__ */ jsx29("label", { htmlFor: "OrderId", children: "Order ID / Description" }),
8670
- /* @__PURE__ */ jsx29(
8671
- "input",
8672
- {
8673
- type: "text",
8674
- className: "form-control",
8675
- maxLength: 100,
8676
- placeholder: "Order Id",
8677
- disabled: true,
8678
- value: (_k = props == null ? void 0 : props.orderID) != null ? _k : "",
8679
- style: { background: "#F6F6F7", color: "#727272" }
8680
- }
8681
- )
8682
- ] }),
8683
- /* @__PURE__ */ jsxs16("div", { className: "form-group", children: [
8684
- /* @__PURE__ */ jsx29("label", { htmlFor: "zip", children: "ZIP" }),
8685
- /* @__PURE__ */ jsx29("input", { type: "text", className: "form-control", maxLength: 100, placeholder: "000000", value: (_l = cardData == null ? void 0 : cardData.zipCode) != null ? _l : "", onChange: (e) => handleCardChange("zipCode", e.target.value) }),
8686
- (cardError == null ? void 0 : cardError.zipCode) && /* @__PURE__ */ jsx29("span", { className: "error-span", children: cardError == null ? void 0 : cardError.zipCode })
8687
- ] }),
8688
- (props == null ? void 0 : props.customerId) && /* @__PURE__ */ jsx29("div", { className: "form-group", children: /* @__PURE__ */ jsxs16("div", { style: { display: "flex", alignItems: "center", gap: "10px", paddingTop: "10px" }, children: [
8689
- /* @__PURE__ */ jsx29(
8690
- "input",
8691
- {
8692
- type: "checkbox",
8693
- id: "save_card",
8694
- className: "toggle-checkbox",
8695
- checked: saveCardInfo,
8696
- onChange: (e) => setSaveCardInfo(e.target.checked)
8528
+ )
8529
+ ] })
8530
+ ) : activetab === "ach" ? (
8531
+ /* ---------- Bank form ---------- */
8532
+ /* @__PURE__ */ jsxs14(
8533
+ "form",
8534
+ {
8535
+ id: "ACHPaymentForm",
8536
+ autoComplete: "off",
8537
+ onSubmit: submitFunc,
8538
+ onKeyDown: (e) => {
8539
+ if (e.key === "Enter" && loading2) {
8540
+ e.preventDefault();
8541
+ e.stopPropagation();
8542
+ }
8543
+ },
8544
+ style: { display: "flex", flexDirection: "column", gap: "20px", flex: "1 1 auto", minHeight: 0, width: "100%" },
8545
+ children: [
8546
+ MethodToggle,
8547
+ /* @__PURE__ */ jsxs14("div", { className: "fps-scroll", children: [
8548
+ /* @__PURE__ */ jsx27(FractalField, { label: "Name on account", htmlFor: "nameonaccount", error: achError == null ? void 0 : achError.name, children: /* @__PURE__ */ jsx27("input", { id: "nameonaccount", className: "fps-input", maxLength: 100, placeholder: "John Doe", name: "name", value: (_d = achData == null ? void 0 : achData.name) != null ? _d : "", onChange: handleChangeAch }) }),
8549
+ /* @__PURE__ */ jsx27(FractalField, { label: "Routing number", htmlFor: "routingnumber", error: achError == null ? void 0 : achError.routingNumber, children: /* @__PURE__ */ jsx27("input", { id: "routingnumber", className: "fps-input", maxLength: 9, placeholder: "000000000", name: "routingNumber", value: (_e = achData == null ? void 0 : achData.routingNumber) != null ? _e : "", onChange: handleChangeAch }) }),
8550
+ /* @__PURE__ */ jsx27(FractalField, { label: "Account number", htmlFor: "accountnumber", error: achError == null ? void 0 : achError.accountNumber, children: /* @__PURE__ */ jsx27("input", { id: "accountnumber", className: "fps-input", maxLength: 16, placeholder: "0000000000", name: "accountNumber", value: (_f = achData == null ? void 0 : achData.accountNumber) != null ? _f : "", onChange: handleChangeAch }) }),
8551
+ /* @__PURE__ */ jsx27(FractalField, { label: "Confirm account number", htmlFor: "confirmaccountnumber", error: achError == null ? void 0 : achError.confirmAccountNumber, children: /* @__PURE__ */ jsx27("input", { id: "confirmaccountnumber", className: "fps-input", maxLength: 16, placeholder: "0000000000", name: "confirmAccountNumber", value: (_g = achData == null ? void 0 : achData.confirmAccountNumber) != null ? _g : "", onChange: handleChangeAch }) }),
8552
+ /* @__PURE__ */ jsx27(FractalField, { label: "Bank name", htmlFor: "bankname", error: achError == null ? void 0 : achError.bankName, children: /* @__PURE__ */ jsx27("input", { id: "bankname", className: "fps-input", maxLength: 100, placeholder: "My Bank", name: "bankName", value: (_h = achData == null ? void 0 : achData.bankName) != null ? _h : "", onChange: handleChangeAch }) }),
8553
+ ((achData == null ? void 0 : achData.accountType) === "business saving" || (achData == null ? void 0 : achData.accountType) === "business checking") && /* @__PURE__ */ jsx27(FractalField, { label: "Company name", htmlFor: "companyName", error: achError == null ? void 0 : achError.companyName, children: /* @__PURE__ */ jsx27("input", { id: "companyName", className: "fps-input", maxLength: 100, placeholder: "My Company", name: "companyName", value: (_i = achData == null ? void 0 : achData.companyName) != null ? _i : "", onChange: handleChangeAch }) }),
8554
+ /* @__PURE__ */ jsx27(FractalField, { label: "Account type", htmlFor: "accounttype", children: /* @__PURE__ */ jsxs14("select", { id: "accounttype", name: "accountType", className: "fps-input", value: (_j = achData == null ? void 0 : achData.accountType) != null ? _j : "", onChange: handleChangeAch, children: [
8555
+ /* @__PURE__ */ jsx27("option", { value: "", children: "Select" }),
8556
+ accountTypes.map((type) => /* @__PURE__ */ jsx27("option", { value: type.value, children: type.label }, type.value))
8557
+ ] }) }),
8558
+ (props == null ? void 0 : props.customerId) && /* @__PURE__ */ jsxs14(FractalCheckbox, { id: "saveACH", checked: saveACHinfo, onChange: (v) => {
8559
+ setSaveACHinfo(v);
8560
+ if (!v) {
8561
+ setSaveACHConsent1(false);
8562
+ setErrorBankConsentOther("");
8697
8563
  }
8698
- ),
8699
- /* @__PURE__ */ jsx29("label", { htmlFor: "save_card", className: "toggle-label" }),
8700
- /* @__PURE__ */ jsx29("label", { htmlFor: "save_card", children: "Save card for future payments " }),
8701
- /* @__PURE__ */ jsxs16("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: [
8702
- /* @__PURE__ */ jsxs16("g", { clipPath: "url(#clip0_12420_50192)", children: [
8703
- /* @__PURE__ */ jsx29("rect", { width: "20", height: "20", fill: "white" }),
8704
- /* @__PURE__ */ jsx29("circle", { cx: "10", cy: "10", r: "10", fill: "#E0DFE2" }),
8705
- /* @__PURE__ */ jsx29("path", { d: "M9.03406 12.0979V12.0072C9.04055 11.4153 9.10057 10.9443 9.21411 10.5943C9.3309 10.2442 9.49635 9.96102 9.71046 9.74463C9.92457 9.52824 10.1825 9.33095 10.4842 9.15274C10.6788 9.03182 10.854 8.89658 11.0097 8.74702C11.1655 8.59745 11.2887 8.42562 11.3796 8.2315C11.4704 8.03739 11.5158 7.82259 11.5158 7.58711C11.5158 7.3039 11.4477 7.05887 11.3114 6.85203C11.1752 6.64519 10.9935 6.48608 10.7664 6.3747C10.5426 6.26014 10.2928 6.20286 10.017 6.20286C9.76723 6.20286 9.52879 6.25378 9.3017 6.35561C9.07461 6.45744 8.88646 6.61655 8.73723 6.83294C8.588 7.04614 8.50203 7.3214 8.47932 7.65871H7C7.02271 7.08592 7.17032 6.60223 7.44282 6.20764C7.71533 5.80986 8.07543 5.50915 8.52311 5.30549C8.97405 5.10183 9.47202 5 10.017 5C10.6139 5 11.1363 5.10979 11.5839 5.32936C12.0316 5.54574 12.3788 5.84964 12.6253 6.24105C12.8751 6.62928 13 7.08274 13 7.60143C13 7.95784 12.9432 8.27924 12.8297 8.56563C12.7161 8.84885 12.5539 9.10183 12.3431 9.32458C12.1354 9.54733 11.8856 9.74463 11.5937 9.91647C11.3179 10.0851 11.0941 10.2601 10.9221 10.4415C10.7534 10.6229 10.6302 10.8377 10.5523 11.0859C10.4745 11.3341 10.4323 11.6412 10.4258 12.0072V12.0979H9.03406ZM9.76886 15C9.50284 15 9.27413 14.9077 9.08273 14.7232C8.89132 14.5354 8.79562 14.3095 8.79562 14.0453C8.79562 13.7844 8.89132 13.5617 9.08273 13.3771C9.27413 13.1893 9.50284 13.0955 9.76886 13.0955C10.0316 13.0955 10.2587 13.1893 10.4501 13.3771C10.6448 13.5617 10.7421 13.7844 10.7421 14.0453C10.7421 14.2204 10.6967 14.3811 10.6058 14.5274C10.5182 14.6706 10.4015 14.7852 10.2555 14.8711C10.1095 14.957 9.94728 15 9.76886 15Z", fill: "#161616" })
8564
+ }, children: [
8565
+ "Save this bank account. ",
8566
+ merchantName,
8567
+ " may charge it for future invoices. ",
8568
+ /* @__PURE__ */ jsx27("u", { children: "See terms" }),
8569
+ "."
8570
+ ] }),
8571
+ saveACHinfo && /* @__PURE__ */ jsxs14(Fragment14, { children: [
8572
+ /* @__PURE__ */ jsxs14(FractalCheckbox, { id: "saveACHConsent1", checked: saveACHConsent1, onChange: (v) => {
8573
+ setSaveACHConsent1(v);
8574
+ if (v) setErrorBankConsentOther("");
8575
+ }, children: [
8576
+ "By providing my bank account information and selecting \u2018Save for future payments\u2019, I authorize ",
8577
+ merchantName,
8578
+ " to store my bank account details for future ACH payments. I understand that future payments may be initiated using this saved account in accordance with my instructions. I confirm I am authorized to use this bank account."
8706
8579
  ] }),
8707
- /* @__PURE__ */ jsx29("defs", { children: /* @__PURE__ */ jsx29("clipPath", { id: "clip0_12420_50192", children: /* @__PURE__ */ jsx29("rect", { width: "20", height: "20", fill: "white" }) }) })
8580
+ errorBankConsentOther && /* @__PURE__ */ jsx27("span", { className: "fps-error", children: errorBankConsentOther })
8581
+ ] }),
8582
+ !saveACHinfo && /* @__PURE__ */ jsxs14(Fragment14, { children: [
8583
+ /* @__PURE__ */ jsxs14(FractalCheckbox, { id: "achconsent", checked: isBankConsentChecked, onChange: (v) => {
8584
+ setIsBankConsentChecked(v);
8585
+ if (v) setErrorBankConsent("");
8586
+ }, children: [
8587
+ "By selecting this box, I authorize ",
8588
+ merchantName,
8589
+ " to initiate a one-time electronic ACH debit from my bank account for the total amount displayed on this screen, including any applicable processing fee. I confirm that I am authorized to use this account and that the bank account information I provided is correct."
8590
+ ] }),
8591
+ errorBankConsent && /* @__PURE__ */ jsx27("span", { className: "fps-error", children: errorBankConsent })
8708
8592
  ] })
8709
- ] }) })
8710
- ] }),
8711
- /* @__PURE__ */ jsxs16("div", { className: "form-group", style: { marginTop: "20px", padding: "0" }, children: [
8712
- (paymentData == null ? void 0 : paymentData.paymentDeviceList) && ((_m = paymentData == null ? void 0 : paymentData.paymentDeviceList) == null ? void 0 : _m.length) > 0 && /* @__PURE__ */ jsx29("button", { type: "button", style: { marginBottom: "10px" }, className: "pay-button", onClick: () => setActiveForm(!activeForm), children: activeForm ? "Pay With Reader" : "Pay With Card" }),
8713
- /* @__PURE__ */ jsx29("button", { type: "submit", style: { margin: 0 }, className: "pay-button", children: partialAmount && !partialError ? formatUSD((_n = Number(partialAmount)) == null ? void 0 : _n.toFixed(2)) : formatUSD((_o = Number(aftertaxAmount)) == null ? void 0 : _o.toFixed(2)) })
8714
- ] })
8715
- ] })
8716
- ] }),
8717
- /* @__PURE__ */ jsxs16("div", { id: "ach", style: { display: activetab === "ach" ? "block" : "none" }, className: "tabcontent", children: [
8718
- /* @__PURE__ */ jsx29("div", { className: "frac-card-payment", children: /* @__PURE__ */ jsxs16("div", { className: "frac-heading-card-wrap", children: [
8719
- /* @__PURE__ */ jsx29("div", { className: "frac-backarrow", children: (bankList == null ? void 0 : bankList.length) > 0 && activeinBank === "form" && /* @__PURE__ */ jsxs16("button", { className: "charge-payment-back-btn ", onClick: () => setActiveinBank("list"), children: [
8720
- " ",
8721
- /* @__PURE__ */ jsx29(IoArrowBack, {})
8722
- ] }) }),
8723
- /* @__PURE__ */ jsx29("h6", { className: "frac-card-payment-heading", children: "Bank Payment" })
8724
- ] }) }),
8725
- activeinBank === "list" ? /* @__PURE__ */ jsxs16(Fragment16, { children: [
8726
- /* @__PURE__ */ jsx29(CardList, { listHeading: "Banks", paymentGateway: paymentData == null ? void 0 : paymentData.paymentGateway, ListItems: bankList, selectedCard, setSelectedCard, handleDeleteCard, otherButtonLabel: "Pay With Other Bank", otherButtonAction: () => {
8727
- setActiveinBank("form");
8728
- } }),
8729
- /* @__PURE__ */ jsx29("div", { className: "form-group", style: { padding: "0" }, children: /* @__PURE__ */ jsx29("button", { className: "pay-button", style: { margin: "0px" }, type: "submit", onClick: handlepayment, children: partialAmount && !partialError ? formatUSD((_p = Number(partialAmount)) == null ? void 0 : _p.toFixed(2)) : formatUSD((_q = Number(cashDiscount)) == null ? void 0 : _q.toFixed(2)) }) })
8730
- ] }) : /* @__PURE__ */ jsxs16("form", { id: "ACHPaymentForm", style: { textAlign: "start" }, onSubmit: submitFunc, autoComplete: "off", onKeyDown: (e) => {
8731
- if (e.key === "Enter" && loading2) {
8732
- e.preventDefault();
8733
- e.stopPropagation();
8734
- }
8735
- }, children: [
8736
- /* @__PURE__ */ jsxs16("div", { className: "ach-scrl", style: {
8737
- minHeight: (paymentData == null ? void 0 : paymentData.isSkyFiAccount) && (cardList == null ? void 0 : cardList.length) > 0 ? "444px" : (paymentData == null ? void 0 : paymentData.isSkyFiAccount) && (cardList == null ? void 0 : cardList.length) == 0 ? "436px" : (cardList == null ? void 0 : cardList.length) > 0 ? "462px" : "520px",
8738
- maxHeight: (paymentData == null ? void 0 : paymentData.isSkyFiAccount) && (cardList == null ? void 0 : cardList.length) > 0 ? "444px" : (cardList == null ? void 0 : cardList.length) > 0 ? "380px" : "380px"
8739
- }, children: [
8740
- /* @__PURE__ */ jsxs16("div", { className: "form-group mb-4", children: [
8741
- /* @__PURE__ */ jsx29("label", { htmlFor: "nameonaccount", children: "Name on account" }),
8742
- /* @__PURE__ */ jsx29("input", { type: "text", id: "nameonaccount", className: "form-control", maxLength: 100, placeholder: "John Doe", name: "name", value: (_r = achData == null ? void 0 : achData.name) != null ? _r : "", onChange: handleChangeAch }),
8743
- (achError == null ? void 0 : achError.name) && /* @__PURE__ */ jsx29("span", { className: "error-span", children: achError == null ? void 0 : achError.name })
8744
- ] }),
8745
- /* @__PURE__ */ jsxs16("div", { className: "form-group mb-4", children: [
8746
- /* @__PURE__ */ jsx29("label", { htmlFor: "routingnumber", children: "Routing number" }),
8747
- /* @__PURE__ */ jsx29(
8748
- "input",
8749
- {
8750
- type: "text",
8751
- id: "routingnumber",
8752
- className: "form-control",
8753
- maxLength: 9,
8754
- placeholder: "000000000",
8755
- name: "routingNumber",
8756
- value: (_s = achData == null ? void 0 : achData.routingNumber) != null ? _s : "",
8757
- onChange: handleChangeAch
8758
- }
8759
- ),
8760
- (achError == null ? void 0 : achError.routingNumber) && /* @__PURE__ */ jsx29("span", { className: "error-span", children: achError == null ? void 0 : achError.routingNumber })
8761
8593
  ] }),
8762
- /* @__PURE__ */ jsxs16("div", { className: "form-group mb-4", children: [
8763
- /* @__PURE__ */ jsx29("label", { htmlFor: "accountnumber", children: "Account number" }),
8764
- /* @__PURE__ */ jsx29(
8765
- "input",
8766
- {
8767
- type: "text",
8768
- id: "accountnumber",
8769
- className: "form-control",
8770
- maxLength: 16,
8771
- placeholder: "0000000000",
8772
- name: "accountNumber",
8773
- value: (_t = achData == null ? void 0 : achData.accountNumber) != null ? _t : "",
8774
- onChange: handleChangeAch
8775
- }
8776
- ),
8777
- (achError == null ? void 0 : achError.accountNumber) && /* @__PURE__ */ jsx29("span", { className: "error-span", children: achError == null ? void 0 : achError.accountNumber })
8778
- ] }),
8779
- /* @__PURE__ */ jsxs16("div", { className: "form-group mb-4", children: [
8780
- /* @__PURE__ */ jsx29("label", { htmlFor: "confirmaccountnumber", children: "Confirm account number" }),
8781
- /* @__PURE__ */ jsx29(
8782
- "input",
8783
- {
8784
- type: "text",
8785
- id: "confirmaccountnumber",
8786
- className: "form-control",
8787
- maxLength: 16,
8788
- placeholder: "0000000000",
8789
- name: "confirmAccountNumber",
8790
- value: (_u = achData == null ? void 0 : achData.confirmAccountNumber) != null ? _u : "",
8791
- onChange: handleChangeAch
8792
- }
8793
- ),
8794
- (achError == null ? void 0 : achError.confirmAccountNumber) && /* @__PURE__ */ jsx29("span", { className: "error-span", children: achError == null ? void 0 : achError.confirmAccountNumber })
8795
- ] }),
8796
- /* @__PURE__ */ jsxs16("div", { className: "form-group mb-4", children: [
8797
- /* @__PURE__ */ jsx29("label", { htmlFor: "bankname", children: "Bank name" }),
8798
- /* @__PURE__ */ jsx29(
8594
+ /* @__PURE__ */ jsx27(
8595
+ FractalFooter,
8596
+ {
8597
+ authText: AuthText,
8598
+ submit: true,
8599
+ disabled: loading2,
8600
+ buttonLabel: `Pay ${formatUSD(effectiveTotal.toFixed(2))} to ${merchantName}`
8601
+ }
8602
+ )
8603
+ ]
8604
+ }
8605
+ )
8606
+ ) : (
8607
+ /* ---------- Card form ---------- */
8608
+ /* @__PURE__ */ jsxs14(
8609
+ "form",
8610
+ {
8611
+ id: (paymentData == null ? void 0 : paymentData.paymentGateway) === 32 ? "paymentForm" : "PaymentForm",
8612
+ onSubmit: submitFunc,
8613
+ onKeyDown: (e) => {
8614
+ if (e.key === "Enter" && loading2) {
8615
+ e.preventDefault();
8616
+ e.stopPropagation();
8617
+ }
8618
+ },
8619
+ style: { display: "flex", flexDirection: "column", gap: "20px", flex: "1 1 auto", minHeight: 0, width: "100%" },
8620
+ children: [
8621
+ MethodToggle,
8622
+ /* @__PURE__ */ jsxs14("div", { className: "fps-scroll", children: [
8623
+ /* @__PURE__ */ jsx27(FractalField, { label: "Name on card", htmlFor: "cardHolderName", error: cardError == null ? void 0 : cardError.cardName, children: /* @__PURE__ */ jsx27(
8799
8624
  "input",
8800
8625
  {
8801
- type: "text",
8802
- id: "bankname",
8803
- className: "form-control",
8626
+ id: "cardHolderName",
8627
+ className: "fps-input",
8804
8628
  maxLength: 100,
8805
- placeholder: "My Bank",
8806
- name: "bankName",
8807
- value: (_v = achData == null ? void 0 : achData.bankName) != null ? _v : "",
8808
- onChange: handleChangeAch
8629
+ placeholder: "John Doe",
8630
+ value: (cardData == null ? void 0 : cardData.cardName) || "",
8631
+ onChange: (e) => {
8632
+ const value = e.target.value;
8633
+ if (/^[a-zA-Z\s]*$/.test(value)) handleCardChange("cardName", value);
8634
+ }
8809
8635
  }
8810
- ),
8811
- (achError == null ? void 0 : achError.bankName) && /* @__PURE__ */ jsx29("span", { className: "error-span", children: achError == null ? void 0 : achError.bankName })
8812
- ] }),
8813
- ((achData == null ? void 0 : achData.accountType) === "business saving" || (achData == null ? void 0 : achData.accountType) === "business checking") && /* @__PURE__ */ jsxs16("div", { className: "form-group mb-4", children: [
8814
- /* @__PURE__ */ jsx29("label", { htmlFor: "companyName", children: "Company name" }),
8815
- /* @__PURE__ */ jsx29(
8816
- "input",
8636
+ ) }),
8637
+ /* @__PURE__ */ jsx27(FractalField, { label: (paymentData == null ? void 0 : paymentData.paymentGateway) === 32 ? "Card number" : "", error: cardError == null ? void 0 : cardError.cardNumber, children: /* @__PURE__ */ jsx27("div", { className: `fps-tokenizer ${(paymentData == null ? void 0 : paymentData.paymentGateway) !== 32 ? "dc-tokenizer" : ""}`, children: (paymentData == null ? void 0 : paymentData.paymentGateway) === 32 ? show && isTokenizerReady && /* @__PURE__ */ jsx27(
8638
+ FractalFields_default,
8817
8639
  {
8818
- type: "text",
8819
- id: "companyName",
8820
- className: "form-control",
8821
- maxLength: 100,
8822
- placeholder: "My Company",
8823
- name: "companyName",
8824
- value: (_w = achData == null ? void 0 : achData.companyName) != null ? _w : "",
8825
- onChange: handleChangeAch
8640
+ fractalStyles,
8641
+ tokenizerRef,
8642
+ surchargeEnabled: Number(paymentData == null ? void 0 : paymentData.surchargeProgram) === 1 && !!(props == null ? void 0 : props.pass_fee),
8643
+ createSurchargeSession,
8644
+ getSurchargeOptions,
8645
+ onSurchargeResult: setSurchargeResult
8826
8646
  }
8827
- ),
8828
- (achError == null ? void 0 : achError.companyName) && /* @__PURE__ */ jsx29("span", { className: "error-span", children: achError == null ? void 0 : achError.companyName })
8829
- ] }),
8830
- /* @__PURE__ */ jsxs16("div", { className: "form-group mb-4", children: [
8831
- /* @__PURE__ */ jsx29("label", { htmlFor: "accounttype", children: "Select account type" }),
8832
- /* @__PURE__ */ jsxs16("select", { name: "accountType", id: "accounttype", className: "form-control", value: (_x = achData == null ? void 0 : achData.accountType) != null ? _x : "", onChange: handleChangeAch, children: [
8833
- /* @__PURE__ */ jsx29("option", { value: "", children: "Select account" }),
8834
- accountTypes.map((type) => /* @__PURE__ */ jsx29("option", { value: type.value, children: type.label }, type.value))
8647
+ ) : /* @__PURE__ */ jsx27(DataCapFields, { isOpen: show, tokenKey: paymentData == null ? void 0 : paymentData.dctoken, setLoader: setLoadingIframe, onError: (msg) => setError(msg || DcLoadingError) }) }) }),
8648
+ /* @__PURE__ */ jsx27(FractalField, { label: "Zip", htmlFor: "zip", error: cardError == null ? void 0 : cardError.zipCode, children: /* @__PURE__ */ jsx27("input", { id: "zip", className: "fps-input", maxLength: 100, placeholder: "000000", value: (_k = cardData == null ? void 0 : cardData.zipCode) != null ? _k : "", onChange: (e) => handleCardChange("zipCode", e.target.value) }) }),
8649
+ (props == null ? void 0 : props.customerId) && /* @__PURE__ */ jsxs14(FractalCheckbox, { id: "save_card", checked: saveCardInfo, onChange: (v) => setSaveCardInfo(v), children: [
8650
+ "Save this card. ",
8651
+ merchantName,
8652
+ " may charge it for future invoices. ",
8653
+ /* @__PURE__ */ jsx27("u", { children: "See terms" }),
8654
+ "."
8835
8655
  ] })
8836
8656
  ] }),
8837
- !saveACHinfo && /* @__PURE__ */ jsxs16(Fragment16, { children: [
8838
- /* @__PURE__ */ jsxs16("div", { className: "form-group mb-4 save-ach-div", style: { paddingTop: "5px" }, children: [
8839
- /* @__PURE__ */ jsx29(
8840
- "input",
8841
- {
8842
- type: "checkbox",
8843
- id: "achconsent",
8844
- className: "",
8845
- checked: isBankConsentChecked,
8846
- onChange: (e) => {
8847
- setIsBankConsentChecked(e.target.checked);
8848
- if (e.target.checked) {
8849
- setErrorBankConsent("");
8850
- }
8851
- }
8852
- }
8853
- ),
8854
- /* @__PURE__ */ jsx29("label", { htmlFor: "achconsent", children: `By selecting this box, I authorize SkyFi, on behalf of ${(paymentData == null ? void 0 : paymentData.bname) || "merchant"}, to initiate a one-time electronic ACH debit from my bank account for the total amount displayed on this screen, including any applicable processing fee. I confirm that I am authorized to use this account and that the bank account information I provided is correct.` })
8855
- ] }),
8856
- errorBankConsent && /* @__PURE__ */ jsx29("span", { className: "error-span", children: errorBankConsent })
8857
- ] }),
8858
- (props == null ? void 0 : props.customerId) && /* @__PURE__ */ jsxs16("div", { className: "form-group mb-4 save-ach-div", style: { paddingTop: "5px" }, children: [
8859
- /* @__PURE__ */ jsx29("input", { type: "checkbox", id: "saveACH", className: "", maxLength: 100, placeholder: "My Bank", checked: saveACHinfo, onChange: (e) => setSaveACHinfo(e.target.checked) }),
8860
- /* @__PURE__ */ jsx29("label", { htmlFor: "saveACH", children: "Save for future use" })
8861
- ] }),
8862
- saveACHinfo && /* @__PURE__ */ jsxs16(Fragment16, { children: [
8863
- /* @__PURE__ */ jsxs16("div", { className: "form-group-frac save-ach-div", style: { paddingTop: "5px" }, children: [
8864
- /* @__PURE__ */ jsx29("input", { type: "checkbox", id: "saveACHConsent1", className: "", maxLength: 100, placeholder: "My Bank", checked: saveACHConsent1, onChange: (e) => {
8865
- setSaveACHConsent1(e.target.checked);
8866
- if (e.target.checked) {
8867
- setErrorBankConsentOther("");
8868
- }
8869
- } }),
8870
- /* @__PURE__ */ jsxs16("label", { className: "saveachlabel", htmlFor: "saveACHConsent1", children: [
8871
- "By providing my bank account information and selecting \u2018Save for future payments\u2019, I authorize ",
8872
- (paymentData == null ? void 0 : paymentData.bname) || "merchant",
8873
- " to store my bank account details for future ACH payments. I understand that future payments may be initiated using this saved account in accordance with my instructions. I confirm I am authorized to use this bank account."
8874
- ] })
8875
- ] }),
8876
- errorBankConsentOther && /* @__PURE__ */ jsx29("span", { className: "error-span", children: errorBankConsentOther })
8877
- ] })
8878
- ] }),
8879
- /* @__PURE__ */ jsx29("div", { className: "form-group ", children: /* @__PURE__ */ jsx29("button", { className: "pay-button", style: { margin: "20px 0 0" }, type: "submit", children: partialAmount && !partialError ? formatUSD((_y = Number(partialAmount)) == null ? void 0 : _y.toFixed(2)) : formatUSD((_z = Number(cashDiscount)) == null ? void 0 : _z.toFixed(2)) }) })
8880
- ] })
8881
- ] })
8882
- ] }) }) })
8657
+ /* @__PURE__ */ jsx27(
8658
+ FractalFooter,
8659
+ {
8660
+ authText: AuthText,
8661
+ submit: true,
8662
+ disabled: loading2 || surchargeLookupLoading,
8663
+ buttonLabel: `Pay ${formatUSD(effectiveTotal.toFixed(2))} to ${merchantName}`
8664
+ }
8665
+ )
8666
+ ]
8667
+ }
8668
+ )
8669
+ )
8883
8670
  ] })
8884
- ] }) })
8671
+ ] })
8885
8672
  ] })
8886
8673
  ]
8887
8674
  }
@@ -8894,13 +8681,13 @@ function PartialPayment(props) {
8894
8681
  import { useEffect as useEffect16, useState as useState10, useMemo } from "react";
8895
8682
 
8896
8683
  // src/app/components/Skysystemz/SkyChargewidgetstyles.tsx
8897
- import { jsx as jsx30 } from "react/jsx-runtime";
8684
+ import { jsx as jsx28 } from "react/jsx-runtime";
8898
8685
  function SkyChargewidgetstyles() {
8899
8686
  const primarycolor = "#000";
8900
8687
  const primarybgcolor = "#fff";
8901
8688
  const primarybodycolor = "#212529";
8902
8689
  const primarybordercolor = "#dee2e6";
8903
- return /* @__PURE__ */ jsx30("style", { children: `
8690
+ return /* @__PURE__ */ jsx28("style", { children: `
8904
8691
  @import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');
8905
8692
  body
8906
8693
  {
@@ -9786,6 +9573,44 @@ function ThreeDSChallenge({
9786
9573
  return null;
9787
9574
  }
9788
9575
 
9576
+ // src/app/components/Atoms/CardBankRadio/CardBankRadio.tsx
9577
+ import { Fragment as Fragment15, jsx as jsx29, jsxs as jsxs15 } from "react/jsx-runtime";
9578
+ var CardBankRadio = (_a) => {
9579
+ var _b = _a, { skydesign = false, savingsText } = _b, props = __objRest(_b, ["skydesign", "savingsText"]);
9580
+ const savingsBadgeClass = `frac-saving-badge ${skydesign ? "frac-saving-badge-corner" : "frac-saving-badge-corner frac-saving-badge-with-radio"}`;
9581
+ return /* @__PURE__ */ jsx29(Fragment15, { children: /* @__PURE__ */ jsx29(
9582
+ "div",
9583
+ {
9584
+ className: `frac-card-bank-radio ${props.activetab === props.value ? "frac-active" : ""}`,
9585
+ onClick: () => props.onChange(props.value),
9586
+ role: "radio",
9587
+ children: skydesign ? /* @__PURE__ */ jsxs15(Fragment15, { children: [
9588
+ /* @__PURE__ */ jsxs15("div", { className: "frac-card-title-main", children: [
9589
+ /* @__PURE__ */ jsxs15("div", { className: "box-inner-card-text", children: [
9590
+ /* @__PURE__ */ jsx29("img", { src: props.label.toLowerCase() === "card" ? defaultcard : props.label.toLowerCase() === "reader" ? pax : bankNew, className: "frac-payment-type-logo", alt: "" }),
9591
+ /* @__PURE__ */ jsx29("div", { className: "frac-card-label-text", children: props.label })
9592
+ ] }),
9593
+ /* @__PURE__ */ jsx29("div", { className: "frac-card-label", children: /* @__PURE__ */ jsx29("div", { className: "frac-card-label-amount", children: formatUSD(props.amount) }) })
9594
+ ] }),
9595
+ /* @__PURE__ */ jsx29("div", { children: /* @__PURE__ */ jsx29("input", { name: "paymenttype", checked: props.activetab === props.value, type: "hidden", value: props.value, onChange: (e) => {
9596
+ props.onChange(e.target.value);
9597
+ } }) })
9598
+ ] }) : /* @__PURE__ */ jsxs15(Fragment15, { children: [
9599
+ /* @__PURE__ */ jsxs15("div", { className: "frac-card-title-main", children: [
9600
+ /* @__PURE__ */ jsx29("img", { src: props.label.toLowerCase() === "card" ? defaultcard : props.label.toLowerCase() === "reader" ? pax : bankNew, className: "frac-payment-type-logo", alt: "" }),
9601
+ /* @__PURE__ */ jsxs15("div", { className: "frac-card-label", children: [
9602
+ /* @__PURE__ */ jsx29("div", { className: "frac-card-label-text", children: props.label }),
9603
+ /* @__PURE__ */ jsx29("div", { className: "frac-card-label-amount", children: formatUSD(props.amount) })
9604
+ ] })
9605
+ ] }),
9606
+ /* @__PURE__ */ jsx29("div", { children: /* @__PURE__ */ jsx29("input", { name: "paymenttype", checked: props.activetab === props.value, type: "radio", value: props.value, onChange: (e) => {
9607
+ props.onChange(e.target.value);
9608
+ } }) })
9609
+ ] })
9610
+ }
9611
+ ) });
9612
+ };
9613
+
9789
9614
  // src/app/components/Atoms/ThreedsCheckout/ThreedsCheckout.tsx
9790
9615
  import { Elements } from "@stripe/react-stripe-js";
9791
9616
  import { loadStripe } from "@stripe/stripe-js";
@@ -9794,7 +9619,7 @@ import { loadStripe } from "@stripe/stripe-js";
9794
9619
  import { PaymentElement, useElements, useStripe } from "@stripe/react-stripe-js";
9795
9620
  import axios7 from "axios";
9796
9621
  import { useState as useState8 } from "react";
9797
- import { jsx as jsx31, jsxs as jsxs17 } from "react/jsx-runtime";
9622
+ import { jsx as jsx30, jsxs as jsxs16 } from "react/jsx-runtime";
9798
9623
  var CheckoutForm = ({ onSuccess, showLoader, setError, session_token, callback, hideLoader, handleClose, amount, isPreAuth }) => {
9799
9624
  var _a;
9800
9625
  const stripe = useStripe();
@@ -9859,24 +9684,76 @@ var CheckoutForm = ({ onSuccess, showLoader, setError, session_token, callback,
9859
9684
  hideLoader();
9860
9685
  }
9861
9686
  };
9862
- return /* @__PURE__ */ jsxs17("form", { onSubmit: handleSubmit, children: [
9863
- /* @__PURE__ */ jsx31(PaymentElement, {}),
9864
- /* @__PURE__ */ jsx31("button", { className: "pay-button", disabled: loading || !stripe, children: loading ? "Processing..." : `${formatUSD((_a = Number(amount)) == null ? void 0 : _a.toFixed(2))}` })
9687
+ return /* @__PURE__ */ jsxs16("form", { onSubmit: handleSubmit, children: [
9688
+ /* @__PURE__ */ jsx30(PaymentElement, {}),
9689
+ /* @__PURE__ */ jsx30("button", { className: "pay-button", disabled: loading || !stripe, children: loading ? "Processing..." : `${formatUSD((_a = Number(amount)) == null ? void 0 : _a.toFixed(2))}` })
9865
9690
  ] });
9866
9691
  };
9867
9692
 
9868
9693
  // src/app/components/Atoms/ThreedsCheckout/ThreedsCheckout.tsx
9869
- import { jsx as jsx32 } from "react/jsx-runtime";
9694
+ import { jsx as jsx31 } from "react/jsx-runtime";
9870
9695
  var stripePromise = loadStripe(
9871
9696
  threedsSecurePublicKey
9872
9697
  );
9873
9698
  function CheckoutWrapper({ clientSecret, onSuccess, showLoader, setError, session_token, callback, hideLoader, handleClose, amount, isPreAuth }) {
9874
9699
  if (!clientSecret) return null;
9875
- return /* @__PURE__ */ jsx32(Elements, { stripe: stripePromise, options: { clientSecret }, children: /* @__PURE__ */ jsx32(CheckoutForm, { onSuccess, showLoader, hideLoader, setError, session_token, callback, handleClose, amount, isPreAuth }) });
9700
+ return /* @__PURE__ */ jsx31(Elements, { stripe: stripePromise, options: { clientSecret }, children: /* @__PURE__ */ jsx31(CheckoutForm, { onSuccess, showLoader, hideLoader, setError, session_token, callback, handleClose, amount, isPreAuth }) });
9876
9701
  }
9877
9702
 
9878
9703
  // src/app/components/Atoms/ModelContentSky/ModelContentSky.tsx
9879
- import { IoArrowBack as IoArrowBack2 } from "react-icons/io5";
9704
+ import { IoArrowBack } from "react-icons/io5";
9705
+
9706
+ // src/app/components/Atoms/CardList/CardList.tsx
9707
+ import { Fragment as Fragment16, jsx as jsx32, jsxs as jsxs17 } from "react/jsx-runtime";
9708
+ var CardList = ({ listHeading = "Card", ListItems, selectedCard, setSelectedCard, paymentGateway, handleDeleteCard, otherButtonAction, otherButtonLabel, headingClass }) => {
9709
+ let trash2 = S3Url + "widget/Trash.svg";
9710
+ return /* @__PURE__ */ jsxs17(Fragment16, { children: [
9711
+ /* @__PURE__ */ jsx32("h6", { className: headingClass || "card-ach-heading", style: { marginBottom: "10px !important" }, children: listHeading }),
9712
+ /* @__PURE__ */ jsxs17("div", { className: "card-lint-div-in", children: [
9713
+ /* @__PURE__ */ jsx32("div", { className: "card-list-div", children: ListItems && (ListItems == null ? void 0 : ListItems.length) > 0 && (ListItems == null ? void 0 : ListItems.map((card, index) => {
9714
+ let isDisabled = false;
9715
+ if (paymentGateway) {
9716
+ isDisabled = paymentGateway != (card == null ? void 0 : card.payment_method_type) && (card == null ? void 0 : card.card_type) != "Bank";
9717
+ }
9718
+ return /* @__PURE__ */ jsxs17("div", { className: "card-list-single-div", children: [
9719
+ /* @__PURE__ */ jsxs17("div", { className: "card-number-radio", children: [
9720
+ /* @__PURE__ */ jsx32(
9721
+ "input",
9722
+ {
9723
+ disabled: isDisabled,
9724
+ type: "radio",
9725
+ className: "cardRadio",
9726
+ name: "selected_card",
9727
+ id: "",
9728
+ checked: (selectedCard == null ? void 0 : selectedCard.id) === (card == null ? void 0 : card.id),
9729
+ onChange: (e) => setSelectedCard(card)
9730
+ }
9731
+ ),
9732
+ /* @__PURE__ */ jsxs17("label", { htmlFor: "", className: "card-number-last-four", children: [
9733
+ "**** ",
9734
+ card == null ? void 0 : card.cardlastfourdigit
9735
+ ] }),
9736
+ (card == null ? void 0 : card.card_type) != "Bank" && /* @__PURE__ */ jsxs17("h6", { className: "card-expiry-date", children: [
9737
+ card == null ? void 0 : card.expmonth,
9738
+ "/",
9739
+ card == null ? void 0 : card.expyear
9740
+ ] })
9741
+ ] }),
9742
+ /* @__PURE__ */ jsxs17("div", { className: "card-number-radio", children: [
9743
+ /* @__PURE__ */ jsx32("span", { className: "visa-card", children: /* @__PURE__ */ jsx32("img", { src: getCardType(card == null ? void 0 : card.card_type), alt: "" }) }),
9744
+ /* @__PURE__ */ jsx32("span", { className: "visa-card", style: { cursor: "pointer" }, onClick: () => handleDeleteCard(card == null ? void 0 : card.id), children: /* @__PURE__ */ jsx32("img", { src: trash2, alt: "" }) })
9745
+ ] })
9746
+ ] }, card == null ? void 0 : card.id);
9747
+ })) }),
9748
+ /* @__PURE__ */ jsxs17("div", { className: "pay-with-other-card", onClick: otherButtonAction, children: [
9749
+ otherButtonLabel,
9750
+ /* @__PURE__ */ jsx32("img", { src: defaultcard, alt: "" })
9751
+ ] })
9752
+ ] })
9753
+ ] });
9754
+ };
9755
+
9756
+ // src/app/components/Atoms/ModelContentSky/ModelContentSky.tsx
9880
9757
  import { NumericFormat as NumericFormat2 } from "react-number-format";
9881
9758
 
9882
9759
  // src/app/components/ErrorCardMessage/ErrorCardOverlaystyle.tsx
@@ -11327,7 +11204,7 @@ var ModelContentSky = ({ amount, bankAmount, submitBtnText = "Pay", session_toke
11327
11204
  /* @__PURE__ */ jsx36("h1", { className: "pay-heading", children: "Pay" }),
11328
11205
  (cardList == null ? void 0 : cardList.length) > 0 && activetab !== "cardList" && /* @__PURE__ */ jsxs19("button", { className: "res-charge-payment-back-btn ", onClick: () => setActive("cardList"), children: [
11329
11206
  " ",
11330
- /* @__PURE__ */ jsx36(IoArrowBack2, {}),
11207
+ /* @__PURE__ */ jsx36(IoArrowBack, {}),
11331
11208
  " Back"
11332
11209
  ] })
11333
11210
  ] }),
@@ -11407,7 +11284,7 @@ var ModelContentSky = ({ amount, bankAmount, submitBtnText = "Pay", session_toke
11407
11284
  /* @__PURE__ */ jsxs19("div", { className: "frac-heading-card-wrap", children: [
11408
11285
  /* @__PURE__ */ jsx36("div", { className: "frac-backarrow", children: (cardList == null ? void 0 : cardList.length) > 0 && activeinCard === "form" && /* @__PURE__ */ jsxs19("button", { className: "charge-payment-back-btn ", onClick: () => setActiveinCard("list"), children: [
11409
11286
  " ",
11410
- /* @__PURE__ */ jsx36(IoArrowBack2, {})
11287
+ /* @__PURE__ */ jsx36(IoArrowBack, {})
11411
11288
  ] }) }),
11412
11289
  /* @__PURE__ */ jsx36("h6", { className: "frac-card-payment-heading", children: "Card Payment" })
11413
11290
  ] }),
@@ -11606,7 +11483,7 @@ var ModelContentSky = ({ amount, bankAmount, submitBtnText = "Pay", session_toke
11606
11483
  !onSubmit && /* @__PURE__ */ jsxs19("div", { className: "frac-heading-card-wrap", children: [
11607
11484
  /* @__PURE__ */ jsx36("div", { className: "frac-backarrow", children: (bankList == null ? void 0 : bankList.length) > 0 && activeinBank === "form" && /* @__PURE__ */ jsxs19("button", { className: "charge-payment-back-btn ", onClick: () => setActiveinBank("list"), children: [
11608
11485
  " ",
11609
- /* @__PURE__ */ jsx36(IoArrowBack2, {})
11486
+ /* @__PURE__ */ jsx36(IoArrowBack, {})
11610
11487
  ] }) }),
11611
11488
  /* @__PURE__ */ jsx36("h6", { className: "frac-card-payment-heading", children: "Bank Payment" })
11612
11489
  ] }),