@fractalpay/fractalpay-next 0.1.5 → 0.1.7

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",
42
- version: "0.1.5",
42
+ version: "0.1.7",
43
43
  private: false,
44
44
  type: "module",
45
45
  scripts: {
@@ -3614,6 +3614,10 @@ var DataCapFields = ({
3614
3614
  initialize();
3615
3615
  return () => {
3616
3616
  resolverRef.current = null;
3617
+ if (initTimeoutRef.current) {
3618
+ clearTimeout(initTimeoutRef.current);
3619
+ initTimeoutRef.current = null;
3620
+ }
3617
3621
  };
3618
3622
  }, [isOpen, tokenKey]);
3619
3623
  useEffect7(() => {
@@ -4106,7 +4110,8 @@ function FractalOrderSummary({
4106
4110
  cardIcons,
4107
4111
  note,
4108
4112
  secureIcon,
4109
- secureText = "Secure payment powered by Fractal"
4113
+ secureText = "Secure payment powered by Fractal",
4114
+ extra
4110
4115
  }) {
4111
4116
  return /* @__PURE__ */ jsxs8("aside", { className: "fps-summary", children: [
4112
4117
  /* @__PURE__ */ jsx17("div", { className: "fps-logo", children: logo && /* @__PURE__ */ jsx17("img", { src: logo, alt: "" }) }),
@@ -4121,6 +4126,7 @@ function FractalOrderSummary({
4121
4126
  /* @__PURE__ */ jsx17("div", { className: "fps-total-label", children: totalLabel }),
4122
4127
  /* @__PURE__ */ jsx17("div", { className: "fps-total", children: total })
4123
4128
  ] }),
4129
+ extra,
4124
4130
  cardIcons && /* @__PURE__ */ jsxs8("div", { className: "fps-cards", children: [
4125
4131
  /* @__PURE__ */ jsx17("img", { src: cardIcons.visa, alt: "Visa" }),
4126
4132
  /* @__PURE__ */ jsx17("img", { src: cardIcons.mastercard, alt: "Mastercard" }),
@@ -4284,6 +4290,7 @@ function GetPaymentPage(props) {
4284
4290
  const [loading, setLoading] = useState4(false);
4285
4291
  const [loadingIframe, setLoadingIframe] = useState4(false);
4286
4292
  const [loading2, setLoading2] = useState4(false);
4293
+ const [surchargeLookupLoading, setSurchargeLookupLoading] = useState4(false);
4287
4294
  const [error, setError] = useState4("");
4288
4295
  const [errorIframe, setErrorIframe] = useState4("");
4289
4296
  const [success, setSuccess] = useState4(false);
@@ -4325,6 +4332,7 @@ function GetPaymentPage(props) {
4325
4332
  const [cashDiscount, setCashDiscount] = useState4(Number(props == null ? void 0 : props.amount));
4326
4333
  const [bankAmount, setBankAmount] = useState4(Number(props == null ? void 0 : props.amount));
4327
4334
  const [bankFeeAmount, setBankFeeAmount] = useState4(0);
4335
+ const [bankSavingsAmount, setBankSavingsAmount] = useState4(0);
4328
4336
  const [paymentData, setPaymentData] = useState4();
4329
4337
  let [tranId, setTranId] = useState4("");
4330
4338
  let [isDebitAdjusted, setIsDebitAdjusted] = useState4(false);
@@ -4381,6 +4389,47 @@ function GetPaymentPage(props) {
4381
4389
  cardholder_billing_zip: (cardData == null ? void 0 : cardData.zipCode) || void 0
4382
4390
  };
4383
4391
  };
4392
+ const runCofSurchargeLookup = async (cardId) => {
4393
+ var _a2, _b2;
4394
+ try {
4395
+ const res = await axios3.post(`${baseUrl}surcharge-lookup-cof`, {
4396
+ fractalpayPublicKey: fractalpayClientKey,
4397
+ customer_id: props == null ? void 0 : props.customerId,
4398
+ card_id: cardId,
4399
+ amount: Number((_a2 = cashDiscount != null ? cashDiscount : props == null ? void 0 : props.amount) != null ? _a2 : 0),
4400
+ cardholder_billing_zip: (cardData == null ? void 0 : cardData.zipCode) || void 0
4401
+ });
4402
+ const data = (_b2 = res == null ? void 0 : res.data) == null ? void 0 : _b2.data;
4403
+ if (!data) return null;
4404
+ return {
4405
+ card_brand: data.card_brand,
4406
+ card_issue_type: data.card_issue_type,
4407
+ surcharge_allowed: data.surcharge_allowed,
4408
+ max_surcharge_percent: data.max_surcharge_percent,
4409
+ max_surcharge_amount: data.max_surcharge_amount
4410
+ };
4411
+ } catch (err) {
4412
+ console.error("COF surcharge lookup failed", err);
4413
+ return null;
4414
+ }
4415
+ };
4416
+ useEffect8(() => {
4417
+ const surchargingOn = Number(paymentData == null ? void 0 : paymentData.surchargeProgram) === 1 && !!(props == null ? void 0 : props.pass_fee);
4418
+ if (!surchargingOn || !(selectedCard == null ? void 0 : selectedCard.id) || selectedCard.card_type === "Bank") {
4419
+ setSurchargeResult(null);
4420
+ return;
4421
+ }
4422
+ let cancelled = false;
4423
+ setSurchargeLookupLoading(true);
4424
+ runCofSurchargeLookup(selectedCard.id).then((result) => {
4425
+ if (cancelled) return;
4426
+ setSurchargeResult(result);
4427
+ setSurchargeLookupLoading(false);
4428
+ });
4429
+ return () => {
4430
+ cancelled = true;
4431
+ };
4432
+ }, [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]);
4384
4433
  useEffect8(() => {
4385
4434
  if (show) {
4386
4435
  let cash_discount = CalculateCashDiscount(props == null ? void 0 : props.amount, (props == null ? void 0 : props.surcharge) || 0);
@@ -4392,16 +4441,18 @@ function GetPaymentPage(props) {
4392
4441
  setCashDiscount(cash_discount);
4393
4442
  const cardFeeAmount = Number((Number(props == null ? void 0 : props.amount) - Number(cash_discount || 0)).toFixed(2));
4394
4443
  const bankFeeAmount2 = Number((props == null ? void 0 : props.bankFeeAmount) || 0);
4395
- const bankSavingsAmount = Math.max(bankFeeAmount2 > 0 ? cardFeeAmount - bankFeeAmount2 : cardFeeAmount, 0);
4396
- const bankSavingsText = bankSavingsAmount > 0 ? `Save ${formatUSD(bankSavingsAmount.toFixed(2))}` : "";
4444
+ const bankSavingsAmount2 = Math.max(bankFeeAmount2 > 0 ? cardFeeAmount - bankFeeAmount2 : cardFeeAmount, 0);
4445
+ const bankSavingsText = bankSavingsAmount2 > 0 ? `Save ${formatUSD(bankSavingsAmount2.toFixed(2))}` : "";
4397
4446
  setBankFeeAmount(bankFeeAmount2);
4447
+ setBankSavingsAmount(bankSavingsAmount2);
4398
4448
  console.log({
4399
4449
  cash_discount,
4400
4450
  bankAmount: bankAmount2,
4401
4451
  cardFeeAmount,
4402
4452
  bankFeeAmount: bankFeeAmount2,
4403
- bankSavingsAmount,
4404
- bankSavingsText
4453
+ bankSavingsAmount: bankSavingsAmount2,
4454
+ bankSavingsText,
4455
+ amount: props == null ? void 0 : props.amount
4405
4456
  });
4406
4457
  }
4407
4458
  }, [show, props == null ? void 0 : props.pass_fee, props == null ? void 0 : props.amount, props == null ? void 0 : props.surcharge]);
@@ -4412,6 +4463,8 @@ function GetPaymentPage(props) {
4412
4463
  setSuccess(false);
4413
4464
  setTranId("");
4414
4465
  setSurchargeResult(null);
4466
+ setPaymentData(void 0);
4467
+ setLoadingIframe(false);
4415
4468
  setAchData({
4416
4469
  name: "",
4417
4470
  routingNumber: "",
@@ -4712,7 +4765,7 @@ function GetPaymentPage(props) {
4712
4765
  const customer_id = props == null ? void 0 : props.customerId;
4713
4766
  const fractalpayPublicKey = props == null ? void 0 : props.merchantPublicKey;
4714
4767
  const order_id = props == null ? void 0 : props.orderID;
4715
- const amount = props == null ? void 0 : props.amount;
4768
+ const amount = leftTotal;
4716
4769
  const card_id = selectedCard == null ? void 0 : selectedCard.id;
4717
4770
  const card_type = selectedCard == null ? void 0 : selectedCard.card_type;
4718
4771
  const preAuth_id = (props == null ? void 0 : props.preauthId) || "";
@@ -4782,7 +4835,7 @@ function GetPaymentPage(props) {
4782
4835
  try {
4783
4836
  const formData = {
4784
4837
  // amount: `${props.amount || 0}`,
4785
- amount: `${leftTotal}`,
4838
+ amount: `${orderAmount}`,
4786
4839
  fractalpayPublicKey: fractalpayClientKey,
4787
4840
  orderId: props == null ? void 0 : props.orderID,
4788
4841
  customer_id: props == null ? void 0 : props.customerId,
@@ -4855,8 +4908,8 @@ function GetPaymentPage(props) {
4855
4908
  return;
4856
4909
  }
4857
4910
  const card_issue_type = ((_i2 = tokenizeData == null ? void 0 : tokenizeData.bin_lookup_result) == null ? void 0 : _i2.card_issue_type) || null;
4858
- const feeExempt = ["debit", "prepaid"].includes(String(card_issue_type || "").toLowerCase());
4859
- if (feeExempt && (props == null ? void 0 : props.pass_fee) && (paymentData == null ? void 0 : paymentData.surchargeProgram) == 1) {
4911
+ const feeExempt2 = ["debit", "prepaid"].includes(String(card_issue_type || "").toLowerCase());
4912
+ if (feeExempt2 && (props == null ? void 0 : props.pass_fee) && (paymentData == null ? void 0 : paymentData.surchargeProgram) == 1) {
4860
4913
  setLoderText(`Processing ${card_issue_type} card without fee`);
4861
4914
  }
4862
4915
  console.log(tokenizeData, "tokenizeData");
@@ -5041,15 +5094,15 @@ function GetPaymentPage(props) {
5041
5094
  if (customer_id) {
5042
5095
  if (card_id) {
5043
5096
  setLoading2(true);
5044
- const feeExempt = ["debit", "prepaid"].includes(String(card_issue_type || "").toLowerCase());
5045
- if (feeExempt && (props == null ? void 0 : props.pass_fee) && (paymentData == null ? void 0 : paymentData.surchargeProgram) == 1) {
5097
+ const feeExempt2 = ["debit", "prepaid"].includes(String(card_issue_type || "").toLowerCase());
5098
+ if (feeExempt2 && (props == null ? void 0 : props.pass_fee) && (paymentData == null ? void 0 : paymentData.surchargeProgram) == 1) {
5046
5099
  setLoderText(`Processing ${card_issue_type} card without fee`);
5047
5100
  }
5048
5101
  let resultofOrderCreate;
5049
5102
  if (!(card_type === "Bank")) {
5050
5103
  const formData = {
5051
5104
  // amount: `${props.amount || 0}`,
5052
- amount: `${leftTotal}`,
5105
+ amount: `${orderAmount}`,
5053
5106
  fractalpayPublicKey: fractalpayClientKey,
5054
5107
  orderId: props == null ? void 0 : props.orderID,
5055
5108
  customer_id: props == null ? void 0 : props.customerId,
@@ -5064,7 +5117,7 @@ function GetPaymentPage(props) {
5064
5117
  console.log(resultofOrderCreate, "vfndsjkfvhg", resultofOrderCreate == null ? void 0 : resultofOrderCreate.data.data.posSalesIdEncode);
5065
5118
  }
5066
5119
  let chargeobj = __spreadValues(__spreadValues({
5067
- amount: card_type === "Bank" ? `${bankAmount}` : amount,
5120
+ amount: `${leftTotal}`,
5068
5121
  order_id,
5069
5122
  customer_id,
5070
5123
  card_id,
@@ -5251,18 +5304,24 @@ function GetPaymentPage(props) {
5251
5304
  const merchantName = (paymentData == null ? void 0 : paymentData.bname) || (paymentData == null ? void 0 : paymentData.customer_name) || "the merchant";
5252
5305
  const invoiceNo = String((props == null ? void 0 : props.orderID) || "").replace(/^\s*invoice\s*#?\s*/i, "").trim();
5253
5306
  const invoiceLabel = invoiceNo ? `Invoice #${invoiceNo}` : "Invoice";
5307
+ const isSurchargeProgram = Number(paymentData == null ? void 0 : paymentData.surchargeProgram) === 1;
5254
5308
  const baseAmount = Number((_a = cashDiscount != null ? cashDiscount : props == null ? void 0 : props.amount) != null ? _a : 0);
5255
5309
  const fundingType = (_b = surchargeResult == null ? void 0 : surchargeResult.card_issue_type) == null ? void 0 : _b.toLowerCase();
5256
- const surchargeBlocked = surchargeResult && (fundingType !== "debit" && fundingType !== "prepaid");
5257
- const cardTotal = !surchargeBlocked ? baseAmount : Number((props == null ? void 0 : props.amount) || 0);
5310
+ const feeExempt = fundingType === "debit" || fundingType === "prepaid";
5311
+ let cardTotal;
5312
+ if (isSurchargeProgram) {
5313
+ cardTotal = feeExempt ? baseAmount : parseFloat((baseAmount * (1 + Number((props == null ? void 0 : props.surcharge) || 0) / 100)).toFixed(2));
5314
+ } else {
5315
+ cardTotal = Number((props == null ? void 0 : props.amount) || 0);
5316
+ }
5258
5317
  const surchargeFee = Math.max(cardTotal - baseAmount, 0);
5259
- const isBankView = activetab === "ach";
5318
+ const isBankView = activetab !== "reader" && activeinCard === "list" && !!(selectedCard == null ? void 0 : selectedCard.id) ? (selectedCard == null ? void 0 : selectedCard.card_type) === "Bank" : activetab === "ach";
5260
5319
  const discountNum = Number((props == null ? void 0 : props.discount) || 0);
5261
5320
  const taxNum = Number((props == null ? void 0 : props.tax) || 0);
5262
5321
  const leftTotal = isBankView ? Number(bankAmount || 0) : cardTotal;
5322
+ const orderAmount = isSurchargeProgram ? baseAmount : Number((props == null ? void 0 : props.amount) || 0);
5263
5323
  const fmtNum = (n) => Number(n).toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 });
5264
5324
  const hasFee = surchargeFee > 0 && !!(props == null ? void 0 : props.pass_fee);
5265
- const isSurchargeProgram = Number(paymentData == null ? void 0 : paymentData.surchargeProgram) === 1;
5266
5325
  const showSurchargeLine = isSurchargeProgram && !isBankView && hasFee;
5267
5326
  const summarySubtotal = isSurchargeProgram || isBankView ? baseAmount : cardTotal;
5268
5327
  const savedMethods = [...cardList || [], ...bankList || []];
@@ -5313,11 +5372,16 @@ function GetPaymentPage(props) {
5313
5372
  { label: "Tax", value: fmtNum(taxNum), muted: true },
5314
5373
  ...showSurchargeLine ? [{ label: "Surcharge", value: formatUSD(surchargeFee.toFixed(2)) }] : []
5315
5374
  ];
5316
- 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: [
5375
+ 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: [
5317
5376
  /* @__PURE__ */ jsx18("b", { children: formatUSD(baseAmount.toFixed(2)) }),
5318
- " if customer pays with debit or by bank (no surcharge)."
5377
+ " if customer pays with debit (no surcharge), or ",
5378
+ /* @__PURE__ */ jsx18("b", { children: formatUSD(Number(bankAmount || 0).toFixed(2)) }),
5379
+ " if by bank."
5319
5380
  ] }) : /* @__PURE__ */ jsxs9("div", { className: "fps-note", children: [
5320
5381
  /* @__PURE__ */ jsx18("b", { children: formatUSD(baseAmount.toFixed(2)) }),
5382
+ " if customer pays with debit or by bank (no surcharge)."
5383
+ ] }) : /* @__PURE__ */ jsxs9("div", { className: "fps-note", children: [
5384
+ /* @__PURE__ */ jsx18("b", { children: formatUSD(Number(bankAmount || 0).toFixed(2)) }),
5321
5385
  " if customer pays by bank (cash discount price)."
5322
5386
  ] });
5323
5387
  const LeftSummary = /* @__PURE__ */ jsx18(
@@ -5385,7 +5449,7 @@ function GetPaymentPage(props) {
5385
5449
  } }) }),
5386
5450
  success && /* @__PURE__ */ jsx18(SuccessMsz, { onClose: handleClose, tranId, isDebitAdjusted }),
5387
5451
  !error && !errorIframe && !success && /* @__PURE__ */ jsxs9(Fragment9, { children: [
5388
- (loading || loading2 || loadingIframe) && /* @__PURE__ */ jsx18(Loader_default, { loading: loading || loading2 || loadingIframe, loaderText }),
5452
+ (loading || loading2 || loadingIframe || surchargeLookupLoading) && /* @__PURE__ */ jsx18(Loader_default, { loading: loading || loading2 || loadingIframe || surchargeLookupLoading, loaderText }),
5389
5453
  /* @__PURE__ */ jsxs9("div", { className: "fps-modal", children: [
5390
5454
  LeftSummary,
5391
5455
  /* @__PURE__ */ jsxs9("section", { className: "fps-content", children: [
@@ -5423,7 +5487,7 @@ function GetPaymentPage(props) {
5423
5487
  FractalFooter,
5424
5488
  {
5425
5489
  authText: AuthText,
5426
- disabled: loading2 || !(selectedCard == null ? void 0 : selectedCard.id),
5490
+ disabled: loading2 || !(selectedCard == null ? void 0 : selectedCard.id) || surchargeLookupLoading,
5427
5491
  onPay: handlechargeCustomer,
5428
5492
  buttonLabel: isPreAuth ? `Authorize ${formatUSD(cardTotal.toFixed(2))}` : `Pay ${formatUSD(((selectedCard == null ? void 0 : selectedCard.card_type) === "Bank" ? Number(bankAmount || 0) : cardTotal).toFixed(2))} to ${merchantName}`
5429
5493
  }
@@ -7427,103 +7491,10 @@ function CardOnFile({ session_token, callback, isloading, onCancel, showChecks,
7427
7491
  import { useEffect as useEffect12, useRef as useRef7, useState as useState7 } from "react";
7428
7492
  import axios6 from "axios";
7429
7493
  import Swal3 from "sweetalert2";
7430
-
7431
- // src/app/components/Atoms/CardBankRadio/CardBankRadio.tsx
7432
- import { Fragment as Fragment14, jsx as jsx27, jsxs as jsxs14 } from "react/jsx-runtime";
7433
- var CardBankRadio = (_a) => {
7434
- var _b = _a, { skydesign = false, savingsText } = _b, props = __objRest(_b, ["skydesign", "savingsText"]);
7435
- const savingsBadgeClass = `frac-saving-badge ${skydesign ? "frac-saving-badge-corner" : "frac-saving-badge-corner frac-saving-badge-with-radio"}`;
7436
- return /* @__PURE__ */ jsx27(Fragment14, { children: /* @__PURE__ */ jsx27(
7437
- "div",
7438
- {
7439
- className: `frac-card-bank-radio ${props.activetab === props.value ? "frac-active" : ""}`,
7440
- onClick: () => props.onChange(props.value),
7441
- role: "radio",
7442
- children: skydesign ? /* @__PURE__ */ jsxs14(Fragment14, { children: [
7443
- /* @__PURE__ */ jsxs14("div", { className: "frac-card-title-main", children: [
7444
- /* @__PURE__ */ jsxs14("div", { className: "box-inner-card-text", children: [
7445
- /* @__PURE__ */ jsx27("img", { src: props.label.toLowerCase() === "card" ? defaultcard : props.label.toLowerCase() === "reader" ? pax : bankNew, className: "frac-payment-type-logo", alt: "" }),
7446
- /* @__PURE__ */ jsx27("div", { className: "frac-card-label-text", children: props.label })
7447
- ] }),
7448
- /* @__PURE__ */ jsx27("div", { className: "frac-card-label", children: /* @__PURE__ */ jsx27("div", { className: "frac-card-label-amount", children: formatUSD(props.amount) }) })
7449
- ] }),
7450
- /* @__PURE__ */ jsx27("div", { children: /* @__PURE__ */ jsx27("input", { name: "paymenttype", checked: props.activetab === props.value, type: "hidden", value: props.value, onChange: (e) => {
7451
- props.onChange(e.target.value);
7452
- } }) })
7453
- ] }) : /* @__PURE__ */ jsxs14(Fragment14, { children: [
7454
- /* @__PURE__ */ jsxs14("div", { className: "frac-card-title-main", children: [
7455
- /* @__PURE__ */ jsx27("img", { src: props.label.toLowerCase() === "card" ? defaultcard : props.label.toLowerCase() === "reader" ? pax : bankNew, className: "frac-payment-type-logo", alt: "" }),
7456
- /* @__PURE__ */ jsxs14("div", { className: "frac-card-label", children: [
7457
- /* @__PURE__ */ jsx27("div", { className: "frac-card-label-text", children: props.label }),
7458
- /* @__PURE__ */ jsx27("div", { className: "frac-card-label-amount", children: formatUSD(props.amount) })
7459
- ] })
7460
- ] }),
7461
- /* @__PURE__ */ jsx27("div", { children: /* @__PURE__ */ jsx27("input", { name: "paymenttype", checked: props.activetab === props.value, type: "radio", value: props.value, onChange: (e) => {
7462
- props.onChange(e.target.value);
7463
- } }) })
7464
- ] })
7465
- }
7466
- ) });
7467
- };
7468
-
7469
- // src/app/components/PartialPayment/PartialPayment.tsx
7470
- import { IoArrowBack } from "react-icons/io5";
7471
-
7472
- // src/app/components/Atoms/CardList/CardList.tsx
7473
- import { Fragment as Fragment15, jsx as jsx28, jsxs as jsxs15 } from "react/jsx-runtime";
7474
- var CardList = ({ listHeading = "Card", ListItems, selectedCard, setSelectedCard, paymentGateway, handleDeleteCard, otherButtonAction, otherButtonLabel, headingClass }) => {
7475
- let trash2 = S3Url + "widget/Trash.svg";
7476
- return /* @__PURE__ */ jsxs15(Fragment15, { children: [
7477
- /* @__PURE__ */ jsx28("h6", { className: headingClass || "card-ach-heading", style: { marginBottom: "10px !important" }, children: listHeading }),
7478
- /* @__PURE__ */ jsxs15("div", { className: "card-lint-div-in", children: [
7479
- /* @__PURE__ */ jsx28("div", { className: "card-list-div", children: ListItems && (ListItems == null ? void 0 : ListItems.length) > 0 && (ListItems == null ? void 0 : ListItems.map((card, index) => {
7480
- let isDisabled = false;
7481
- if (paymentGateway) {
7482
- isDisabled = paymentGateway != (card == null ? void 0 : card.payment_method_type) && (card == null ? void 0 : card.card_type) != "Bank";
7483
- }
7484
- return /* @__PURE__ */ jsxs15("div", { className: "card-list-single-div", children: [
7485
- /* @__PURE__ */ jsxs15("div", { className: "card-number-radio", children: [
7486
- /* @__PURE__ */ jsx28(
7487
- "input",
7488
- {
7489
- disabled: isDisabled,
7490
- type: "radio",
7491
- className: "cardRadio",
7492
- name: "selected_card",
7493
- id: "",
7494
- checked: (selectedCard == null ? void 0 : selectedCard.id) === (card == null ? void 0 : card.id),
7495
- onChange: (e) => setSelectedCard(card)
7496
- }
7497
- ),
7498
- /* @__PURE__ */ jsxs15("label", { htmlFor: "", className: "card-number-last-four", children: [
7499
- "**** ",
7500
- card == null ? void 0 : card.cardlastfourdigit
7501
- ] }),
7502
- (card == null ? void 0 : card.card_type) != "Bank" && /* @__PURE__ */ jsxs15("h6", { className: "card-expiry-date", children: [
7503
- card == null ? void 0 : card.expmonth,
7504
- "/",
7505
- card == null ? void 0 : card.expyear
7506
- ] })
7507
- ] }),
7508
- /* @__PURE__ */ jsxs15("div", { className: "card-number-radio", children: [
7509
- /* @__PURE__ */ jsx28("span", { className: "visa-card", children: /* @__PURE__ */ jsx28("img", { src: getCardType(card == null ? void 0 : card.card_type), alt: "" }) }),
7510
- /* @__PURE__ */ jsx28("span", { className: "visa-card", style: { cursor: "pointer" }, onClick: () => handleDeleteCard(card == null ? void 0 : card.id), children: /* @__PURE__ */ jsx28("img", { src: trash2, alt: "" }) })
7511
- ] })
7512
- ] }, card == null ? void 0 : card.id);
7513
- })) }),
7514
- /* @__PURE__ */ jsxs15("div", { className: "pay-with-other-card", onClick: otherButtonAction, children: [
7515
- otherButtonLabel,
7516
- /* @__PURE__ */ jsx28("img", { src: defaultcard, alt: "" })
7517
- ] })
7518
- ] })
7519
- ] });
7520
- };
7521
-
7522
- // src/app/components/PartialPayment/PartialPayment.tsx
7523
7494
  import { NumericFormat } from "react-number-format";
7524
- import { Fragment as Fragment16, jsx as jsx29, jsxs as jsxs16 } from "react/jsx-runtime";
7495
+ import { Fragment as Fragment14, jsx as jsx27, jsxs as jsxs14 } from "react/jsx-runtime";
7525
7496
  function PartialPayment(props) {
7526
- 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;
7497
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
7527
7498
  const buttonRef = useRef7(null);
7528
7499
  useEffect12(() => {
7529
7500
  if (props.onTriggerPay) {
@@ -7545,15 +7516,14 @@ function PartialPayment(props) {
7545
7516
  const [loading, setLoading] = useState7(false);
7546
7517
  const [loading2, setLoading2] = useState7(false);
7547
7518
  const [loadingIframe, setLoadingIframe] = useState7(false);
7519
+ const [surchargeLookupLoading, setSurchargeLookupLoading] = useState7(false);
7548
7520
  const [errorIframe, setErrorIframe] = useState7("");
7549
7521
  const [error, setError] = useState7("");
7550
7522
  const [success, setSuccess] = useState7(false);
7551
7523
  const [show, setShow] = useState7(false);
7552
7524
  const [activetab, setActive] = useState7("card");
7553
- const [activeList, setActiveList] = useState7("card");
7554
7525
  const [activeinCard, setActiveinCard] = useState7("form");
7555
7526
  const [activeinBank, setActiveinBank] = useState7("form");
7556
- const [activeForm, setActiveForm] = useState7(true);
7557
7527
  const [saveCardInfo, setSaveCardInfo] = useState7(false);
7558
7528
  const [saveACHinfo, setSaveACHinfo] = useState7(false);
7559
7529
  const fractalpayClientKey = props.merchantPublicKey;
@@ -7600,6 +7570,11 @@ function PartialPayment(props) {
7600
7570
  };
7601
7571
  const [paymentData, setPaymentData] = useState7();
7602
7572
  let [tranId, setTranId] = useState7("");
7573
+ const [surchargeResult, setSurchargeResult] = useState7(null);
7574
+ const isSurchargeProgram = Number(paymentData == null ? void 0 : paymentData.surchargeProgram) === 1;
7575
+ const fundingType = (_a = surchargeResult == null ? void 0 : surchargeResult.card_issue_type) == null ? void 0 : _a.toLowerCase();
7576
+ const feeExempt = fundingType === "debit" || fundingType === "prepaid";
7577
+ const cardTotal = isSurchargeProgram && feeExempt ? Number((_b = cashDiscount != null ? cashDiscount : props == null ? void 0 : props.amount) != null ? _b : 0) : Number(aftertaxAmount);
7603
7578
  const showLoader = () => setLoading(true);
7604
7579
  const hideLoader = () => setLoading(false);
7605
7580
  const CalculateCashDiscount = (amount, surcharge) => {
@@ -7612,6 +7587,69 @@ function PartialPayment(props) {
7612
7587
  const originalAmount = +amount + +(amount * surchargeVal);
7613
7588
  return originalAmount;
7614
7589
  };
7590
+ const createSurchargeSession = async () => {
7591
+ var _a2;
7592
+ try {
7593
+ const requestOptions = { method: "POST", redirect: "follow" };
7594
+ const res = await axios6.post(`${masterBaseUrl}api/v1/widget/generate-session`, requestOptions);
7595
+ const data = (_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.data;
7596
+ const public_key_pem = (data == null ? void 0 : data.publicKeyPem) || (data == null ? void 0 : data.public_key_pem);
7597
+ const session_key = data == null ? void 0 : data.session_key;
7598
+ if (!public_key_pem || !session_key) return null;
7599
+ return { session_key, public_key_pem };
7600
+ } catch (err) {
7601
+ console.error("Surcharge session error", err);
7602
+ return null;
7603
+ }
7604
+ };
7605
+ const getSurchargeOptions = () => {
7606
+ var _a2;
7607
+ return {
7608
+ amount: Math.round((partialAmount && !partialError ? Number(partialAmount) : Number((_a2 = cashDiscount != null ? cashDiscount : props == null ? void 0 : props.amount) != null ? _a2 : 0)) * 100),
7609
+ cardholder_billing_zip: (cardData == null ? void 0 : cardData.zipCode) || void 0
7610
+ };
7611
+ };
7612
+ const runCofSurchargeLookup = async (cardId) => {
7613
+ var _a2, _b2;
7614
+ try {
7615
+ const res = await axios6.post(`${baseUrl}surcharge-lookup-cof`, {
7616
+ fractalpayPublicKey: fractalpayClientKey,
7617
+ customer_id: props == null ? void 0 : props.customerId,
7618
+ card_id: cardId,
7619
+ amount: partialAmount && !partialError ? Number(partialAmount) : Number((_a2 = cashDiscount != null ? cashDiscount : props == null ? void 0 : props.amount) != null ? _a2 : 0),
7620
+ cardholder_billing_zip: (cardData == null ? void 0 : cardData.zipCode) || void 0
7621
+ });
7622
+ const data = (_b2 = res == null ? void 0 : res.data) == null ? void 0 : _b2.data;
7623
+ if (!data) return null;
7624
+ return {
7625
+ card_brand: data.card_brand,
7626
+ card_issue_type: data.card_issue_type,
7627
+ surcharge_allowed: data.surcharge_allowed,
7628
+ max_surcharge_percent: data.max_surcharge_percent,
7629
+ max_surcharge_amount: data.max_surcharge_amount
7630
+ };
7631
+ } catch (err) {
7632
+ console.error("COF surcharge lookup failed", err);
7633
+ return null;
7634
+ }
7635
+ };
7636
+ useEffect12(() => {
7637
+ const surchargingOn = Number(paymentData == null ? void 0 : paymentData.surchargeProgram) === 1 && !!(props == null ? void 0 : props.pass_fee);
7638
+ if (!surchargingOn || !(selectedCard == null ? void 0 : selectedCard.id) || selectedCard.card_type === "Bank") {
7639
+ setSurchargeResult(null);
7640
+ return;
7641
+ }
7642
+ let cancelled = false;
7643
+ setSurchargeLookupLoading(true);
7644
+ runCofSurchargeLookup(selectedCard.id).then((result) => {
7645
+ if (cancelled) return;
7646
+ setSurchargeResult(result);
7647
+ setSurchargeLookupLoading(false);
7648
+ });
7649
+ return () => {
7650
+ cancelled = true;
7651
+ };
7652
+ }, [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]);
7615
7653
  useEffect12(() => {
7616
7654
  if (show) {
7617
7655
  if (props == null ? void 0 : props.pass_fee) {
@@ -7629,6 +7667,9 @@ function PartialPayment(props) {
7629
7667
  setError("");
7630
7668
  setSuccess(false);
7631
7669
  setTranId("");
7670
+ setSurchargeResult(null);
7671
+ setPaymentData(void 0);
7672
+ setLoadingIframe(false);
7632
7673
  setAchData({
7633
7674
  name: "",
7634
7675
  routingNumber: "",
@@ -7677,8 +7718,6 @@ function PartialPayment(props) {
7677
7718
  });
7678
7719
  setSelectedReader({});
7679
7720
  setCashDiscount(0);
7680
- setActiveList("card");
7681
- setActiveForm(true);
7682
7721
  setActiveinBank("form");
7683
7722
  setActiveinCard("form");
7684
7723
  setLoading2(false);
@@ -7694,9 +7733,6 @@ function PartialPayment(props) {
7694
7733
  setLoderText("");
7695
7734
  };
7696
7735
  const handleShow = () => setShow(true);
7697
- const handletabchange = (id) => {
7698
- setActive(id);
7699
- };
7700
7736
  const handleCardChange = (field, value) => {
7701
7737
  const name2 = field;
7702
7738
  const numericFields = ["expiryMonth", "expiryYear", "zipCode", "cvv"];
@@ -7802,7 +7838,7 @@ function PartialPayment(props) {
7802
7838
  return Object.keys(errors).length > 0;
7803
7839
  };
7804
7840
  const submitFunc = async (e) => {
7805
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2;
7841
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l, _m, _n;
7806
7842
  e.preventDefault();
7807
7843
  const el = document.activeElement;
7808
7844
  if (el instanceof HTMLElement) {
@@ -7835,7 +7871,7 @@ function PartialPayment(props) {
7835
7871
  response.isCardSave = `${saveCardInfo}`;
7836
7872
  response.isCharge = true;
7837
7873
  response.posSalesIdEncode = (_a3 = paymentData == null ? void 0 : paymentData.orderDetails) == null ? void 0 : _a3.orderId;
7838
- response.partial_amount = partialAmount && !partialError ? partialAmount : aftertaxAmount;
7874
+ response.partial_amount = partialAmount && !partialError ? partialAmount : cardTotal;
7839
7875
  socketClient_default.emit("sendMessage", response);
7840
7876
  let eventName = (_b3 = paymentData == null ? void 0 : paymentData.orderDetails) == null ? void 0 : _b3.orderId;
7841
7877
  socketClient_default.on(eventName, (data) => {
@@ -7878,15 +7914,16 @@ function PartialPayment(props) {
7878
7914
  session_key: (_f2 = (_e2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _e2.data) == null ? void 0 : _f2.session_key
7879
7915
  });
7880
7916
  const card_issue_type = ((_g2 = tokenizeData == null ? void 0 : tokenizeData.bin_lookup_result) == null ? void 0 : _g2.card_issue_type) || null;
7881
- if (card_issue_type === "Debit" && (props == null ? void 0 : props.pass_fee) && (paymentData == null ? void 0 : paymentData.surchargeProgram) == 1) {
7882
- setLoderText("Processing Debit card without fee");
7917
+ const feeExemptCard = ["debit", "prepaid"].includes(String(card_issue_type || "").toLowerCase());
7918
+ if (feeExemptCard && (props == null ? void 0 : props.pass_fee) && (paymentData == null ? void 0 : paymentData.surchargeProgram) == 1) {
7919
+ setLoderText(`Processing ${card_issue_type} card without fee`);
7883
7920
  }
7884
7921
  const reqData = JSON.stringify(__spreadProps(__spreadValues({}, tokenizeData), {
7885
7922
  isSaveCardChecked: saveCardInfo,
7886
7923
  name: cardData == null ? void 0 : cardData.cardName,
7887
7924
  postal_code: cardData == null ? void 0 : cardData.zipCode,
7888
7925
  customer_id: props == null ? void 0 : props.customerId,
7889
- partial_amount: partialAmount && !partialError ? partialAmount : aftertaxAmount,
7926
+ partial_amount: partialAmount && !partialError ? partialAmount : cardTotal,
7890
7927
  card_issue_type
7891
7928
  }));
7892
7929
  const reqData2 = JSON.stringify({
@@ -7927,7 +7964,7 @@ function PartialPayment(props) {
7927
7964
  }
7928
7965
  } catch (err) {
7929
7966
  setLoading2(false);
7930
- 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.");
7967
+ 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.");
7931
7968
  }
7932
7969
  } else {
7933
7970
  try {
@@ -7944,7 +7981,7 @@ function PartialPayment(props) {
7944
7981
  }
7945
7982
  } catch (err) {
7946
7983
  setLoading2(false);
7947
- 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.");
7984
+ 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.");
7948
7985
  }
7949
7986
  }
7950
7987
  }
@@ -7998,7 +8035,7 @@ function PartialPayment(props) {
7998
8035
  }
7999
8036
  };
8000
8037
  const getPaymentDetails = async () => {
8001
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2, _q2, _r2, _s2, _t2, _u2, _v2, _w2, _x2, _y2, _z2, _A;
8038
+ 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;
8002
8039
  showLoader();
8003
8040
  try {
8004
8041
  const data = {
@@ -8016,7 +8053,7 @@ function PartialPayment(props) {
8016
8053
  let willShowCardForm = true;
8017
8054
  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) {
8018
8055
  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");
8019
- 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");
8056
+ 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");
8020
8057
  if ((cardlists == null ? void 0 : cardlists.length) > 0) {
8021
8058
  setActiveinCard("list");
8022
8059
  willShowCardForm = false;
@@ -8029,17 +8066,17 @@ function PartialPayment(props) {
8029
8066
  } else {
8030
8067
  setActive("card");
8031
8068
  }
8032
- 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) {
8033
- setSelectedReader((_u2 = (_t2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _t2.data) == null ? void 0 : _u2.paymentDeviceList[0]);
8069
+ 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) {
8070
+ setSelectedReader((_u = (_t = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _t.data) == null ? void 0 : _u.paymentDeviceList[0]);
8034
8071
  }
8035
- if (willShowCardForm && ((_w2 = (_v2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _v2.data) == null ? void 0 : _w2.paymentGateway) === 31 && ((_y2 = (_x2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _x2.data) == null ? void 0 : _y2.dctoken)) {
8072
+ 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)) {
8036
8073
  setLoadingIframe(true);
8037
8074
  }
8038
8075
  hideLoader();
8039
8076
  } catch (err) {
8040
8077
  console.log(err);
8041
8078
  hideLoader();
8042
- setError(((_A = (_z2 = err == null ? void 0 : err.response) == null ? void 0 : _z2.data) == null ? void 0 : _A.message) || (err == null ? void 0 : err.message) || "Something went wrong");
8079
+ 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");
8043
8080
  }
8044
8081
  };
8045
8082
  const handlechargeCustomer = async (e) => {
@@ -8067,7 +8104,7 @@ function PartialPayment(props) {
8067
8104
  } else if (card_type === "Bank") {
8068
8105
  amount2 = cashDiscount;
8069
8106
  } else {
8070
- amount2 = aftertaxAmount;
8107
+ amount2 = cardTotal;
8071
8108
  }
8072
8109
  let chargeobj = {
8073
8110
  amount: amount2,
@@ -8093,8 +8130,9 @@ function PartialPayment(props) {
8093
8130
  "Content-Type": "application/json"
8094
8131
  };
8095
8132
  setLoading2(true);
8096
- if (card_issue_type == "Debit" && (props == null ? void 0 : props.pass_fee) && (paymentData == null ? void 0 : paymentData.surchargeProgram) == 1) {
8097
- setLoderText("Processing Debit card without fee");
8133
+ const feeExemptCard = ["debit", "prepaid"].includes(String(card_issue_type || "").toLowerCase());
8134
+ if (feeExemptCard && (props == null ? void 0 : props.pass_fee) && (paymentData == null ? void 0 : paymentData.surchargeProgram) == 1) {
8135
+ setLoderText(`Processing ${card_issue_type} card without fee`);
8098
8136
  }
8099
8137
  socketClient_default.emit("sendMessage", { url: chargeurl, body: card_type == "Bank" ? rest : chargeobj, isChargebycard: true });
8100
8138
  socketClient_default.on("charge-by-card", (response) => {
@@ -8157,13 +8195,6 @@ function PartialPayment(props) {
8157
8195
  setError("Something went wrong.");
8158
8196
  }
8159
8197
  };
8160
- const handlepayment = (e) => {
8161
- if (activeList === "card") {
8162
- handlechargeCustomer(e);
8163
- } else if (activeList === "reader") {
8164
- handleChargewithEMV(e);
8165
- }
8166
- };
8167
8198
  useEffect12(() => {
8168
8199
  if (show && fractalpayClientKey) {
8169
8200
  getPaymentDetails();
@@ -8203,7 +8234,6 @@ function PartialPayment(props) {
8203
8234
  confirmButtonText: "OK",
8204
8235
  showConfirmButton: true,
8205
8236
  timer: 1e3,
8206
- // auto-close after 1 second
8207
8237
  timerProgressBar: true,
8208
8238
  customClass: {
8209
8239
  confirmButton: "btn btn-dark"
@@ -8257,11 +8287,6 @@ function PartialPayment(props) {
8257
8287
  return card;
8258
8288
  }
8259
8289
  };
8260
- const getCashDiscount = () => {
8261
- let cashDiscountNew = cashDiscount || 0;
8262
- let diff = Number(aftertaxAmount) - cashDiscountNew;
8263
- return diff.toFixed(0);
8264
- };
8265
8290
  const handlePartialChange = (values) => {
8266
8291
  var _a2, _b2, _c2, _d2;
8267
8292
  if (activetab === "ach") {
@@ -8273,9 +8298,9 @@ function PartialPayment(props) {
8273
8298
  setPartialError("");
8274
8299
  }
8275
8300
  } else {
8276
- if (((_c2 = Number(aftertaxAmount)) == null ? void 0 : _c2.toFixed(2)) < (values == null ? void 0 : values.floatValue) || (values == null ? void 0 : values.floatValue) <= 0) {
8301
+ if (((_c2 = Number(cardTotal)) == null ? void 0 : _c2.toFixed(2)) < (values == null ? void 0 : values.floatValue) || (values == null ? void 0 : values.floatValue) <= 0) {
8277
8302
  setPartialAmount(values == null ? void 0 : values.value);
8278
- setPartialError(`Partial amount cannot exceed ${formatUSD((_d2 = Number(aftertaxAmount)) == null ? void 0 : _d2.toFixed(2))}`);
8303
+ setPartialError(`Partial amount cannot exceed ${formatUSD((_d2 = Number(cardTotal)) == null ? void 0 : _d2.toFixed(2))}`);
8279
8304
  } else {
8280
8305
  setPartialAmount(values == null ? void 0 : values.value);
8281
8306
  setPartialError("");
@@ -8283,30 +8308,136 @@ function PartialPayment(props) {
8283
8308
  }
8284
8309
  };
8285
8310
  useEffect12(() => {
8286
- const baseAmount = activetab === "ach" ? Number(cashDiscount) : Number(aftertaxAmount);
8311
+ const baseAmount2 = activetab === "ach" ? Number(cashDiscount) : Number(cardTotal);
8287
8312
  const partial = Number(partialAmount);
8288
8313
  if (partialAmount) {
8289
- if (partial <= 0 || partial > baseAmount) {
8290
- setPartialError(`Partial amount cannot exceed ${formatUSD(baseAmount.toFixed(2))}`);
8314
+ if (partial <= 0 || partial > baseAmount2) {
8315
+ setPartialError(`Partial amount cannot exceed ${formatUSD(baseAmount2.toFixed(2))}`);
8291
8316
  } else {
8292
8317
  setPartialError("");
8293
8318
  }
8294
8319
  } else {
8295
8320
  setPartialError("");
8296
8321
  }
8297
- }, [activetab, partialAmount, cashDiscount, aftertaxAmount]);
8322
+ }, [activetab, partialAmount, cashDiscount, cardTotal]);
8298
8323
  useEffect12(() => {
8299
8324
  if (typeof FractalTokenizer === "undefined") return;
8300
8325
  const tokenizer = new FractalTokenizer({
8301
8326
  styles: {}
8302
8327
  });
8303
8328
  }, []);
8304
- return /* @__PURE__ */ jsxs16(Fragment16, { children: [
8305
- /* @__PURE__ */ jsx29(DataScript, {}),
8306
- /* @__PURE__ */ jsx29(Chargewidgetstyles, {}),
8307
- /* @__PURE__ */ jsx29(CardBankRadioStyles, {}),
8308
- (paymentData == null ? void 0 : paymentData.paymentGateway) === 32 && /* @__PURE__ */ jsx29(FractalTokenizerScript, { onLoad: () => setTokenizerReady(true) }),
8309
- (paymentData == null ? void 0 : paymentData.paymentGateway) === 31 && /* @__PURE__ */ jsx29(
8329
+ const merchantName = (paymentData == null ? void 0 : paymentData.bname) || (paymentData == null ? void 0 : paymentData.customer_name) || "the merchant";
8330
+ const invoiceNo = String((props == null ? void 0 : props.orderID) || "").replace(/^\s*invoice\s*#?\s*/i, "").trim();
8331
+ const invoiceLabel = invoiceNo ? `Invoice #${invoiceNo}` : "Invoice";
8332
+ const baseAmount = Number((_c = cashDiscount != null ? cashDiscount : props == null ? void 0 : props.amount) != null ? _c : 0);
8333
+ const surchargeFee = Math.max(cardTotal - baseAmount, 0);
8334
+ const isBankView = activetab !== "reader" && activeinCard === "list" && !!(selectedCard == null ? void 0 : selectedCard.id) ? (selectedCard == null ? void 0 : selectedCard.card_type) === "Bank" : activetab === "ach";
8335
+ const discountNum = Number((props == null ? void 0 : props.discount) || 0);
8336
+ const taxNum = Number((props == null ? void 0 : props.tax) || 0);
8337
+ const hasFee = surchargeFee > 0 && !!(props == null ? void 0 : props.pass_fee);
8338
+ const showSurchargeLine = isSurchargeProgram && !isBankView && hasFee;
8339
+ const summarySubtotal = isSurchargeProgram || isBankView ? baseAmount : cardTotal;
8340
+ const fmtNum = (n) => Number(n).toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 });
8341
+ const partialOverride = partialAmount && !partialError ? Number(partialAmount) : null;
8342
+ const methodTotal = isBankView ? Number(cashDiscount || 0) : cardTotal;
8343
+ const effectiveTotal = partialOverride != null ? partialOverride : methodTotal;
8344
+ const hideBank = true;
8345
+ const savedMethods = [...cardList || [], ...hideBank ? [] : bankList || []];
8346
+ const hasSaved = savedMethods.length > 0;
8347
+ const showList = hasSaved && activetab !== "reader" && activeinCard === "list";
8348
+ const availableMethods = [
8349
+ "card",
8350
+ ...!hideBank && (paymentData == null ? void 0 : paymentData.isSkyFiAccount) ? ["ach"] : [],
8351
+ ...(paymentData == null ? void 0 : paymentData.paymentDeviceList) && paymentData.paymentDeviceList.length > 0 ? ["reader"] : []
8352
+ ];
8353
+ const goToList = () => {
8354
+ setActive("card");
8355
+ setActiveinCard("list");
8356
+ setActiveinBank("list");
8357
+ setError("");
8358
+ };
8359
+ const payWithOther = () => {
8360
+ setActive("card");
8361
+ setActiveinCard("form");
8362
+ setActiveinBank("form");
8363
+ setError("");
8364
+ };
8365
+ const switchMethod = (m) => {
8366
+ setActive(m);
8367
+ if (m === "card" || m === "ach") {
8368
+ setActiveinCard("form");
8369
+ setActiveinBank("form");
8370
+ }
8371
+ setError("");
8372
+ };
8373
+ const rightTitle = showList ? "Payment methods" : activetab === "reader" ? "Reader payment" : activetab === "ach" ? "Bank payment" : "Card payment";
8374
+ const showBack = hasSaved && !showList;
8375
+ const MethodToggle = /* @__PURE__ */ jsx27(
8376
+ FractalMethodToggle,
8377
+ {
8378
+ methods: [
8379
+ { value: "card", label: "Card" },
8380
+ ...availableMethods.includes("ach") ? [{ value: "ach", label: "Bank" }] : [],
8381
+ ...availableMethods.includes("reader") ? [{ value: "reader", label: "Reader" }] : []
8382
+ ],
8383
+ active: activetab,
8384
+ onChange: switchMethod
8385
+ }
8386
+ );
8387
+ const summaryLines = [
8388
+ { label: "Subtotal", value: fmtNum(summarySubtotal) },
8389
+ { label: "Discount", value: fmtNum(discountNum), muted: true },
8390
+ { label: "Tax", value: fmtNum(taxNum), muted: true },
8391
+ ...showSurchargeLine ? [{ label: "Surcharge", value: formatUSD(surchargeFee.toFixed(2)) }] : []
8392
+ ];
8393
+ const summaryNote = isBankView ? null : !hasFee ? null : /* @__PURE__ */ jsxs14("div", { className: "fps-note", children: [
8394
+ /* @__PURE__ */ jsx27("b", { children: formatUSD(baseAmount.toFixed(2)) }),
8395
+ " if customer pays with debit or by bank (no surcharge)."
8396
+ ] });
8397
+ const partialInput = (props == null ? void 0 : props.allowPartial) ? /* @__PURE__ */ jsx27(FractalField, { label: "Partial payment", htmlFor: "partialpayment", error: partialError, children: /* @__PURE__ */ jsx27(
8398
+ NumericFormat,
8399
+ {
8400
+ id: "partialpayment",
8401
+ className: "fps-input",
8402
+ prefix: "$",
8403
+ thousandSeparator: true,
8404
+ allowNegative: false,
8405
+ allowLeadingZeros: false,
8406
+ decimalScale: 2,
8407
+ fixedDecimalScale: true,
8408
+ placeholder: "Enter partial amount",
8409
+ value: partialAmount,
8410
+ onValueChange: handlePartialChange
8411
+ }
8412
+ ) }) : null;
8413
+ const LeftSummary = /* @__PURE__ */ jsx27(
8414
+ FractalOrderSummary,
8415
+ {
8416
+ logo: paymentData == null ? void 0 : paymentData.logo,
8417
+ invoiceLabel,
8418
+ lines: summaryLines,
8419
+ total: formatUSD(effectiveTotal.toFixed(2)),
8420
+ cardIcons: isBankView ? null : { visa: visa2, mastercard: mastercard2, amex: americanexp2, discover: discover2 },
8421
+ note: summaryNote,
8422
+ secureIcon: secure2,
8423
+ extra: partialInput
8424
+ }
8425
+ );
8426
+ const AuthText = /* @__PURE__ */ jsxs14("p", { className: "fps-auth", children: [
8427
+ "By paying, you authorize ",
8428
+ merchantName,
8429
+ " to charge ",
8430
+ formatUSD(effectiveTotal.toFixed(2)),
8431
+ " to your ",
8432
+ isBankView ? "account" : "card",
8433
+ ". ",
8434
+ /* @__PURE__ */ jsx27("u", { children: "Refund policy" }),
8435
+ "."
8436
+ ] });
8437
+ return /* @__PURE__ */ jsxs14(Fragment14, { children: [
8438
+ /* @__PURE__ */ jsx27(DataScript, {}),
8439
+ (paymentData == null ? void 0 : paymentData.paymentGateway) === 32 && /* @__PURE__ */ jsx27(FractalTokenizerScript, { onLoad: () => setTokenizerReady(true) }),
8440
+ (paymentData == null ? void 0 : paymentData.paymentGateway) === 31 && /* @__PURE__ */ jsx27(
8310
8441
  DataCapScriptLoader,
8311
8442
  {
8312
8443
  onReady: () => {
@@ -8319,521 +8450,233 @@ function PartialPayment(props) {
8319
8450
  }
8320
8451
  }
8321
8452
  ),
8322
- /* @__PURE__ */ jsxs16(Fragment16, { children: [
8323
- /* @__PURE__ */ jsx29("button", { ref: buttonRef, style: { display: "none" }, className: "paymentBtn", onClick: handleShow, children: "Pay" }),
8324
- /* @__PURE__ */ jsxs16(
8453
+ /* @__PURE__ */ jsx27(Chargewidgetstyles, {}),
8454
+ /* @__PURE__ */ jsx27(CardBankRadioStyles, {}),
8455
+ /* @__PURE__ */ jsx27(FractalWidgetStyles, {}),
8456
+ /* @__PURE__ */ jsxs14(Fragment14, { children: [
8457
+ /* @__PURE__ */ jsx27("button", { ref: buttonRef, style: { display: "none" }, className: "paymentBtn", onClick: handleShow, children: "Pay" }),
8458
+ /* @__PURE__ */ jsxs14(
8325
8459
  CustomModal2_default,
8326
8460
  {
8327
8461
  open: show,
8328
8462
  onClose: handleClose,
8463
+ maxWidth: "760px",
8329
8464
  children: [
8330
- error && /* @__PURE__ */ jsx29("div", { style: { maxHeight: "606px", minHeight: "60vh", padding: "40px" }, children: /* @__PURE__ */ jsx29(ErrorCardMessage_default, { error, onClose: handleClose }) }),
8331
- errorIframe && /* @__PURE__ */ jsx29("div", { style: { maxHeight: "606px", minHeight: "60vh", padding: "40px" }, children: /* @__PURE__ */ jsx29(ErrorCardMessage_default, { error: errorIframe, onClose: () => {
8465
+ error && /* @__PURE__ */ jsx27("div", { style: { maxHeight: "606px", minHeight: "60vh", padding: "40px" }, children: /* @__PURE__ */ jsx27(ErrorCardMessage_default, { error, onClose: handleClose }) }),
8466
+ errorIframe && /* @__PURE__ */ jsx27("div", { style: { maxHeight: "606px", minHeight: "60vh", padding: "40px" }, children: /* @__PURE__ */ jsx27(ErrorCardMessage_default, { error: errorIframe, onClose: () => {
8332
8467
  setErrorIframe("");
8333
8468
  } }) }),
8334
- success && /* @__PURE__ */ jsx29(SuccessMsz, { onClose: handleClose, tranId, isDebitAdjusted }),
8335
- !error && !success && !errorIframe && /* @__PURE__ */ jsxs16(Fragment16, { children: [
8336
- (loading || loading2 || loadingIframe) && /* @__PURE__ */ jsx29(Loader_default, { loading: loading || loading2 || loadingIframe, loaderText }),
8337
- /* @__PURE__ */ jsx29("div", { className: "frac-card-payment-page frac-form", children: /* @__PURE__ */ jsxs16("div", { className: "parent-pay-container", children: [
8338
- /* @__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: [
8339
- /* @__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" }) }),
8340
- /* @__PURE__ */ jsx29("defs", { children: /* @__PURE__ */ jsx29("clipPath", { id: "clip0_12425_52336", children: /* @__PURE__ */ jsx29("rect", { width: "16", height: "16", fill: "white" }) }) })
8341
- ] }) }),
8342
- /* @__PURE__ */ jsx29("div", { className: "pay-main-logo-res", children: /* @__PURE__ */ jsx29("img", { src: paymentData == null ? void 0 : paymentData.logo, id: "pay-logos" }) }),
8343
- /* @__PURE__ */ jsxs16("div", { className: "pay-container", children: [
8344
- /* @__PURE__ */ jsxs16("div", { className: "pay-header pay-conatiner-one frac-pay-conatiner-one", children: [
8345
- /* @__PURE__ */ jsxs16("div", { className: "pay-conatiner-one-first", children: [
8346
- /* @__PURE__ */ jsxs16("div", { className: "pay-logo-container", children: [
8347
- /* @__PURE__ */ jsx29("div", { className: "pay-main-logo", children: /* @__PURE__ */ jsx29("img", { src: paymentData == null ? void 0 : paymentData.logo, id: "pay-logos" }) }),
8348
- (cardList == null ? void 0 : cardList.length) > 0 && activetab !== "cardList" && /* @__PURE__ */ jsxs16("button", { className: "res-charge-payment-back-btn ", onClick: () => setActive("cardList"), children: [
8349
- " ",
8350
- /* @__PURE__ */ jsx29(IoArrowBack, {}),
8351
- " Back"
8352
- ] })
8353
- ] }),
8354
- /* @__PURE__ */ jsxs16("div", { className: "amt-pay-con", children: [
8355
- /* @__PURE__ */ jsx29("div", { className: "pay-amount-conatiner", children: /* @__PURE__ */ jsx29("small", { className: "pay-payment-amount", children: "Select payment type" }) }),
8356
- /* @__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 }) }),
8357
- !loading && (activetab === "card" || activetab === "reader") && (props == null ? void 0 : props.pass_fee) && cashDiscount && cashDiscount > 0 && /* @__PURE__ */ jsxs16("div", { className: "frac-cash-discount-fee", children: [
8358
- /* @__PURE__ */ jsx29("small", { children: (paymentData == null ? void 0 : paymentData.surchargeProgram) == 1 ? "Surcharge" : (paymentData == null ? void 0 : paymentData.showSurcharge) ? "3% Card Fee" : "Cash Discount" }),
8359
- /* @__PURE__ */ jsx29("p", { children: formatUSD((Number(props.amount) - cashDiscount).toFixed(2)) })
8360
- ] }),
8361
- !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(
8362
- "div",
8363
- {
8364
- id: "surcharge-program-notice",
8365
- className: "surcharge-program-notice-text",
8366
- children: [
8367
- "A 3% processing surcharge is applied to all credit card transactions. Debit card payments are processed for",
8368
- " ",
8369
- /* @__PURE__ */ jsxs16("span", { className: "surcharge-program-notice-text-att", children: [
8370
- "$",
8371
- Number(cashDiscount).toLocaleString("en-US", {
8372
- minimumFractionDigits: 2,
8373
- maximumFractionDigits: 2
8374
- })
8375
- ] })
8376
- ]
8469
+ success && /* @__PURE__ */ jsx27(SuccessMsz, { onClose: handleClose, tranId, isDebitAdjusted }),
8470
+ !error && !success && !errorIframe && /* @__PURE__ */ jsxs14(Fragment14, { children: [
8471
+ (loading || loading2 || loadingIframe || surchargeLookupLoading) && /* @__PURE__ */ jsx27(Loader_default, { loading: loading || loading2 || loadingIframe || surchargeLookupLoading, loaderText }),
8472
+ /* @__PURE__ */ jsxs14("div", { className: "fps-modal", children: [
8473
+ LeftSummary,
8474
+ /* @__PURE__ */ jsxs14("section", { className: "fps-content", children: [
8475
+ /* @__PURE__ */ jsx27(FractalModalHeader, { title: rightTitle, onBack: showBack ? goToList : void 0, onClose: handleClose }),
8476
+ showList ? /* @__PURE__ */ jsxs14(Fragment14, { children: [
8477
+ /* @__PURE__ */ jsx27(
8478
+ FractalSavedMethods,
8479
+ {
8480
+ sectionLabel: "Cards / bank accounts",
8481
+ items: savedMethods.map((card) => {
8482
+ const isBankCard = (card == null ? void 0 : card.card_type) === "Bank";
8483
+ let isDisabled = false;
8484
+ if (paymentData == null ? void 0 : paymentData.paymentGateway) {
8485
+ isDisabled = (paymentData == null ? void 0 : paymentData.paymentGateway) != (card == null ? void 0 : card.payment_method_type) && !isBankCard;
8377
8486
  }
8378
- ) }),
8379
- (props == null ? void 0 : props.allowPartial) && /* @__PURE__ */ jsxs16("div", { className: "frac-partial-payment-input", children: [
8380
- /* @__PURE__ */ jsx29("label", { htmlFor: "partialpayment", children: "Partial Payment" }),
8381
- /* @__PURE__ */ jsx29(
8382
- NumericFormat,
8383
- {
8384
- prefix: "$",
8385
- className: "form-control",
8386
- value: partialAmount,
8387
- onValueChange: (values) => {
8388
- handlePartialChange(values);
8389
- },
8390
- thousandSeparator: true,
8391
- placeholder: "Enter partial amount",
8392
- allowNegative: false,
8393
- allowLeadingZeros: false,
8394
- decimalScale: 2,
8395
- fixedDecimalScale: true
8396
- }
8397
- ),
8398
- partialError && /* @__PURE__ */ jsx29("span", { className: "error-span", children: partialError })
8399
- ] })
8400
- ] })
8401
- ] }),
8402
- /* @__PURE__ */ jsxs16("div", { className: "pay-conatiner-one-last", children: [
8403
- /* @__PURE__ */ jsx29("img", { src: secure2, alt: "" }),
8404
- /* @__PURE__ */ jsx29("img", { src: pov2, alt: "" }),
8405
- "Secure payments powered by Fractal"
8406
- ] })
8407
- ] }),
8408
- /* @__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: [
8409
- activetab !== "cardList" ? /* @__PURE__ */ jsxs16("div", { className: "frac-charge-payment-back-btn-wrap ", children: [
8410
- (cardList == null ? void 0 : cardList.length) > 0 && /* @__PURE__ */ jsxs16("button", { className: "charge-payment-back-btn ", onClick: () => setActive("cardList"), children: [
8411
- " ",
8412
- /* @__PURE__ */ jsx29(IoArrowBack, {}),
8413
- " Back"
8414
- ] }),
8415
- (paymentData == null ? void 0 : paymentData.isSkyFiAccount) && /* @__PURE__ */ jsxs16("div", { className: "tab", children: [
8416
- /* @__PURE__ */ jsxs16("button", { className: "tablinks", onClick: (e) => {
8417
- handletabchange("card");
8418
- }, style: { border: activetab === "card" ? "1px solid" : "" }, children: [
8419
- /* @__PURE__ */ jsx29("i", { className: "fas fa-credit-card me-2", style: { marginRight: "8px", fontSize: "15px" } }),
8420
- "Card"
8421
- ] }),
8422
- /* @__PURE__ */ jsxs16("button", { className: "tablinks", onClick: (e) => {
8423
- handletabchange("ach");
8424
- }, style: { border: activetab === "ach" ? "1px solid" : "" }, children: [
8425
- /* @__PURE__ */ jsx29("i", { className: "fas fa-university me-2", style: { marginRight: "8px", fontSize: "15px" } }),
8426
- "Bank"
8427
- ] })
8428
- ] }),
8429
- /* @__PURE__ */ jsxs16("div", { className: "res-pay-con", children: [
8430
- /* @__PURE__ */ jsxs16("div", { className: "pay-amount-conatiner", style: { margin: 0 }, children: [
8431
- /* @__PURE__ */ jsx29("small", { className: "pay-payment-amount", children: "Payment Amount" }),
8432
- /* @__PURE__ */ jsxs16("strong", { className: "pay-amount", children: [
8433
- "$",
8434
- (_b = Number(aftertaxAmount)) == null ? void 0 : _b.toFixed(2)
8435
- ] })
8436
- ] }),
8437
- activetab != "ach" && /* @__PURE__ */ jsxs16("div", { children: [
8438
- /* @__PURE__ */ jsxs16("div", { children: [
8439
- /* @__PURE__ */ jsx29("img", { src: visa2, alt: "", width: 35, style: { paddingRight: "5px" } }),
8440
- /* @__PURE__ */ jsx29("img", { src: mastercard2, width: 35, alt: "" })
8441
- ] }),
8442
- /* @__PURE__ */ jsxs16("div", { children: [
8443
- /* @__PURE__ */ jsx29("img", { src: americanexp2, alt: "", width: 35, style: { paddingRight: "5px" } }),
8444
- /* @__PURE__ */ jsx29("img", { src: discover2, width: 35, alt: "" })
8445
- ] })
8446
- ] })
8447
- ] }),
8448
- !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: [
8449
- /* @__PURE__ */ jsxs16("small", { children: [
8450
- activetab === "card" ? "Cash Discount" : "Cash Discount Savings",
8451
- " "
8452
- ] }),
8453
- /* @__PURE__ */ jsx29("p", { children: formatUSD((Number(aftertaxAmount) - cashDiscount).toFixed(2)) })
8454
- ] }) : null : cashDiscount && cashDiscount > 0 && (props == null ? void 0 : props.pass_fee) && activetab === "card" ? /* @__PURE__ */ jsxs16("div", { className: "frac-cash-discount-fee", children: [
8455
- /* @__PURE__ */ jsxs16("small", { children: [
8456
- activetab === "card" ? "Surcharge" : null,
8457
- " "
8458
- ] }),
8459
- /* @__PURE__ */ jsx29("p", { children: formatUSD((Number(aftertaxAmount) - cashDiscount).toFixed(2)) })
8460
- ] }) : null
8461
- ] }) : /* @__PURE__ */ jsxs16("div", { children: [
8462
- /* @__PURE__ */ jsxs16("h6", { className: "charge-customer-name", style: { marginBottom: "16px !important" }, children: [
8463
- " Charge ",
8464
- paymentData == null ? void 0 : paymentData.customer_name
8465
- ] }),
8466
- /* @__PURE__ */ jsxs16("h6", { className: "card-ach-heading", style: { marginBottom: "10px !important" }, children: [
8467
- " ",
8468
- activeList === "card" ? "Cards/Banks" : "Readers",
8469
- " "
8470
- ] }),
8471
- /* @__PURE__ */ jsxs16("div", { className: "res-pay-con", children: [
8472
- /* @__PURE__ */ jsxs16("div", { className: "pay-amount-conatiner", style: { margin: 0 }, children: [
8473
- /* @__PURE__ */ jsx29("small", { className: "pay-payment-amount", children: "Payment Amount" }),
8474
- /* @__PURE__ */ jsxs16("strong", { className: "pay-amount", children: [
8475
- "$",
8476
- (_c = Number(aftertaxAmount)) == null ? void 0 : _c.toFixed(2)
8477
- ] })
8478
- ] }),
8479
- /* @__PURE__ */ jsxs16("div", { children: [
8480
- /* @__PURE__ */ jsxs16("div", { children: [
8481
- /* @__PURE__ */ jsx29("img", { src: visa2, alt: "", width: 35, style: { paddingRight: "5px" } }),
8482
- /* @__PURE__ */ jsx29("img", { src: mastercard2, width: 35, alt: "" })
8483
- ] }),
8484
- /* @__PURE__ */ jsxs16("div", { children: [
8485
- /* @__PURE__ */ jsx29("img", { src: americanexp2, alt: "", width: 35, style: { paddingRight: "5px" } }),
8486
- /* @__PURE__ */ jsx29("img", { src: discover2, width: 35, alt: "" })
8487
- ] })
8488
- ] })
8489
- ] })
8490
- ] }),
8491
- /* @__PURE__ */ jsxs16("div", { id: "card", style: { display: activetab === "card" ? "block" : "none" }, className: "tabcontent", children: [
8492
- /* @__PURE__ */ jsxs16("div", { className: "frac-card-payment", children: [
8493
- /* @__PURE__ */ jsxs16("div", { className: "frac-heading-card-wrap", children: [
8494
- /* @__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: [
8495
- " ",
8496
- /* @__PURE__ */ jsx29(IoArrowBack, {})
8497
- ] }) }),
8498
- /* @__PURE__ */ jsx29("h6", { className: "frac-card-payment-heading", children: "Card Payment" })
8499
- ] }),
8500
- activetab != "ach" && /* @__PURE__ */ jsxs16("div", { style: { display: "flex", gap: "8px", margin: "8px 0px 19px 0px" }, children: [
8501
- /* @__PURE__ */ jsx29("img", { src: visa2, alt: "", width: 33 }),
8502
- /* @__PURE__ */ jsx29("img", { src: mastercard2, width: 33, alt: "" }),
8503
- /* @__PURE__ */ jsx29("img", { src: americanexp2, alt: "", width: 33 }),
8504
- /* @__PURE__ */ jsx29("img", { src: discover2, width: 33, alt: "" })
8505
- ] })
8506
- ] }),
8507
- activeinCard === "list" ? /* @__PURE__ */ jsxs16(Fragment16, { children: [
8508
- /* @__PURE__ */ jsx29(CardList, { listHeading: "Cards", paymentGateway: paymentData == null ? void 0 : paymentData.paymentGateway, ListItems: cardList, selectedCard, setSelectedCard, handleDeleteCard, otherButtonLabel: "Pay With Other Card", otherButtonAction: () => {
8509
- setActiveinCard("form");
8510
- } }),
8511
- /* @__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)) }) })
8512
- ] }) : (paymentData == null ? void 0 : paymentData.paymentGateway) === 32 ? /* @__PURE__ */ jsxs16(
8513
- "form",
8487
+ return {
8488
+ id: card == null ? void 0 : card.id,
8489
+ primaryText: `**** ${card == null ? void 0 : card.cardlastfourdigit}`,
8490
+ secondaryText: isBankCard ? void 0 : `${card == null ? void 0 : card.expmonth}/${card == null ? void 0 : card.expyear}`,
8491
+ badge: isBankCard ? "BANK" : (card == null ? void 0 : card.card_issue_type) || "CARD",
8492
+ brandLogo: isBankCard ? void 0 : getCardType2(card == null ? void 0 : card.card_type),
8493
+ disabled: isDisabled
8494
+ };
8495
+ }),
8496
+ selectedId: selectedCard == null ? void 0 : selectedCard.id,
8497
+ onSelect: (id) => setSelectedCard(savedMethods.find((c) => (c == null ? void 0 : c.id) === id)),
8498
+ onRemove: (id) => handleDeleteCard(id),
8499
+ removeIcon: trash2,
8500
+ otherLabel: "Pay with other method",
8501
+ onOther: payWithOther,
8502
+ otherIcon: defaultcard2
8503
+ }
8504
+ ),
8505
+ /* @__PURE__ */ jsx27(
8506
+ FractalFooter,
8507
+ {
8508
+ authText: AuthText,
8509
+ disabled: loading2 || !(selectedCard == null ? void 0 : selectedCard.id) || surchargeLookupLoading,
8510
+ onPay: handlechargeCustomer,
8511
+ buttonLabel: `Pay ${formatUSD(effectiveTotal.toFixed(2))} to ${merchantName}`
8512
+ }
8513
+ )
8514
+ ] }) : activetab === "reader" ? (
8515
+ /* ---------- Reader ---------- */
8516
+ /* @__PURE__ */ jsxs14(Fragment14, { children: [
8517
+ MethodToggle,
8518
+ /* @__PURE__ */ jsx27(
8519
+ FractalReaderList,
8514
8520
  {
8515
- id: "paymentForm",
8516
- onSubmit: submitFunc,
8517
- onKeyDown: (e) => {
8518
- if (e.key === "Enter" && loading2) {
8519
- e.preventDefault();
8520
- e.stopPropagation();
8521
- }
8522
- },
8523
- children: [
8524
- /* @__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: [
8525
- /* @__PURE__ */ jsxs16("div", { className: "form-group", children: [
8526
- /* @__PURE__ */ jsx29("label", { htmlFor: "cardHolderName", children: "NAME ON CARD " }),
8527
- /* @__PURE__ */ jsx29("input", { type: "text", className: "form-control", maxLength: 100, placeholder: "John Doe", value: (cardData == null ? void 0 : cardData.cardName) || "", onChange: (e) => {
8528
- const value = e.target.value;
8529
- if (/^[a-zA-Z\s]*$/.test(value)) {
8530
- handleCardChange("cardName", value);
8531
- }
8532
- } }),
8533
- (cardError == null ? void 0 : cardError.cardName) && /* @__PURE__ */ jsx29("span", { className: "error-span", children: cardError == null ? void 0 : cardError.cardName })
8534
- ] }),
8535
- /* @__PURE__ */ jsxs16("div", { className: "form-group", children: [
8536
- /* @__PURE__ */ jsx29("label", { children: "CARD NUMBER" }),
8537
- /* @__PURE__ */ jsx29("div", { className: "toggle-num-wrapper", children: show && (paymentData == null ? void 0 : paymentData.paymentGateway) === 32 && isTokenizerReady && /* @__PURE__ */ jsx29(
8538
- FractalFields_default,
8539
- {
8540
- fractalStyles,
8541
- tokenizerRef
8542
- }
8543
- ) })
8544
- ] }),
8545
- /* @__PURE__ */ jsxs16("div", { className: "form-group", children: [
8546
- /* @__PURE__ */ jsx29("label", { htmlFor: "OrderId", children: "Order ID / Description" }),
8547
- /* @__PURE__ */ jsx29(
8548
- "input",
8549
- {
8550
- type: "text",
8551
- className: "form-control",
8552
- maxLength: 100,
8553
- placeholder: "Order Id",
8554
- disabled: true,
8555
- value: (_f = props == null ? void 0 : props.orderID) != null ? _f : "",
8556
- style: { background: "#F6F6F7", color: "#727272" }
8557
- }
8558
- )
8559
- ] }),
8560
- /* @__PURE__ */ jsxs16("div", { className: "form-group", children: [
8561
- /* @__PURE__ */ jsx29("label", { htmlFor: "zip", children: "ZIP" }),
8562
- /* @__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) }),
8563
- (cardError == null ? void 0 : cardError.zipCode) && /* @__PURE__ */ jsx29("span", { className: "error-span", children: cardError == null ? void 0 : cardError.zipCode })
8564
- ] }),
8565
- (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: [
8566
- /* @__PURE__ */ jsx29(
8567
- "input",
8568
- {
8569
- type: "checkbox",
8570
- id: "save_card",
8571
- className: "toggle-checkbox",
8572
- checked: saveCardInfo,
8573
- onChange: (e) => setSaveCardInfo(e.target.checked)
8574
- }
8575
- ),
8576
- /* @__PURE__ */ jsx29("label", { htmlFor: "save_card", className: "toggle-label" }),
8577
- /* @__PURE__ */ jsx29("label", { htmlFor: "save_card", children: "Save card for future payments " }),
8578
- /* @__PURE__ */ jsxs16("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: [
8579
- /* @__PURE__ */ jsxs16("g", { clipPath: "url(#clip0_12420_50192)", children: [
8580
- /* @__PURE__ */ jsx29("rect", { width: "20", height: "20", fill: "white" }),
8581
- /* @__PURE__ */ jsx29("circle", { cx: "10", cy: "10", r: "10", fill: "#E0DFE2" }),
8582
- /* @__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" })
8583
- ] }),
8584
- /* @__PURE__ */ jsx29("defs", { children: /* @__PURE__ */ jsx29("clipPath", { id: "clip0_12420_50192", children: /* @__PURE__ */ jsx29("rect", { width: "20", height: "20", fill: "white" }) }) })
8585
- ] })
8586
- ] }) })
8587
- ] }),
8588
- /* @__PURE__ */ jsxs16("div", { className: "form-group", style: { marginTop: "20px", padding: "0" }, children: [
8589
- (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" }),
8590
- /* @__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)) })
8591
- ] })
8592
- ]
8521
+ sectionLabel: "Readers",
8522
+ 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 })),
8523
+ selectedId: (selectedReader == null ? void 0 : selectedReader.id) != null ? String(selectedReader == null ? void 0 : selectedReader.id) : void 0,
8524
+ onSelect: (id) => setSelectedReader(((paymentData == null ? void 0 : paymentData.paymentDeviceList) || []).find((r) => String(r == null ? void 0 : r.id) === id)),
8525
+ icon: pax2
8593
8526
  }
8594
- ) : /* @__PURE__ */ jsxs16("form", { id: "PaymentForm", style: { textAlign: "start" }, onSubmit: submitFunc, onKeyDown: (e) => {
8595
- if (e.key === "Enter" && loading2) {
8596
- e.preventDefault();
8597
- e.stopPropagation();
8527
+ ),
8528
+ /* @__PURE__ */ jsx27(
8529
+ FractalFooter,
8530
+ {
8531
+ authText: AuthText,
8532
+ disabled: loading2,
8533
+ onPay: handleChargewithEMV,
8534
+ buttonLabel: `Pay ${formatUSD(effectiveTotal.toFixed(2))} to ${merchantName}`
8598
8535
  }
8599
- }, children: [
8600
- /* @__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: [
8601
- /* @__PURE__ */ jsxs16("div", { className: "form-group", children: [
8602
- /* @__PURE__ */ jsx29("label", { htmlFor: "cardHolderName", children: "NAME ON CARD " }),
8603
- /* @__PURE__ */ jsx29("input", { type: "text", className: "form-control", maxLength: 100, placeholder: "John Doe", value: (cardData == null ? void 0 : cardData.cardName) || "", onChange: (e) => {
8604
- const value = e.target.value;
8605
- if (/^[a-zA-Z\s]*$/.test(value)) {
8606
- handleCardChange("cardName", value);
8607
- }
8608
- } }),
8609
- (cardError == null ? void 0 : cardError.cardName) && /* @__PURE__ */ jsx29("span", { className: "error-span", children: cardError == null ? void 0 : cardError.cardName })
8610
- ] }),
8611
- /* @__PURE__ */ jsx29("div", { className: "form-group", children: /* @__PURE__ */ jsx29(
8612
- DataCapFields,
8613
- {
8614
- isOpen: show,
8615
- tokenKey: paymentData == null ? void 0 : paymentData.dctoken,
8616
- setLoader: setLoadingIframe,
8617
- onError: (msg) => setError(msg || DcLoadingError)
8618
- }
8619
- ) }),
8620
- /* @__PURE__ */ jsxs16("div", { className: "form-group", children: [
8621
- /* @__PURE__ */ jsx29("label", { htmlFor: "OrderId", children: "Order ID / Description" }),
8622
- /* @__PURE__ */ jsx29(
8623
- "input",
8624
- {
8625
- type: "text",
8626
- className: "form-control",
8627
- maxLength: 100,
8628
- placeholder: "Order Id",
8629
- disabled: true,
8630
- value: (_k = props == null ? void 0 : props.orderID) != null ? _k : "",
8631
- style: { background: "#F6F6F7", color: "#727272" }
8632
- }
8633
- )
8634
- ] }),
8635
- /* @__PURE__ */ jsxs16("div", { className: "form-group", children: [
8636
- /* @__PURE__ */ jsx29("label", { htmlFor: "zip", children: "ZIP" }),
8637
- /* @__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) }),
8638
- (cardError == null ? void 0 : cardError.zipCode) && /* @__PURE__ */ jsx29("span", { className: "error-span", children: cardError == null ? void 0 : cardError.zipCode })
8639
- ] }),
8640
- (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: [
8641
- /* @__PURE__ */ jsx29(
8642
- "input",
8643
- {
8644
- type: "checkbox",
8645
- id: "save_card",
8646
- className: "toggle-checkbox",
8647
- checked: saveCardInfo,
8648
- onChange: (e) => setSaveCardInfo(e.target.checked)
8536
+ )
8537
+ ] })
8538
+ ) : activetab === "ach" ? (
8539
+ /* ---------- Bank form ---------- */
8540
+ /* @__PURE__ */ jsxs14(
8541
+ "form",
8542
+ {
8543
+ id: "ACHPaymentForm",
8544
+ autoComplete: "off",
8545
+ onSubmit: submitFunc,
8546
+ onKeyDown: (e) => {
8547
+ if (e.key === "Enter" && loading2) {
8548
+ e.preventDefault();
8549
+ e.stopPropagation();
8550
+ }
8551
+ },
8552
+ style: { display: "flex", flexDirection: "column", gap: "20px", flex: "1 1 auto", minHeight: 0, width: "100%" },
8553
+ children: [
8554
+ MethodToggle,
8555
+ /* @__PURE__ */ jsxs14("div", { className: "fps-scroll", children: [
8556
+ /* @__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 }) }),
8557
+ /* @__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 }) }),
8558
+ /* @__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 }) }),
8559
+ /* @__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 }) }),
8560
+ /* @__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 }) }),
8561
+ ((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 }) }),
8562
+ /* @__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: [
8563
+ /* @__PURE__ */ jsx27("option", { value: "", children: "Select" }),
8564
+ accountTypes.map((type) => /* @__PURE__ */ jsx27("option", { value: type.value, children: type.label }, type.value))
8565
+ ] }) }),
8566
+ (props == null ? void 0 : props.customerId) && /* @__PURE__ */ jsxs14(FractalCheckbox, { id: "saveACH", checked: saveACHinfo, onChange: (v) => {
8567
+ setSaveACHinfo(v);
8568
+ if (!v) {
8569
+ setSaveACHConsent1(false);
8570
+ setErrorBankConsentOther("");
8649
8571
  }
8650
- ),
8651
- /* @__PURE__ */ jsx29("label", { htmlFor: "save_card", className: "toggle-label" }),
8652
- /* @__PURE__ */ jsx29("label", { htmlFor: "save_card", children: "Save card for future payments " }),
8653
- /* @__PURE__ */ jsxs16("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: [
8654
- /* @__PURE__ */ jsxs16("g", { clipPath: "url(#clip0_12420_50192)", children: [
8655
- /* @__PURE__ */ jsx29("rect", { width: "20", height: "20", fill: "white" }),
8656
- /* @__PURE__ */ jsx29("circle", { cx: "10", cy: "10", r: "10", fill: "#E0DFE2" }),
8657
- /* @__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" })
8572
+ }, children: [
8573
+ "Save this bank account. ",
8574
+ merchantName,
8575
+ " may charge it for future invoices. ",
8576
+ /* @__PURE__ */ jsx27("u", { children: "See terms" }),
8577
+ "."
8578
+ ] }),
8579
+ saveACHinfo && /* @__PURE__ */ jsxs14(Fragment14, { children: [
8580
+ /* @__PURE__ */ jsxs14(FractalCheckbox, { id: "saveACHConsent1", checked: saveACHConsent1, onChange: (v) => {
8581
+ setSaveACHConsent1(v);
8582
+ if (v) setErrorBankConsentOther("");
8583
+ }, children: [
8584
+ "By providing my bank account information and selecting \u2018Save for future payments\u2019, I authorize ",
8585
+ merchantName,
8586
+ " 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."
8658
8587
  ] }),
8659
- /* @__PURE__ */ jsx29("defs", { children: /* @__PURE__ */ jsx29("clipPath", { id: "clip0_12420_50192", children: /* @__PURE__ */ jsx29("rect", { width: "20", height: "20", fill: "white" }) }) })
8588
+ errorBankConsentOther && /* @__PURE__ */ jsx27("span", { className: "fps-error", children: errorBankConsentOther })
8589
+ ] }),
8590
+ !saveACHinfo && /* @__PURE__ */ jsxs14(Fragment14, { children: [
8591
+ /* @__PURE__ */ jsxs14(FractalCheckbox, { id: "achconsent", checked: isBankConsentChecked, onChange: (v) => {
8592
+ setIsBankConsentChecked(v);
8593
+ if (v) setErrorBankConsent("");
8594
+ }, children: [
8595
+ "By selecting this box, I authorize ",
8596
+ merchantName,
8597
+ " 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."
8598
+ ] }),
8599
+ errorBankConsent && /* @__PURE__ */ jsx27("span", { className: "fps-error", children: errorBankConsent })
8660
8600
  ] })
8661
- ] }) })
8662
- ] }),
8663
- /* @__PURE__ */ jsxs16("div", { className: "form-group", style: { marginTop: "20px", padding: "0" }, children: [
8664
- (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" }),
8665
- /* @__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)) })
8666
- ] })
8667
- ] })
8668
- ] }),
8669
- /* @__PURE__ */ jsxs16("div", { id: "ach", style: { display: activetab === "ach" ? "block" : "none" }, className: "tabcontent", children: [
8670
- /* @__PURE__ */ jsx29("div", { className: "frac-card-payment", children: /* @__PURE__ */ jsxs16("div", { className: "frac-heading-card-wrap", children: [
8671
- /* @__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: [
8672
- " ",
8673
- /* @__PURE__ */ jsx29(IoArrowBack, {})
8674
- ] }) }),
8675
- /* @__PURE__ */ jsx29("h6", { className: "frac-card-payment-heading", children: "Bank Payment" })
8676
- ] }) }),
8677
- activeinBank === "list" ? /* @__PURE__ */ jsxs16(Fragment16, { children: [
8678
- /* @__PURE__ */ jsx29(CardList, { listHeading: "Banks", paymentGateway: paymentData == null ? void 0 : paymentData.paymentGateway, ListItems: bankList, selectedCard, setSelectedCard, handleDeleteCard, otherButtonLabel: "Pay With Other Bank", otherButtonAction: () => {
8679
- setActiveinBank("form");
8680
- } }),
8681
- /* @__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)) }) })
8682
- ] }) : /* @__PURE__ */ jsxs16("form", { id: "ACHPaymentForm", style: { textAlign: "start" }, onSubmit: submitFunc, autoComplete: "off", onKeyDown: (e) => {
8683
- if (e.key === "Enter" && loading2) {
8684
- e.preventDefault();
8685
- e.stopPropagation();
8686
- }
8687
- }, children: [
8688
- /* @__PURE__ */ jsxs16("div", { className: "ach-scrl", style: {
8689
- 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",
8690
- maxHeight: (paymentData == null ? void 0 : paymentData.isSkyFiAccount) && (cardList == null ? void 0 : cardList.length) > 0 ? "444px" : (cardList == null ? void 0 : cardList.length) > 0 ? "380px" : "380px"
8691
- }, children: [
8692
- /* @__PURE__ */ jsxs16("div", { className: "form-group mb-4", children: [
8693
- /* @__PURE__ */ jsx29("label", { htmlFor: "nameonaccount", children: "Name on account" }),
8694
- /* @__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 }),
8695
- (achError == null ? void 0 : achError.name) && /* @__PURE__ */ jsx29("span", { className: "error-span", children: achError == null ? void 0 : achError.name })
8696
- ] }),
8697
- /* @__PURE__ */ jsxs16("div", { className: "form-group mb-4", children: [
8698
- /* @__PURE__ */ jsx29("label", { htmlFor: "routingnumber", children: "Routing number" }),
8699
- /* @__PURE__ */ jsx29(
8700
- "input",
8701
- {
8702
- type: "text",
8703
- id: "routingnumber",
8704
- className: "form-control",
8705
- maxLength: 9,
8706
- placeholder: "000000000",
8707
- name: "routingNumber",
8708
- value: (_s = achData == null ? void 0 : achData.routingNumber) != null ? _s : "",
8709
- onChange: handleChangeAch
8710
- }
8711
- ),
8712
- (achError == null ? void 0 : achError.routingNumber) && /* @__PURE__ */ jsx29("span", { className: "error-span", children: achError == null ? void 0 : achError.routingNumber })
8713
- ] }),
8714
- /* @__PURE__ */ jsxs16("div", { className: "form-group mb-4", children: [
8715
- /* @__PURE__ */ jsx29("label", { htmlFor: "accountnumber", children: "Account number" }),
8716
- /* @__PURE__ */ jsx29(
8717
- "input",
8718
- {
8719
- type: "text",
8720
- id: "accountnumber",
8721
- className: "form-control",
8722
- maxLength: 16,
8723
- placeholder: "0000000000",
8724
- name: "accountNumber",
8725
- value: (_t = achData == null ? void 0 : achData.accountNumber) != null ? _t : "",
8726
- onChange: handleChangeAch
8727
- }
8728
- ),
8729
- (achError == null ? void 0 : achError.accountNumber) && /* @__PURE__ */ jsx29("span", { className: "error-span", children: achError == null ? void 0 : achError.accountNumber })
8730
- ] }),
8731
- /* @__PURE__ */ jsxs16("div", { className: "form-group mb-4", children: [
8732
- /* @__PURE__ */ jsx29("label", { htmlFor: "confirmaccountnumber", children: "Confirm account number" }),
8733
- /* @__PURE__ */ jsx29(
8734
- "input",
8735
- {
8736
- type: "text",
8737
- id: "confirmaccountnumber",
8738
- className: "form-control",
8739
- maxLength: 16,
8740
- placeholder: "0000000000",
8741
- name: "confirmAccountNumber",
8742
- value: (_u = achData == null ? void 0 : achData.confirmAccountNumber) != null ? _u : "",
8743
- onChange: handleChangeAch
8744
- }
8745
- ),
8746
- (achError == null ? void 0 : achError.confirmAccountNumber) && /* @__PURE__ */ jsx29("span", { className: "error-span", children: achError == null ? void 0 : achError.confirmAccountNumber })
8747
8601
  ] }),
8748
- /* @__PURE__ */ jsxs16("div", { className: "form-group mb-4", children: [
8749
- /* @__PURE__ */ jsx29("label", { htmlFor: "bankname", children: "Bank name" }),
8750
- /* @__PURE__ */ jsx29(
8602
+ /* @__PURE__ */ jsx27(
8603
+ FractalFooter,
8604
+ {
8605
+ authText: AuthText,
8606
+ submit: true,
8607
+ disabled: loading2,
8608
+ buttonLabel: `Pay ${formatUSD(effectiveTotal.toFixed(2))} to ${merchantName}`
8609
+ }
8610
+ )
8611
+ ]
8612
+ }
8613
+ )
8614
+ ) : (
8615
+ /* ---------- Card form ---------- */
8616
+ /* @__PURE__ */ jsxs14(
8617
+ "form",
8618
+ {
8619
+ id: (paymentData == null ? void 0 : paymentData.paymentGateway) === 32 ? "paymentForm" : "PaymentForm",
8620
+ onSubmit: submitFunc,
8621
+ onKeyDown: (e) => {
8622
+ if (e.key === "Enter" && loading2) {
8623
+ e.preventDefault();
8624
+ e.stopPropagation();
8625
+ }
8626
+ },
8627
+ style: { display: "flex", flexDirection: "column", gap: "20px", flex: "1 1 auto", minHeight: 0, width: "100%" },
8628
+ children: [
8629
+ MethodToggle,
8630
+ /* @__PURE__ */ jsxs14("div", { className: "fps-scroll", children: [
8631
+ /* @__PURE__ */ jsx27(FractalField, { label: "Name on card", htmlFor: "cardHolderName", error: cardError == null ? void 0 : cardError.cardName, children: /* @__PURE__ */ jsx27(
8751
8632
  "input",
8752
8633
  {
8753
- type: "text",
8754
- id: "bankname",
8755
- className: "form-control",
8634
+ id: "cardHolderName",
8635
+ className: "fps-input",
8756
8636
  maxLength: 100,
8757
- placeholder: "My Bank",
8758
- name: "bankName",
8759
- value: (_v = achData == null ? void 0 : achData.bankName) != null ? _v : "",
8760
- onChange: handleChangeAch
8637
+ placeholder: "John Doe",
8638
+ value: (cardData == null ? void 0 : cardData.cardName) || "",
8639
+ onChange: (e) => {
8640
+ const value = e.target.value;
8641
+ if (/^[a-zA-Z\s]*$/.test(value)) handleCardChange("cardName", value);
8642
+ }
8761
8643
  }
8762
- ),
8763
- (achError == null ? void 0 : achError.bankName) && /* @__PURE__ */ jsx29("span", { className: "error-span", children: achError == null ? void 0 : achError.bankName })
8764
- ] }),
8765
- ((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: [
8766
- /* @__PURE__ */ jsx29("label", { htmlFor: "companyName", children: "Company name" }),
8767
- /* @__PURE__ */ jsx29(
8768
- "input",
8644
+ ) }),
8645
+ /* @__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(
8646
+ FractalFields_default,
8769
8647
  {
8770
- type: "text",
8771
- id: "companyName",
8772
- className: "form-control",
8773
- maxLength: 100,
8774
- placeholder: "My Company",
8775
- name: "companyName",
8776
- value: (_w = achData == null ? void 0 : achData.companyName) != null ? _w : "",
8777
- onChange: handleChangeAch
8648
+ fractalStyles,
8649
+ tokenizerRef,
8650
+ surchargeEnabled: Number(paymentData == null ? void 0 : paymentData.surchargeProgram) === 1 && !!(props == null ? void 0 : props.pass_fee),
8651
+ createSurchargeSession,
8652
+ getSurchargeOptions,
8653
+ onSurchargeResult: setSurchargeResult
8778
8654
  }
8779
- ),
8780
- (achError == null ? void 0 : achError.companyName) && /* @__PURE__ */ jsx29("span", { className: "error-span", children: achError == null ? void 0 : achError.companyName })
8781
- ] }),
8782
- /* @__PURE__ */ jsxs16("div", { className: "form-group mb-4", children: [
8783
- /* @__PURE__ */ jsx29("label", { htmlFor: "accounttype", children: "Select account type" }),
8784
- /* @__PURE__ */ jsxs16("select", { name: "accountType", id: "accounttype", className: "form-control", value: (_x = achData == null ? void 0 : achData.accountType) != null ? _x : "", onChange: handleChangeAch, children: [
8785
- /* @__PURE__ */ jsx29("option", { value: "", children: "Select account" }),
8786
- accountTypes.map((type) => /* @__PURE__ */ jsx29("option", { value: type.value, children: type.label }, type.value))
8655
+ ) : /* @__PURE__ */ jsx27(DataCapFields, { isOpen: show, tokenKey: paymentData == null ? void 0 : paymentData.dctoken, setLoader: setLoadingIframe, onError: (msg) => setError(msg || DcLoadingError) }) }) }),
8656
+ /* @__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) }) }),
8657
+ (props == null ? void 0 : props.customerId) && /* @__PURE__ */ jsxs14(FractalCheckbox, { id: "save_card", checked: saveCardInfo, onChange: (v) => setSaveCardInfo(v), children: [
8658
+ "Save this card. ",
8659
+ merchantName,
8660
+ " may charge it for future invoices. ",
8661
+ /* @__PURE__ */ jsx27("u", { children: "See terms" }),
8662
+ "."
8787
8663
  ] })
8788
8664
  ] }),
8789
- !saveACHinfo && /* @__PURE__ */ jsxs16(Fragment16, { children: [
8790
- /* @__PURE__ */ jsxs16("div", { className: "form-group mb-4 save-ach-div", style: { paddingTop: "5px" }, children: [
8791
- /* @__PURE__ */ jsx29(
8792
- "input",
8793
- {
8794
- type: "checkbox",
8795
- id: "achconsent",
8796
- className: "",
8797
- checked: isBankConsentChecked,
8798
- onChange: (e) => {
8799
- setIsBankConsentChecked(e.target.checked);
8800
- if (e.target.checked) {
8801
- setErrorBankConsent("");
8802
- }
8803
- }
8804
- }
8805
- ),
8806
- /* @__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.` })
8807
- ] }),
8808
- errorBankConsent && /* @__PURE__ */ jsx29("span", { className: "error-span", children: errorBankConsent })
8809
- ] }),
8810
- (props == null ? void 0 : props.customerId) && /* @__PURE__ */ jsxs16("div", { className: "form-group mb-4 save-ach-div", style: { paddingTop: "5px" }, children: [
8811
- /* @__PURE__ */ jsx29("input", { type: "checkbox", id: "saveACH", className: "", maxLength: 100, placeholder: "My Bank", checked: saveACHinfo, onChange: (e) => setSaveACHinfo(e.target.checked) }),
8812
- /* @__PURE__ */ jsx29("label", { htmlFor: "saveACH", children: "Save for future use" })
8813
- ] }),
8814
- saveACHinfo && /* @__PURE__ */ jsxs16(Fragment16, { children: [
8815
- /* @__PURE__ */ jsxs16("div", { className: "form-group-frac save-ach-div", style: { paddingTop: "5px" }, children: [
8816
- /* @__PURE__ */ jsx29("input", { type: "checkbox", id: "saveACHConsent1", className: "", maxLength: 100, placeholder: "My Bank", checked: saveACHConsent1, onChange: (e) => {
8817
- setSaveACHConsent1(e.target.checked);
8818
- if (e.target.checked) {
8819
- setErrorBankConsentOther("");
8820
- }
8821
- } }),
8822
- /* @__PURE__ */ jsxs16("label", { className: "saveachlabel", htmlFor: "saveACHConsent1", children: [
8823
- "By providing my bank account information and selecting \u2018Save for future payments\u2019, I authorize ",
8824
- (paymentData == null ? void 0 : paymentData.bname) || "merchant",
8825
- " 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."
8826
- ] })
8827
- ] }),
8828
- errorBankConsentOther && /* @__PURE__ */ jsx29("span", { className: "error-span", children: errorBankConsentOther })
8829
- ] })
8830
- ] }),
8831
- /* @__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)) }) })
8832
- ] })
8833
- ] })
8834
- ] }) }) })
8665
+ /* @__PURE__ */ jsx27(
8666
+ FractalFooter,
8667
+ {
8668
+ authText: AuthText,
8669
+ submit: true,
8670
+ disabled: loading2 || surchargeLookupLoading,
8671
+ buttonLabel: `Pay ${formatUSD(effectiveTotal.toFixed(2))} to ${merchantName}`
8672
+ }
8673
+ )
8674
+ ]
8675
+ }
8676
+ )
8677
+ )
8835
8678
  ] })
8836
- ] }) })
8679
+ ] })
8837
8680
  ] })
8838
8681
  ]
8839
8682
  }
@@ -8846,13 +8689,13 @@ function PartialPayment(props) {
8846
8689
  import { useEffect as useEffect16, useState as useState10, useMemo } from "react";
8847
8690
 
8848
8691
  // src/app/components/Skysystemz/SkyChargewidgetstyles.tsx
8849
- import { jsx as jsx30 } from "react/jsx-runtime";
8692
+ import { jsx as jsx28 } from "react/jsx-runtime";
8850
8693
  function SkyChargewidgetstyles() {
8851
8694
  const primarycolor = "#000";
8852
8695
  const primarybgcolor = "#fff";
8853
8696
  const primarybodycolor = "#212529";
8854
8697
  const primarybordercolor = "#dee2e6";
8855
- return /* @__PURE__ */ jsx30("style", { children: `
8698
+ return /* @__PURE__ */ jsx28("style", { children: `
8856
8699
  @import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');
8857
8700
  body
8858
8701
  {
@@ -9738,6 +9581,44 @@ function ThreeDSChallenge({
9738
9581
  return null;
9739
9582
  }
9740
9583
 
9584
+ // src/app/components/Atoms/CardBankRadio/CardBankRadio.tsx
9585
+ import { Fragment as Fragment15, jsx as jsx29, jsxs as jsxs15 } from "react/jsx-runtime";
9586
+ var CardBankRadio = (_a) => {
9587
+ var _b = _a, { skydesign = false, savingsText } = _b, props = __objRest(_b, ["skydesign", "savingsText"]);
9588
+ const savingsBadgeClass = `frac-saving-badge ${skydesign ? "frac-saving-badge-corner" : "frac-saving-badge-corner frac-saving-badge-with-radio"}`;
9589
+ return /* @__PURE__ */ jsx29(Fragment15, { children: /* @__PURE__ */ jsx29(
9590
+ "div",
9591
+ {
9592
+ className: `frac-card-bank-radio ${props.activetab === props.value ? "frac-active" : ""}`,
9593
+ onClick: () => props.onChange(props.value),
9594
+ role: "radio",
9595
+ children: skydesign ? /* @__PURE__ */ jsxs15(Fragment15, { children: [
9596
+ /* @__PURE__ */ jsxs15("div", { className: "frac-card-title-main", children: [
9597
+ /* @__PURE__ */ jsxs15("div", { className: "box-inner-card-text", children: [
9598
+ /* @__PURE__ */ jsx29("img", { src: props.label.toLowerCase() === "card" ? defaultcard : props.label.toLowerCase() === "reader" ? pax : bankNew, className: "frac-payment-type-logo", alt: "" }),
9599
+ /* @__PURE__ */ jsx29("div", { className: "frac-card-label-text", children: props.label })
9600
+ ] }),
9601
+ /* @__PURE__ */ jsx29("div", { className: "frac-card-label", children: /* @__PURE__ */ jsx29("div", { className: "frac-card-label-amount", children: formatUSD(props.amount) }) })
9602
+ ] }),
9603
+ /* @__PURE__ */ jsx29("div", { children: /* @__PURE__ */ jsx29("input", { name: "paymenttype", checked: props.activetab === props.value, type: "hidden", value: props.value, onChange: (e) => {
9604
+ props.onChange(e.target.value);
9605
+ } }) })
9606
+ ] }) : /* @__PURE__ */ jsxs15(Fragment15, { children: [
9607
+ /* @__PURE__ */ jsxs15("div", { className: "frac-card-title-main", children: [
9608
+ /* @__PURE__ */ jsx29("img", { src: props.label.toLowerCase() === "card" ? defaultcard : props.label.toLowerCase() === "reader" ? pax : bankNew, className: "frac-payment-type-logo", alt: "" }),
9609
+ /* @__PURE__ */ jsxs15("div", { className: "frac-card-label", children: [
9610
+ /* @__PURE__ */ jsx29("div", { className: "frac-card-label-text", children: props.label }),
9611
+ /* @__PURE__ */ jsx29("div", { className: "frac-card-label-amount", children: formatUSD(props.amount) })
9612
+ ] })
9613
+ ] }),
9614
+ /* @__PURE__ */ jsx29("div", { children: /* @__PURE__ */ jsx29("input", { name: "paymenttype", checked: props.activetab === props.value, type: "radio", value: props.value, onChange: (e) => {
9615
+ props.onChange(e.target.value);
9616
+ } }) })
9617
+ ] })
9618
+ }
9619
+ ) });
9620
+ };
9621
+
9741
9622
  // src/app/components/Atoms/ThreedsCheckout/ThreedsCheckout.tsx
9742
9623
  import { Elements } from "@stripe/react-stripe-js";
9743
9624
  import { loadStripe } from "@stripe/stripe-js";
@@ -9746,7 +9627,7 @@ import { loadStripe } from "@stripe/stripe-js";
9746
9627
  import { PaymentElement, useElements, useStripe } from "@stripe/react-stripe-js";
9747
9628
  import axios7 from "axios";
9748
9629
  import { useState as useState8 } from "react";
9749
- import { jsx as jsx31, jsxs as jsxs17 } from "react/jsx-runtime";
9630
+ import { jsx as jsx30, jsxs as jsxs16 } from "react/jsx-runtime";
9750
9631
  var CheckoutForm = ({ onSuccess, showLoader, setError, session_token, callback, hideLoader, handleClose, amount, isPreAuth }) => {
9751
9632
  var _a;
9752
9633
  const stripe = useStripe();
@@ -9811,24 +9692,76 @@ var CheckoutForm = ({ onSuccess, showLoader, setError, session_token, callback,
9811
9692
  hideLoader();
9812
9693
  }
9813
9694
  };
9814
- return /* @__PURE__ */ jsxs17("form", { onSubmit: handleSubmit, children: [
9815
- /* @__PURE__ */ jsx31(PaymentElement, {}),
9816
- /* @__PURE__ */ jsx31("button", { className: "pay-button", disabled: loading || !stripe, children: loading ? "Processing..." : `${formatUSD((_a = Number(amount)) == null ? void 0 : _a.toFixed(2))}` })
9695
+ return /* @__PURE__ */ jsxs16("form", { onSubmit: handleSubmit, children: [
9696
+ /* @__PURE__ */ jsx30(PaymentElement, {}),
9697
+ /* @__PURE__ */ jsx30("button", { className: "pay-button", disabled: loading || !stripe, children: loading ? "Processing..." : `${formatUSD((_a = Number(amount)) == null ? void 0 : _a.toFixed(2))}` })
9817
9698
  ] });
9818
9699
  };
9819
9700
 
9820
9701
  // src/app/components/Atoms/ThreedsCheckout/ThreedsCheckout.tsx
9821
- import { jsx as jsx32 } from "react/jsx-runtime";
9702
+ import { jsx as jsx31 } from "react/jsx-runtime";
9822
9703
  var stripePromise = loadStripe(
9823
9704
  threedsSecurePublicKey
9824
9705
  );
9825
9706
  function CheckoutWrapper({ clientSecret, onSuccess, showLoader, setError, session_token, callback, hideLoader, handleClose, amount, isPreAuth }) {
9826
9707
  if (!clientSecret) return null;
9827
- return /* @__PURE__ */ jsx32(Elements, { stripe: stripePromise, options: { clientSecret }, children: /* @__PURE__ */ jsx32(CheckoutForm, { onSuccess, showLoader, hideLoader, setError, session_token, callback, handleClose, amount, isPreAuth }) });
9708
+ return /* @__PURE__ */ jsx31(Elements, { stripe: stripePromise, options: { clientSecret }, children: /* @__PURE__ */ jsx31(CheckoutForm, { onSuccess, showLoader, hideLoader, setError, session_token, callback, handleClose, amount, isPreAuth }) });
9828
9709
  }
9829
9710
 
9830
9711
  // src/app/components/Atoms/ModelContentSky/ModelContentSky.tsx
9831
- import { IoArrowBack as IoArrowBack2 } from "react-icons/io5";
9712
+ import { IoArrowBack } from "react-icons/io5";
9713
+
9714
+ // src/app/components/Atoms/CardList/CardList.tsx
9715
+ import { Fragment as Fragment16, jsx as jsx32, jsxs as jsxs17 } from "react/jsx-runtime";
9716
+ var CardList = ({ listHeading = "Card", ListItems, selectedCard, setSelectedCard, paymentGateway, handleDeleteCard, otherButtonAction, otherButtonLabel, headingClass }) => {
9717
+ let trash2 = S3Url + "widget/Trash.svg";
9718
+ return /* @__PURE__ */ jsxs17(Fragment16, { children: [
9719
+ /* @__PURE__ */ jsx32("h6", { className: headingClass || "card-ach-heading", style: { marginBottom: "10px !important" }, children: listHeading }),
9720
+ /* @__PURE__ */ jsxs17("div", { className: "card-lint-div-in", children: [
9721
+ /* @__PURE__ */ jsx32("div", { className: "card-list-div", children: ListItems && (ListItems == null ? void 0 : ListItems.length) > 0 && (ListItems == null ? void 0 : ListItems.map((card, index) => {
9722
+ let isDisabled = false;
9723
+ if (paymentGateway) {
9724
+ isDisabled = paymentGateway != (card == null ? void 0 : card.payment_method_type) && (card == null ? void 0 : card.card_type) != "Bank";
9725
+ }
9726
+ return /* @__PURE__ */ jsxs17("div", { className: "card-list-single-div", children: [
9727
+ /* @__PURE__ */ jsxs17("div", { className: "card-number-radio", children: [
9728
+ /* @__PURE__ */ jsx32(
9729
+ "input",
9730
+ {
9731
+ disabled: isDisabled,
9732
+ type: "radio",
9733
+ className: "cardRadio",
9734
+ name: "selected_card",
9735
+ id: "",
9736
+ checked: (selectedCard == null ? void 0 : selectedCard.id) === (card == null ? void 0 : card.id),
9737
+ onChange: (e) => setSelectedCard(card)
9738
+ }
9739
+ ),
9740
+ /* @__PURE__ */ jsxs17("label", { htmlFor: "", className: "card-number-last-four", children: [
9741
+ "**** ",
9742
+ card == null ? void 0 : card.cardlastfourdigit
9743
+ ] }),
9744
+ (card == null ? void 0 : card.card_type) != "Bank" && /* @__PURE__ */ jsxs17("h6", { className: "card-expiry-date", children: [
9745
+ card == null ? void 0 : card.expmonth,
9746
+ "/",
9747
+ card == null ? void 0 : card.expyear
9748
+ ] })
9749
+ ] }),
9750
+ /* @__PURE__ */ jsxs17("div", { className: "card-number-radio", children: [
9751
+ /* @__PURE__ */ jsx32("span", { className: "visa-card", children: /* @__PURE__ */ jsx32("img", { src: getCardType(card == null ? void 0 : card.card_type), alt: "" }) }),
9752
+ /* @__PURE__ */ jsx32("span", { className: "visa-card", style: { cursor: "pointer" }, onClick: () => handleDeleteCard(card == null ? void 0 : card.id), children: /* @__PURE__ */ jsx32("img", { src: trash2, alt: "" }) })
9753
+ ] })
9754
+ ] }, card == null ? void 0 : card.id);
9755
+ })) }),
9756
+ /* @__PURE__ */ jsxs17("div", { className: "pay-with-other-card", onClick: otherButtonAction, children: [
9757
+ otherButtonLabel,
9758
+ /* @__PURE__ */ jsx32("img", { src: defaultcard, alt: "" })
9759
+ ] })
9760
+ ] })
9761
+ ] });
9762
+ };
9763
+
9764
+ // src/app/components/Atoms/ModelContentSky/ModelContentSky.tsx
9832
9765
  import { NumericFormat as NumericFormat2 } from "react-number-format";
9833
9766
 
9834
9767
  // src/app/components/ErrorCardMessage/ErrorCardOverlaystyle.tsx
@@ -11279,7 +11212,7 @@ var ModelContentSky = ({ amount, bankAmount, submitBtnText = "Pay", session_toke
11279
11212
  /* @__PURE__ */ jsx36("h1", { className: "pay-heading", children: "Pay" }),
11280
11213
  (cardList == null ? void 0 : cardList.length) > 0 && activetab !== "cardList" && /* @__PURE__ */ jsxs19("button", { className: "res-charge-payment-back-btn ", onClick: () => setActive("cardList"), children: [
11281
11214
  " ",
11282
- /* @__PURE__ */ jsx36(IoArrowBack2, {}),
11215
+ /* @__PURE__ */ jsx36(IoArrowBack, {}),
11283
11216
  " Back"
11284
11217
  ] })
11285
11218
  ] }),
@@ -11359,7 +11292,7 @@ var ModelContentSky = ({ amount, bankAmount, submitBtnText = "Pay", session_toke
11359
11292
  /* @__PURE__ */ jsxs19("div", { className: "frac-heading-card-wrap", children: [
11360
11293
  /* @__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: [
11361
11294
  " ",
11362
- /* @__PURE__ */ jsx36(IoArrowBack2, {})
11295
+ /* @__PURE__ */ jsx36(IoArrowBack, {})
11363
11296
  ] }) }),
11364
11297
  /* @__PURE__ */ jsx36("h6", { className: "frac-card-payment-heading", children: "Card Payment" })
11365
11298
  ] }),
@@ -11558,7 +11491,7 @@ var ModelContentSky = ({ amount, bankAmount, submitBtnText = "Pay", session_toke
11558
11491
  !onSubmit && /* @__PURE__ */ jsxs19("div", { className: "frac-heading-card-wrap", children: [
11559
11492
  /* @__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: [
11560
11493
  " ",
11561
- /* @__PURE__ */ jsx36(IoArrowBack2, {})
11494
+ /* @__PURE__ */ jsx36(IoArrowBack, {})
11562
11495
  ] }) }),
11563
11496
  /* @__PURE__ */ jsx36("h6", { className: "frac-card-payment-heading", children: "Bank Payment" })
11564
11497
  ] }),