@fractalpay/fractalpay-next-dev 0.0.305 → 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.305",
42
+ version: "0.0.307",
43
43
  private: false,
44
44
  type: "module",
45
45
  scripts: {
@@ -287,7 +287,7 @@ if (name === "@fractalpay/fractalpay-next-dev") {
287
287
  applePayMerchantId = "fractal";
288
288
  googlePayMerchantId = "BCR2DN4T6OC2TCQH";
289
289
  googlePayEnvironment = "PRODUCTION";
290
- googlePayGatewayMerchantId = "fractal";
290
+ googlePayGatewayMerchantId = "skysystemz";
291
291
  } else if (name === "@fractalpay/fractalpay-next") {
292
292
  masterBaseUrl = "https://api.fractalpay.com/";
293
293
  baseUrl = "https://widget.fractalpay.com/";
@@ -297,7 +297,7 @@ if (name === "@fractalpay/fractalpay-next-dev") {
297
297
  applePayMerchantId = "fractal";
298
298
  googlePayMerchantId = "BCR2DN4T6OC2TCQH";
299
299
  googlePayEnvironment = "PRODUCTION";
300
- googlePayGatewayMerchantId = "fractal";
300
+ googlePayGatewayMerchantId = "skysystemz";
301
301
  } else {
302
302
  baseUrl = "http://localhost:8082/";
303
303
  masterBaseUrl = "http://localhost:8081/";
@@ -3481,8 +3481,6 @@ var baseCSS = `
3481
3481
  }
3482
3482
 
3483
3483
  `;
3484
- var datacapInitializing = false;
3485
- var datacapInitialized = false;
3486
3484
  var DataCapFields = ({
3487
3485
  isOpen,
3488
3486
  tokenKey,
@@ -3490,11 +3488,15 @@ var DataCapFields = ({
3490
3488
  isAddCard,
3491
3489
  isEmbedded,
3492
3490
  customCSS: extraCss,
3493
- height
3491
+ height,
3492
+ onError
3494
3493
  }) => {
3495
3494
  const iframeId = "datacap-iframe";
3496
3495
  const resolverRef = useRef2(null);
3497
3496
  const [iframeReady, setIframeReady] = useState3(false);
3497
+ const [mountKey, setMountKey] = useState3(0);
3498
+ const initGenRef = useRef2(0);
3499
+ const initTimeoutRef = useRef2(null);
3498
3500
  let customCSS = baseCSS;
3499
3501
  useEffect7(() => {
3500
3502
  if (!isOpen || !tokenKey) return;
@@ -3534,6 +3536,8 @@ var DataCapFields = ({
3534
3536
  if (extraCss) {
3535
3537
  customCSS += extraCss;
3536
3538
  }
3539
+ const myGen = ++initGenRef.current;
3540
+ setMountKey(myGen);
3537
3541
  const initialize = async () => {
3538
3542
  setLoader == null ? void 0 : setLoader(true);
3539
3543
  setIframeReady(false);
@@ -3552,18 +3556,39 @@ var DataCapFields = ({
3552
3556
  }
3553
3557
  }, 100);
3554
3558
  });
3555
- await waitForSDK();
3556
- const sdk = window.DatacapHostedWebToken;
3557
- if (datacapInitializing || datacapInitialized) {
3558
- console.log("\u{1F7E1} Datacap already initializing/initialized");
3559
+ const waitForIframe = () => new Promise((resolve, reject) => {
3560
+ let attempts = 0;
3561
+ const interval = setInterval(() => {
3562
+ attempts++;
3563
+ if (document.getElementById(iframeId)) {
3564
+ clearInterval(interval);
3565
+ resolve();
3566
+ }
3567
+ if (attempts > 100) {
3568
+ clearInterval(interval);
3569
+ reject("Datacap iframe not found");
3570
+ }
3571
+ }, 50);
3572
+ });
3573
+ try {
3574
+ await waitForSDK();
3575
+ await waitForIframe();
3576
+ } catch (err) {
3577
+ if (initGenRef.current !== myGen) return;
3578
+ console.error("\u274C Datacap failed to become ready:", err);
3579
+ setLoader == null ? void 0 : setLoader(false);
3580
+ onError == null ? void 0 : onError("Unable to load payment form. Please try again.");
3559
3581
  return;
3560
3582
  }
3561
- datacapInitializing = true;
3562
- const initTimeout = setTimeout(() => {
3583
+ if (initGenRef.current !== myGen) return;
3584
+ const sdk = window.DatacapHostedWebToken;
3585
+ initTimeoutRef.current = setTimeout(() => {
3563
3586
  var _a, _b;
3587
+ if (initGenRef.current !== myGen) return;
3564
3588
  console.error("\u274C Datacap iframe load timeout");
3565
- datacapInitializing = false;
3589
+ initTimeoutRef.current = null;
3566
3590
  setLoader == null ? void 0 : setLoader(false);
3591
+ onError == null ? void 0 : onError("Unable to load payment form. Please try again.");
3567
3592
  (_b = (_a = resolverRef.current) == null ? void 0 : _a.reject) == null ? void 0 : _b.call(
3568
3593
  _a,
3569
3594
  "Unable to load payment form"
@@ -3573,9 +3598,7 @@ var DataCapFields = ({
3573
3598
  tokenKey,
3574
3599
  iframeId,
3575
3600
  (response) => {
3576
- clearTimeout(initTimeout);
3577
- datacapInitializing = false;
3578
- datacapInitialized = true;
3601
+ if (initGenRef.current !== myGen) return;
3579
3602
  setLoader == null ? void 0 : setLoader(false);
3580
3603
  if (!resolverRef.current) return;
3581
3604
  if ((response == null ? void 0 : response.Error) || (response == null ? void 0 : response.Errors)) {
@@ -3615,12 +3638,6 @@ var DataCapFields = ({
3615
3638
  delete window.requestDcToken;
3616
3639
  };
3617
3640
  }, []);
3618
- useEffect7(() => {
3619
- return () => {
3620
- datacapInitializing = false;
3621
- datacapInitialized = false;
3622
- };
3623
- }, []);
3624
3641
  return (
3625
3642
  // <iframe
3626
3643
  // id={iframeId}
@@ -3643,13 +3660,22 @@ var DataCapFields = ({
3643
3660
  id: iframeId,
3644
3661
  onLoad: () => {
3645
3662
  console.log("\u{1F7E2} Iframe visually loaded");
3663
+ if (initTimeoutRef.current) {
3664
+ clearTimeout(initTimeoutRef.current);
3665
+ initTimeoutRef.current = null;
3666
+ }
3646
3667
  setIframeReady(true);
3647
3668
  setLoader == null ? void 0 : setLoader(false);
3648
3669
  },
3649
3670
  onError: () => {
3650
3671
  var _a, _b;
3651
3672
  console.error("\u274C iframe failed");
3673
+ if (initTimeoutRef.current) {
3674
+ clearTimeout(initTimeoutRef.current);
3675
+ initTimeoutRef.current = null;
3676
+ }
3652
3677
  setLoader == null ? void 0 : setLoader(false);
3678
+ onError == null ? void 0 : onError("Payment form failed to load");
3653
3679
  (_b = (_a = resolverRef.current) == null ? void 0 : _a.reject) == null ? void 0 : _b.call(
3654
3680
  _a,
3655
3681
  "Payment form failed to load"
@@ -3662,7 +3688,8 @@ var DataCapFields = ({
3662
3688
  opacity: iframeReady ? 1 : 0,
3663
3689
  transition: "opacity 0.3s ease"
3664
3690
  }
3665
- }
3691
+ },
3692
+ mountKey
3666
3693
  )
3667
3694
  );
3668
3695
  };
@@ -4079,7 +4106,8 @@ function FractalOrderSummary({
4079
4106
  cardIcons,
4080
4107
  note,
4081
4108
  secureIcon,
4082
- secureText = "Secure payment powered by Fractal"
4109
+ secureText = "Secure payment powered by Fractal",
4110
+ extra
4083
4111
  }) {
4084
4112
  return /* @__PURE__ */ jsxs8("aside", { className: "fps-summary", children: [
4085
4113
  /* @__PURE__ */ jsx17("div", { className: "fps-logo", children: logo && /* @__PURE__ */ jsx17("img", { src: logo, alt: "" }) }),
@@ -4094,6 +4122,7 @@ function FractalOrderSummary({
4094
4122
  /* @__PURE__ */ jsx17("div", { className: "fps-total-label", children: totalLabel }),
4095
4123
  /* @__PURE__ */ jsx17("div", { className: "fps-total", children: total })
4096
4124
  ] }),
4125
+ extra,
4097
4126
  cardIcons && /* @__PURE__ */ jsxs8("div", { className: "fps-cards", children: [
4098
4127
  /* @__PURE__ */ jsx17("img", { src: cardIcons.visa, alt: "Visa" }),
4099
4128
  /* @__PURE__ */ jsx17("img", { src: cardIcons.mastercard, alt: "Mastercard" }),
@@ -4299,6 +4328,7 @@ function GetPaymentPage(props) {
4299
4328
  const [cashDiscount, setCashDiscount] = useState4(Number(props == null ? void 0 : props.amount));
4300
4329
  const [bankAmount, setBankAmount] = useState4(Number(props == null ? void 0 : props.amount));
4301
4330
  const [bankFeeAmount, setBankFeeAmount] = useState4(0);
4331
+ const [bankSavingsAmount, setBankSavingsAmount] = useState4(0);
4302
4332
  const [paymentData, setPaymentData] = useState4();
4303
4333
  let [tranId, setTranId] = useState4("");
4304
4334
  let [isDebitAdjusted, setIsDebitAdjusted] = useState4(false);
@@ -4407,16 +4437,18 @@ function GetPaymentPage(props) {
4407
4437
  setCashDiscount(cash_discount);
4408
4438
  const cardFeeAmount = Number((Number(props == null ? void 0 : props.amount) - Number(cash_discount || 0)).toFixed(2));
4409
4439
  const bankFeeAmount2 = Number((props == null ? void 0 : props.bankFeeAmount) || 0);
4410
- const bankSavingsAmount = Math.max(bankFeeAmount2 > 0 ? cardFeeAmount - bankFeeAmount2 : cardFeeAmount, 0);
4411
- 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))}` : "";
4412
4442
  setBankFeeAmount(bankFeeAmount2);
4443
+ setBankSavingsAmount(bankSavingsAmount2);
4413
4444
  console.log({
4414
4445
  cash_discount,
4415
4446
  bankAmount: bankAmount2,
4416
4447
  cardFeeAmount,
4417
4448
  bankFeeAmount: bankFeeAmount2,
4418
- bankSavingsAmount,
4419
- bankSavingsText
4449
+ bankSavingsAmount: bankSavingsAmount2,
4450
+ bankSavingsText,
4451
+ amount: props == null ? void 0 : props.amount
4420
4452
  });
4421
4453
  }
4422
4454
  }, [show, props == null ? void 0 : props.pass_fee, props == null ? void 0 : props.amount, props == null ? void 0 : props.surcharge]);
@@ -4993,7 +5025,7 @@ function GetPaymentPage(props) {
4993
5025
  }
4994
5026
  };
4995
5027
  const getPaymentDetails = async () => {
4996
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w;
5028
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A;
4997
5029
  showLoader();
4998
5030
  try {
4999
5031
  const data = {
@@ -5008,12 +5040,14 @@ function GetPaymentPage(props) {
5008
5040
  handleClose();
5009
5041
  setError("Something went wrong.");
5010
5042
  }
5043
+ let willShowCardForm = true;
5011
5044
  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) {
5012
5045
  let banklists = (_k = (_j2 = (_i2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _i2.data) == null ? void 0 : _j2.card_list) == null ? void 0 : _k.filter((card) => (card == null ? void 0 : card.card_type) == "Bank");
5013
5046
  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");
5014
5047
  if ((cardlists == null ? void 0 : cardlists.length) > 0 || (banklists == null ? void 0 : banklists.length) > 0) {
5015
5048
  setActiveinCard("list");
5016
5049
  setActiveinBank("list");
5050
+ willShowCardForm = false;
5017
5051
  }
5018
5052
  setCardList(cardlists);
5019
5053
  setBankList(banklists);
@@ -5023,11 +5057,14 @@ function GetPaymentPage(props) {
5023
5057
  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) {
5024
5058
  setSelectedReader((_u = (_t = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _t.data) == null ? void 0 : _u.paymentDeviceList[0]);
5025
5059
  }
5060
+ 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)) {
5061
+ setLoadingIframe(true);
5062
+ }
5026
5063
  hideLoader();
5027
5064
  } catch (err) {
5028
5065
  console.log(err);
5029
5066
  hideLoader();
5030
- setError(((_w = (_v = err == null ? void 0 : err.response) == null ? void 0 : _v.data) == null ? void 0 : _w.message) || (err == null ? void 0 : err.message) || "Something went wrong");
5067
+ 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");
5031
5068
  }
5032
5069
  };
5033
5070
  const handlechargeCustomer = async (e) => {
@@ -5272,7 +5309,7 @@ function GetPaymentPage(props) {
5272
5309
  cardTotal = Number((props == null ? void 0 : props.amount) || 0);
5273
5310
  }
5274
5311
  const surchargeFee = Math.max(cardTotal - baseAmount, 0);
5275
- 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";
5276
5313
  const discountNum = Number((props == null ? void 0 : props.discount) || 0);
5277
5314
  const taxNum = Number((props == null ? void 0 : props.tax) || 0);
5278
5315
  const leftTotal = isBankView ? Number(bankAmount || 0) : cardTotal;
@@ -5329,11 +5366,16 @@ function GetPaymentPage(props) {
5329
5366
  { label: "Tax", value: fmtNum(taxNum), muted: true },
5330
5367
  ...showSurchargeLine ? [{ label: "Surcharge", value: formatUSD(surchargeFee.toFixed(2)) }] : []
5331
5368
  ];
5332
- 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: [
5333
5370
  /* @__PURE__ */ jsx18("b", { children: formatUSD(baseAmount.toFixed(2)) }),
5334
- " 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."
5335
5374
  ] }) : /* @__PURE__ */ jsxs9("div", { className: "fps-note", children: [
5336
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)) }),
5337
5379
  " if customer pays by bank (cash discount price)."
5338
5380
  ] });
5339
5381
  const LeftSummary = /* @__PURE__ */ jsx18(
@@ -5585,7 +5627,7 @@ function GetPaymentPage(props) {
5585
5627
  getSurchargeOptions,
5586
5628
  onSurchargeResult: setSurchargeResult
5587
5629
  }
5588
- ) : /* @__PURE__ */ jsx18(DataCapFields, { isOpen: show, tokenKey: paymentData == null ? void 0 : paymentData.dctoken, setLoader: setLoadingIframe }) }) }),
5630
+ ) : /* @__PURE__ */ jsx18(DataCapFields, { isOpen: show, tokenKey: paymentData == null ? void 0 : paymentData.dctoken, setLoader: setLoadingIframe, onError: (msg) => setError(msg || DcLoadingError) }) }) }),
5589
5631
  /* @__PURE__ */ jsx18(FractalField, { label: "Zip", htmlFor: "zip", error: cardError == null ? void 0 : cardError.zipCode, children: /* @__PURE__ */ jsx18("input", { id: "zip", className: "fps-input", maxLength: 100, placeholder: "000000", value: (_j = cardData == null ? void 0 : cardData.zipCode) != null ? _j : "", onChange: (e) => handleCardChange("zipCode", e.target.value) }) }),
5590
5632
  (props == null ? void 0 : props.customerId) && /* @__PURE__ */ jsxs9(FractalCheckbox, { id: "save_card", checked: saveCardInfo, onChange: (v) => setSaveCardInfo(v), children: [
5591
5633
  "Save this card. ",
@@ -6158,7 +6200,7 @@ function AddCardEasyPay(props) {
6158
6200
  return Object.keys(errors).length > 0;
6159
6201
  };
6160
6202
  const getPaymentDetails = async () => {
6161
- var _a2, _b2, _c;
6203
+ var _a2, _b2, _c, _d, _e, _f, _g;
6162
6204
  showLoader();
6163
6205
  try {
6164
6206
  const data = {
@@ -6172,6 +6214,9 @@ function AddCardEasyPay(props) {
6172
6214
  handleClose();
6173
6215
  setError("Something went wrong.");
6174
6216
  }
6217
+ if (((_e = (_d = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _d.data) == null ? void 0 : _e.paymentGateway) === 31 && ((_g = (_f = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _f.data) == null ? void 0 : _g.dctoken)) {
6218
+ setLoadingIframe(true);
6219
+ }
6175
6220
  hideLoader();
6176
6221
  } catch (err) {
6177
6222
  console.log(err);
@@ -6429,7 +6474,8 @@ function AddCardEasyPay(props) {
6429
6474
  isOpen: true,
6430
6475
  tokenKey: paymentData == null ? void 0 : paymentData.dctoken,
6431
6476
  setLoader: setLoadingIframe,
6432
- isAddCard: true
6477
+ isAddCard: true,
6478
+ onError: (msg) => setError(msg || DcLoadingError)
6433
6479
  }
6434
6480
  ) }),
6435
6481
  /* @__PURE__ */ jsxs11("div", { className: "form-group", style: { marginTop: "0" }, children: [
@@ -7036,21 +7082,24 @@ function CardOnFile({ session_token, callback, isloading, onCancel, showChecks,
7036
7082
  onCancel();
7037
7083
  };
7038
7084
  const getPaymentDetails = async () => {
7039
- var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k;
7085
+ var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
7040
7086
  try {
7041
7087
  showLoader();
7042
7088
  const res = await axios5.get(`${masterBaseUrl}api/v1/gateway/get-payment-details/${session_token}`);
7043
7089
  if ((res == null ? void 0 : res.status) == 200) {
7044
7090
  setPaymentGateway((_b2 = (_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.data) == null ? void 0 : _b2.paymentGateway);
7045
7091
  setDCToken((_d = (_c = res == null ? void 0 : res.data) == null ? void 0 : _c.data) == null ? void 0 : _d.dctoken);
7092
+ if (((_f = (_e = res == null ? void 0 : res.data) == null ? void 0 : _e.data) == null ? void 0 : _f.paymentGateway) === 31 && ((_h = (_g = res == null ? void 0 : res.data) == null ? void 0 : _g.data) == null ? void 0 : _h.dctoken)) {
7093
+ setLoadingIframe(true);
7094
+ }
7046
7095
  hideLoader();
7047
7096
  }
7048
7097
  } catch (error2) {
7049
- console.log((_f = (_e = error2 == null ? void 0 : error2.response) == null ? void 0 : _e.data) == null ? void 0 : _f.result, "error while getting payment details");
7098
+ console.log((_j = (_i = error2 == null ? void 0 : error2.response) == null ? void 0 : _i.data) == null ? void 0 : _j.result, "error while getting payment details");
7050
7099
  callback({
7051
- error: ((_h = (_g = error2 == null ? void 0 : error2.response) == null ? void 0 : _g.data) == null ? void 0 : _h.message) || "Something went wrong!",
7052
- result: (_j = (_i = error2 == null ? void 0 : error2.response) == null ? void 0 : _i.data) == null ? void 0 : _j.result,
7053
- statusCode: (_k = error2 == null ? void 0 : error2.response) == null ? void 0 : _k.status
7100
+ error: ((_l = (_k = error2 == null ? void 0 : error2.response) == null ? void 0 : _k.data) == null ? void 0 : _l.message) || "Something went wrong!",
7101
+ result: (_n = (_m = error2 == null ? void 0 : error2.response) == null ? void 0 : _m.data) == null ? void 0 : _n.result,
7102
+ statusCode: (_o = error2 == null ? void 0 : error2.response) == null ? void 0 : _o.status
7054
7103
  });
7055
7104
  hideLoader();
7056
7105
  }
@@ -7316,7 +7365,8 @@ function CardOnFile({ session_token, callback, isloading, onCancel, showChecks,
7316
7365
  tokenKey: dcToken,
7317
7366
  setLoader: setLoadingIframe,
7318
7367
  customCSS,
7319
- height
7368
+ height,
7369
+ onError: (msg) => setError(msg || DcLoadingError)
7320
7370
  }
7321
7371
  ) }),
7322
7372
  /* @__PURE__ */ jsxs13("div", { className: "form-group", children: [
@@ -7435,103 +7485,10 @@ function CardOnFile({ session_token, callback, isloading, onCancel, showChecks,
7435
7485
  import { useEffect as useEffect12, useRef as useRef7, useState as useState7 } from "react";
7436
7486
  import axios6 from "axios";
7437
7487
  import Swal3 from "sweetalert2";
7438
-
7439
- // src/app/components/Atoms/CardBankRadio/CardBankRadio.tsx
7440
- import { Fragment as Fragment14, jsx as jsx27, jsxs as jsxs14 } from "react/jsx-runtime";
7441
- var CardBankRadio = (_a) => {
7442
- var _b = _a, { skydesign = false, savingsText } = _b, props = __objRest(_b, ["skydesign", "savingsText"]);
7443
- const savingsBadgeClass = `frac-saving-badge ${skydesign ? "frac-saving-badge-corner" : "frac-saving-badge-corner frac-saving-badge-with-radio"}`;
7444
- return /* @__PURE__ */ jsx27(Fragment14, { children: /* @__PURE__ */ jsx27(
7445
- "div",
7446
- {
7447
- className: `frac-card-bank-radio ${props.activetab === props.value ? "frac-active" : ""}`,
7448
- onClick: () => props.onChange(props.value),
7449
- role: "radio",
7450
- children: skydesign ? /* @__PURE__ */ jsxs14(Fragment14, { children: [
7451
- /* @__PURE__ */ jsxs14("div", { className: "frac-card-title-main", children: [
7452
- /* @__PURE__ */ jsxs14("div", { className: "box-inner-card-text", children: [
7453
- /* @__PURE__ */ jsx27("img", { src: props.label.toLowerCase() === "card" ? defaultcard : props.label.toLowerCase() === "reader" ? pax : bankNew, className: "frac-payment-type-logo", alt: "" }),
7454
- /* @__PURE__ */ jsx27("div", { className: "frac-card-label-text", children: props.label })
7455
- ] }),
7456
- /* @__PURE__ */ jsx27("div", { className: "frac-card-label", children: /* @__PURE__ */ jsx27("div", { className: "frac-card-label-amount", children: formatUSD(props.amount) }) })
7457
- ] }),
7458
- /* @__PURE__ */ jsx27("div", { children: /* @__PURE__ */ jsx27("input", { name: "paymenttype", checked: props.activetab === props.value, type: "hidden", value: props.value, onChange: (e) => {
7459
- props.onChange(e.target.value);
7460
- } }) })
7461
- ] }) : /* @__PURE__ */ jsxs14(Fragment14, { children: [
7462
- /* @__PURE__ */ jsxs14("div", { className: "frac-card-title-main", children: [
7463
- /* @__PURE__ */ jsx27("img", { src: props.label.toLowerCase() === "card" ? defaultcard : props.label.toLowerCase() === "reader" ? pax : bankNew, className: "frac-payment-type-logo", alt: "" }),
7464
- /* @__PURE__ */ jsxs14("div", { className: "frac-card-label", children: [
7465
- /* @__PURE__ */ jsx27("div", { className: "frac-card-label-text", children: props.label }),
7466
- /* @__PURE__ */ jsx27("div", { className: "frac-card-label-amount", children: formatUSD(props.amount) })
7467
- ] })
7468
- ] }),
7469
- /* @__PURE__ */ jsx27("div", { children: /* @__PURE__ */ jsx27("input", { name: "paymenttype", checked: props.activetab === props.value, type: "radio", value: props.value, onChange: (e) => {
7470
- props.onChange(e.target.value);
7471
- } }) })
7472
- ] })
7473
- }
7474
- ) });
7475
- };
7476
-
7477
- // src/app/components/PartialPayment/PartialPayment.tsx
7478
- import { IoArrowBack } from "react-icons/io5";
7479
-
7480
- // src/app/components/Atoms/CardList/CardList.tsx
7481
- import { Fragment as Fragment15, jsx as jsx28, jsxs as jsxs15 } from "react/jsx-runtime";
7482
- var CardList = ({ listHeading = "Card", ListItems, selectedCard, setSelectedCard, paymentGateway, handleDeleteCard, otherButtonAction, otherButtonLabel, headingClass }) => {
7483
- let trash2 = S3Url + "widget/Trash.svg";
7484
- return /* @__PURE__ */ jsxs15(Fragment15, { children: [
7485
- /* @__PURE__ */ jsx28("h6", { className: headingClass || "card-ach-heading", style: { marginBottom: "10px !important" }, children: listHeading }),
7486
- /* @__PURE__ */ jsxs15("div", { className: "card-lint-div-in", children: [
7487
- /* @__PURE__ */ jsx28("div", { className: "card-list-div", children: ListItems && (ListItems == null ? void 0 : ListItems.length) > 0 && (ListItems == null ? void 0 : ListItems.map((card, index) => {
7488
- let isDisabled = false;
7489
- if (paymentGateway) {
7490
- isDisabled = paymentGateway != (card == null ? void 0 : card.payment_method_type) && (card == null ? void 0 : card.card_type) != "Bank";
7491
- }
7492
- return /* @__PURE__ */ jsxs15("div", { className: "card-list-single-div", children: [
7493
- /* @__PURE__ */ jsxs15("div", { className: "card-number-radio", children: [
7494
- /* @__PURE__ */ jsx28(
7495
- "input",
7496
- {
7497
- disabled: isDisabled,
7498
- type: "radio",
7499
- className: "cardRadio",
7500
- name: "selected_card",
7501
- id: "",
7502
- checked: (selectedCard == null ? void 0 : selectedCard.id) === (card == null ? void 0 : card.id),
7503
- onChange: (e) => setSelectedCard(card)
7504
- }
7505
- ),
7506
- /* @__PURE__ */ jsxs15("label", { htmlFor: "", className: "card-number-last-four", children: [
7507
- "**** ",
7508
- card == null ? void 0 : card.cardlastfourdigit
7509
- ] }),
7510
- (card == null ? void 0 : card.card_type) != "Bank" && /* @__PURE__ */ jsxs15("h6", { className: "card-expiry-date", children: [
7511
- card == null ? void 0 : card.expmonth,
7512
- "/",
7513
- card == null ? void 0 : card.expyear
7514
- ] })
7515
- ] }),
7516
- /* @__PURE__ */ jsxs15("div", { className: "card-number-radio", children: [
7517
- /* @__PURE__ */ jsx28("span", { className: "visa-card", children: /* @__PURE__ */ jsx28("img", { src: getCardType(card == null ? void 0 : card.card_type), alt: "" }) }),
7518
- /* @__PURE__ */ jsx28("span", { className: "visa-card", style: { cursor: "pointer" }, onClick: () => handleDeleteCard(card == null ? void 0 : card.id), children: /* @__PURE__ */ jsx28("img", { src: trash2, alt: "" }) })
7519
- ] })
7520
- ] }, card == null ? void 0 : card.id);
7521
- })) }),
7522
- /* @__PURE__ */ jsxs15("div", { className: "pay-with-other-card", onClick: otherButtonAction, children: [
7523
- otherButtonLabel,
7524
- /* @__PURE__ */ jsx28("img", { src: defaultcard, alt: "" })
7525
- ] })
7526
- ] })
7527
- ] });
7528
- };
7529
-
7530
- // src/app/components/PartialPayment/PartialPayment.tsx
7531
7488
  import { NumericFormat } from "react-number-format";
7532
- 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";
7533
7490
  function PartialPayment(props) {
7534
- 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;
7535
7492
  const buttonRef = useRef7(null);
7536
7493
  useEffect12(() => {
7537
7494
  if (props.onTriggerPay) {
@@ -7553,15 +7510,14 @@ function PartialPayment(props) {
7553
7510
  const [loading, setLoading] = useState7(false);
7554
7511
  const [loading2, setLoading2] = useState7(false);
7555
7512
  const [loadingIframe, setLoadingIframe] = useState7(false);
7513
+ const [surchargeLookupLoading, setSurchargeLookupLoading] = useState7(false);
7556
7514
  const [errorIframe, setErrorIframe] = useState7("");
7557
7515
  const [error, setError] = useState7("");
7558
7516
  const [success, setSuccess] = useState7(false);
7559
7517
  const [show, setShow] = useState7(false);
7560
7518
  const [activetab, setActive] = useState7("card");
7561
- const [activeList, setActiveList] = useState7("card");
7562
7519
  const [activeinCard, setActiveinCard] = useState7("form");
7563
7520
  const [activeinBank, setActiveinBank] = useState7("form");
7564
- const [activeForm, setActiveForm] = useState7(true);
7565
7521
  const [saveCardInfo, setSaveCardInfo] = useState7(false);
7566
7522
  const [saveACHinfo, setSaveACHinfo] = useState7(false);
7567
7523
  const fractalpayClientKey = props.merchantPublicKey;
@@ -7608,6 +7564,11 @@ function PartialPayment(props) {
7608
7564
  };
7609
7565
  const [paymentData, setPaymentData] = useState7();
7610
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);
7611
7572
  const showLoader = () => setLoading(true);
7612
7573
  const hideLoader = () => setLoading(false);
7613
7574
  const CalculateCashDiscount = (amount, surcharge) => {
@@ -7620,6 +7581,69 @@ function PartialPayment(props) {
7620
7581
  const originalAmount = +amount + +(amount * surchargeVal);
7621
7582
  return originalAmount;
7622
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]);
7623
7647
  useEffect12(() => {
7624
7648
  if (show) {
7625
7649
  if (props == null ? void 0 : props.pass_fee) {
@@ -7637,6 +7661,7 @@ function PartialPayment(props) {
7637
7661
  setError("");
7638
7662
  setSuccess(false);
7639
7663
  setTranId("");
7664
+ setSurchargeResult(null);
7640
7665
  setAchData({
7641
7666
  name: "",
7642
7667
  routingNumber: "",
@@ -7685,8 +7710,6 @@ function PartialPayment(props) {
7685
7710
  });
7686
7711
  setSelectedReader({});
7687
7712
  setCashDiscount(0);
7688
- setActiveList("card");
7689
- setActiveForm(true);
7690
7713
  setActiveinBank("form");
7691
7714
  setActiveinCard("form");
7692
7715
  setLoading2(false);
@@ -7702,9 +7725,6 @@ function PartialPayment(props) {
7702
7725
  setLoderText("");
7703
7726
  };
7704
7727
  const handleShow = () => setShow(true);
7705
- const handletabchange = (id) => {
7706
- setActive(id);
7707
- };
7708
7728
  const handleCardChange = (field, value) => {
7709
7729
  const name2 = field;
7710
7730
  const numericFields = ["expiryMonth", "expiryYear", "zipCode", "cvv"];
@@ -7810,7 +7830,7 @@ function PartialPayment(props) {
7810
7830
  return Object.keys(errors).length > 0;
7811
7831
  };
7812
7832
  const submitFunc = async (e) => {
7813
- 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;
7814
7834
  e.preventDefault();
7815
7835
  const el = document.activeElement;
7816
7836
  if (el instanceof HTMLElement) {
@@ -7843,7 +7863,7 @@ function PartialPayment(props) {
7843
7863
  response.isCardSave = `${saveCardInfo}`;
7844
7864
  response.isCharge = true;
7845
7865
  response.posSalesIdEncode = (_a3 = paymentData == null ? void 0 : paymentData.orderDetails) == null ? void 0 : _a3.orderId;
7846
- response.partial_amount = partialAmount && !partialError ? partialAmount : aftertaxAmount;
7866
+ response.partial_amount = partialAmount && !partialError ? partialAmount : cardTotal;
7847
7867
  socketClient_default.emit("sendMessage", response);
7848
7868
  let eventName = (_b3 = paymentData == null ? void 0 : paymentData.orderDetails) == null ? void 0 : _b3.orderId;
7849
7869
  socketClient_default.on(eventName, (data) => {
@@ -7886,15 +7906,16 @@ function PartialPayment(props) {
7886
7906
  session_key: (_f2 = (_e2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _e2.data) == null ? void 0 : _f2.session_key
7887
7907
  });
7888
7908
  const card_issue_type = ((_g2 = tokenizeData == null ? void 0 : tokenizeData.bin_lookup_result) == null ? void 0 : _g2.card_issue_type) || null;
7889
- if (card_issue_type === "Debit" && (props == null ? void 0 : props.pass_fee) && (paymentData == null ? void 0 : paymentData.surchargeProgram) == 1) {
7890
- 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`);
7891
7912
  }
7892
7913
  const reqData = JSON.stringify(__spreadProps(__spreadValues({}, tokenizeData), {
7893
7914
  isSaveCardChecked: saveCardInfo,
7894
7915
  name: cardData == null ? void 0 : cardData.cardName,
7895
7916
  postal_code: cardData == null ? void 0 : cardData.zipCode,
7896
7917
  customer_id: props == null ? void 0 : props.customerId,
7897
- partial_amount: partialAmount && !partialError ? partialAmount : aftertaxAmount,
7918
+ partial_amount: partialAmount && !partialError ? partialAmount : cardTotal,
7898
7919
  card_issue_type
7899
7920
  }));
7900
7921
  const reqData2 = JSON.stringify({
@@ -7935,7 +7956,7 @@ function PartialPayment(props) {
7935
7956
  }
7936
7957
  } catch (err) {
7937
7958
  setLoading2(false);
7938
- 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.");
7939
7960
  }
7940
7961
  } else {
7941
7962
  try {
@@ -7952,7 +7973,7 @@ function PartialPayment(props) {
7952
7973
  }
7953
7974
  } catch (err) {
7954
7975
  setLoading2(false);
7955
- 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.");
7956
7977
  }
7957
7978
  }
7958
7979
  }
@@ -8006,7 +8027,7 @@ function PartialPayment(props) {
8006
8027
  }
8007
8028
  };
8008
8029
  const getPaymentDetails = async () => {
8009
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2, _q2, _r2, _s2, _t2, _u2, _v2, _w2;
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;
8010
8031
  showLoader();
8011
8032
  try {
8012
8033
  const data = {
@@ -8021,11 +8042,13 @@ function PartialPayment(props) {
8021
8042
  handleClose();
8022
8043
  setError("Something went wrong.");
8023
8044
  }
8045
+ let willShowCardForm = true;
8024
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) {
8025
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");
8026
- 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");
8027
8049
  if ((cardlists == null ? void 0 : cardlists.length) > 0) {
8028
8050
  setActiveinCard("list");
8051
+ willShowCardForm = false;
8029
8052
  }
8030
8053
  if ((banklists == null ? void 0 : banklists.length) > 0) {
8031
8054
  setActiveinBank("list");
@@ -8035,14 +8058,17 @@ function PartialPayment(props) {
8035
8058
  } else {
8036
8059
  setActive("card");
8037
8060
  }
8038
- 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) {
8039
- 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]);
8063
+ }
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)) {
8065
+ setLoadingIframe(true);
8040
8066
  }
8041
8067
  hideLoader();
8042
8068
  } catch (err) {
8043
8069
  console.log(err);
8044
8070
  hideLoader();
8045
- setError(((_w2 = (_v2 = err == null ? void 0 : err.response) == null ? void 0 : _v2.data) == null ? void 0 : _w2.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");
8046
8072
  }
8047
8073
  };
8048
8074
  const handlechargeCustomer = async (e) => {
@@ -8070,7 +8096,7 @@ function PartialPayment(props) {
8070
8096
  } else if (card_type === "Bank") {
8071
8097
  amount2 = cashDiscount;
8072
8098
  } else {
8073
- amount2 = aftertaxAmount;
8099
+ amount2 = cardTotal;
8074
8100
  }
8075
8101
  let chargeobj = {
8076
8102
  amount: amount2,
@@ -8096,8 +8122,9 @@ function PartialPayment(props) {
8096
8122
  "Content-Type": "application/json"
8097
8123
  };
8098
8124
  setLoading2(true);
8099
- if (card_issue_type == "Debit" && (props == null ? void 0 : props.pass_fee) && (paymentData == null ? void 0 : paymentData.surchargeProgram) == 1) {
8100
- 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`);
8101
8128
  }
8102
8129
  socketClient_default.emit("sendMessage", { url: chargeurl, body: card_type == "Bank" ? rest : chargeobj, isChargebycard: true });
8103
8130
  socketClient_default.on("charge-by-card", (response) => {
@@ -8160,13 +8187,6 @@ function PartialPayment(props) {
8160
8187
  setError("Something went wrong.");
8161
8188
  }
8162
8189
  };
8163
- const handlepayment = (e) => {
8164
- if (activeList === "card") {
8165
- handlechargeCustomer(e);
8166
- } else if (activeList === "reader") {
8167
- handleChargewithEMV(e);
8168
- }
8169
- };
8170
8190
  useEffect12(() => {
8171
8191
  if (show && fractalpayClientKey) {
8172
8192
  getPaymentDetails();
@@ -8206,7 +8226,6 @@ function PartialPayment(props) {
8206
8226
  confirmButtonText: "OK",
8207
8227
  showConfirmButton: true,
8208
8228
  timer: 1e3,
8209
- // auto-close after 1 second
8210
8229
  timerProgressBar: true,
8211
8230
  customClass: {
8212
8231
  confirmButton: "btn btn-dark"
@@ -8260,11 +8279,6 @@ function PartialPayment(props) {
8260
8279
  return card;
8261
8280
  }
8262
8281
  };
8263
- const getCashDiscount = () => {
8264
- let cashDiscountNew = cashDiscount || 0;
8265
- let diff = Number(aftertaxAmount) - cashDiscountNew;
8266
- return diff.toFixed(0);
8267
- };
8268
8282
  const handlePartialChange = (values) => {
8269
8283
  var _a2, _b2, _c2, _d2;
8270
8284
  if (activetab === "ach") {
@@ -8276,9 +8290,9 @@ function PartialPayment(props) {
8276
8290
  setPartialError("");
8277
8291
  }
8278
8292
  } else {
8279
- 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) {
8280
8294
  setPartialAmount(values == null ? void 0 : values.value);
8281
- 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))}`);
8282
8296
  } else {
8283
8297
  setPartialAmount(values == null ? void 0 : values.value);
8284
8298
  setPartialError("");
@@ -8286,556 +8300,375 @@ function PartialPayment(props) {
8286
8300
  }
8287
8301
  };
8288
8302
  useEffect12(() => {
8289
- const baseAmount = activetab === "ach" ? Number(cashDiscount) : Number(aftertaxAmount);
8303
+ const baseAmount2 = activetab === "ach" ? Number(cashDiscount) : Number(cardTotal);
8290
8304
  const partial = Number(partialAmount);
8291
8305
  if (partialAmount) {
8292
- if (partial <= 0 || partial > baseAmount) {
8293
- 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))}`);
8294
8308
  } else {
8295
8309
  setPartialError("");
8296
8310
  }
8297
8311
  } else {
8298
8312
  setPartialError("");
8299
8313
  }
8300
- }, [activetab, partialAmount, cashDiscount, aftertaxAmount]);
8314
+ }, [activetab, partialAmount, cashDiscount, cardTotal]);
8301
8315
  useEffect12(() => {
8302
8316
  if (typeof FractalTokenizer === "undefined") return;
8303
8317
  const tokenizer = new FractalTokenizer({
8304
8318
  styles: {}
8305
8319
  });
8306
8320
  }, []);
8307
- return /* @__PURE__ */ jsxs16(Fragment16, { children: [
8308
- /* @__PURE__ */ jsx29(DataScript, {}),
8309
- /* @__PURE__ */ jsx29(Chargewidgetstyles, {}),
8310
- /* @__PURE__ */ jsx29(CardBankRadioStyles, {}),
8311
- (paymentData == null ? void 0 : paymentData.paymentGateway) === 32 && /* @__PURE__ */ jsx29(FractalTokenizerScript, { onLoad: () => setTokenizerReady(true) }),
8312
- (paymentData == null ? void 0 : paymentData.paymentGateway) === 31 && /* @__PURE__ */ jsx29(
8313
- DataCapScriptLoader,
8314
- {
8315
- onReady: () => {
8316
- console.log("SDK Ready");
8317
- },
8318
- onError: (err) => {
8319
- setLoading(false);
8320
- setLoadingIframe(false);
8321
- setError(DcLoadingError);
8322
- }
8323
- }
8324
- ),
8325
- /* @__PURE__ */ jsxs16(Fragment16, { children: [
8326
- /* @__PURE__ */ jsx29("button", { ref: buttonRef, style: { display: "none" }, className: "paymentBtn", onClick: handleShow, children: "Pay" }),
8327
- /* @__PURE__ */ jsxs16(
8328
- CustomModal2_default,
8329
- {
8330
- open: show,
8331
- onClose: handleClose,
8332
- children: [
8333
- error && /* @__PURE__ */ jsx29("div", { style: { maxHeight: "606px", minHeight: "60vh", padding: "40px" }, children: /* @__PURE__ */ jsx29(ErrorCardMessage_default, { error, onClose: handleClose }) }),
8334
- errorIframe && /* @__PURE__ */ jsx29("div", { style: { maxHeight: "606px", minHeight: "60vh", padding: "40px" }, children: /* @__PURE__ */ jsx29(ErrorCardMessage_default, { error: errorIframe, onClose: () => {
8335
- setErrorIframe("");
8336
- } }) }),
8337
- success && /* @__PURE__ */ jsx29(SuccessMsz, { onClose: handleClose, tranId, isDebitAdjusted }),
8338
- !error && !success && !errorIframe && /* @__PURE__ */ jsxs16(Fragment16, { children: [
8339
- (loading || loading2 || loadingIframe) && /* @__PURE__ */ jsx29(Loader_default, { loading: loading || loading2 || loadingIframe, loaderText }),
8340
- /* @__PURE__ */ jsx29("div", { className: "frac-card-payment-page frac-form", children: /* @__PURE__ */ jsxs16("div", { className: "parent-pay-container", children: [
8341
- /* @__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: [
8342
- /* @__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" }) }),
8343
- /* @__PURE__ */ jsx29("defs", { children: /* @__PURE__ */ jsx29("clipPath", { id: "clip0_12425_52336", children: /* @__PURE__ */ jsx29("rect", { width: "16", height: "16", fill: "white" }) }) })
8344
- ] }) }),
8345
- /* @__PURE__ */ jsx29("div", { className: "pay-main-logo-res", children: /* @__PURE__ */ jsx29("img", { src: paymentData == null ? void 0 : paymentData.logo, id: "pay-logos" }) }),
8346
- /* @__PURE__ */ jsxs16("div", { className: "pay-container", children: [
8347
- /* @__PURE__ */ jsxs16("div", { className: "pay-header pay-conatiner-one frac-pay-conatiner-one", children: [
8348
- /* @__PURE__ */ jsxs16("div", { className: "pay-conatiner-one-first", children: [
8349
- /* @__PURE__ */ jsxs16("div", { className: "pay-logo-container", children: [
8350
- /* @__PURE__ */ jsx29("div", { className: "pay-main-logo", children: /* @__PURE__ */ jsx29("img", { src: paymentData == null ? void 0 : paymentData.logo, id: "pay-logos" }) }),
8351
- (cardList == null ? void 0 : cardList.length) > 0 && activetab !== "cardList" && /* @__PURE__ */ jsxs16("button", { className: "res-charge-payment-back-btn ", onClick: () => setActive("cardList"), children: [
8352
- " ",
8353
- /* @__PURE__ */ jsx29(IoArrowBack, {}),
8354
- " Back"
8355
- ] })
8356
- ] }),
8357
- /* @__PURE__ */ jsxs16("div", { className: "amt-pay-con", children: [
8358
- /* @__PURE__ */ jsx29("div", { className: "pay-amount-conatiner", children: /* @__PURE__ */ jsx29("small", { className: "pay-payment-amount", children: "Select payment type" }) }),
8359
- /* @__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 }) }),
8360
- !loading && (activetab === "card" || activetab === "reader") && (props == null ? void 0 : props.pass_fee) && cashDiscount && cashDiscount > 0 && /* @__PURE__ */ jsxs16("div", { className: "frac-cash-discount-fee", children: [
8361
- /* @__PURE__ */ jsx29("small", { children: (paymentData == null ? void 0 : paymentData.surchargeProgram) == 1 ? "Surcharge" : (paymentData == null ? void 0 : paymentData.showSurcharge) ? "3% Card Fee" : "Cash Discount" }),
8362
- /* @__PURE__ */ jsx29("p", { children: formatUSD((Number(props.amount) - cashDiscount).toFixed(2)) })
8363
- ] }),
8364
- !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(
8365
- "div",
8366
- {
8367
- id: "surcharge-program-notice",
8368
- className: "surcharge-program-notice-text",
8369
- children: [
8370
- "A 3% processing surcharge is applied to all credit card transactions. Debit card payments are processed for",
8371
- " ",
8372
- /* @__PURE__ */ jsxs16("span", { className: "surcharge-program-notice-text-att", children: [
8373
- "$",
8374
- Number(cashDiscount).toLocaleString("en-US", {
8375
- minimumFractionDigits: 2,
8376
- maximumFractionDigits: 2
8377
- })
8378
- ] })
8379
- ]
8380
- }
8381
- ) }),
8382
- (props == null ? void 0 : props.allowPartial) && /* @__PURE__ */ jsxs16("div", { className: "frac-partial-payment-input", children: [
8383
- /* @__PURE__ */ jsx29("label", { htmlFor: "partialpayment", children: "Partial Payment" }),
8384
- /* @__PURE__ */ jsx29(
8385
- NumericFormat,
8386
- {
8387
- prefix: "$",
8388
- className: "form-control",
8389
- value: partialAmount,
8390
- onValueChange: (values) => {
8391
- handlePartialChange(values);
8392
- },
8393
- thousandSeparator: true,
8394
- placeholder: "Enter partial amount",
8395
- allowNegative: false,
8396
- allowLeadingZeros: false,
8397
- decimalScale: 2,
8398
- fixedDecimalScale: true
8399
- }
8400
- ),
8401
- partialError && /* @__PURE__ */ jsx29("span", { className: "error-span", children: partialError })
8402
- ] })
8403
- ] })
8404
- ] }),
8405
- /* @__PURE__ */ jsxs16("div", { className: "pay-conatiner-one-last", children: [
8406
- /* @__PURE__ */ jsx29("img", { src: secure2, alt: "" }),
8407
- /* @__PURE__ */ jsx29("img", { src: pov2, alt: "" }),
8408
- "Secure payments powered by Fractal"
8409
- ] })
8410
- ] }),
8411
- /* @__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: [
8412
- activetab !== "cardList" ? /* @__PURE__ */ jsxs16("div", { className: "frac-charge-payment-back-btn-wrap ", children: [
8413
- (cardList == null ? void 0 : cardList.length) > 0 && /* @__PURE__ */ jsxs16("button", { className: "charge-payment-back-btn ", onClick: () => setActive("cardList"), children: [
8414
- " ",
8415
- /* @__PURE__ */ jsx29(IoArrowBack, {}),
8416
- " Back"
8417
- ] }),
8418
- (paymentData == null ? void 0 : paymentData.isSkyFiAccount) && /* @__PURE__ */ jsxs16("div", { className: "tab", children: [
8419
- /* @__PURE__ */ jsxs16("button", { className: "tablinks", onClick: (e) => {
8420
- handletabchange("card");
8421
- }, style: { border: activetab === "card" ? "1px solid" : "" }, children: [
8422
- /* @__PURE__ */ jsx29("i", { className: "fas fa-credit-card me-2", style: { marginRight: "8px", fontSize: "15px" } }),
8423
- "Card"
8424
- ] }),
8425
- /* @__PURE__ */ jsxs16("button", { className: "tablinks", onClick: (e) => {
8426
- handletabchange("ach");
8427
- }, style: { border: activetab === "ach" ? "1px solid" : "" }, children: [
8428
- /* @__PURE__ */ jsx29("i", { className: "fas fa-university me-2", style: { marginRight: "8px", fontSize: "15px" } }),
8429
- "Bank"
8430
- ] })
8431
- ] }),
8432
- /* @__PURE__ */ jsxs16("div", { className: "res-pay-con", children: [
8433
- /* @__PURE__ */ jsxs16("div", { className: "pay-amount-conatiner", style: { margin: 0 }, children: [
8434
- /* @__PURE__ */ jsx29("small", { className: "pay-payment-amount", children: "Payment Amount" }),
8435
- /* @__PURE__ */ jsxs16("strong", { className: "pay-amount", children: [
8436
- "$",
8437
- (_b = Number(aftertaxAmount)) == null ? void 0 : _b.toFixed(2)
8438
- ] })
8439
- ] }),
8440
- activetab != "ach" && /* @__PURE__ */ jsxs16("div", { children: [
8441
- /* @__PURE__ */ jsxs16("div", { children: [
8442
- /* @__PURE__ */ jsx29("img", { src: visa2, alt: "", width: 35, style: { paddingRight: "5px" } }),
8443
- /* @__PURE__ */ jsx29("img", { src: mastercard2, width: 35, alt: "" })
8444
- ] }),
8445
- /* @__PURE__ */ jsxs16("div", { children: [
8446
- /* @__PURE__ */ jsx29("img", { src: americanexp2, alt: "", width: 35, style: { paddingRight: "5px" } }),
8447
- /* @__PURE__ */ jsx29("img", { src: discover2, width: 35, alt: "" })
8448
- ] })
8449
- ] })
8450
- ] }),
8451
- !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: [
8452
- /* @__PURE__ */ jsxs16("small", { children: [
8453
- activetab === "card" ? "Cash Discount" : "Cash Discount Savings",
8454
- " "
8455
- ] }),
8456
- /* @__PURE__ */ jsx29("p", { children: formatUSD((Number(aftertaxAmount) - cashDiscount).toFixed(2)) })
8457
- ] }) : null : cashDiscount && cashDiscount > 0 && (props == null ? void 0 : props.pass_fee) && activetab === "card" ? /* @__PURE__ */ jsxs16("div", { className: "frac-cash-discount-fee", children: [
8458
- /* @__PURE__ */ jsxs16("small", { children: [
8459
- activetab === "card" ? "Surcharge" : null,
8460
- " "
8461
- ] }),
8462
- /* @__PURE__ */ jsx29("p", { children: formatUSD((Number(aftertaxAmount) - cashDiscount).toFixed(2)) })
8463
- ] }) : null
8464
- ] }) : /* @__PURE__ */ jsxs16("div", { children: [
8465
- /* @__PURE__ */ jsxs16("h6", { className: "charge-customer-name", style: { marginBottom: "16px !important" }, children: [
8466
- " Charge ",
8467
- paymentData == null ? void 0 : paymentData.customer_name
8468
- ] }),
8469
- /* @__PURE__ */ jsxs16("h6", { className: "card-ach-heading", style: { marginBottom: "10px !important" }, children: [
8470
- " ",
8471
- activeList === "card" ? "Cards/Banks" : "Readers",
8472
- " "
8473
- ] }),
8474
- /* @__PURE__ */ jsxs16("div", { className: "res-pay-con", children: [
8475
- /* @__PURE__ */ jsxs16("div", { className: "pay-amount-conatiner", style: { margin: 0 }, children: [
8476
- /* @__PURE__ */ jsx29("small", { className: "pay-payment-amount", children: "Payment Amount" }),
8477
- /* @__PURE__ */ jsxs16("strong", { className: "pay-amount", children: [
8478
- "$",
8479
- (_c = Number(aftertaxAmount)) == null ? void 0 : _c.toFixed(2)
8480
- ] })
8481
- ] }),
8482
- /* @__PURE__ */ jsxs16("div", { children: [
8483
- /* @__PURE__ */ jsxs16("div", { children: [
8484
- /* @__PURE__ */ jsx29("img", { src: visa2, alt: "", width: 35, style: { paddingRight: "5px" } }),
8485
- /* @__PURE__ */ jsx29("img", { src: mastercard2, width: 35, alt: "" })
8486
- ] }),
8487
- /* @__PURE__ */ jsxs16("div", { children: [
8488
- /* @__PURE__ */ jsx29("img", { src: americanexp2, alt: "", width: 35, style: { paddingRight: "5px" } }),
8489
- /* @__PURE__ */ jsx29("img", { src: discover2, width: 35, alt: "" })
8490
- ] })
8491
- ] })
8492
- ] })
8493
- ] }),
8494
- /* @__PURE__ */ jsxs16("div", { id: "card", style: { display: activetab === "card" ? "block" : "none" }, className: "tabcontent", children: [
8495
- /* @__PURE__ */ jsxs16("div", { className: "frac-card-payment", children: [
8496
- /* @__PURE__ */ jsxs16("div", { className: "frac-heading-card-wrap", children: [
8497
- /* @__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: [
8498
- " ",
8499
- /* @__PURE__ */ jsx29(IoArrowBack, {})
8500
- ] }) }),
8501
- /* @__PURE__ */ jsx29("h6", { className: "frac-card-payment-heading", children: "Card Payment" })
8502
- ] }),
8503
- activetab != "ach" && /* @__PURE__ */ jsxs16("div", { style: { display: "flex", gap: "8px", margin: "8px 0px 19px 0px" }, children: [
8504
- /* @__PURE__ */ jsx29("img", { src: visa2, alt: "", width: 33 }),
8505
- /* @__PURE__ */ jsx29("img", { src: mastercard2, width: 33, alt: "" }),
8506
- /* @__PURE__ */ jsx29("img", { src: americanexp2, alt: "", width: 33 }),
8507
- /* @__PURE__ */ jsx29("img", { src: discover2, width: 33, alt: "" })
8508
- ] })
8509
- ] }),
8510
- activeinCard === "list" ? /* @__PURE__ */ jsxs16(Fragment16, { children: [
8511
- /* @__PURE__ */ jsx29(CardList, { listHeading: "Cards", paymentGateway: paymentData == null ? void 0 : paymentData.paymentGateway, ListItems: cardList, selectedCard, setSelectedCard, handleDeleteCard, otherButtonLabel: "Pay With Other Card", otherButtonAction: () => {
8512
- setActiveinCard("form");
8513
- } }),
8514
- /* @__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)) }) })
8515
- ] }) : (paymentData == null ? void 0 : paymentData.paymentGateway) === 32 ? /* @__PURE__ */ jsxs16(
8516
- "form",
8517
- {
8518
- id: "paymentForm",
8519
- onSubmit: submitFunc,
8520
- onKeyDown: (e) => {
8521
- if (e.key === "Enter" && loading2) {
8522
- e.preventDefault();
8523
- e.stopPropagation();
8524
- }
8525
- },
8526
- children: [
8527
- /* @__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: [
8528
- /* @__PURE__ */ jsxs16("div", { className: "form-group", children: [
8529
- /* @__PURE__ */ jsx29("label", { htmlFor: "cardHolderName", children: "NAME ON CARD " }),
8530
- /* @__PURE__ */ jsx29("input", { type: "text", className: "form-control", maxLength: 100, placeholder: "John Doe", value: (cardData == null ? void 0 : cardData.cardName) || "", onChange: (e) => {
8531
- const value = e.target.value;
8532
- if (/^[a-zA-Z\s]*$/.test(value)) {
8533
- handleCardChange("cardName", value);
8534
- }
8535
- } }),
8536
- (cardError == null ? void 0 : cardError.cardName) && /* @__PURE__ */ jsx29("span", { className: "error-span", children: cardError == null ? void 0 : cardError.cardName })
8537
- ] }),
8538
- /* @__PURE__ */ jsxs16("div", { className: "form-group", children: [
8539
- /* @__PURE__ */ jsx29("label", { children: "CARD NUMBER" }),
8540
- /* @__PURE__ */ jsx29("div", { className: "toggle-num-wrapper", children: show && (paymentData == null ? void 0 : paymentData.paymentGateway) === 32 && isTokenizerReady && /* @__PURE__ */ jsx29(
8541
- FractalFields_default,
8542
- {
8543
- fractalStyles,
8544
- tokenizerRef
8545
- }
8546
- ) })
8547
- ] }),
8548
- /* @__PURE__ */ jsxs16("div", { className: "form-group", children: [
8549
- /* @__PURE__ */ jsx29("label", { htmlFor: "OrderId", children: "Order ID / Description" }),
8550
- /* @__PURE__ */ jsx29(
8551
- "input",
8552
- {
8553
- type: "text",
8554
- className: "form-control",
8555
- maxLength: 100,
8556
- placeholder: "Order Id",
8557
- disabled: true,
8558
- value: (_f = props == null ? void 0 : props.orderID) != null ? _f : "",
8559
- style: { background: "#F6F6F7", color: "#727272" }
8560
- }
8561
- )
8562
- ] }),
8563
- /* @__PURE__ */ jsxs16("div", { className: "form-group", children: [
8564
- /* @__PURE__ */ jsx29("label", { htmlFor: "zip", children: "ZIP" }),
8565
- /* @__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) }),
8566
- (cardError == null ? void 0 : cardError.zipCode) && /* @__PURE__ */ jsx29("span", { className: "error-span", children: cardError == null ? void 0 : cardError.zipCode })
8567
- ] }),
8568
- (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: [
8569
- /* @__PURE__ */ jsx29(
8570
- "input",
8571
- {
8572
- type: "checkbox",
8573
- id: "save_card",
8574
- className: "toggle-checkbox",
8575
- checked: saveCardInfo,
8576
- onChange: (e) => setSaveCardInfo(e.target.checked)
8577
- }
8578
- ),
8579
- /* @__PURE__ */ jsx29("label", { htmlFor: "save_card", className: "toggle-label" }),
8580
- /* @__PURE__ */ jsx29("label", { htmlFor: "save_card", children: "Save card for future payments " }),
8581
- /* @__PURE__ */ jsxs16("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: [
8582
- /* @__PURE__ */ jsxs16("g", { clipPath: "url(#clip0_12420_50192)", children: [
8583
- /* @__PURE__ */ jsx29("rect", { width: "20", height: "20", fill: "white" }),
8584
- /* @__PURE__ */ jsx29("circle", { cx: "10", cy: "10", r: "10", fill: "#E0DFE2" }),
8585
- /* @__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" })
8586
- ] }),
8587
- /* @__PURE__ */ jsx29("defs", { children: /* @__PURE__ */ jsx29("clipPath", { id: "clip0_12420_50192", children: /* @__PURE__ */ jsx29("rect", { width: "20", height: "20", fill: "white" }) }) })
8588
- ] })
8589
- ] }) })
8590
- ] }),
8591
- /* @__PURE__ */ jsxs16("div", { className: "form-group", style: { marginTop: "20px", padding: "0" }, children: [
8592
- (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" }),
8593
- /* @__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)) })
8594
- ] })
8595
- ]
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(
8433
+ DataCapScriptLoader,
8434
+ {
8435
+ onReady: () => {
8436
+ console.log("SDK Ready");
8437
+ },
8438
+ onError: (err) => {
8439
+ setLoading(false);
8440
+ setLoadingIframe(false);
8441
+ setError(DcLoadingError);
8442
+ }
8443
+ }
8444
+ ),
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(
8451
+ CustomModal2_default,
8452
+ {
8453
+ open: show,
8454
+ onClose: handleClose,
8455
+ maxWidth: "760px",
8456
+ children: [
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: () => {
8459
+ setErrorIframe("");
8460
+ } }) }),
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;
8478
+ }
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,
8512
+ {
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
8596
8518
  }
8597
- ) : /* @__PURE__ */ jsxs16("form", { id: "PaymentForm", style: { textAlign: "start" }, onSubmit: submitFunc, onKeyDown: (e) => {
8598
- if (e.key === "Enter" && loading2) {
8599
- e.preventDefault();
8600
- 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}`
8601
8527
  }
8602
- }, children: [
8603
- /* @__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: [
8604
- /* @__PURE__ */ jsxs16("div", { className: "form-group", children: [
8605
- /* @__PURE__ */ jsx29("label", { htmlFor: "cardHolderName", children: "NAME ON CARD " }),
8606
- /* @__PURE__ */ jsx29("input", { type: "text", className: "form-control", maxLength: 100, placeholder: "John Doe", value: (cardData == null ? void 0 : cardData.cardName) || "", onChange: (e) => {
8607
- const value = e.target.value;
8608
- if (/^[a-zA-Z\s]*$/.test(value)) {
8609
- handleCardChange("cardName", value);
8610
- }
8611
- } }),
8612
- (cardError == null ? void 0 : cardError.cardName) && /* @__PURE__ */ jsx29("span", { className: "error-span", children: cardError == null ? void 0 : cardError.cardName })
8613
- ] }),
8614
- /* @__PURE__ */ jsx29("div", { className: "form-group", children: /* @__PURE__ */ jsx29(
8615
- DataCapFields,
8616
- {
8617
- isOpen: show,
8618
- tokenKey: paymentData == null ? void 0 : paymentData.dctoken,
8619
- setLoader: setLoadingIframe
8620
- }
8621
- ) }),
8622
- /* @__PURE__ */ jsxs16("div", { className: "form-group", children: [
8623
- /* @__PURE__ */ jsx29("label", { htmlFor: "OrderId", children: "Order ID / Description" }),
8624
- /* @__PURE__ */ jsx29(
8625
- "input",
8626
- {
8627
- type: "text",
8628
- className: "form-control",
8629
- maxLength: 100,
8630
- placeholder: "Order Id",
8631
- disabled: true,
8632
- value: (_k = props == null ? void 0 : props.orderID) != null ? _k : "",
8633
- style: { background: "#F6F6F7", color: "#727272" }
8634
- }
8635
- )
8636
- ] }),
8637
- /* @__PURE__ */ jsxs16("div", { className: "form-group", children: [
8638
- /* @__PURE__ */ jsx29("label", { htmlFor: "zip", children: "ZIP" }),
8639
- /* @__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) }),
8640
- (cardError == null ? void 0 : cardError.zipCode) && /* @__PURE__ */ jsx29("span", { className: "error-span", children: cardError == null ? void 0 : cardError.zipCode })
8641
- ] }),
8642
- (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: [
8643
- /* @__PURE__ */ jsx29(
8644
- "input",
8645
- {
8646
- type: "checkbox",
8647
- id: "save_card",
8648
- className: "toggle-checkbox",
8649
- checked: saveCardInfo,
8650
- 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("");
8651
8563
  }
8652
- ),
8653
- /* @__PURE__ */ jsx29("label", { htmlFor: "save_card", className: "toggle-label" }),
8654
- /* @__PURE__ */ jsx29("label", { htmlFor: "save_card", children: "Save card for future payments " }),
8655
- /* @__PURE__ */ jsxs16("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: [
8656
- /* @__PURE__ */ jsxs16("g", { clipPath: "url(#clip0_12420_50192)", children: [
8657
- /* @__PURE__ */ jsx29("rect", { width: "20", height: "20", fill: "white" }),
8658
- /* @__PURE__ */ jsx29("circle", { cx: "10", cy: "10", r: "10", fill: "#E0DFE2" }),
8659
- /* @__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."
8579
+ ] }),
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."
8660
8590
  ] }),
8661
- /* @__PURE__ */ jsx29("defs", { children: /* @__PURE__ */ jsx29("clipPath", { id: "clip0_12420_50192", children: /* @__PURE__ */ jsx29("rect", { width: "20", height: "20", fill: "white" }) }) })
8591
+ errorBankConsent && /* @__PURE__ */ jsx27("span", { className: "fps-error", children: errorBankConsent })
8662
8592
  ] })
8663
- ] }) })
8664
- ] }),
8665
- /* @__PURE__ */ jsxs16("div", { className: "form-group", style: { marginTop: "20px", padding: "0" }, children: [
8666
- (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" }),
8667
- /* @__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)) })
8668
- ] })
8669
- ] })
8670
- ] }),
8671
- /* @__PURE__ */ jsxs16("div", { id: "ach", style: { display: activetab === "ach" ? "block" : "none" }, className: "tabcontent", children: [
8672
- /* @__PURE__ */ jsx29("div", { className: "frac-card-payment", children: /* @__PURE__ */ jsxs16("div", { className: "frac-heading-card-wrap", children: [
8673
- /* @__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: [
8674
- " ",
8675
- /* @__PURE__ */ jsx29(IoArrowBack, {})
8676
- ] }) }),
8677
- /* @__PURE__ */ jsx29("h6", { className: "frac-card-payment-heading", children: "Bank Payment" })
8678
- ] }) }),
8679
- activeinBank === "list" ? /* @__PURE__ */ jsxs16(Fragment16, { children: [
8680
- /* @__PURE__ */ jsx29(CardList, { listHeading: "Banks", paymentGateway: paymentData == null ? void 0 : paymentData.paymentGateway, ListItems: bankList, selectedCard, setSelectedCard, handleDeleteCard, otherButtonLabel: "Pay With Other Bank", otherButtonAction: () => {
8681
- setActiveinBank("form");
8682
- } }),
8683
- /* @__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)) }) })
8684
- ] }) : /* @__PURE__ */ jsxs16("form", { id: "ACHPaymentForm", style: { textAlign: "start" }, onSubmit: submitFunc, autoComplete: "off", onKeyDown: (e) => {
8685
- if (e.key === "Enter" && loading2) {
8686
- e.preventDefault();
8687
- e.stopPropagation();
8688
- }
8689
- }, children: [
8690
- /* @__PURE__ */ jsxs16("div", { className: "ach-scrl", style: {
8691
- 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",
8692
- maxHeight: (paymentData == null ? void 0 : paymentData.isSkyFiAccount) && (cardList == null ? void 0 : cardList.length) > 0 ? "444px" : (cardList == null ? void 0 : cardList.length) > 0 ? "380px" : "380px"
8693
- }, children: [
8694
- /* @__PURE__ */ jsxs16("div", { className: "form-group mb-4", children: [
8695
- /* @__PURE__ */ jsx29("label", { htmlFor: "nameonaccount", children: "Name on account" }),
8696
- /* @__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 }),
8697
- (achError == null ? void 0 : achError.name) && /* @__PURE__ */ jsx29("span", { className: "error-span", children: achError == null ? void 0 : achError.name })
8698
- ] }),
8699
- /* @__PURE__ */ jsxs16("div", { className: "form-group mb-4", children: [
8700
- /* @__PURE__ */ jsx29("label", { htmlFor: "routingnumber", children: "Routing number" }),
8701
- /* @__PURE__ */ jsx29(
8702
- "input",
8703
- {
8704
- type: "text",
8705
- id: "routingnumber",
8706
- className: "form-control",
8707
- maxLength: 9,
8708
- placeholder: "000000000",
8709
- name: "routingNumber",
8710
- value: (_s = achData == null ? void 0 : achData.routingNumber) != null ? _s : "",
8711
- onChange: handleChangeAch
8712
- }
8713
- ),
8714
- (achError == null ? void 0 : achError.routingNumber) && /* @__PURE__ */ jsx29("span", { className: "error-span", children: achError == null ? void 0 : achError.routingNumber })
8715
- ] }),
8716
- /* @__PURE__ */ jsxs16("div", { className: "form-group mb-4", children: [
8717
- /* @__PURE__ */ jsx29("label", { htmlFor: "accountnumber", children: "Account number" }),
8718
- /* @__PURE__ */ jsx29(
8719
- "input",
8720
- {
8721
- type: "text",
8722
- id: "accountnumber",
8723
- className: "form-control",
8724
- maxLength: 16,
8725
- placeholder: "0000000000",
8726
- name: "accountNumber",
8727
- value: (_t = achData == null ? void 0 : achData.accountNumber) != null ? _t : "",
8728
- onChange: handleChangeAch
8729
- }
8730
- ),
8731
- (achError == null ? void 0 : achError.accountNumber) && /* @__PURE__ */ jsx29("span", { className: "error-span", children: achError == null ? void 0 : achError.accountNumber })
8732
8593
  ] }),
8733
- /* @__PURE__ */ jsxs16("div", { className: "form-group mb-4", children: [
8734
- /* @__PURE__ */ jsx29("label", { htmlFor: "confirmaccountnumber", children: "Confirm account number" }),
8735
- /* @__PURE__ */ jsx29(
8736
- "input",
8737
- {
8738
- type: "text",
8739
- id: "confirmaccountnumber",
8740
- className: "form-control",
8741
- maxLength: 16,
8742
- placeholder: "0000000000",
8743
- name: "confirmAccountNumber",
8744
- value: (_u = achData == null ? void 0 : achData.confirmAccountNumber) != null ? _u : "",
8745
- onChange: handleChangeAch
8746
- }
8747
- ),
8748
- (achError == null ? void 0 : achError.confirmAccountNumber) && /* @__PURE__ */ jsx29("span", { className: "error-span", children: achError == null ? void 0 : achError.confirmAccountNumber })
8749
- ] }),
8750
- /* @__PURE__ */ jsxs16("div", { className: "form-group mb-4", children: [
8751
- /* @__PURE__ */ jsx29("label", { htmlFor: "bankname", children: "Bank name" }),
8752
- /* @__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(
8753
8624
  "input",
8754
8625
  {
8755
- type: "text",
8756
- id: "bankname",
8757
- className: "form-control",
8626
+ id: "cardHolderName",
8627
+ className: "fps-input",
8758
8628
  maxLength: 100,
8759
- placeholder: "My Bank",
8760
- name: "bankName",
8761
- value: (_v = achData == null ? void 0 : achData.bankName) != null ? _v : "",
8762
- 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
+ }
8763
8635
  }
8764
- ),
8765
- (achError == null ? void 0 : achError.bankName) && /* @__PURE__ */ jsx29("span", { className: "error-span", children: achError == null ? void 0 : achError.bankName })
8766
- ] }),
8767
- ((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: [
8768
- /* @__PURE__ */ jsx29("label", { htmlFor: "companyName", children: "Company name" }),
8769
- /* @__PURE__ */ jsx29(
8770
- "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,
8771
8639
  {
8772
- type: "text",
8773
- id: "companyName",
8774
- className: "form-control",
8775
- maxLength: 100,
8776
- placeholder: "My Company",
8777
- name: "companyName",
8778
- value: (_w = achData == null ? void 0 : achData.companyName) != null ? _w : "",
8779
- 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
8780
8646
  }
8781
- ),
8782
- (achError == null ? void 0 : achError.companyName) && /* @__PURE__ */ jsx29("span", { className: "error-span", children: achError == null ? void 0 : achError.companyName })
8783
- ] }),
8784
- /* @__PURE__ */ jsxs16("div", { className: "form-group mb-4", children: [
8785
- /* @__PURE__ */ jsx29("label", { htmlFor: "accounttype", children: "Select account type" }),
8786
- /* @__PURE__ */ jsxs16("select", { name: "accountType", id: "accounttype", className: "form-control", value: (_x = achData == null ? void 0 : achData.accountType) != null ? _x : "", onChange: handleChangeAch, children: [
8787
- /* @__PURE__ */ jsx29("option", { value: "", children: "Select account" }),
8788
- 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
+ "."
8789
8655
  ] })
8790
8656
  ] }),
8791
- !saveACHinfo && /* @__PURE__ */ jsxs16(Fragment16, { children: [
8792
- /* @__PURE__ */ jsxs16("div", { className: "form-group mb-4 save-ach-div", style: { paddingTop: "5px" }, children: [
8793
- /* @__PURE__ */ jsx29(
8794
- "input",
8795
- {
8796
- type: "checkbox",
8797
- id: "achconsent",
8798
- className: "",
8799
- checked: isBankConsentChecked,
8800
- onChange: (e) => {
8801
- setIsBankConsentChecked(e.target.checked);
8802
- if (e.target.checked) {
8803
- setErrorBankConsent("");
8804
- }
8805
- }
8806
- }
8807
- ),
8808
- /* @__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.` })
8809
- ] }),
8810
- errorBankConsent && /* @__PURE__ */ jsx29("span", { className: "error-span", children: errorBankConsent })
8811
- ] }),
8812
- (props == null ? void 0 : props.customerId) && /* @__PURE__ */ jsxs16("div", { className: "form-group mb-4 save-ach-div", style: { paddingTop: "5px" }, children: [
8813
- /* @__PURE__ */ jsx29("input", { type: "checkbox", id: "saveACH", className: "", maxLength: 100, placeholder: "My Bank", checked: saveACHinfo, onChange: (e) => setSaveACHinfo(e.target.checked) }),
8814
- /* @__PURE__ */ jsx29("label", { htmlFor: "saveACH", children: "Save for future use" })
8815
- ] }),
8816
- saveACHinfo && /* @__PURE__ */ jsxs16(Fragment16, { children: [
8817
- /* @__PURE__ */ jsxs16("div", { className: "form-group-frac save-ach-div", style: { paddingTop: "5px" }, children: [
8818
- /* @__PURE__ */ jsx29("input", { type: "checkbox", id: "saveACHConsent1", className: "", maxLength: 100, placeholder: "My Bank", checked: saveACHConsent1, onChange: (e) => {
8819
- setSaveACHConsent1(e.target.checked);
8820
- if (e.target.checked) {
8821
- setErrorBankConsentOther("");
8822
- }
8823
- } }),
8824
- /* @__PURE__ */ jsxs16("label", { className: "saveachlabel", htmlFor: "saveACHConsent1", children: [
8825
- "By providing my bank account information and selecting \u2018Save for future payments\u2019, I authorize ",
8826
- (paymentData == null ? void 0 : paymentData.bname) || "merchant",
8827
- " 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."
8828
- ] })
8829
- ] }),
8830
- errorBankConsentOther && /* @__PURE__ */ jsx29("span", { className: "error-span", children: errorBankConsentOther })
8831
- ] })
8832
- ] }),
8833
- /* @__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)) }) })
8834
- ] })
8835
- ] })
8836
- ] }) }) })
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
+ )
8837
8670
  ] })
8838
- ] }) })
8671
+ ] })
8839
8672
  ] })
8840
8673
  ]
8841
8674
  }
@@ -8848,13 +8681,13 @@ function PartialPayment(props) {
8848
8681
  import { useEffect as useEffect16, useState as useState10, useMemo } from "react";
8849
8682
 
8850
8683
  // src/app/components/Skysystemz/SkyChargewidgetstyles.tsx
8851
- import { jsx as jsx30 } from "react/jsx-runtime";
8684
+ import { jsx as jsx28 } from "react/jsx-runtime";
8852
8685
  function SkyChargewidgetstyles() {
8853
8686
  const primarycolor = "#000";
8854
8687
  const primarybgcolor = "#fff";
8855
8688
  const primarybodycolor = "#212529";
8856
8689
  const primarybordercolor = "#dee2e6";
8857
- return /* @__PURE__ */ jsx30("style", { children: `
8690
+ return /* @__PURE__ */ jsx28("style", { children: `
8858
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');
8859
8692
  body
8860
8693
  {
@@ -9740,6 +9573,44 @@ function ThreeDSChallenge({
9740
9573
  return null;
9741
9574
  }
9742
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
+
9743
9614
  // src/app/components/Atoms/ThreedsCheckout/ThreedsCheckout.tsx
9744
9615
  import { Elements } from "@stripe/react-stripe-js";
9745
9616
  import { loadStripe } from "@stripe/stripe-js";
@@ -9748,7 +9619,7 @@ import { loadStripe } from "@stripe/stripe-js";
9748
9619
  import { PaymentElement, useElements, useStripe } from "@stripe/react-stripe-js";
9749
9620
  import axios7 from "axios";
9750
9621
  import { useState as useState8 } from "react";
9751
- import { jsx as jsx31, jsxs as jsxs17 } from "react/jsx-runtime";
9622
+ import { jsx as jsx30, jsxs as jsxs16 } from "react/jsx-runtime";
9752
9623
  var CheckoutForm = ({ onSuccess, showLoader, setError, session_token, callback, hideLoader, handleClose, amount, isPreAuth }) => {
9753
9624
  var _a;
9754
9625
  const stripe = useStripe();
@@ -9813,24 +9684,76 @@ var CheckoutForm = ({ onSuccess, showLoader, setError, session_token, callback,
9813
9684
  hideLoader();
9814
9685
  }
9815
9686
  };
9816
- return /* @__PURE__ */ jsxs17("form", { onSubmit: handleSubmit, children: [
9817
- /* @__PURE__ */ jsx31(PaymentElement, {}),
9818
- /* @__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))}` })
9819
9690
  ] });
9820
9691
  };
9821
9692
 
9822
9693
  // src/app/components/Atoms/ThreedsCheckout/ThreedsCheckout.tsx
9823
- import { jsx as jsx32 } from "react/jsx-runtime";
9694
+ import { jsx as jsx31 } from "react/jsx-runtime";
9824
9695
  var stripePromise = loadStripe(
9825
9696
  threedsSecurePublicKey
9826
9697
  );
9827
9698
  function CheckoutWrapper({ clientSecret, onSuccess, showLoader, setError, session_token, callback, hideLoader, handleClose, amount, isPreAuth }) {
9828
9699
  if (!clientSecret) return null;
9829
- 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 }) });
9830
9701
  }
9831
9702
 
9832
9703
  // src/app/components/Atoms/ModelContentSky/ModelContentSky.tsx
9833
- 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
9834
9757
  import { NumericFormat as NumericFormat2 } from "react-number-format";
9835
9758
 
9836
9759
  // src/app/components/ErrorCardMessage/ErrorCardOverlaystyle.tsx
@@ -10166,6 +10089,10 @@ var ModelContentSky = ({ amount, bankAmount, submitBtnText = "Pay", session_toke
10166
10089
  const [errorBankConsent, setErrorBankConsent] = useState9("");
10167
10090
  const [errorBankConsentOther, setErrorBankConsentOther] = useState9("");
10168
10091
  const [isTokenizerReady, setTokenizerReady] = useState9(false);
10092
+ console.log(loadingIframe, "loadingIframe");
10093
+ console.log(loading, "loader");
10094
+ console.log(loading2, "loading2");
10095
+ console.log(loadingPrev, "loadingPrev");
10169
10096
  let mastercard2 = S3Url + "widget/mc-img.svg";
10170
10097
  let visa2 = S3Url + "widget/visa-img.svg";
10171
10098
  let americanexp2 = S3Url + "widget/ae-img.svg";
@@ -10374,6 +10301,7 @@ var ModelContentSky = ({ amount, bankAmount, submitBtnText = "Pay", session_toke
10374
10301
  };
10375
10302
  const completeFractalFlow = async (tokenizeData, intentid, typeoftoken) => {
10376
10303
  var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
10304
+ showLoader();
10377
10305
  try {
10378
10306
  console.log({
10379
10307
  tokenizeData,
@@ -10999,7 +10927,7 @@ var ModelContentSky = ({ amount, bankAmount, submitBtnText = "Pay", session_toke
10999
10927
  }
11000
10928
  };
11001
10929
  const getPaymentDetails = async () => {
11002
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2, _q2;
10930
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2, _q2, _r2, _s2, _t2, _u2;
11003
10931
  try {
11004
10932
  showLoader();
11005
10933
  const res = await axios8.get(`${masterBaseUrl}api/v1/gateway/get-payment-details/${session_token}`, {
@@ -11013,16 +10941,19 @@ var ModelContentSky = ({ amount, bankAmount, submitBtnText = "Pay", session_toke
11013
10941
  setProcessingFee(Number((_d2 = (_c2 = res == null ? void 0 : res.data) == null ? void 0 : _c2.data) == null ? void 0 : _d2.fee) || 0);
11014
10942
  setPaymentGateway((_f2 = (_e2 = res == null ? void 0 : res.data) == null ? void 0 : _e2.data) == null ? void 0 : _f2.paymentGateway);
11015
10943
  setDCToken((_h2 = (_g2 = res == null ? void 0 : res.data) == null ? void 0 : _g2.data) == null ? void 0 : _h2.dctoken);
10944
+ if (((_j2 = (_i2 = res == null ? void 0 : res.data) == null ? void 0 : _i2.data) == null ? void 0 : _j2.paymentGateway) === 31 && ((_l2 = (_k2 = res == null ? void 0 : res.data) == null ? void 0 : _k2.data) == null ? void 0 : _l2.dctoken)) {
10945
+ setLoadingIframe(true);
10946
+ }
11016
10947
  hideLoader();
11017
10948
  }
11018
10949
  } catch (error2) {
11019
- console.log((_j2 = (_i2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _i2.data) == null ? void 0 : _j2.result, "error while getting payment details");
10950
+ console.log((_n2 = (_m2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _m2.data) == null ? void 0 : _n2.result, "error while getting payment details");
11020
10951
  callback({
11021
- error: ((_l2 = (_k2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _k2.data) == null ? void 0 : _l2.message) || "Something went wrong!",
11022
- result: (_n2 = (_m2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _m2.data) == null ? void 0 : _n2.result,
11023
- statusCode: (_o2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _o2.status
10952
+ error: ((_p2 = (_o2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _o2.data) == null ? void 0 : _p2.message) || "Something went wrong!",
10953
+ result: (_r2 = (_q2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _q2.data) == null ? void 0 : _r2.result,
10954
+ statusCode: (_s2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _s2.status
11024
10955
  });
11025
- setError(((_q2 = (_p2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _p2.data) == null ? void 0 : _q2.message) || (error2 == null ? void 0 : error2.message) || "Something went wrong");
10956
+ setError(((_u2 = (_t2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _t2.data) == null ? void 0 : _u2.message) || (error2 == null ? void 0 : error2.message) || "Something went wrong");
11026
10957
  hideLoader();
11027
10958
  }
11028
10959
  };
@@ -11273,7 +11204,7 @@ var ModelContentSky = ({ amount, bankAmount, submitBtnText = "Pay", session_toke
11273
11204
  /* @__PURE__ */ jsx36("h1", { className: "pay-heading", children: "Pay" }),
11274
11205
  (cardList == null ? void 0 : cardList.length) > 0 && activetab !== "cardList" && /* @__PURE__ */ jsxs19("button", { className: "res-charge-payment-back-btn ", onClick: () => setActive("cardList"), children: [
11275
11206
  " ",
11276
- /* @__PURE__ */ jsx36(IoArrowBack2, {}),
11207
+ /* @__PURE__ */ jsx36(IoArrowBack, {}),
11277
11208
  " Back"
11278
11209
  ] })
11279
11210
  ] }),
@@ -11353,7 +11284,7 @@ var ModelContentSky = ({ amount, bankAmount, submitBtnText = "Pay", session_toke
11353
11284
  /* @__PURE__ */ jsxs19("div", { className: "frac-heading-card-wrap", children: [
11354
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: [
11355
11286
  " ",
11356
- /* @__PURE__ */ jsx36(IoArrowBack2, {})
11287
+ /* @__PURE__ */ jsx36(IoArrowBack, {})
11357
11288
  ] }) }),
11358
11289
  /* @__PURE__ */ jsx36("h6", { className: "frac-card-payment-heading", children: "Card Payment" })
11359
11290
  ] }),
@@ -11489,7 +11420,8 @@ var ModelContentSky = ({ amount, bankAmount, submitBtnText = "Pay", session_toke
11489
11420
  tokenKey: dcToken,
11490
11421
  setLoader: activeinCard === "form" ? setLoadingIframe : null,
11491
11422
  isEmbedded: onSubmit ? true : false,
11492
- customCSS
11423
+ customCSS,
11424
+ onError: (msg) => setError(msg || DcLoadingError)
11493
11425
  }
11494
11426
  ) }),
11495
11427
  /* @__PURE__ */ jsxs19("div", { className: "form-group-frac", children: [
@@ -11551,7 +11483,7 @@ var ModelContentSky = ({ amount, bankAmount, submitBtnText = "Pay", session_toke
11551
11483
  !onSubmit && /* @__PURE__ */ jsxs19("div", { className: "frac-heading-card-wrap", children: [
11552
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: [
11553
11485
  " ",
11554
- /* @__PURE__ */ jsx36(IoArrowBack2, {})
11486
+ /* @__PURE__ */ jsx36(IoArrowBack, {})
11555
11487
  ] }) }),
11556
11488
  /* @__PURE__ */ jsx36("h6", { className: "frac-card-payment-heading", children: "Bank Payment" })
11557
11489
  ] }),