@fractalpay/fractalpay-next-dev 0.0.304 → 0.0.306
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 +160 -57
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -39,7 +39,7 @@ var require_package = __commonJS({
|
|
|
39
39
|
"package.json"(exports, module) {
|
|
40
40
|
module.exports = {
|
|
41
41
|
name: "@fractalpay/fractalpay-next-dev",
|
|
42
|
-
version: "0.0.
|
|
42
|
+
version: "0.0.306",
|
|
43
43
|
private: false,
|
|
44
44
|
type: "module",
|
|
45
45
|
scripts: {
|
|
@@ -287,7 +287,7 @@ if (name === "@fractalpay/fractalpay-next-dev") {
|
|
|
287
287
|
applePayMerchantId = "fractal";
|
|
288
288
|
googlePayMerchantId = "BCR2DN4T6OC2TCQH";
|
|
289
289
|
googlePayEnvironment = "PRODUCTION";
|
|
290
|
-
googlePayGatewayMerchantId = "
|
|
290
|
+
googlePayGatewayMerchantId = "skysystemz";
|
|
291
291
|
} else if (name === "@fractalpay/fractalpay-next") {
|
|
292
292
|
masterBaseUrl = "https://api.fractalpay.com/";
|
|
293
293
|
baseUrl = "https://widget.fractalpay.com/";
|
|
@@ -297,7 +297,7 @@ if (name === "@fractalpay/fractalpay-next-dev") {
|
|
|
297
297
|
applePayMerchantId = "fractal";
|
|
298
298
|
googlePayMerchantId = "BCR2DN4T6OC2TCQH";
|
|
299
299
|
googlePayEnvironment = "PRODUCTION";
|
|
300
|
-
googlePayGatewayMerchantId = "
|
|
300
|
+
googlePayGatewayMerchantId = "skysystemz";
|
|
301
301
|
} else {
|
|
302
302
|
baseUrl = "http://localhost:8082/";
|
|
303
303
|
masterBaseUrl = "http://localhost:8081/";
|
|
@@ -3481,8 +3481,6 @@ var baseCSS = `
|
|
|
3481
3481
|
}
|
|
3482
3482
|
|
|
3483
3483
|
`;
|
|
3484
|
-
var datacapInitializing = false;
|
|
3485
|
-
var datacapInitialized = false;
|
|
3486
3484
|
var DataCapFields = ({
|
|
3487
3485
|
isOpen,
|
|
3488
3486
|
tokenKey,
|
|
@@ -3490,11 +3488,15 @@ var DataCapFields = ({
|
|
|
3490
3488
|
isAddCard,
|
|
3491
3489
|
isEmbedded,
|
|
3492
3490
|
customCSS: extraCss,
|
|
3493
|
-
height
|
|
3491
|
+
height,
|
|
3492
|
+
onError
|
|
3494
3493
|
}) => {
|
|
3495
3494
|
const iframeId = "datacap-iframe";
|
|
3496
3495
|
const resolverRef = useRef2(null);
|
|
3497
3496
|
const [iframeReady, setIframeReady] = useState3(false);
|
|
3497
|
+
const [mountKey, setMountKey] = useState3(0);
|
|
3498
|
+
const initGenRef = useRef2(0);
|
|
3499
|
+
const initTimeoutRef = useRef2(null);
|
|
3498
3500
|
let customCSS = baseCSS;
|
|
3499
3501
|
useEffect7(() => {
|
|
3500
3502
|
if (!isOpen || !tokenKey) return;
|
|
@@ -3534,6 +3536,8 @@ var DataCapFields = ({
|
|
|
3534
3536
|
if (extraCss) {
|
|
3535
3537
|
customCSS += extraCss;
|
|
3536
3538
|
}
|
|
3539
|
+
const myGen = ++initGenRef.current;
|
|
3540
|
+
setMountKey(myGen);
|
|
3537
3541
|
const initialize = async () => {
|
|
3538
3542
|
setLoader == null ? void 0 : setLoader(true);
|
|
3539
3543
|
setIframeReady(false);
|
|
@@ -3552,18 +3556,39 @@ var DataCapFields = ({
|
|
|
3552
3556
|
}
|
|
3553
3557
|
}, 100);
|
|
3554
3558
|
});
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
+
const waitForIframe = () => new Promise((resolve, reject) => {
|
|
3560
|
+
let attempts = 0;
|
|
3561
|
+
const interval = setInterval(() => {
|
|
3562
|
+
attempts++;
|
|
3563
|
+
if (document.getElementById(iframeId)) {
|
|
3564
|
+
clearInterval(interval);
|
|
3565
|
+
resolve();
|
|
3566
|
+
}
|
|
3567
|
+
if (attempts > 100) {
|
|
3568
|
+
clearInterval(interval);
|
|
3569
|
+
reject("Datacap iframe not found");
|
|
3570
|
+
}
|
|
3571
|
+
}, 50);
|
|
3572
|
+
});
|
|
3573
|
+
try {
|
|
3574
|
+
await waitForSDK();
|
|
3575
|
+
await waitForIframe();
|
|
3576
|
+
} catch (err) {
|
|
3577
|
+
if (initGenRef.current !== myGen) return;
|
|
3578
|
+
console.error("\u274C Datacap failed to become ready:", err);
|
|
3579
|
+
setLoader == null ? void 0 : setLoader(false);
|
|
3580
|
+
onError == null ? void 0 : onError("Unable to load payment form. Please try again.");
|
|
3559
3581
|
return;
|
|
3560
3582
|
}
|
|
3561
|
-
|
|
3562
|
-
const
|
|
3583
|
+
if (initGenRef.current !== myGen) return;
|
|
3584
|
+
const sdk = window.DatacapHostedWebToken;
|
|
3585
|
+
initTimeoutRef.current = setTimeout(() => {
|
|
3563
3586
|
var _a, _b;
|
|
3587
|
+
if (initGenRef.current !== myGen) return;
|
|
3564
3588
|
console.error("\u274C Datacap iframe load timeout");
|
|
3565
|
-
|
|
3589
|
+
initTimeoutRef.current = null;
|
|
3566
3590
|
setLoader == null ? void 0 : setLoader(false);
|
|
3591
|
+
onError == null ? void 0 : onError("Unable to load payment form. Please try again.");
|
|
3567
3592
|
(_b = (_a = resolverRef.current) == null ? void 0 : _a.reject) == null ? void 0 : _b.call(
|
|
3568
3593
|
_a,
|
|
3569
3594
|
"Unable to load payment form"
|
|
@@ -3573,9 +3598,7 @@ var DataCapFields = ({
|
|
|
3573
3598
|
tokenKey,
|
|
3574
3599
|
iframeId,
|
|
3575
3600
|
(response) => {
|
|
3576
|
-
|
|
3577
|
-
datacapInitializing = false;
|
|
3578
|
-
datacapInitialized = true;
|
|
3601
|
+
if (initGenRef.current !== myGen) return;
|
|
3579
3602
|
setLoader == null ? void 0 : setLoader(false);
|
|
3580
3603
|
if (!resolverRef.current) return;
|
|
3581
3604
|
if ((response == null ? void 0 : response.Error) || (response == null ? void 0 : response.Errors)) {
|
|
@@ -3615,12 +3638,6 @@ var DataCapFields = ({
|
|
|
3615
3638
|
delete window.requestDcToken;
|
|
3616
3639
|
};
|
|
3617
3640
|
}, []);
|
|
3618
|
-
useEffect7(() => {
|
|
3619
|
-
return () => {
|
|
3620
|
-
datacapInitializing = false;
|
|
3621
|
-
datacapInitialized = false;
|
|
3622
|
-
};
|
|
3623
|
-
}, []);
|
|
3624
3641
|
return (
|
|
3625
3642
|
// <iframe
|
|
3626
3643
|
// id={iframeId}
|
|
@@ -3643,13 +3660,22 @@ var DataCapFields = ({
|
|
|
3643
3660
|
id: iframeId,
|
|
3644
3661
|
onLoad: () => {
|
|
3645
3662
|
console.log("\u{1F7E2} Iframe visually loaded");
|
|
3663
|
+
if (initTimeoutRef.current) {
|
|
3664
|
+
clearTimeout(initTimeoutRef.current);
|
|
3665
|
+
initTimeoutRef.current = null;
|
|
3666
|
+
}
|
|
3646
3667
|
setIframeReady(true);
|
|
3647
3668
|
setLoader == null ? void 0 : setLoader(false);
|
|
3648
3669
|
},
|
|
3649
3670
|
onError: () => {
|
|
3650
3671
|
var _a, _b;
|
|
3651
3672
|
console.error("\u274C iframe failed");
|
|
3673
|
+
if (initTimeoutRef.current) {
|
|
3674
|
+
clearTimeout(initTimeoutRef.current);
|
|
3675
|
+
initTimeoutRef.current = null;
|
|
3676
|
+
}
|
|
3652
3677
|
setLoader == null ? void 0 : setLoader(false);
|
|
3678
|
+
onError == null ? void 0 : onError("Payment form failed to load");
|
|
3653
3679
|
(_b = (_a = resolverRef.current) == null ? void 0 : _a.reject) == null ? void 0 : _b.call(
|
|
3654
3680
|
_a,
|
|
3655
3681
|
"Payment form failed to load"
|
|
@@ -3662,7 +3688,8 @@ var DataCapFields = ({
|
|
|
3662
3688
|
opacity: iframeReady ? 1 : 0,
|
|
3663
3689
|
transition: "opacity 0.3s ease"
|
|
3664
3690
|
}
|
|
3665
|
-
}
|
|
3691
|
+
},
|
|
3692
|
+
mountKey
|
|
3666
3693
|
)
|
|
3667
3694
|
);
|
|
3668
3695
|
};
|
|
@@ -4257,6 +4284,7 @@ function GetPaymentPage(props) {
|
|
|
4257
4284
|
const [loading, setLoading] = useState4(false);
|
|
4258
4285
|
const [loadingIframe, setLoadingIframe] = useState4(false);
|
|
4259
4286
|
const [loading2, setLoading2] = useState4(false);
|
|
4287
|
+
const [surchargeLookupLoading, setSurchargeLookupLoading] = useState4(false);
|
|
4260
4288
|
const [error, setError] = useState4("");
|
|
4261
4289
|
const [errorIframe, setErrorIframe] = useState4("");
|
|
4262
4290
|
const [success, setSuccess] = useState4(false);
|
|
@@ -4354,6 +4382,47 @@ function GetPaymentPage(props) {
|
|
|
4354
4382
|
cardholder_billing_zip: (cardData == null ? void 0 : cardData.zipCode) || void 0
|
|
4355
4383
|
};
|
|
4356
4384
|
};
|
|
4385
|
+
const runCofSurchargeLookup = async (cardId) => {
|
|
4386
|
+
var _a2, _b2;
|
|
4387
|
+
try {
|
|
4388
|
+
const res = await axios3.post(`${baseUrl}surcharge-lookup-cof`, {
|
|
4389
|
+
fractalpayPublicKey: fractalpayClientKey,
|
|
4390
|
+
customer_id: props == null ? void 0 : props.customerId,
|
|
4391
|
+
card_id: cardId,
|
|
4392
|
+
amount: Number((_a2 = cashDiscount != null ? cashDiscount : props == null ? void 0 : props.amount) != null ? _a2 : 0),
|
|
4393
|
+
cardholder_billing_zip: (cardData == null ? void 0 : cardData.zipCode) || void 0
|
|
4394
|
+
});
|
|
4395
|
+
const data = (_b2 = res == null ? void 0 : res.data) == null ? void 0 : _b2.data;
|
|
4396
|
+
if (!data) return null;
|
|
4397
|
+
return {
|
|
4398
|
+
card_brand: data.card_brand,
|
|
4399
|
+
card_issue_type: data.card_issue_type,
|
|
4400
|
+
surcharge_allowed: data.surcharge_allowed,
|
|
4401
|
+
max_surcharge_percent: data.max_surcharge_percent,
|
|
4402
|
+
max_surcharge_amount: data.max_surcharge_amount
|
|
4403
|
+
};
|
|
4404
|
+
} catch (err) {
|
|
4405
|
+
console.error("COF surcharge lookup failed", err);
|
|
4406
|
+
return null;
|
|
4407
|
+
}
|
|
4408
|
+
};
|
|
4409
|
+
useEffect8(() => {
|
|
4410
|
+
const surchargingOn = Number(paymentData == null ? void 0 : paymentData.surchargeProgram) === 1 && !!(props == null ? void 0 : props.pass_fee);
|
|
4411
|
+
if (!surchargingOn || !(selectedCard == null ? void 0 : selectedCard.id) || selectedCard.card_type === "Bank") {
|
|
4412
|
+
setSurchargeResult(null);
|
|
4413
|
+
return;
|
|
4414
|
+
}
|
|
4415
|
+
let cancelled = false;
|
|
4416
|
+
setSurchargeLookupLoading(true);
|
|
4417
|
+
runCofSurchargeLookup(selectedCard.id).then((result) => {
|
|
4418
|
+
if (cancelled) return;
|
|
4419
|
+
setSurchargeResult(result);
|
|
4420
|
+
setSurchargeLookupLoading(false);
|
|
4421
|
+
});
|
|
4422
|
+
return () => {
|
|
4423
|
+
cancelled = true;
|
|
4424
|
+
};
|
|
4425
|
+
}, [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]);
|
|
4357
4426
|
useEffect8(() => {
|
|
4358
4427
|
if (show) {
|
|
4359
4428
|
let cash_discount = CalculateCashDiscount(props == null ? void 0 : props.amount, (props == null ? void 0 : props.surcharge) || 0);
|
|
@@ -4685,7 +4754,7 @@ function GetPaymentPage(props) {
|
|
|
4685
4754
|
const customer_id = props == null ? void 0 : props.customerId;
|
|
4686
4755
|
const fractalpayPublicKey = props == null ? void 0 : props.merchantPublicKey;
|
|
4687
4756
|
const order_id = props == null ? void 0 : props.orderID;
|
|
4688
|
-
const amount =
|
|
4757
|
+
const amount = leftTotal;
|
|
4689
4758
|
const card_id = selectedCard == null ? void 0 : selectedCard.id;
|
|
4690
4759
|
const card_type = selectedCard == null ? void 0 : selectedCard.card_type;
|
|
4691
4760
|
const preAuth_id = (props == null ? void 0 : props.preauthId) || "";
|
|
@@ -4755,7 +4824,7 @@ function GetPaymentPage(props) {
|
|
|
4755
4824
|
try {
|
|
4756
4825
|
const formData = {
|
|
4757
4826
|
// amount: `${props.amount || 0}`,
|
|
4758
|
-
amount: `${
|
|
4827
|
+
amount: `${orderAmount}`,
|
|
4759
4828
|
fractalpayPublicKey: fractalpayClientKey,
|
|
4760
4829
|
orderId: props == null ? void 0 : props.orderID,
|
|
4761
4830
|
customer_id: props == null ? void 0 : props.customerId,
|
|
@@ -4828,8 +4897,8 @@ function GetPaymentPage(props) {
|
|
|
4828
4897
|
return;
|
|
4829
4898
|
}
|
|
4830
4899
|
const card_issue_type = ((_i2 = tokenizeData == null ? void 0 : tokenizeData.bin_lookup_result) == null ? void 0 : _i2.card_issue_type) || null;
|
|
4831
|
-
const
|
|
4832
|
-
if (
|
|
4900
|
+
const feeExempt2 = ["debit", "prepaid"].includes(String(card_issue_type || "").toLowerCase());
|
|
4901
|
+
if (feeExempt2 && (props == null ? void 0 : props.pass_fee) && (paymentData == null ? void 0 : paymentData.surchargeProgram) == 1) {
|
|
4833
4902
|
setLoderText(`Processing ${card_issue_type} card without fee`);
|
|
4834
4903
|
}
|
|
4835
4904
|
console.log(tokenizeData, "tokenizeData");
|
|
@@ -4951,7 +5020,7 @@ function GetPaymentPage(props) {
|
|
|
4951
5020
|
}
|
|
4952
5021
|
};
|
|
4953
5022
|
const getPaymentDetails = async () => {
|
|
4954
|
-
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
5023
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A;
|
|
4955
5024
|
showLoader();
|
|
4956
5025
|
try {
|
|
4957
5026
|
const data = {
|
|
@@ -4966,12 +5035,14 @@ function GetPaymentPage(props) {
|
|
|
4966
5035
|
handleClose();
|
|
4967
5036
|
setError("Something went wrong.");
|
|
4968
5037
|
}
|
|
5038
|
+
let willShowCardForm = true;
|
|
4969
5039
|
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) {
|
|
4970
5040
|
let banklists = (_k = (_j2 = (_i2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _i2.data) == null ? void 0 : _j2.card_list) == null ? void 0 : _k.filter((card) => (card == null ? void 0 : card.card_type) == "Bank");
|
|
4971
5041
|
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");
|
|
4972
5042
|
if ((cardlists == null ? void 0 : cardlists.length) > 0 || (banklists == null ? void 0 : banklists.length) > 0) {
|
|
4973
5043
|
setActiveinCard("list");
|
|
4974
5044
|
setActiveinBank("list");
|
|
5045
|
+
willShowCardForm = false;
|
|
4975
5046
|
}
|
|
4976
5047
|
setCardList(cardlists);
|
|
4977
5048
|
setBankList(banklists);
|
|
@@ -4981,11 +5052,14 @@ function GetPaymentPage(props) {
|
|
|
4981
5052
|
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) {
|
|
4982
5053
|
setSelectedReader((_u = (_t = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _t.data) == null ? void 0 : _u.paymentDeviceList[0]);
|
|
4983
5054
|
}
|
|
5055
|
+
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)) {
|
|
5056
|
+
setLoadingIframe(true);
|
|
5057
|
+
}
|
|
4984
5058
|
hideLoader();
|
|
4985
5059
|
} catch (err) {
|
|
4986
5060
|
console.log(err);
|
|
4987
5061
|
hideLoader();
|
|
4988
|
-
setError(((
|
|
5062
|
+
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");
|
|
4989
5063
|
}
|
|
4990
5064
|
};
|
|
4991
5065
|
const handlechargeCustomer = async (e) => {
|
|
@@ -5009,15 +5083,15 @@ function GetPaymentPage(props) {
|
|
|
5009
5083
|
if (customer_id) {
|
|
5010
5084
|
if (card_id) {
|
|
5011
5085
|
setLoading2(true);
|
|
5012
|
-
const
|
|
5013
|
-
if (
|
|
5086
|
+
const feeExempt2 = ["debit", "prepaid"].includes(String(card_issue_type || "").toLowerCase());
|
|
5087
|
+
if (feeExempt2 && (props == null ? void 0 : props.pass_fee) && (paymentData == null ? void 0 : paymentData.surchargeProgram) == 1) {
|
|
5014
5088
|
setLoderText(`Processing ${card_issue_type} card without fee`);
|
|
5015
5089
|
}
|
|
5016
5090
|
let resultofOrderCreate;
|
|
5017
5091
|
if (!(card_type === "Bank")) {
|
|
5018
5092
|
const formData = {
|
|
5019
5093
|
// amount: `${props.amount || 0}`,
|
|
5020
|
-
amount: `${
|
|
5094
|
+
amount: `${orderAmount}`,
|
|
5021
5095
|
fractalpayPublicKey: fractalpayClientKey,
|
|
5022
5096
|
orderId: props == null ? void 0 : props.orderID,
|
|
5023
5097
|
customer_id: props == null ? void 0 : props.customerId,
|
|
@@ -5032,7 +5106,7 @@ function GetPaymentPage(props) {
|
|
|
5032
5106
|
console.log(resultofOrderCreate, "vfndsjkfvhg", resultofOrderCreate == null ? void 0 : resultofOrderCreate.data.data.posSalesIdEncode);
|
|
5033
5107
|
}
|
|
5034
5108
|
let chargeobj = __spreadValues(__spreadValues({
|
|
5035
|
-
amount:
|
|
5109
|
+
amount: `${leftTotal}`,
|
|
5036
5110
|
order_id,
|
|
5037
5111
|
customer_id,
|
|
5038
5112
|
card_id,
|
|
@@ -5219,18 +5293,24 @@ function GetPaymentPage(props) {
|
|
|
5219
5293
|
const merchantName = (paymentData == null ? void 0 : paymentData.bname) || (paymentData == null ? void 0 : paymentData.customer_name) || "the merchant";
|
|
5220
5294
|
const invoiceNo = String((props == null ? void 0 : props.orderID) || "").replace(/^\s*invoice\s*#?\s*/i, "").trim();
|
|
5221
5295
|
const invoiceLabel = invoiceNo ? `Invoice #${invoiceNo}` : "Invoice";
|
|
5296
|
+
const isSurchargeProgram = Number(paymentData == null ? void 0 : paymentData.surchargeProgram) === 1;
|
|
5222
5297
|
const baseAmount = Number((_a = cashDiscount != null ? cashDiscount : props == null ? void 0 : props.amount) != null ? _a : 0);
|
|
5223
5298
|
const fundingType = (_b = surchargeResult == null ? void 0 : surchargeResult.card_issue_type) == null ? void 0 : _b.toLowerCase();
|
|
5224
|
-
const
|
|
5225
|
-
|
|
5299
|
+
const feeExempt = fundingType === "debit" || fundingType === "prepaid";
|
|
5300
|
+
let cardTotal;
|
|
5301
|
+
if (isSurchargeProgram) {
|
|
5302
|
+
cardTotal = feeExempt ? baseAmount : parseFloat((baseAmount * (1 + Number((props == null ? void 0 : props.surcharge) || 0) / 100)).toFixed(2));
|
|
5303
|
+
} else {
|
|
5304
|
+
cardTotal = Number((props == null ? void 0 : props.amount) || 0);
|
|
5305
|
+
}
|
|
5226
5306
|
const surchargeFee = Math.max(cardTotal - baseAmount, 0);
|
|
5227
5307
|
const isBankView = activetab === "ach";
|
|
5228
5308
|
const discountNum = Number((props == null ? void 0 : props.discount) || 0);
|
|
5229
5309
|
const taxNum = Number((props == null ? void 0 : props.tax) || 0);
|
|
5230
5310
|
const leftTotal = isBankView ? Number(bankAmount || 0) : cardTotal;
|
|
5311
|
+
const orderAmount = isSurchargeProgram ? baseAmount : Number((props == null ? void 0 : props.amount) || 0);
|
|
5231
5312
|
const fmtNum = (n) => Number(n).toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
|
5232
5313
|
const hasFee = surchargeFee > 0 && !!(props == null ? void 0 : props.pass_fee);
|
|
5233
|
-
const isSurchargeProgram = Number(paymentData == null ? void 0 : paymentData.surchargeProgram) === 1;
|
|
5234
5314
|
const showSurchargeLine = isSurchargeProgram && !isBankView && hasFee;
|
|
5235
5315
|
const summarySubtotal = isSurchargeProgram || isBankView ? baseAmount : cardTotal;
|
|
5236
5316
|
const savedMethods = [...cardList || [], ...bankList || []];
|
|
@@ -5353,7 +5433,7 @@ function GetPaymentPage(props) {
|
|
|
5353
5433
|
} }) }),
|
|
5354
5434
|
success && /* @__PURE__ */ jsx18(SuccessMsz, { onClose: handleClose, tranId, isDebitAdjusted }),
|
|
5355
5435
|
!error && !errorIframe && !success && /* @__PURE__ */ jsxs9(Fragment9, { children: [
|
|
5356
|
-
(loading || loading2 || loadingIframe) && /* @__PURE__ */ jsx18(Loader_default, { loading: loading || loading2 || loadingIframe, loaderText }),
|
|
5436
|
+
(loading || loading2 || loadingIframe || surchargeLookupLoading) && /* @__PURE__ */ jsx18(Loader_default, { loading: loading || loading2 || loadingIframe || surchargeLookupLoading, loaderText }),
|
|
5357
5437
|
/* @__PURE__ */ jsxs9("div", { className: "fps-modal", children: [
|
|
5358
5438
|
LeftSummary,
|
|
5359
5439
|
/* @__PURE__ */ jsxs9("section", { className: "fps-content", children: [
|
|
@@ -5391,7 +5471,7 @@ function GetPaymentPage(props) {
|
|
|
5391
5471
|
FractalFooter,
|
|
5392
5472
|
{
|
|
5393
5473
|
authText: AuthText,
|
|
5394
|
-
disabled: loading2 || !(selectedCard == null ? void 0 : selectedCard.id),
|
|
5474
|
+
disabled: loading2 || !(selectedCard == null ? void 0 : selectedCard.id) || surchargeLookupLoading,
|
|
5395
5475
|
onPay: handlechargeCustomer,
|
|
5396
5476
|
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}`
|
|
5397
5477
|
}
|
|
@@ -5537,7 +5617,7 @@ function GetPaymentPage(props) {
|
|
|
5537
5617
|
getSurchargeOptions,
|
|
5538
5618
|
onSurchargeResult: setSurchargeResult
|
|
5539
5619
|
}
|
|
5540
|
-
) : /* @__PURE__ */ jsx18(DataCapFields, { isOpen: show, tokenKey: paymentData == null ? void 0 : paymentData.dctoken, setLoader: setLoadingIframe }) }) }),
|
|
5620
|
+
) : /* @__PURE__ */ jsx18(DataCapFields, { isOpen: show, tokenKey: paymentData == null ? void 0 : paymentData.dctoken, setLoader: setLoadingIframe, onError: (msg) => setError(msg || DcLoadingError) }) }) }),
|
|
5541
5621
|
/* @__PURE__ */ jsx18(FractalField, { label: "Zip", htmlFor: "zip", error: cardError == null ? void 0 : cardError.zipCode, children: /* @__PURE__ */ jsx18("input", { id: "zip", className: "fps-input", maxLength: 100, placeholder: "000000", value: (_j = cardData == null ? void 0 : cardData.zipCode) != null ? _j : "", onChange: (e) => handleCardChange("zipCode", e.target.value) }) }),
|
|
5542
5622
|
(props == null ? void 0 : props.customerId) && /* @__PURE__ */ jsxs9(FractalCheckbox, { id: "save_card", checked: saveCardInfo, onChange: (v) => setSaveCardInfo(v), children: [
|
|
5543
5623
|
"Save this card. ",
|
|
@@ -6110,7 +6190,7 @@ function AddCardEasyPay(props) {
|
|
|
6110
6190
|
return Object.keys(errors).length > 0;
|
|
6111
6191
|
};
|
|
6112
6192
|
const getPaymentDetails = async () => {
|
|
6113
|
-
var _a2, _b2, _c;
|
|
6193
|
+
var _a2, _b2, _c, _d, _e, _f, _g;
|
|
6114
6194
|
showLoader();
|
|
6115
6195
|
try {
|
|
6116
6196
|
const data = {
|
|
@@ -6124,6 +6204,9 @@ function AddCardEasyPay(props) {
|
|
|
6124
6204
|
handleClose();
|
|
6125
6205
|
setError("Something went wrong.");
|
|
6126
6206
|
}
|
|
6207
|
+
if (((_e = (_d = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _d.data) == null ? void 0 : _e.paymentGateway) === 31 && ((_g = (_f = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _f.data) == null ? void 0 : _g.dctoken)) {
|
|
6208
|
+
setLoadingIframe(true);
|
|
6209
|
+
}
|
|
6127
6210
|
hideLoader();
|
|
6128
6211
|
} catch (err) {
|
|
6129
6212
|
console.log(err);
|
|
@@ -6381,7 +6464,8 @@ function AddCardEasyPay(props) {
|
|
|
6381
6464
|
isOpen: true,
|
|
6382
6465
|
tokenKey: paymentData == null ? void 0 : paymentData.dctoken,
|
|
6383
6466
|
setLoader: setLoadingIframe,
|
|
6384
|
-
isAddCard: true
|
|
6467
|
+
isAddCard: true,
|
|
6468
|
+
onError: (msg) => setError(msg || DcLoadingError)
|
|
6385
6469
|
}
|
|
6386
6470
|
) }),
|
|
6387
6471
|
/* @__PURE__ */ jsxs11("div", { className: "form-group", style: { marginTop: "0" }, children: [
|
|
@@ -6988,21 +7072,24 @@ function CardOnFile({ session_token, callback, isloading, onCancel, showChecks,
|
|
|
6988
7072
|
onCancel();
|
|
6989
7073
|
};
|
|
6990
7074
|
const getPaymentDetails = async () => {
|
|
6991
|
-
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
7075
|
+
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
6992
7076
|
try {
|
|
6993
7077
|
showLoader();
|
|
6994
7078
|
const res = await axios5.get(`${masterBaseUrl}api/v1/gateway/get-payment-details/${session_token}`);
|
|
6995
7079
|
if ((res == null ? void 0 : res.status) == 200) {
|
|
6996
7080
|
setPaymentGateway((_b2 = (_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.data) == null ? void 0 : _b2.paymentGateway);
|
|
6997
7081
|
setDCToken((_d = (_c = res == null ? void 0 : res.data) == null ? void 0 : _c.data) == null ? void 0 : _d.dctoken);
|
|
7082
|
+
if (((_f = (_e = res == null ? void 0 : res.data) == null ? void 0 : _e.data) == null ? void 0 : _f.paymentGateway) === 31 && ((_h = (_g = res == null ? void 0 : res.data) == null ? void 0 : _g.data) == null ? void 0 : _h.dctoken)) {
|
|
7083
|
+
setLoadingIframe(true);
|
|
7084
|
+
}
|
|
6998
7085
|
hideLoader();
|
|
6999
7086
|
}
|
|
7000
7087
|
} catch (error2) {
|
|
7001
|
-
console.log((
|
|
7088
|
+
console.log((_j = (_i = error2 == null ? void 0 : error2.response) == null ? void 0 : _i.data) == null ? void 0 : _j.result, "error while getting payment details");
|
|
7002
7089
|
callback({
|
|
7003
|
-
error: ((
|
|
7004
|
-
result: (
|
|
7005
|
-
statusCode: (
|
|
7090
|
+
error: ((_l = (_k = error2 == null ? void 0 : error2.response) == null ? void 0 : _k.data) == null ? void 0 : _l.message) || "Something went wrong!",
|
|
7091
|
+
result: (_n = (_m = error2 == null ? void 0 : error2.response) == null ? void 0 : _m.data) == null ? void 0 : _n.result,
|
|
7092
|
+
statusCode: (_o = error2 == null ? void 0 : error2.response) == null ? void 0 : _o.status
|
|
7006
7093
|
});
|
|
7007
7094
|
hideLoader();
|
|
7008
7095
|
}
|
|
@@ -7268,7 +7355,8 @@ function CardOnFile({ session_token, callback, isloading, onCancel, showChecks,
|
|
|
7268
7355
|
tokenKey: dcToken,
|
|
7269
7356
|
setLoader: setLoadingIframe,
|
|
7270
7357
|
customCSS,
|
|
7271
|
-
height
|
|
7358
|
+
height,
|
|
7359
|
+
onError: (msg) => setError(msg || DcLoadingError)
|
|
7272
7360
|
}
|
|
7273
7361
|
) }),
|
|
7274
7362
|
/* @__PURE__ */ jsxs13("div", { className: "form-group", children: [
|
|
@@ -7958,7 +8046,7 @@ function PartialPayment(props) {
|
|
|
7958
8046
|
}
|
|
7959
8047
|
};
|
|
7960
8048
|
const getPaymentDetails = async () => {
|
|
7961
|
-
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2, _q2, _r2, _s2, _t2, _u2, _v2, _w2;
|
|
8049
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2, _q2, _r2, _s2, _t2, _u2, _v2, _w2, _x2, _y2, _z2, _A;
|
|
7962
8050
|
showLoader();
|
|
7963
8051
|
try {
|
|
7964
8052
|
const data = {
|
|
@@ -7973,11 +8061,13 @@ function PartialPayment(props) {
|
|
|
7973
8061
|
handleClose();
|
|
7974
8062
|
setError("Something went wrong.");
|
|
7975
8063
|
}
|
|
8064
|
+
let willShowCardForm = true;
|
|
7976
8065
|
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) {
|
|
7977
8066
|
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");
|
|
7978
8067
|
let cardlists = (_n2 = (_m2 = (_l2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _l2.data) == null ? void 0 : _m2.card_list) == null ? void 0 : _n2.filter((card) => (card == null ? void 0 : card.card_type) !== "Bank");
|
|
7979
8068
|
if ((cardlists == null ? void 0 : cardlists.length) > 0) {
|
|
7980
8069
|
setActiveinCard("list");
|
|
8070
|
+
willShowCardForm = false;
|
|
7981
8071
|
}
|
|
7982
8072
|
if ((banklists == null ? void 0 : banklists.length) > 0) {
|
|
7983
8073
|
setActiveinBank("list");
|
|
@@ -7990,11 +8080,14 @@ function PartialPayment(props) {
|
|
|
7990
8080
|
if (((_p2 = (_o2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _o2.data) == null ? void 0 : _p2.paymentDeviceList) && ((_s2 = (_r2 = (_q2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _q2.data) == null ? void 0 : _r2.paymentDeviceList) == null ? void 0 : _s2.length) > 0) {
|
|
7991
8081
|
setSelectedReader((_u2 = (_t2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _t2.data) == null ? void 0 : _u2.paymentDeviceList[0]);
|
|
7992
8082
|
}
|
|
8083
|
+
if (willShowCardForm && ((_w2 = (_v2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _v2.data) == null ? void 0 : _w2.paymentGateway) === 31 && ((_y2 = (_x2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _x2.data) == null ? void 0 : _y2.dctoken)) {
|
|
8084
|
+
setLoadingIframe(true);
|
|
8085
|
+
}
|
|
7993
8086
|
hideLoader();
|
|
7994
8087
|
} catch (err) {
|
|
7995
8088
|
console.log(err);
|
|
7996
8089
|
hideLoader();
|
|
7997
|
-
setError(((
|
|
8090
|
+
setError(((_A = (_z2 = err == null ? void 0 : err.response) == null ? void 0 : _z2.data) == null ? void 0 : _A.message) || (err == null ? void 0 : err.message) || "Something went wrong");
|
|
7998
8091
|
}
|
|
7999
8092
|
};
|
|
8000
8093
|
const handlechargeCustomer = async (e) => {
|
|
@@ -8568,7 +8661,8 @@ function PartialPayment(props) {
|
|
|
8568
8661
|
{
|
|
8569
8662
|
isOpen: show,
|
|
8570
8663
|
tokenKey: paymentData == null ? void 0 : paymentData.dctoken,
|
|
8571
|
-
setLoader: setLoadingIframe
|
|
8664
|
+
setLoader: setLoadingIframe,
|
|
8665
|
+
onError: (msg) => setError(msg || DcLoadingError)
|
|
8572
8666
|
}
|
|
8573
8667
|
) }),
|
|
8574
8668
|
/* @__PURE__ */ jsxs16("div", { className: "form-group", children: [
|
|
@@ -10118,6 +10212,10 @@ var ModelContentSky = ({ amount, bankAmount, submitBtnText = "Pay", session_toke
|
|
|
10118
10212
|
const [errorBankConsent, setErrorBankConsent] = useState9("");
|
|
10119
10213
|
const [errorBankConsentOther, setErrorBankConsentOther] = useState9("");
|
|
10120
10214
|
const [isTokenizerReady, setTokenizerReady] = useState9(false);
|
|
10215
|
+
console.log(loadingIframe, "loadingIframe");
|
|
10216
|
+
console.log(loading, "loader");
|
|
10217
|
+
console.log(loading2, "loading2");
|
|
10218
|
+
console.log(loadingPrev, "loadingPrev");
|
|
10121
10219
|
let mastercard2 = S3Url + "widget/mc-img.svg";
|
|
10122
10220
|
let visa2 = S3Url + "widget/visa-img.svg";
|
|
10123
10221
|
let americanexp2 = S3Url + "widget/ae-img.svg";
|
|
@@ -10326,6 +10424,7 @@ var ModelContentSky = ({ amount, bankAmount, submitBtnText = "Pay", session_toke
|
|
|
10326
10424
|
};
|
|
10327
10425
|
const completeFractalFlow = async (tokenizeData, intentid, typeoftoken) => {
|
|
10328
10426
|
var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
|
|
10427
|
+
showLoader();
|
|
10329
10428
|
try {
|
|
10330
10429
|
console.log({
|
|
10331
10430
|
tokenizeData,
|
|
@@ -10951,7 +11050,7 @@ var ModelContentSky = ({ amount, bankAmount, submitBtnText = "Pay", session_toke
|
|
|
10951
11050
|
}
|
|
10952
11051
|
};
|
|
10953
11052
|
const getPaymentDetails = async () => {
|
|
10954
|
-
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2, _q2;
|
|
11053
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2, _q2, _r2, _s2, _t2, _u2;
|
|
10955
11054
|
try {
|
|
10956
11055
|
showLoader();
|
|
10957
11056
|
const res = await axios8.get(`${masterBaseUrl}api/v1/gateway/get-payment-details/${session_token}`, {
|
|
@@ -10965,16 +11064,19 @@ var ModelContentSky = ({ amount, bankAmount, submitBtnText = "Pay", session_toke
|
|
|
10965
11064
|
setProcessingFee(Number((_d2 = (_c2 = res == null ? void 0 : res.data) == null ? void 0 : _c2.data) == null ? void 0 : _d2.fee) || 0);
|
|
10966
11065
|
setPaymentGateway((_f2 = (_e2 = res == null ? void 0 : res.data) == null ? void 0 : _e2.data) == null ? void 0 : _f2.paymentGateway);
|
|
10967
11066
|
setDCToken((_h2 = (_g2 = res == null ? void 0 : res.data) == null ? void 0 : _g2.data) == null ? void 0 : _h2.dctoken);
|
|
11067
|
+
if (((_j2 = (_i2 = res == null ? void 0 : res.data) == null ? void 0 : _i2.data) == null ? void 0 : _j2.paymentGateway) === 31 && ((_l2 = (_k2 = res == null ? void 0 : res.data) == null ? void 0 : _k2.data) == null ? void 0 : _l2.dctoken)) {
|
|
11068
|
+
setLoadingIframe(true);
|
|
11069
|
+
}
|
|
10968
11070
|
hideLoader();
|
|
10969
11071
|
}
|
|
10970
11072
|
} catch (error2) {
|
|
10971
|
-
console.log((
|
|
11073
|
+
console.log((_n2 = (_m2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _m2.data) == null ? void 0 : _n2.result, "error while getting payment details");
|
|
10972
11074
|
callback({
|
|
10973
|
-
error: ((
|
|
10974
|
-
result: (
|
|
10975
|
-
statusCode: (
|
|
11075
|
+
error: ((_p2 = (_o2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _o2.data) == null ? void 0 : _p2.message) || "Something went wrong!",
|
|
11076
|
+
result: (_r2 = (_q2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _q2.data) == null ? void 0 : _r2.result,
|
|
11077
|
+
statusCode: (_s2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _s2.status
|
|
10976
11078
|
});
|
|
10977
|
-
setError(((
|
|
11079
|
+
setError(((_u2 = (_t2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _t2.data) == null ? void 0 : _u2.message) || (error2 == null ? void 0 : error2.message) || "Something went wrong");
|
|
10978
11080
|
hideLoader();
|
|
10979
11081
|
}
|
|
10980
11082
|
};
|
|
@@ -11441,7 +11543,8 @@ var ModelContentSky = ({ amount, bankAmount, submitBtnText = "Pay", session_toke
|
|
|
11441
11543
|
tokenKey: dcToken,
|
|
11442
11544
|
setLoader: activeinCard === "form" ? setLoadingIframe : null,
|
|
11443
11545
|
isEmbedded: onSubmit ? true : false,
|
|
11444
|
-
customCSS
|
|
11546
|
+
customCSS,
|
|
11547
|
+
onError: (msg) => setError(msg || DcLoadingError)
|
|
11445
11548
|
}
|
|
11446
11549
|
) }),
|
|
11447
11550
|
/* @__PURE__ */ jsxs19("div", { className: "form-group-frac", children: [
|