@fractalpay/fractalpay-next-dev 0.0.212 → 0.0.214
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 +207 -567
- 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.214",
|
|
43
43
|
private: false,
|
|
44
44
|
type: "module",
|
|
45
45
|
scripts: {
|
|
@@ -3665,7 +3665,7 @@ function GetPaymentPage(props) {
|
|
|
3665
3665
|
return Object.keys(errors).length > 0;
|
|
3666
3666
|
};
|
|
3667
3667
|
const submitFunc = async (e) => {
|
|
3668
|
-
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2;
|
|
3668
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2;
|
|
3669
3669
|
e.preventDefault();
|
|
3670
3670
|
const el = document.activeElement;
|
|
3671
3671
|
if (el instanceof HTMLElement) {
|
|
@@ -3743,10 +3743,16 @@ function GetPaymentPage(props) {
|
|
|
3743
3743
|
let sesionResult = await axios3.post(`${masterBaseUrl}api/v1/widget/generate-session`, requestOptions);
|
|
3744
3744
|
try {
|
|
3745
3745
|
console.log(sesionResult, "sesionResult");
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3746
|
+
let tokenizeData;
|
|
3747
|
+
try {
|
|
3748
|
+
tokenizeData = await tokenizerRef.current.createToken({
|
|
3749
|
+
public_key_pem: ((_b2 = (_a2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _a2.data) == null ? void 0 : _b2.publicKeyPem) || ((_d2 = (_c2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _c2.data) == null ? void 0 : _d2.public_key_pem),
|
|
3750
|
+
session_key: (_f2 = (_e2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _e2.data) == null ? void 0 : _f2.session_key
|
|
3751
|
+
});
|
|
3752
|
+
} catch (err) {
|
|
3753
|
+
setErrorIframe(((_h2 = (_g2 = err == null ? void 0 : err.response) == null ? void 0 : _g2.data) == null ? void 0 : _h2.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
|
|
3754
|
+
setLoading2(false);
|
|
3755
|
+
}
|
|
3750
3756
|
console.log(tokenizeData, "tokenizeData");
|
|
3751
3757
|
const reqData = JSON.stringify(__spreadProps(__spreadValues({}, tokenizeData), {
|
|
3752
3758
|
isSaveCardChecked: saveCardInfo,
|
|
@@ -3755,7 +3761,7 @@ function GetPaymentPage(props) {
|
|
|
3755
3761
|
customer_id: props == null ? void 0 : props.customerId
|
|
3756
3762
|
}));
|
|
3757
3763
|
const reqData2 = JSON.stringify({
|
|
3758
|
-
"pre_sales_id": `${(
|
|
3764
|
+
"pre_sales_id": `${(_j2 = (_i2 = result == null ? void 0 : result.data) == null ? void 0 : _i2.data) == null ? void 0 : _j2.posSalesIdEncode}`,
|
|
3759
3765
|
"token": `${tokenizeData == null ? void 0 : tokenizeData.token}`,
|
|
3760
3766
|
"json_response": `${reqData}`
|
|
3761
3767
|
});
|
|
@@ -3788,11 +3794,11 @@ function GetPaymentPage(props) {
|
|
|
3788
3794
|
});
|
|
3789
3795
|
} catch (err) {
|
|
3790
3796
|
setLoading2(false);
|
|
3791
|
-
|
|
3797
|
+
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.");
|
|
3792
3798
|
}
|
|
3793
3799
|
} catch (err) {
|
|
3794
3800
|
setLoading2(false);
|
|
3795
|
-
setError(((
|
|
3801
|
+
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.");
|
|
3796
3802
|
}
|
|
3797
3803
|
} else {
|
|
3798
3804
|
try {
|
|
@@ -3810,7 +3816,7 @@ function GetPaymentPage(props) {
|
|
|
3810
3816
|
}
|
|
3811
3817
|
} catch (err) {
|
|
3812
3818
|
setLoading2(false);
|
|
3813
|
-
setError(((
|
|
3819
|
+
setError(((_p2 = (_o2 = err == null ? void 0 : err.response) == null ? void 0 : _o2.data) == null ? void 0 : _p2.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
|
|
3814
3820
|
}
|
|
3815
3821
|
}
|
|
3816
3822
|
}
|
|
@@ -4626,6 +4632,7 @@ function PreAuthPayment(_a) {
|
|
|
4626
4632
|
const [loading, setLoading] = useState5(false);
|
|
4627
4633
|
const [loading2, setLoading2] = useState5(false);
|
|
4628
4634
|
const [error, setError] = useState5("");
|
|
4635
|
+
const [errorIframe, setErrorIframe] = useState5("");
|
|
4629
4636
|
const [success, setSuccess] = useState5(false);
|
|
4630
4637
|
const [show, setShow] = useState5(false);
|
|
4631
4638
|
const [activetab, setActive] = useState5("card");
|
|
@@ -4678,6 +4685,7 @@ function PreAuthPayment(_a) {
|
|
|
4678
4685
|
const [selectedCard, setSelectedCard] = useState5();
|
|
4679
4686
|
const [cashDiscount, setCashDiscount] = useState5(void 0);
|
|
4680
4687
|
const [paymentData, setPaymentData] = useState5();
|
|
4688
|
+
const [loadingIframe, setLoadingIframe] = useState5(false);
|
|
4681
4689
|
let [tranId, setTranId] = useState5("");
|
|
4682
4690
|
const CalculateCashDiscount = (amount, surcharge) => {
|
|
4683
4691
|
const surchargeVal = (parseFloat(surcharge) || 0) / 100;
|
|
@@ -4770,44 +4778,22 @@ function PreAuthPayment(_a) {
|
|
|
4770
4778
|
});
|
|
4771
4779
|
};
|
|
4772
4780
|
const validateCardData = () => {
|
|
4773
|
-
var _a3, _b3
|
|
4781
|
+
var _a3, _b3;
|
|
4774
4782
|
const errors = {};
|
|
4775
4783
|
const data = cardData;
|
|
4776
|
-
if ((
|
|
4777
|
-
|
|
4778
|
-
const year = (data == null ? void 0 : data.expiryYear) || "";
|
|
4779
|
-
if (!((_a3 = data == null ? void 0 : data.cardNumber) == null ? void 0 : _a3.trim())) errors.cardNumber = "Card number is required";
|
|
4780
|
-
if (!((_b3 = data == null ? void 0 : data.expiryMonth) == null ? void 0 : _b3.trim()) || !((_c2 = data == null ? void 0 : data.expiryYear) == null ? void 0 : _c2.trim())) {
|
|
4781
|
-
errors.expiryMonth = "Invalid Expiration Date.";
|
|
4782
|
-
} else if (isNaN(month) || month < 1 || month > 12 || year.length !== 4) {
|
|
4783
|
-
errors.expiryMonth = "Invalid Expiration Date.";
|
|
4784
|
-
}
|
|
4785
|
-
if (!((_d2 = data == null ? void 0 : data.cvv) == null ? void 0 : _d2.trim())) errors.cvv = "CVV is required";
|
|
4786
|
-
if ((data == null ? void 0 : data.expiryMonth) && (data == null ? void 0 : data.expiryYear) && data.expiryMonth.length <= 2 && data.expiryYear.length === 4) {
|
|
4787
|
-
const month2 = parseInt(data.expiryMonth, 10);
|
|
4788
|
-
const year2 = parseInt(data.expiryYear, 10);
|
|
4789
|
-
const now = /* @__PURE__ */ new Date();
|
|
4790
|
-
const currentMonth = now.getMonth() + 1;
|
|
4791
|
-
const currentYear = now.getFullYear();
|
|
4792
|
-
if (year2 < currentYear || year2 === currentYear && month2 < currentMonth) {
|
|
4793
|
-
errors.expiryMonth = "Card is expired";
|
|
4794
|
-
}
|
|
4795
|
-
}
|
|
4796
|
-
}
|
|
4797
|
-
if (!((_e2 = data == null ? void 0 : data.cardName) == null ? void 0 : _e2.trim())) errors.cardName = "Card name is required";
|
|
4798
|
-
if (!((_f2 = data == null ? void 0 : data.zipCode) == null ? void 0 : _f2.trim())) errors.zipCode = "ZIP code is required";
|
|
4784
|
+
if (!((_a3 = data == null ? void 0 : data.cardName) == null ? void 0 : _a3.trim())) errors.cardName = "Card name is required";
|
|
4785
|
+
if (!((_b3 = data == null ? void 0 : data.zipCode) == null ? void 0 : _b3.trim())) errors.zipCode = "ZIP code is required";
|
|
4799
4786
|
setCardError(errors);
|
|
4800
4787
|
return Object.keys(errors).length > 0;
|
|
4801
4788
|
};
|
|
4802
4789
|
const submitFunc = async (e) => {
|
|
4803
|
-
var _a3, _b3, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l;
|
|
4790
|
+
var _a3, _b3, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l, _m, _n;
|
|
4804
4791
|
e.preventDefault();
|
|
4805
4792
|
const el = document.activeElement;
|
|
4806
4793
|
if (el instanceof HTMLElement) {
|
|
4807
4794
|
el.blur();
|
|
4808
4795
|
}
|
|
4809
4796
|
if (loading2) return;
|
|
4810
|
-
debugger;
|
|
4811
4797
|
if (activetab == "card") {
|
|
4812
4798
|
const hasError = validateCardData();
|
|
4813
4799
|
if (hasError) return;
|
|
@@ -4815,16 +4801,6 @@ function PreAuthPayment(_a) {
|
|
|
4815
4801
|
let validCard = true;
|
|
4816
4802
|
let validExpirationDate = true;
|
|
4817
4803
|
let validCVV = true;
|
|
4818
|
-
if ((paymentData == null ? void 0 : paymentData.paymentGateway) !== 32) {
|
|
4819
|
-
let validCard2 = DatacapWebToken.validateCardNumber(cardData == null ? void 0 : cardData.cardNumber.replaceAll(" ", ""));
|
|
4820
|
-
let validExpirationDate2 = DatacapWebToken.validateExpirationDate(cardData == null ? void 0 : cardData.expiryMonth, cardData == null ? void 0 : cardData.expiryYear);
|
|
4821
|
-
let validCVV2 = DatacapWebToken.validateCVV(cardData == null ? void 0 : cardData.cvv);
|
|
4822
|
-
let errors = {};
|
|
4823
|
-
if (!validCard2) errors.cardNumber = "Invalid card Number";
|
|
4824
|
-
if (!validExpirationDate2) errors.expiryMonth = "Invalid Expiration Date.";
|
|
4825
|
-
if (!validCVV2) errors.cvv = "Invalid CVV";
|
|
4826
|
-
setCardError(errors);
|
|
4827
|
-
}
|
|
4828
4804
|
if (validCard && validCVV && validExpirationDate) {
|
|
4829
4805
|
setLoading2(true);
|
|
4830
4806
|
try {
|
|
@@ -4887,10 +4863,17 @@ function PreAuthPayment(_a) {
|
|
|
4887
4863
|
try {
|
|
4888
4864
|
let sesionResult = await axios4.post(`${masterBaseUrl}api/v1/widget/generate-session`, requestOptions);
|
|
4889
4865
|
try {
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4866
|
+
let tokenizeData;
|
|
4867
|
+
try {
|
|
4868
|
+
tokenizeData = await tokenizerRef.current.createToken({
|
|
4869
|
+
public_key_pem: ((_b3 = (_a3 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _a3.data) == null ? void 0 : _b3.publicKeyPem) || ((_d2 = (_c2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _c2.data) == null ? void 0 : _d2.public_key_pem),
|
|
4870
|
+
session_key: (_f2 = (_e2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _e2.data) == null ? void 0 : _f2.session_key
|
|
4871
|
+
});
|
|
4872
|
+
} catch (err) {
|
|
4873
|
+
setLoading2(false);
|
|
4874
|
+
setErrorIframe(((_h2 = (_g2 = err == null ? void 0 : err.response) == null ? void 0 : _g2.data) == null ? void 0 : _h2.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
|
|
4875
|
+
return;
|
|
4876
|
+
}
|
|
4894
4877
|
const reqData = JSON.stringify(__spreadProps(__spreadValues({}, tokenizeData), {
|
|
4895
4878
|
name: cardData == null ? void 0 : cardData.cardName,
|
|
4896
4879
|
postal_code: cardData == null ? void 0 : cardData.zipCode,
|
|
@@ -4937,18 +4920,28 @@ function PreAuthPayment(_a) {
|
|
|
4937
4920
|
} catch (err) {
|
|
4938
4921
|
console.log(err);
|
|
4939
4922
|
setLoading2(false);
|
|
4940
|
-
setError(((
|
|
4923
|
+
setError(((_j2 = (_i2 = err == null ? void 0 : err.response) == null ? void 0 : _i2.data) == null ? void 0 : _j2.message) || (err == null ? void 0 : err.message) || "Something went wrong , Try again later");
|
|
4941
4924
|
}
|
|
4942
4925
|
} catch (err) {
|
|
4943
4926
|
setLoading2(false);
|
|
4944
|
-
setError(((
|
|
4927
|
+
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 , Try again later");
|
|
4945
4928
|
}
|
|
4946
4929
|
} else {
|
|
4947
|
-
|
|
4930
|
+
try {
|
|
4931
|
+
const result = await window.requestDcToken();
|
|
4932
|
+
;
|
|
4933
|
+
if (result.Token) {
|
|
4934
|
+
tokenCallback(result);
|
|
4935
|
+
}
|
|
4936
|
+
} catch (err) {
|
|
4937
|
+
console.log(err, "Error while tokenizing");
|
|
4938
|
+
setErrorIframe(err);
|
|
4939
|
+
setLoading2(false);
|
|
4940
|
+
}
|
|
4948
4941
|
}
|
|
4949
4942
|
} catch (err) {
|
|
4950
4943
|
setLoading2(false);
|
|
4951
|
-
setError(((
|
|
4944
|
+
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.");
|
|
4952
4945
|
}
|
|
4953
4946
|
}
|
|
4954
4947
|
}
|
|
@@ -5187,6 +5180,7 @@ function PreAuthPayment(_a) {
|
|
|
5187
5180
|
/* @__PURE__ */ jsx20(FractalTokenizerScript, {}),
|
|
5188
5181
|
/* @__PURE__ */ jsx20(Chargewidgetstyles, {}),
|
|
5189
5182
|
/* @__PURE__ */ jsx20(CardBankRadioStyles, {}),
|
|
5183
|
+
/* @__PURE__ */ jsx20(DataCapScriptLoader, {}),
|
|
5190
5184
|
/* @__PURE__ */ jsxs12(Fragment12, { children: [
|
|
5191
5185
|
showButton && /* @__PURE__ */ jsx20(
|
|
5192
5186
|
"button",
|
|
@@ -5203,9 +5197,12 @@ function PreAuthPayment(_a) {
|
|
|
5203
5197
|
onClose: handleClose,
|
|
5204
5198
|
children: [
|
|
5205
5199
|
error && /* @__PURE__ */ jsx20("div", { style: { maxHeight: "606px", minHeight: "60vh", padding: "40px" }, children: /* @__PURE__ */ jsx20(ErrorCardMessage_default, { error, onClose: handleClose }) }),
|
|
5200
|
+
errorIframe && /* @__PURE__ */ jsx20("div", { style: { maxHeight: "606px", minHeight: "60vh", padding: "40px" }, children: /* @__PURE__ */ jsx20(ErrorCardMessage_default, { error: errorIframe, onClose: () => {
|
|
5201
|
+
setErrorIframe("");
|
|
5202
|
+
} }) }),
|
|
5206
5203
|
success && /* @__PURE__ */ jsx20(SuccessMsz, { onClose: handleClose, tranId }),
|
|
5207
5204
|
!error && !success && /* @__PURE__ */ jsxs12(Fragment12, { children: [
|
|
5208
|
-
(loading || loading2) && /* @__PURE__ */ jsx20(Loader_default, { loading: loading || loading2 }),
|
|
5205
|
+
(loading || loading2 || loadingIframe) && /* @__PURE__ */ jsx20(Loader_default, { loading: loading || loading2 || loadingIframe }),
|
|
5209
5206
|
/* @__PURE__ */ jsx20("div", { children: /* @__PURE__ */ jsx20("div", { className: "frac-card-payment-page frac-form", children: /* @__PURE__ */ jsxs12("div", { className: "parent-pay-container", children: [
|
|
5210
5207
|
/* @__PURE__ */ jsx20("span", { className: "request-payment-close-popup", onClick: handleClose, children: /* @__PURE__ */ jsxs12("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: [
|
|
5211
5208
|
/* @__PURE__ */ jsx20("g", { clipPath: "url(#clip0_12425_52336)", children: /* @__PURE__ */ jsx20("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" }) }),
|
|
@@ -5424,70 +5421,14 @@ function PreAuthPayment(_a) {
|
|
|
5424
5421
|
),
|
|
5425
5422
|
(cardError == null ? void 0 : cardError.cardName) && /* @__PURE__ */ jsx20("span", { className: "error-span", children: cardError == null ? void 0 : cardError.cardName })
|
|
5426
5423
|
] }),
|
|
5427
|
-
/* @__PURE__ */
|
|
5428
|
-
|
|
5429
|
-
|
|
5430
|
-
|
|
5431
|
-
|
|
5432
|
-
|
|
5433
|
-
|
|
5434
|
-
|
|
5435
|
-
maxLength: 19,
|
|
5436
|
-
inputMode: "numeric",
|
|
5437
|
-
placeholder: "0000 0000 0000 0000",
|
|
5438
|
-
value: (cardData == null ? void 0 : cardData.cardNumber) || "",
|
|
5439
|
-
onChange: (e) => handleCardNumberChange(e),
|
|
5440
|
-
"data-token": "card_number"
|
|
5441
|
-
}
|
|
5442
|
-
),
|
|
5443
|
-
/* @__PURE__ */ jsx20("div", { className: "card-crdi card-expiry-new", children: /* @__PURE__ */ jsxs12("div", { className: "exp-date-year-container", children: [
|
|
5444
|
-
/* @__PURE__ */ jsx20("div", { className: "exp-date form-group", children: /* @__PURE__ */ jsx20(
|
|
5445
|
-
"input",
|
|
5446
|
-
{
|
|
5447
|
-
"data-token": "exp_month",
|
|
5448
|
-
className: "form-control required card-cvv-in",
|
|
5449
|
-
type: "text",
|
|
5450
|
-
style: { maxHeight: "36px" },
|
|
5451
|
-
placeholder: "MM",
|
|
5452
|
-
maxLength: 2,
|
|
5453
|
-
value: (cardData == null ? void 0 : cardData.expiryMonth) || "",
|
|
5454
|
-
onChange: (e) => handleCardChange("expiryMonth", e.target.value)
|
|
5455
|
-
}
|
|
5456
|
-
) }),
|
|
5457
|
-
/* @__PURE__ */ jsx20("div", { className: "exp-year form-group", children: /* @__PURE__ */ jsx20(
|
|
5458
|
-
"input",
|
|
5459
|
-
{
|
|
5460
|
-
"data-token": "exp_year",
|
|
5461
|
-
className: "form-control required card-cvv-in",
|
|
5462
|
-
type: "text",
|
|
5463
|
-
style: { maxHeight: "36px" },
|
|
5464
|
-
placeholder: "YYYY",
|
|
5465
|
-
maxLength: 4,
|
|
5466
|
-
value: (cardData == null ? void 0 : cardData.expiryYear) || "",
|
|
5467
|
-
onChange: (e) => handleCardChange("expiryYear", e.target.value)
|
|
5468
|
-
}
|
|
5469
|
-
) }),
|
|
5470
|
-
/* @__PURE__ */ jsx20("div", { className: "security-digit form-group", children: /* @__PURE__ */ jsx20(
|
|
5471
|
-
"input",
|
|
5472
|
-
{
|
|
5473
|
-
"data-token": "cvv",
|
|
5474
|
-
className: "form-control required card-cvv-in",
|
|
5475
|
-
type: "text",
|
|
5476
|
-
style: { maxHeight: "36px" },
|
|
5477
|
-
maxLength: 4,
|
|
5478
|
-
placeholder: "CVC",
|
|
5479
|
-
value: (cardData == null ? void 0 : cardData.cvv) || "",
|
|
5480
|
-
onChange: (e) => handleCardChange("cvv", e.target.value)
|
|
5481
|
-
}
|
|
5482
|
-
) })
|
|
5483
|
-
] }) }),
|
|
5484
|
-
(cardError == null ? void 0 : cardError.cardNumber) && /* @__PURE__ */ jsx20("span", { className: "error-span", children: cardError == null ? void 0 : cardError.cardNumber }),
|
|
5485
|
-
/* @__PURE__ */ jsxs12("p", { style: { margin: "0" }, children: [
|
|
5486
|
-
(cardError == null ? void 0 : cardError.expiryMonth) || (cardError == null ? void 0 : cardError.expiryYear) ? /* @__PURE__ */ jsx20("span", { className: "error-span", style: { paddingRight: "4px" }, children: cardError == null ? void 0 : cardError.expiryMonth }) : "",
|
|
5487
|
-
(cardError == null ? void 0 : cardError.cvv) && /* @__PURE__ */ jsx20("span", { className: "error-span", children: cardError == null ? void 0 : cardError.cvv })
|
|
5488
|
-
] })
|
|
5489
|
-
] })
|
|
5490
|
-
] }),
|
|
5424
|
+
/* @__PURE__ */ jsx20("div", { className: "form-group", children: /* @__PURE__ */ jsx20(
|
|
5425
|
+
DataCapFields,
|
|
5426
|
+
{
|
|
5427
|
+
isOpen: show,
|
|
5428
|
+
tokenKey: paymentData == null ? void 0 : paymentData.dctoken,
|
|
5429
|
+
setLoader: setLoadingIframe
|
|
5430
|
+
}
|
|
5431
|
+
) }),
|
|
5491
5432
|
/* @__PURE__ */ jsxs12("div", { className: "form-group", children: [
|
|
5492
5433
|
/* @__PURE__ */ jsx20("label", { htmlFor: "OrderId", children: "Order ID / Description" }),
|
|
5493
5434
|
/* @__PURE__ */ jsx20(
|
|
@@ -5971,6 +5912,8 @@ import { Fragment as Fragment14, jsx as jsx24, jsxs as jsxs14 } from "react/jsx-
|
|
|
5971
5912
|
function AddCardEasyPay(props) {
|
|
5972
5913
|
var _a, _b;
|
|
5973
5914
|
const [loading, setLoading] = useState6(false);
|
|
5915
|
+
const [loadingIframe, setLoadingIframe] = useState6(false);
|
|
5916
|
+
const [errorIframe, setErrorIframe] = useState6("");
|
|
5974
5917
|
const [success, setSuccess] = useState6(false);
|
|
5975
5918
|
const [error, setError] = useState6("");
|
|
5976
5919
|
const [show, setShow] = useState6(false);
|
|
@@ -6061,7 +6004,6 @@ function AddCardEasyPay(props) {
|
|
|
6061
6004
|
setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
6062
6005
|
[name2]: ""
|
|
6063
6006
|
}));
|
|
6064
|
-
console.log(value, name2);
|
|
6065
6007
|
setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
6066
6008
|
[name2]: value
|
|
6067
6009
|
}));
|
|
@@ -6080,7 +6022,6 @@ function AddCardEasyPay(props) {
|
|
|
6080
6022
|
setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
6081
6023
|
cardNumber: formatted
|
|
6082
6024
|
}));
|
|
6083
|
-
console.log(rawValue == null ? void 0 : rawValue.length, "length");
|
|
6084
6025
|
if ((rawValue == null ? void 0 : rawValue.length) === 16) {
|
|
6085
6026
|
(_b2 = exp_month_ref == null ? void 0 : exp_month_ref.current) == null ? void 0 : _b2.focus();
|
|
6086
6027
|
}
|
|
@@ -6089,38 +6030,10 @@ function AddCardEasyPay(props) {
|
|
|
6089
6030
|
});
|
|
6090
6031
|
};
|
|
6091
6032
|
const validateCardData = () => {
|
|
6092
|
-
var _a2
|
|
6033
|
+
var _a2;
|
|
6093
6034
|
const errors = {};
|
|
6094
6035
|
const data = cardData;
|
|
6095
|
-
if ((
|
|
6096
|
-
const month = parseInt((data == null ? void 0 : data.expiryMonth) || "", 10);
|
|
6097
|
-
const year = (data == null ? void 0 : data.expiryYear) || "";
|
|
6098
|
-
if (!((_a2 = data == null ? void 0 : data.cardNumber) == null ? void 0 : _a2.trim())) errors.cardNumber = "Card number is required";
|
|
6099
|
-
if (!((_b2 = data == null ? void 0 : data.expiryMonth) == null ? void 0 : _b2.trim())) {
|
|
6100
|
-
errors.expiryMonth = "Expiration month is required";
|
|
6101
|
-
} else if (Number(data == null ? void 0 : data.expiryMonth) > 12 || Number(data == null ? void 0 : data.expiryMonth) < 1) {
|
|
6102
|
-
errors.expiryMonth = "Invalid Expiration Month.";
|
|
6103
|
-
}
|
|
6104
|
-
if (!((_c = data == null ? void 0 : data.expiryYear) == null ? void 0 : _c.trim())) {
|
|
6105
|
-
errors.expiryYear = "Expiration year is required";
|
|
6106
|
-
} else if (((_d = data == null ? void 0 : data.expiryYear) == null ? void 0 : _d.trim().length) !== 4 || Number(data == null ? void 0 : data.expiryYear) < 2025) {
|
|
6107
|
-
errors.expiryYear = "Invalid Expiration Year.";
|
|
6108
|
-
} else if (isNaN(month) || month < 1 || month > 12 || year.length !== 4) {
|
|
6109
|
-
errors.expiryMonth = "Invalid Expiration Date.";
|
|
6110
|
-
}
|
|
6111
|
-
if (!((_e = data == null ? void 0 : data.cvv) == null ? void 0 : _e.trim())) errors.cvv = "CVC is required";
|
|
6112
|
-
if ((data == null ? void 0 : data.expiryMonth) && (data == null ? void 0 : data.expiryYear) && data.expiryMonth.length <= 2 && data.expiryYear.length === 4) {
|
|
6113
|
-
const month2 = parseInt(data.expiryMonth, 10);
|
|
6114
|
-
const year2 = parseInt(data.expiryYear, 10);
|
|
6115
|
-
const now = /* @__PURE__ */ new Date();
|
|
6116
|
-
const currentMonth = now.getMonth() + 1;
|
|
6117
|
-
const currentYear = now.getFullYear();
|
|
6118
|
-
if (year2 < currentYear || year2 === currentYear && month2 < currentMonth) {
|
|
6119
|
-
errors.expiryMonth = "Card is expired";
|
|
6120
|
-
}
|
|
6121
|
-
}
|
|
6122
|
-
}
|
|
6123
|
-
if (!((_f = data == null ? void 0 : data.cardName) == null ? void 0 : _f.trim())) errors.cardName = "Card name is required";
|
|
6036
|
+
if (!((_a2 = data == null ? void 0 : data.cardName) == null ? void 0 : _a2.trim())) errors.cardName = "Card name is required";
|
|
6124
6037
|
setCardError(errors);
|
|
6125
6038
|
return Object.keys(errors).length > 0;
|
|
6126
6039
|
};
|
|
@@ -6134,7 +6047,6 @@ function AddCardEasyPay(props) {
|
|
|
6134
6047
|
addcard: true
|
|
6135
6048
|
};
|
|
6136
6049
|
let paymentData2 = await axios5.post(`${baseUrl}get-payment-details`, data);
|
|
6137
|
-
console.log(paymentData2);
|
|
6138
6050
|
setPaymentData((_a2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _a2.data);
|
|
6139
6051
|
if (!((_c = (_b2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _b2.data) == null ? void 0 : _c.paymentGateway)) {
|
|
6140
6052
|
handleClose();
|
|
@@ -6163,30 +6075,17 @@ function AddCardEasyPay(props) {
|
|
|
6163
6075
|
}
|
|
6164
6076
|
if (loading) return;
|
|
6165
6077
|
const hasError = validateCardData();
|
|
6166
|
-
console.log(cardData);
|
|
6167
6078
|
if (hasError) return;
|
|
6168
6079
|
else {
|
|
6169
6080
|
let validCard = true;
|
|
6170
6081
|
let validExpirationDate = true;
|
|
6171
6082
|
let validCVV = true;
|
|
6172
|
-
if ((paymentData == null ? void 0 : paymentData.paymentGateway) !== 32) {
|
|
6173
|
-
let validCard2 = DatacapWebToken.validateCardNumber(cardData == null ? void 0 : cardData.cardNumber.replaceAll(" ", ""));
|
|
6174
|
-
let validExpirationDate2 = DatacapWebToken.validateExpirationDate(cardData == null ? void 0 : cardData.expiryMonth, cardData == null ? void 0 : cardData.expiryYear);
|
|
6175
|
-
let validCVV2 = DatacapWebToken.validateCVV(cardData == null ? void 0 : cardData.cvv);
|
|
6176
|
-
let errors = {};
|
|
6177
|
-
if (!validCard2) errors.cardNumber = "Invalid card Number";
|
|
6178
|
-
if (!validExpirationDate2) errors.expiryMonth = "Invalid Expiration Date.";
|
|
6179
|
-
if (!validCVV2) errors.cvv = "Invalid CVV";
|
|
6180
|
-
setCardError(errors);
|
|
6181
|
-
}
|
|
6182
6083
|
if (validCard && validCVV && validExpirationDate) {
|
|
6183
6084
|
showLoader();
|
|
6184
6085
|
try {
|
|
6185
6086
|
let getTokenCallback = async function(token) {
|
|
6186
6087
|
var _a3, _b3, _c2;
|
|
6187
|
-
console.log(token);
|
|
6188
6088
|
if (token.Error) {
|
|
6189
|
-
console.log(token == null ? void 0 : token.Error);
|
|
6190
6089
|
setError(token.Error);
|
|
6191
6090
|
hideLoader();
|
|
6192
6091
|
} else {
|
|
@@ -6199,7 +6098,6 @@ function AddCardEasyPay(props) {
|
|
|
6199
6098
|
};
|
|
6200
6099
|
try {
|
|
6201
6100
|
let apiResponse = await axios5.post(`${baseUrl}add-card`, reqData);
|
|
6202
|
-
console.log(apiResponse);
|
|
6203
6101
|
if ((_a3 = apiResponse == null ? void 0 : apiResponse.data) == null ? void 0 : _a3.result) {
|
|
6204
6102
|
setSuccess(true);
|
|
6205
6103
|
hideLoader();
|
|
@@ -6251,7 +6149,6 @@ function AddCardEasyPay(props) {
|
|
|
6251
6149
|
headers: myHeaders2
|
|
6252
6150
|
}
|
|
6253
6151
|
);
|
|
6254
|
-
console.log(addCardRes);
|
|
6255
6152
|
if ((_g = addCardRes == null ? void 0 : addCardRes.data) == null ? void 0 : _g.result) {
|
|
6256
6153
|
setSuccess(true);
|
|
6257
6154
|
hideLoader();
|
|
@@ -6270,8 +6167,16 @@ function AddCardEasyPay(props) {
|
|
|
6270
6167
|
setError(((_m = (_l = err == null ? void 0 : err.response) == null ? void 0 : _l.data) == null ? void 0 : _m.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
|
|
6271
6168
|
}
|
|
6272
6169
|
} else {
|
|
6273
|
-
|
|
6274
|
-
|
|
6170
|
+
try {
|
|
6171
|
+
const result = await window.requestDcToken();
|
|
6172
|
+
;
|
|
6173
|
+
if (result.Token) {
|
|
6174
|
+
getTokenCallback(result);
|
|
6175
|
+
}
|
|
6176
|
+
} catch (err) {
|
|
6177
|
+
console.log(err, "Error while tokenizing");
|
|
6178
|
+
setErrorIframe(err);
|
|
6179
|
+
hideLoader();
|
|
6275
6180
|
}
|
|
6276
6181
|
}
|
|
6277
6182
|
} catch (err) {
|
|
@@ -6290,9 +6195,13 @@ function AddCardEasyPay(props) {
|
|
|
6290
6195
|
return /* @__PURE__ */ jsxs14(Fragment14, { children: [
|
|
6291
6196
|
/* @__PURE__ */ jsx24(DataScript, {}),
|
|
6292
6197
|
/* @__PURE__ */ jsx24(FractalTokenizerScript, {}),
|
|
6198
|
+
/* @__PURE__ */ jsx24(DataCapScriptLoader, {}),
|
|
6293
6199
|
/* @__PURE__ */ jsx24(AddCardStyle, {}),
|
|
6294
|
-
/* @__PURE__ */ jsx24(Loader_default, { loading }),
|
|
6200
|
+
/* @__PURE__ */ jsx24(Loader_default, { loading: loading || loadingIframe }),
|
|
6295
6201
|
error && /* @__PURE__ */ jsx24("div", { style: { maxHeight: "606px", minHeight: "60vh", padding: "40px" }, children: /* @__PURE__ */ jsx24(ErrorCardMessage_default, { error, onClose: handleClose }) }),
|
|
6202
|
+
errorIframe && /* @__PURE__ */ jsx24("div", { style: { maxHeight: "606px", minHeight: "60vh", padding: "40px" }, children: /* @__PURE__ */ jsx24(ErrorCardMessage_default, { error: errorIframe, onClose: () => {
|
|
6203
|
+
setErrorIframe("");
|
|
6204
|
+
} }) }),
|
|
6296
6205
|
success && /* @__PURE__ */ jsx24(SuccessCardMsz_default, { onClose: handleCloseSeccess }),
|
|
6297
6206
|
!error && !success && /* @__PURE__ */ jsx24(Fragment14, { children: /* @__PURE__ */ jsx24(
|
|
6298
6207
|
"div",
|
|
@@ -6382,77 +6291,14 @@ function AddCardEasyPay(props) {
|
|
|
6382
6291
|
}
|
|
6383
6292
|
}, children: [
|
|
6384
6293
|
/* @__PURE__ */ jsxs14("div", { style: { maxHeight: "350px", minHeight: "0" }, className: "card-scrl", children: [
|
|
6385
|
-
/* @__PURE__ */
|
|
6386
|
-
|
|
6387
|
-
|
|
6388
|
-
|
|
6389
|
-
|
|
6390
|
-
|
|
6391
|
-
|
|
6392
|
-
|
|
6393
|
-
maxLength: 19,
|
|
6394
|
-
inputMode: "numeric",
|
|
6395
|
-
value: (cardData == null ? void 0 : cardData.cardNumber) || "",
|
|
6396
|
-
onChange: (e) => handleCardNumberChange(e),
|
|
6397
|
-
ref: card_number_ref
|
|
6398
|
-
}
|
|
6399
|
-
),
|
|
6400
|
-
(cardError == null ? void 0 : cardError.cardNumber) && /* @__PURE__ */ jsx24("span", { className: "error-span", style: { color: "red", fontSize: "12px" }, children: cardError == null ? void 0 : cardError.cardNumber }),
|
|
6401
|
-
/* @__PURE__ */ jsx24("br", {})
|
|
6402
|
-
] }),
|
|
6403
|
-
/* @__PURE__ */ jsx24("div", { className: "card-dtl", children: /* @__PURE__ */ jsxs14("div", { className: "exp-cvc-container", style: { margin: "0" }, children: [
|
|
6404
|
-
/* @__PURE__ */ jsxs14("div", { className: "form-group", style: { marginTop: "0" }, children: [
|
|
6405
|
-
/* @__PURE__ */ jsx24("label", { htmlFor: "expMonth", children: "MM" }),
|
|
6406
|
-
/* @__PURE__ */ jsx24(
|
|
6407
|
-
"input",
|
|
6408
|
-
{
|
|
6409
|
-
"data-token": "exp_month",
|
|
6410
|
-
className: "form-control required",
|
|
6411
|
-
type: "text",
|
|
6412
|
-
placeholder: "MM",
|
|
6413
|
-
maxLength: 2,
|
|
6414
|
-
value: (cardData == null ? void 0 : cardData.expiryMonth) || "",
|
|
6415
|
-
onChange: (e) => handleCardChange("expiryMonth", e.target.value),
|
|
6416
|
-
ref: exp_month_ref
|
|
6417
|
-
}
|
|
6418
|
-
),
|
|
6419
|
-
(cardError == null ? void 0 : cardError.expiryMonth) && /* @__PURE__ */ jsx24("span", { className: "error-span", style: { color: "red", fontSize: "12px" }, children: cardError == null ? void 0 : cardError.expiryMonth })
|
|
6420
|
-
] }),
|
|
6421
|
-
/* @__PURE__ */ jsxs14("div", { className: "form-group", style: { marginTop: "0" }, children: [
|
|
6422
|
-
/* @__PURE__ */ jsx24("label", { htmlFor: "expYear", children: "YYYY" }),
|
|
6423
|
-
/* @__PURE__ */ jsx24(
|
|
6424
|
-
"input",
|
|
6425
|
-
{
|
|
6426
|
-
"data-token": "exp_year",
|
|
6427
|
-
className: "form-control required",
|
|
6428
|
-
type: "text",
|
|
6429
|
-
placeholder: "YYYY",
|
|
6430
|
-
maxLength: 4,
|
|
6431
|
-
value: (cardData == null ? void 0 : cardData.expiryYear) || "",
|
|
6432
|
-
onChange: (e) => handleCardChange("expiryYear", e.target.value),
|
|
6433
|
-
ref: exp_year_ref
|
|
6434
|
-
}
|
|
6435
|
-
),
|
|
6436
|
-
(cardError == null ? void 0 : cardError.expiryYear) && /* @__PURE__ */ jsx24("span", { className: "error-span", style: { color: "red", fontSize: "12px" }, children: cardError == null ? void 0 : cardError.expiryYear })
|
|
6437
|
-
] }),
|
|
6438
|
-
/* @__PURE__ */ jsxs14("div", { className: "form-group", style: { marginTop: "0" }, children: [
|
|
6439
|
-
/* @__PURE__ */ jsx24("label", { htmlFor: "cvc", children: "CVC" }),
|
|
6440
|
-
/* @__PURE__ */ jsx24(
|
|
6441
|
-
"input",
|
|
6442
|
-
{
|
|
6443
|
-
"data-token": "cvv",
|
|
6444
|
-
className: "form-control required",
|
|
6445
|
-
type: "text",
|
|
6446
|
-
placeholder: "CVC",
|
|
6447
|
-
maxLength: 4,
|
|
6448
|
-
value: (cardData == null ? void 0 : cardData.cvv) || "",
|
|
6449
|
-
onChange: (e) => handleCardChange("cvv", e.target.value),
|
|
6450
|
-
ref: cvv_ref
|
|
6451
|
-
}
|
|
6452
|
-
),
|
|
6453
|
-
(cardError == null ? void 0 : cardError.cvv) && /* @__PURE__ */ jsx24("span", { className: "error-span", style: { color: "red", fontSize: "12px" }, children: cardError == null ? void 0 : cardError.cvv })
|
|
6454
|
-
] })
|
|
6455
|
-
] }) }),
|
|
6294
|
+
/* @__PURE__ */ jsx24("div", { className: "form-group", style: { marginTop: "0", marginBottom: "10px" }, children: /* @__PURE__ */ jsx24(
|
|
6295
|
+
DataCapFields,
|
|
6296
|
+
{
|
|
6297
|
+
isOpen: true,
|
|
6298
|
+
tokenKey: paymentData == null ? void 0 : paymentData.dctoken,
|
|
6299
|
+
setLoader: setLoadingIframe
|
|
6300
|
+
}
|
|
6301
|
+
) }),
|
|
6456
6302
|
/* @__PURE__ */ jsxs14("div", { className: "form-group", style: { marginTop: "0" }, children: [
|
|
6457
6303
|
/* @__PURE__ */ jsxs14("label", { htmlFor: "cardholderName", children: [
|
|
6458
6304
|
"Name on card",
|
|
@@ -6816,6 +6662,8 @@ import { Fragment as Fragment16, jsx as jsx27, jsxs as jsxs16 } from "react/jsx-
|
|
|
6816
6662
|
function CardOnFile({ session_token, callback, isloading, onCancel, showChecks, merchantName, signCheckbox, checkedSignCheckbox, onCheckSign, cancelbtnClass, savebtnClass, inputClass, isDual }) {
|
|
6817
6663
|
var _a, _b;
|
|
6818
6664
|
const [loading, setLoading] = useState7(false);
|
|
6665
|
+
const [errorIframe, setErrorIframe] = useState7("");
|
|
6666
|
+
const [loadingIframe, setLoadingIframe] = useState7(false);
|
|
6819
6667
|
const [seeMore, setSeeMore] = useState7(false);
|
|
6820
6668
|
const [cardData, setCardData] = useState7();
|
|
6821
6669
|
const [cardError, setCardError] = useState7({});
|
|
@@ -6824,6 +6672,7 @@ function CardOnFile({ session_token, callback, isloading, onCancel, showChecks,
|
|
|
6824
6672
|
const hideLoader = () => setLoading(false);
|
|
6825
6673
|
const [passFee, setPassFee] = useState7(false);
|
|
6826
6674
|
const [paymentGateway, setPaymentGateway] = useState7();
|
|
6675
|
+
const [dcToken, setDCToken] = useState7();
|
|
6827
6676
|
const tokenizerRef = useRef7(null);
|
|
6828
6677
|
const fractalStyles = {
|
|
6829
6678
|
input: {
|
|
@@ -6848,30 +6697,12 @@ function CardOnFile({ session_token, callback, isloading, onCancel, showChecks,
|
|
|
6848
6697
|
}
|
|
6849
6698
|
};
|
|
6850
6699
|
const validateCardData = () => {
|
|
6851
|
-
var _a2, _b2, _c
|
|
6700
|
+
var _a2, _b2, _c;
|
|
6852
6701
|
const errors = {};
|
|
6853
6702
|
const data = cardData;
|
|
6854
|
-
if (
|
|
6855
|
-
|
|
6856
|
-
|
|
6857
|
-
if (!((_a2 = data == null ? void 0 : data.cardNumber) == null ? void 0 : _a2.trim())) errors.cardNumber = "Please enter a card number.";
|
|
6858
|
-
if (!((_b2 = data == null ? void 0 : data.expiryMonth) == null ? void 0 : _b2.trim())) {
|
|
6859
|
-
errors.expiryMonth = "Please enter an expiry month.";
|
|
6860
|
-
} else if (Number(data == null ? void 0 : data.expiryMonth) > 12 || Number(data == null ? void 0 : data.expiryMonth) < 1) {
|
|
6861
|
-
errors.expiryMonth = "Invalid Expiration Month.";
|
|
6862
|
-
}
|
|
6863
|
-
if (!((_c = data == null ? void 0 : data.expiryYear) == null ? void 0 : _c.trim())) {
|
|
6864
|
-
errors.expiryYear = "Please enter an expiry year.";
|
|
6865
|
-
} else if (((_d = data == null ? void 0 : data.expiryYear) == null ? void 0 : _d.trim().length) !== 4 || Number(data == null ? void 0 : data.expiryYear) < 2025) {
|
|
6866
|
-
errors.expiryYear = "Invalid Expiration Year.";
|
|
6867
|
-
} else if (isNaN(month) || month < 1 || month > 12 || year.length !== 4) {
|
|
6868
|
-
errors.expiryMonth = "Invalid Expiration Date.";
|
|
6869
|
-
}
|
|
6870
|
-
if (!((_e = data == null ? void 0 : data.cvv) == null ? void 0 : _e.trim())) errors.cvv = "Please enter a CVV.";
|
|
6871
|
-
}
|
|
6872
|
-
if (!((_f = data == null ? void 0 : data.firstName) == null ? void 0 : _f.trim())) errors.firstName = "Please enter a first name.";
|
|
6873
|
-
if (!((_g = data == null ? void 0 : data.lastName) == null ? void 0 : _g.trim())) errors.lastName = "Please enter a last name.";
|
|
6874
|
-
if (!((_h = data == null ? void 0 : data.zipCode) == null ? void 0 : _h.trim())) errors.zipCode = "Please enter a zip code.";
|
|
6703
|
+
if (!((_a2 = data == null ? void 0 : data.firstName) == null ? void 0 : _a2.trim())) errors.firstName = "Please enter a first name.";
|
|
6704
|
+
if (!((_b2 = data == null ? void 0 : data.lastName) == null ? void 0 : _b2.trim())) errors.lastName = "Please enter a last name.";
|
|
6705
|
+
if (!((_c = data == null ? void 0 : data.zipCode) == null ? void 0 : _c.trim())) errors.zipCode = "Please enter a zip code.";
|
|
6875
6706
|
if (signCheckbox && !checkedSignCheckbox) errors.checkSign = "You must authorize this before proceeding.";
|
|
6876
6707
|
if (showChecks && !(data == null ? void 0 : data.authHold)) errors.authHold = "You must authorize this before proceeding.";
|
|
6877
6708
|
if (showChecks && !(data == null ? void 0 : data.authorise)) errors.authorise = "Please confirm your authorization to continue.";
|
|
@@ -6963,10 +6794,16 @@ function CardOnFile({ session_token, callback, isloading, onCancel, showChecks,
|
|
|
6963
6794
|
redirect: "follow"
|
|
6964
6795
|
};
|
|
6965
6796
|
let sesionResult = await axios6.post(`${masterBaseUrl}api/v1/widget/generate-session`, requestOptions);
|
|
6966
|
-
|
|
6967
|
-
|
|
6968
|
-
|
|
6969
|
-
|
|
6797
|
+
let tokenizeData;
|
|
6798
|
+
try {
|
|
6799
|
+
tokenizeData = await tokenizerRef.current.createToken({
|
|
6800
|
+
public_key_pem: ((_b2 = (_a2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _a2.data) == null ? void 0 : _b2.publicKeyPem) || ((_d = (_c = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _c.data) == null ? void 0 : _d.public_key_pem),
|
|
6801
|
+
session_key: (_f = (_e = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _e.data) == null ? void 0 : _f.session_key
|
|
6802
|
+
});
|
|
6803
|
+
} catch (err) {
|
|
6804
|
+
setErrorIframe(err);
|
|
6805
|
+
hideLoader();
|
|
6806
|
+
}
|
|
6970
6807
|
if (tokenizeData == null ? void 0 : tokenizeData.token) {
|
|
6971
6808
|
let token = tokenizeData == null ? void 0 : tokenizeData.token;
|
|
6972
6809
|
try {
|
|
@@ -7017,9 +6854,6 @@ function CardOnFile({ session_token, callback, isloading, onCancel, showChecks,
|
|
|
7017
6854
|
const hasError = validateCardData();
|
|
7018
6855
|
if (hasError) return;
|
|
7019
6856
|
let isValid = true;
|
|
7020
|
-
if (paymentGateway != 32) {
|
|
7021
|
-
isValid = validateCardInputs();
|
|
7022
|
-
}
|
|
7023
6857
|
if (!isValid) return;
|
|
7024
6858
|
showLoader();
|
|
7025
6859
|
try {
|
|
@@ -7034,7 +6868,17 @@ function CardOnFile({ session_token, callback, isloading, onCancel, showChecks,
|
|
|
7034
6868
|
if (paymentGateway2 == ((_e = PaymentMethodKeys) == null ? void 0 : _e.FRACTALKEY)) {
|
|
7035
6869
|
await handleFractalTokenFlow();
|
|
7036
6870
|
} else {
|
|
7037
|
-
|
|
6871
|
+
try {
|
|
6872
|
+
const result2 = await window.requestDcToken();
|
|
6873
|
+
;
|
|
6874
|
+
if (result2.Token) {
|
|
6875
|
+
handleTokenCallback(result2);
|
|
6876
|
+
}
|
|
6877
|
+
} catch (err) {
|
|
6878
|
+
console.log(err, "Error while tokenizing");
|
|
6879
|
+
setErrorIframe(err);
|
|
6880
|
+
setLoading(false);
|
|
6881
|
+
}
|
|
7038
6882
|
}
|
|
7039
6883
|
}
|
|
7040
6884
|
} catch (error2) {
|
|
@@ -7061,22 +6905,22 @@ function CardOnFile({ session_token, callback, isloading, onCancel, showChecks,
|
|
|
7061
6905
|
});
|
|
7062
6906
|
onCancel();
|
|
7063
6907
|
};
|
|
7064
|
-
console.log(passFee, "aoapoaa");
|
|
7065
6908
|
const getPaymentDetails = async () => {
|
|
7066
|
-
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i;
|
|
6909
|
+
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
7067
6910
|
try {
|
|
7068
6911
|
showLoader();
|
|
7069
6912
|
const res = await axios6.get(`${masterBaseUrl}api/v1/gateway/get-payment-details/${session_token}`);
|
|
7070
6913
|
if ((res == null ? void 0 : res.status) == 200) {
|
|
7071
6914
|
setPaymentGateway((_b2 = (_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.data) == null ? void 0 : _b2.paymentGateway);
|
|
6915
|
+
setDCToken((_d = (_c = res == null ? void 0 : res.data) == null ? void 0 : _c.data) == null ? void 0 : _d.dctoken);
|
|
7072
6916
|
hideLoader();
|
|
7073
6917
|
}
|
|
7074
6918
|
} catch (error2) {
|
|
7075
|
-
console.log((
|
|
6919
|
+
console.log((_f = (_e = error2 == null ? void 0 : error2.response) == null ? void 0 : _e.data) == null ? void 0 : _f.result, "error while getting payment details");
|
|
7076
6920
|
callback({
|
|
7077
|
-
error: ((
|
|
7078
|
-
result: (
|
|
7079
|
-
statusCode: (
|
|
6921
|
+
error: ((_h = (_g = error2 == null ? void 0 : error2.response) == null ? void 0 : _g.data) == null ? void 0 : _h.message) || "Something went wrong!",
|
|
6922
|
+
result: (_j = (_i = error2 == null ? void 0 : error2.response) == null ? void 0 : _i.data) == null ? void 0 : _j.result,
|
|
6923
|
+
statusCode: (_k = error2 == null ? void 0 : error2.response) == null ? void 0 : _k.status
|
|
7080
6924
|
});
|
|
7081
6925
|
hideLoader();
|
|
7082
6926
|
}
|
|
@@ -7092,9 +6936,14 @@ function CardOnFile({ session_token, callback, isloading, onCancel, showChecks,
|
|
|
7092
6936
|
}, []);
|
|
7093
6937
|
return /* @__PURE__ */ jsxs16(Fragment16, { children: [
|
|
7094
6938
|
/* @__PURE__ */ jsx27(DataScript, {}),
|
|
6939
|
+
/* @__PURE__ */ jsx27(FractalTokenizerScript, {}),
|
|
6940
|
+
/* @__PURE__ */ jsx27(DataCapScriptLoader, {}),
|
|
7095
6941
|
/* @__PURE__ */ jsx27(AddCardSkyStyle, {}),
|
|
7096
|
-
/* @__PURE__ */ jsx27(Loader_default, { loading: loading || isloading }),
|
|
6942
|
+
/* @__PURE__ */ jsx27(Loader_default, { loading: loading || isloading || loadingIframe }),
|
|
7097
6943
|
error && /* @__PURE__ */ jsx27("div", { style: { maxHeight: "606px", minHeight: "60vh", padding: "40px" }, children: /* @__PURE__ */ jsx27(ErrorCardMessage_default, { error, onClose: handleClose }) }),
|
|
6944
|
+
errorIframe && /* @__PURE__ */ jsx27("div", { style: { maxHeight: "606px", minHeight: "60vh", padding: "40px" }, children: /* @__PURE__ */ jsx27(ErrorCardMessage_default, { error: errorIframe, onClose: () => {
|
|
6945
|
+
setErrorIframe("");
|
|
6946
|
+
} }) }),
|
|
7098
6947
|
!error && /* @__PURE__ */ jsx27("div", { className: "creditformbox", children: paymentGateway == 32 ? /* @__PURE__ */ jsxs16("form", { id: "paymentForm", onSubmit: handleCardAdd, onKeyDown: (e) => {
|
|
7099
6948
|
if (e.key === "Enter" && loading) {
|
|
7100
6949
|
e.preventDefault();
|
|
@@ -7318,102 +7167,31 @@ function CardOnFile({ session_token, callback, isloading, onCancel, showChecks,
|
|
|
7318
7167
|
(cardError == null ? void 0 : cardError.lastName) && /* @__PURE__ */ jsx27("small", { className: "error", children: cardError == null ? void 0 : cardError.lastName })
|
|
7319
7168
|
] })
|
|
7320
7169
|
] }),
|
|
7321
|
-
/* @__PURE__ */ jsx27("div", { className: "form-pay-row", children: /* @__PURE__ */
|
|
7170
|
+
/* @__PURE__ */ jsx27("div", { className: "form-pay-row", children: /* @__PURE__ */ jsx27(
|
|
7171
|
+
DataCapFields,
|
|
7172
|
+
{
|
|
7173
|
+
isOpen: true,
|
|
7174
|
+
tokenKey: dcToken,
|
|
7175
|
+
setLoader: setLoadingIframe
|
|
7176
|
+
}
|
|
7177
|
+
) }),
|
|
7178
|
+
/* @__PURE__ */ jsxs16("div", { className: "form-group", children: [
|
|
7322
7179
|
/* @__PURE__ */ jsxs16("label", { children: [
|
|
7323
|
-
"
|
|
7180
|
+
" Zip ",
|
|
7324
7181
|
/* @__PURE__ */ jsx27("span", { className: "text-danger", children: "*" })
|
|
7325
7182
|
] }),
|
|
7326
7183
|
/* @__PURE__ */ jsx27(
|
|
7327
7184
|
"input",
|
|
7328
7185
|
{
|
|
7329
7186
|
type: "text",
|
|
7330
|
-
|
|
7331
|
-
placeholder: "
|
|
7332
|
-
|
|
7333
|
-
|
|
7334
|
-
value: (cardData == null ? void 0 : cardData.cardNumber) || "",
|
|
7335
|
-
onChange: (e) => handleCardNumberChange(e),
|
|
7187
|
+
name: "zipcode",
|
|
7188
|
+
placeholder: "Zip Code",
|
|
7189
|
+
value: (_b = cardData == null ? void 0 : cardData.zipCode) != null ? _b : "",
|
|
7190
|
+
onChange: (e) => handleCardChange("zipCode", e.target.value),
|
|
7336
7191
|
className: inputClass
|
|
7337
7192
|
}
|
|
7338
7193
|
),
|
|
7339
|
-
(cardError == null ? void 0 : cardError.
|
|
7340
|
-
] }) }),
|
|
7341
|
-
/* @__PURE__ */ jsxs16("div", { className: "card-pay-row", children: [
|
|
7342
|
-
/* @__PURE__ */ jsxs16("div", { className: "form-group", children: [
|
|
7343
|
-
/* @__PURE__ */ jsxs16("label", { children: [
|
|
7344
|
-
" Exp Month ",
|
|
7345
|
-
/* @__PURE__ */ jsx27("span", { className: "text-danger", children: "*" })
|
|
7346
|
-
] }),
|
|
7347
|
-
/* @__PURE__ */ jsx27(
|
|
7348
|
-
"input",
|
|
7349
|
-
{
|
|
7350
|
-
type: "text",
|
|
7351
|
-
"data-token": "exp_month",
|
|
7352
|
-
placeholder: "MM",
|
|
7353
|
-
maxLength: 2,
|
|
7354
|
-
value: (cardData == null ? void 0 : cardData.expiryMonth) || "",
|
|
7355
|
-
onChange: (e) => handleCardChange("expiryMonth", e.target.value),
|
|
7356
|
-
className: inputClass
|
|
7357
|
-
}
|
|
7358
|
-
),
|
|
7359
|
-
(cardError == null ? void 0 : cardError.expiryMonth) && /* @__PURE__ */ jsx27("small", { className: "error", children: cardError == null ? void 0 : cardError.expiryMonth })
|
|
7360
|
-
] }),
|
|
7361
|
-
/* @__PURE__ */ jsxs16("div", { className: "form-group", children: [
|
|
7362
|
-
/* @__PURE__ */ jsxs16("label", { children: [
|
|
7363
|
-
" Exp Year ",
|
|
7364
|
-
/* @__PURE__ */ jsx27("span", { className: "text-danger", children: "*" })
|
|
7365
|
-
] }),
|
|
7366
|
-
/* @__PURE__ */ jsx27(
|
|
7367
|
-
"input",
|
|
7368
|
-
{
|
|
7369
|
-
type: "text",
|
|
7370
|
-
"data-token": "exp_year",
|
|
7371
|
-
placeholder: "YYYY",
|
|
7372
|
-
maxLength: 4,
|
|
7373
|
-
value: (cardData == null ? void 0 : cardData.expiryYear) || "",
|
|
7374
|
-
onChange: (e) => handleCardChange("expiryYear", e.target.value),
|
|
7375
|
-
className: inputClass
|
|
7376
|
-
}
|
|
7377
|
-
),
|
|
7378
|
-
(cardError == null ? void 0 : cardError.expiryYear) && /* @__PURE__ */ jsx27("small", { className: "error", children: cardError == null ? void 0 : cardError.expiryYear })
|
|
7379
|
-
] }),
|
|
7380
|
-
/* @__PURE__ */ jsxs16("div", { className: "form-group", children: [
|
|
7381
|
-
/* @__PURE__ */ jsxs16("label", { children: [
|
|
7382
|
-
" CVV ",
|
|
7383
|
-
/* @__PURE__ */ jsx27("span", { className: "text-danger", children: "*" })
|
|
7384
|
-
] }),
|
|
7385
|
-
/* @__PURE__ */ jsx27(
|
|
7386
|
-
"input",
|
|
7387
|
-
{
|
|
7388
|
-
type: "text",
|
|
7389
|
-
"data-token": "cvv",
|
|
7390
|
-
placeholder: "CVV",
|
|
7391
|
-
maxLength: 4,
|
|
7392
|
-
value: (cardData == null ? void 0 : cardData.cvv) || "",
|
|
7393
|
-
onChange: (e) => handleCardChange("cvv", e.target.value),
|
|
7394
|
-
className: inputClass
|
|
7395
|
-
}
|
|
7396
|
-
),
|
|
7397
|
-
(cardError == null ? void 0 : cardError.cvv) && /* @__PURE__ */ jsx27("small", { className: "error", children: cardError == null ? void 0 : cardError.cvv })
|
|
7398
|
-
] }),
|
|
7399
|
-
/* @__PURE__ */ jsxs16("div", { className: "form-group", children: [
|
|
7400
|
-
/* @__PURE__ */ jsxs16("label", { children: [
|
|
7401
|
-
" Zip ",
|
|
7402
|
-
/* @__PURE__ */ jsx27("span", { className: "text-danger", children: "*" })
|
|
7403
|
-
] }),
|
|
7404
|
-
/* @__PURE__ */ jsx27(
|
|
7405
|
-
"input",
|
|
7406
|
-
{
|
|
7407
|
-
type: "text",
|
|
7408
|
-
name: "zipcode",
|
|
7409
|
-
placeholder: "Zip Code",
|
|
7410
|
-
value: (_b = cardData == null ? void 0 : cardData.zipCode) != null ? _b : "",
|
|
7411
|
-
onChange: (e) => handleCardChange("zipCode", e.target.value),
|
|
7412
|
-
className: inputClass
|
|
7413
|
-
}
|
|
7414
|
-
),
|
|
7415
|
-
(cardError == null ? void 0 : cardError.zipCode) && /* @__PURE__ */ jsx27("small", { className: "error", children: cardError == null ? void 0 : cardError.zipCode })
|
|
7416
|
-
] })
|
|
7194
|
+
(cardError == null ? void 0 : cardError.zipCode) && /* @__PURE__ */ jsx27("small", { className: "error", children: cardError == null ? void 0 : cardError.zipCode })
|
|
7417
7195
|
] }),
|
|
7418
7196
|
isDual && /* @__PURE__ */ jsxs16("div", { className: "pass-fee-toggle-div", children: [
|
|
7419
7197
|
/* @__PURE__ */ jsx27(
|
|
@@ -7538,6 +7316,8 @@ function PartialPayment(props) {
|
|
|
7538
7316
|
let pax2 = S3Url + "widget/pax.svg";
|
|
7539
7317
|
const [loading, setLoading] = useState8(false);
|
|
7540
7318
|
const [loading2, setLoading2] = useState8(false);
|
|
7319
|
+
const [loadingIframe, setLoadingIframe] = useState8(false);
|
|
7320
|
+
const [errorIframe, setErrorIframe] = useState8("");
|
|
7541
7321
|
const [error, setError] = useState8("");
|
|
7542
7322
|
const [success, setSuccess] = useState8(false);
|
|
7543
7323
|
const [show, setShow] = useState8(false);
|
|
@@ -7749,32 +7529,11 @@ function PartialPayment(props) {
|
|
|
7749
7529
|
}));
|
|
7750
7530
|
};
|
|
7751
7531
|
const validateCardData = () => {
|
|
7752
|
-
var _a2, _b2
|
|
7532
|
+
var _a2, _b2;
|
|
7753
7533
|
const errors = {};
|
|
7754
7534
|
const data = cardData;
|
|
7755
|
-
if ((
|
|
7756
|
-
|
|
7757
|
-
const month = parseInt((data == null ? void 0 : data.expiryMonth) || "", 10);
|
|
7758
|
-
const year = (data == null ? void 0 : data.expiryYear) || "";
|
|
7759
|
-
if (!((_b2 = data == null ? void 0 : data.expiryMonth) == null ? void 0 : _b2.trim()) || !((_c2 = data == null ? void 0 : data.expiryYear) == null ? void 0 : _c2.trim())) {
|
|
7760
|
-
errors.expiryMonth = "Invalid Expiration Date.";
|
|
7761
|
-
} else if (isNaN(month) || month < 1 || month > 12 || year.length !== 4) {
|
|
7762
|
-
errors.expiryMonth = "Invalid Expiration Date.";
|
|
7763
|
-
}
|
|
7764
|
-
if (!((_d2 = data == null ? void 0 : data.cvv) == null ? void 0 : _d2.trim())) errors.cvv = "CVV is required";
|
|
7765
|
-
if ((data == null ? void 0 : data.expiryMonth) && (data == null ? void 0 : data.expiryYear) && data.expiryMonth.length <= 2 && data.expiryYear.length === 4) {
|
|
7766
|
-
const month2 = parseInt(data.expiryMonth, 10);
|
|
7767
|
-
const year2 = parseInt(data.expiryYear, 10);
|
|
7768
|
-
const now = /* @__PURE__ */ new Date();
|
|
7769
|
-
const currentMonth = now.getMonth() + 1;
|
|
7770
|
-
const currentYear = now.getFullYear();
|
|
7771
|
-
if (year2 < currentYear || year2 === currentYear && month2 < currentMonth) {
|
|
7772
|
-
errors.expiryMonth = "Card is expired";
|
|
7773
|
-
}
|
|
7774
|
-
}
|
|
7775
|
-
}
|
|
7776
|
-
if (!((_e2 = data == null ? void 0 : data.cardName) == null ? void 0 : _e2.trim())) errors.cardName = "Card name is required";
|
|
7777
|
-
if (!((_f2 = data == null ? void 0 : data.zipCode) == null ? void 0 : _f2.trim())) errors.zipCode = "ZIP code is required";
|
|
7535
|
+
if (!((_a2 = data == null ? void 0 : data.cardName) == null ? void 0 : _a2.trim())) errors.cardName = "Card name is required";
|
|
7536
|
+
if (!((_b2 = data == null ? void 0 : data.zipCode) == null ? void 0 : _b2.trim())) errors.zipCode = "ZIP code is required";
|
|
7778
7537
|
setCardError(errors);
|
|
7779
7538
|
return Object.keys(errors).length > 0;
|
|
7780
7539
|
};
|
|
@@ -7814,16 +7573,6 @@ function PartialPayment(props) {
|
|
|
7814
7573
|
let validCard = true;
|
|
7815
7574
|
let validExpirationDate = true;
|
|
7816
7575
|
let validCVV = true;
|
|
7817
|
-
if ((paymentData == null ? void 0 : paymentData.paymentGateway) !== 32) {
|
|
7818
|
-
let validCard2 = DatacapWebToken.validateCardNumber(cardData == null ? void 0 : cardData.cardNumber.replaceAll(" ", ""));
|
|
7819
|
-
let validExpirationDate2 = DatacapWebToken.validateExpirationDate(cardData == null ? void 0 : cardData.expiryMonth, cardData == null ? void 0 : cardData.expiryYear);
|
|
7820
|
-
let validCVV2 = DatacapWebToken.validateCVV(cardData == null ? void 0 : cardData.cvv);
|
|
7821
|
-
let errors = {};
|
|
7822
|
-
if (!validCard2) errors.cardNumber = "Invalid card Number";
|
|
7823
|
-
if (!validExpirationDate2) errors.expiryMonth = "Invalid Expiration Date.";
|
|
7824
|
-
if (!validCVV2) errors.cvv = "Invalid CVV";
|
|
7825
|
-
setCardError(errors);
|
|
7826
|
-
}
|
|
7827
7576
|
if (validCard && validCVV && validExpirationDate) {
|
|
7828
7577
|
setLoading2(true);
|
|
7829
7578
|
try {
|
|
@@ -7930,8 +7679,16 @@ function PartialPayment(props) {
|
|
|
7930
7679
|
setError(((_k2 = (_j2 = err == null ? void 0 : err.response) == null ? void 0 : _j2.data) == null ? void 0 : _k2.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
|
|
7931
7680
|
}
|
|
7932
7681
|
} else {
|
|
7933
|
-
|
|
7934
|
-
|
|
7682
|
+
try {
|
|
7683
|
+
const result = await window.requestDcToken();
|
|
7684
|
+
;
|
|
7685
|
+
if (result.Token) {
|
|
7686
|
+
tokenCallback(result);
|
|
7687
|
+
}
|
|
7688
|
+
} catch (err) {
|
|
7689
|
+
console.log(err, "Error while tokenizing");
|
|
7690
|
+
setErrorIframe(err);
|
|
7691
|
+
setLoading2(false);
|
|
7935
7692
|
}
|
|
7936
7693
|
}
|
|
7937
7694
|
} catch (err) {
|
|
@@ -8002,7 +7759,6 @@ function PartialPayment(props) {
|
|
|
8002
7759
|
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) {
|
|
8003
7760
|
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");
|
|
8004
7761
|
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");
|
|
8005
|
-
console.log(banklists, "hohgohoo", cardlists);
|
|
8006
7762
|
if ((cardlists == null ? void 0 : cardlists.length) > 0) {
|
|
8007
7763
|
setActiveinCard("list");
|
|
8008
7764
|
}
|
|
@@ -8239,10 +7995,8 @@ function PartialPayment(props) {
|
|
|
8239
7995
|
let diff = Number(aftertaxAmount) - cashDiscountNew;
|
|
8240
7996
|
return diff.toFixed(0);
|
|
8241
7997
|
};
|
|
8242
|
-
console.log(activeinCard, "activeinCard", "activeinBank", activeinBank);
|
|
8243
7998
|
const handlePartialChange = (values) => {
|
|
8244
7999
|
var _a2, _b2, _c2, _d2;
|
|
8245
|
-
console.log(values, "values");
|
|
8246
8000
|
if (activetab === "ach") {
|
|
8247
8001
|
if (((_a2 = Number(cashDiscount)) == null ? void 0 : _a2.toFixed(2)) < (values == null ? void 0 : values.floatValue) || (values == null ? void 0 : values.floatValue) <= 0) {
|
|
8248
8002
|
setPartialAmount(values == null ? void 0 : values.value);
|
|
@@ -8274,7 +8028,6 @@ function PartialPayment(props) {
|
|
|
8274
8028
|
setPartialError("");
|
|
8275
8029
|
}
|
|
8276
8030
|
}, [activetab, partialAmount, cashDiscount, aftertaxAmount]);
|
|
8277
|
-
console.log(activetab, "activetab");
|
|
8278
8031
|
useEffect13(() => {
|
|
8279
8032
|
if (typeof FractalTokenizer === "undefined") return;
|
|
8280
8033
|
const tokenizer = new FractalTokenizer({
|
|
@@ -8286,6 +8039,7 @@ function PartialPayment(props) {
|
|
|
8286
8039
|
/* @__PURE__ */ jsx28(Chargewidgetstyles, {}),
|
|
8287
8040
|
/* @__PURE__ */ jsx28(CardBankRadioStyles, {}),
|
|
8288
8041
|
/* @__PURE__ */ jsx28(FractalTokenizerScript, {}),
|
|
8042
|
+
/* @__PURE__ */ jsx28(DataCapScriptLoader, {}),
|
|
8289
8043
|
/* @__PURE__ */ jsxs17(Fragment17, { children: [
|
|
8290
8044
|
/* @__PURE__ */ jsx28("button", { ref: buttonRef, style: { display: "none" }, className: "paymentBtn", onClick: handleShow, children: "Pay" }),
|
|
8291
8045
|
/* @__PURE__ */ jsxs17(
|
|
@@ -8566,70 +8320,14 @@ function PartialPayment(props) {
|
|
|
8566
8320
|
} }),
|
|
8567
8321
|
(cardError == null ? void 0 : cardError.cardName) && /* @__PURE__ */ jsx28("span", { className: "error-span", children: cardError == null ? void 0 : cardError.cardName })
|
|
8568
8322
|
] }),
|
|
8569
|
-
/* @__PURE__ */
|
|
8570
|
-
|
|
8571
|
-
|
|
8572
|
-
|
|
8573
|
-
|
|
8574
|
-
|
|
8575
|
-
|
|
8576
|
-
|
|
8577
|
-
maxLength: 19,
|
|
8578
|
-
inputMode: "numeric",
|
|
8579
|
-
placeholder: "0000 0000 0000 0000",
|
|
8580
|
-
value: (cardData == null ? void 0 : cardData.cardNumber) || "",
|
|
8581
|
-
onChange: (e) => handleCardNumberChange(e),
|
|
8582
|
-
"data-token": "card_number"
|
|
8583
|
-
}
|
|
8584
|
-
),
|
|
8585
|
-
/* @__PURE__ */ jsx28("div", { className: "card-crdi card-expiry-new", children: /* @__PURE__ */ jsxs17("div", { className: "exp-date-year-container", children: [
|
|
8586
|
-
/* @__PURE__ */ jsx28("div", { className: "exp-date form-group", children: /* @__PURE__ */ jsx28(
|
|
8587
|
-
"input",
|
|
8588
|
-
{
|
|
8589
|
-
"data-token": "exp_month",
|
|
8590
|
-
className: "form-control required card-cvv-in",
|
|
8591
|
-
type: "text",
|
|
8592
|
-
style: { maxHeight: "36px" },
|
|
8593
|
-
placeholder: "MM",
|
|
8594
|
-
maxLength: 2,
|
|
8595
|
-
value: (cardData == null ? void 0 : cardData.expiryMonth) || "",
|
|
8596
|
-
onChange: (e) => handleCardChange("expiryMonth", e.target.value)
|
|
8597
|
-
}
|
|
8598
|
-
) }),
|
|
8599
|
-
/* @__PURE__ */ jsx28("div", { className: "exp-year form-group", children: /* @__PURE__ */ jsx28(
|
|
8600
|
-
"input",
|
|
8601
|
-
{
|
|
8602
|
-
"data-token": "exp_year",
|
|
8603
|
-
className: "form-control required card-cvv-in",
|
|
8604
|
-
type: "text",
|
|
8605
|
-
style: { maxHeight: "36px" },
|
|
8606
|
-
placeholder: "YYYY",
|
|
8607
|
-
maxLength: 4,
|
|
8608
|
-
value: (cardData == null ? void 0 : cardData.expiryYear) || "",
|
|
8609
|
-
onChange: (e) => handleCardChange("expiryYear", e.target.value)
|
|
8610
|
-
}
|
|
8611
|
-
) }),
|
|
8612
|
-
/* @__PURE__ */ jsx28("div", { className: "security-digit form-group", children: /* @__PURE__ */ jsx28(
|
|
8613
|
-
"input",
|
|
8614
|
-
{
|
|
8615
|
-
"data-token": "cvv",
|
|
8616
|
-
className: "form-control card-cvv-in required",
|
|
8617
|
-
type: "text",
|
|
8618
|
-
style: { maxHeight: "36px" },
|
|
8619
|
-
maxLength: 4,
|
|
8620
|
-
placeholder: "CVC",
|
|
8621
|
-
value: (cardData == null ? void 0 : cardData.cvv) || "",
|
|
8622
|
-
onChange: (e) => handleCardChange("cvv", e.target.value)
|
|
8623
|
-
}
|
|
8624
|
-
) })
|
|
8625
|
-
] }) }),
|
|
8626
|
-
(cardError == null ? void 0 : cardError.cardNumber) && /* @__PURE__ */ jsx28("span", { className: "error-span", children: cardError == null ? void 0 : cardError.cardNumber }),
|
|
8627
|
-
/* @__PURE__ */ jsxs17("p", { style: { margin: "0" }, children: [
|
|
8628
|
-
(cardError == null ? void 0 : cardError.expiryMonth) || (cardError == null ? void 0 : cardError.expiryYear) ? /* @__PURE__ */ jsx28("span", { className: "error-span", style: { paddingRight: "4px" }, children: cardError == null ? void 0 : cardError.expiryMonth }) : "",
|
|
8629
|
-
(cardError == null ? void 0 : cardError.cvv) && /* @__PURE__ */ jsx28("span", { className: "error-span", children: cardError == null ? void 0 : cardError.cvv })
|
|
8630
|
-
] })
|
|
8631
|
-
] })
|
|
8632
|
-
] }),
|
|
8323
|
+
/* @__PURE__ */ jsx28("div", { className: "form-group", children: /* @__PURE__ */ jsx28(
|
|
8324
|
+
DataCapFields,
|
|
8325
|
+
{
|
|
8326
|
+
isOpen: show,
|
|
8327
|
+
tokenKey: paymentData == null ? void 0 : paymentData.dctoken,
|
|
8328
|
+
setLoader: setLoadingIframe
|
|
8329
|
+
}
|
|
8330
|
+
) }),
|
|
8633
8331
|
/* @__PURE__ */ jsxs17("div", { className: "form-group", children: [
|
|
8634
8332
|
/* @__PURE__ */ jsx28("label", { htmlFor: "OrderId", children: "Order ID / Description" }),
|
|
8635
8333
|
/* @__PURE__ */ jsx28(
|
|
@@ -9773,10 +9471,12 @@ var ModelContentSky = ({ amount, bankAmount, submitBtnText = "Pay", session_toke
|
|
|
9773
9471
|
const [saveACHinfo, setSaveACHinfo] = useState10(false);
|
|
9774
9472
|
const [saveCardInfo, setSaveCardInfo] = useState10(false);
|
|
9775
9473
|
const [error, setError] = useState10("");
|
|
9474
|
+
const [errorIframe, setErrorIframe] = useState10("");
|
|
9776
9475
|
const [success, setSuccess] = useState10(false);
|
|
9777
9476
|
let [tranId, setTranId] = useState10("");
|
|
9778
9477
|
const [loading, setLoading] = useState10(false);
|
|
9779
9478
|
const [loading2, setLoading2] = useState10(false);
|
|
9479
|
+
const [loadingIframe, setLoadingIframe] = useState10(false);
|
|
9780
9480
|
const [cardList, setCardList] = useState10([]);
|
|
9781
9481
|
const [bankList, setBankList] = useState10([]);
|
|
9782
9482
|
const [selectedCard, setSelectedCard] = useState10();
|
|
@@ -9796,6 +9496,7 @@ var ModelContentSky = ({ amount, bankAmount, submitBtnText = "Pay", session_toke
|
|
|
9796
9496
|
const [partialError, setPartialError] = useState10("");
|
|
9797
9497
|
const [remainingAmount, setRemainingAmount] = useState10("");
|
|
9798
9498
|
const [paymentGateway, setPaymentGateway] = useState10();
|
|
9499
|
+
const [dcToken, setDCToken] = useState10();
|
|
9799
9500
|
let mastercard2 = S3Url + "widget/mc-img.svg";
|
|
9800
9501
|
let visa2 = S3Url + "widget/visa-img.svg";
|
|
9801
9502
|
let americanexp2 = S3Url + "widget/ae-img.svg";
|
|
@@ -10091,7 +9792,13 @@ var ModelContentSky = ({ amount, bankAmount, submitBtnText = "Pay", session_toke
|
|
|
10091
9792
|
};
|
|
10092
9793
|
}
|
|
10093
9794
|
}
|
|
10094
|
-
|
|
9795
|
+
let tokenizeData;
|
|
9796
|
+
try {
|
|
9797
|
+
tokenizeData = await tokenizerRef.current.createToken(objtokenize);
|
|
9798
|
+
} catch (error2) {
|
|
9799
|
+
setErrorIframe(error2);
|
|
9800
|
+
hideLoader();
|
|
9801
|
+
}
|
|
10095
9802
|
if (tokenizeData == null ? void 0 : tokenizeData.token) {
|
|
10096
9803
|
let ThreedsData = tokenizeData == null ? void 0 : tokenizeData.stripe_three_ds_response;
|
|
10097
9804
|
if (require3ds && !ThreedsData && (ThreedsData == null ? void 0 : ThreedsData.status) === "200 OK" && ((_n2 = ThreedsData == null ? void 0 : ThreedsData.data) == null ? void 0 : _n2.challenge_url)) {
|
|
@@ -10133,32 +9840,11 @@ var ModelContentSky = ({ amount, bankAmount, submitBtnText = "Pay", session_toke
|
|
|
10133
9840
|
}
|
|
10134
9841
|
};
|
|
10135
9842
|
const validateCardData = () => {
|
|
10136
|
-
var _a2, _b2
|
|
9843
|
+
var _a2, _b2;
|
|
10137
9844
|
const errors = {};
|
|
10138
9845
|
const data = cardData;
|
|
10139
|
-
if (
|
|
10140
|
-
|
|
10141
|
-
const year = (data == null ? void 0 : data.expiryYear) || "";
|
|
10142
|
-
if (!((_a2 = data == null ? void 0 : data.cardNumber) == null ? void 0 : _a2.trim())) errors.cardNumber = "Card number is required";
|
|
10143
|
-
if (!((_b2 = data == null ? void 0 : data.expiryMonth) == null ? void 0 : _b2.trim()) || !((_c2 = data == null ? void 0 : data.expiryYear) == null ? void 0 : _c2.trim())) {
|
|
10144
|
-
errors.expiryMonth = "Invalid Expiration Date.";
|
|
10145
|
-
} else if (isNaN(month) || month < 1 || month > 12 || year.length !== 4) {
|
|
10146
|
-
errors.expiryMonth = "Invalid Expiration Date.";
|
|
10147
|
-
}
|
|
10148
|
-
if (!((_d2 = data == null ? void 0 : data.cvv) == null ? void 0 : _d2.trim())) errors.cvv = "CVV is required";
|
|
10149
|
-
if ((data == null ? void 0 : data.expiryMonth) && (data == null ? void 0 : data.expiryYear) && data.expiryMonth.length <= 2 && data.expiryYear.length === 4) {
|
|
10150
|
-
const month2 = parseInt(data.expiryMonth, 10);
|
|
10151
|
-
const year2 = parseInt(data.expiryYear, 10);
|
|
10152
|
-
const now = /* @__PURE__ */ new Date();
|
|
10153
|
-
const currentMonth = now.getMonth() + 1;
|
|
10154
|
-
const currentYear = now.getFullYear();
|
|
10155
|
-
if (year2 < currentYear || year2 === currentYear && month2 < currentMonth) {
|
|
10156
|
-
errors.expiryMonth = "Card is expired";
|
|
10157
|
-
}
|
|
10158
|
-
}
|
|
10159
|
-
}
|
|
10160
|
-
if (!((_e2 = data == null ? void 0 : data.cardName) == null ? void 0 : _e2.trim())) errors.cardName = "Card name is required";
|
|
10161
|
-
if (!((_f2 = data == null ? void 0 : data.zipCode) == null ? void 0 : _f2.trim())) errors.zipCode = "ZIP code is required";
|
|
9846
|
+
if (!((_a2 = data == null ? void 0 : data.cardName) == null ? void 0 : _a2.trim())) errors.cardName = "Card name is required";
|
|
9847
|
+
if (!((_b2 = data == null ? void 0 : data.zipCode) == null ? void 0 : _b2.trim())) errors.zipCode = "ZIP code is required";
|
|
10162
9848
|
setCardError(errors);
|
|
10163
9849
|
return Object.keys(errors).length > 0;
|
|
10164
9850
|
};
|
|
@@ -10188,9 +9874,6 @@ var ModelContentSky = ({ amount, bankAmount, submitBtnText = "Pay", session_toke
|
|
|
10188
9874
|
const hasError = validateCardData();
|
|
10189
9875
|
if (hasError) return;
|
|
10190
9876
|
let isValid = true;
|
|
10191
|
-
if (paymentGateway !== 32) {
|
|
10192
|
-
isValid = validateCardInputs();
|
|
10193
|
-
}
|
|
10194
9877
|
if (!isValid) return;
|
|
10195
9878
|
} else {
|
|
10196
9879
|
const hasError = validateAchData();
|
|
@@ -10211,7 +9894,18 @@ var ModelContentSky = ({ amount, bankAmount, submitBtnText = "Pay", session_toke
|
|
|
10211
9894
|
if (paymentGateway2 == ((_e2 = PaymentMethodKeys) == null ? void 0 : _e2.FRACTALKEY)) {
|
|
10212
9895
|
await handleFractalTokenFlow();
|
|
10213
9896
|
} else {
|
|
10214
|
-
|
|
9897
|
+
try {
|
|
9898
|
+
const result2 = await window.requestDcToken();
|
|
9899
|
+
;
|
|
9900
|
+
console.log("Token:", result2.Token);
|
|
9901
|
+
if (result2.Token) {
|
|
9902
|
+
handleTokenCallback(result2);
|
|
9903
|
+
}
|
|
9904
|
+
} catch (err) {
|
|
9905
|
+
console.log(err, "Error while tokenizing");
|
|
9906
|
+
setErrorIframe(err);
|
|
9907
|
+
setLoading(false);
|
|
9908
|
+
}
|
|
10215
9909
|
}
|
|
10216
9910
|
} else {
|
|
10217
9911
|
let callbackdata;
|
|
@@ -10641,7 +10335,7 @@ var ModelContentSky = ({ amount, bankAmount, submitBtnText = "Pay", session_toke
|
|
|
10641
10335
|
}
|
|
10642
10336
|
};
|
|
10643
10337
|
const getPaymentDetails = async () => {
|
|
10644
|
-
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2;
|
|
10338
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2;
|
|
10645
10339
|
try {
|
|
10646
10340
|
showLoader();
|
|
10647
10341
|
const res = await axios9.get(`${masterBaseUrl}api/v1/gateway/get-payment-details/${session_token}`);
|
|
@@ -10649,14 +10343,15 @@ var ModelContentSky = ({ amount, bankAmount, submitBtnText = "Pay", session_toke
|
|
|
10649
10343
|
setIsBankActive((_b2 = (_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.data) == null ? void 0 : _b2.isBankActive);
|
|
10650
10344
|
setProcessingFee(Number((_d2 = (_c2 = res == null ? void 0 : res.data) == null ? void 0 : _c2.data) == null ? void 0 : _d2.fee) || 0);
|
|
10651
10345
|
setPaymentGateway((_f2 = (_e2 = res == null ? void 0 : res.data) == null ? void 0 : _e2.data) == null ? void 0 : _f2.paymentGateway);
|
|
10346
|
+
setDCToken((_h2 = (_g2 = res == null ? void 0 : res.data) == null ? void 0 : _g2.data) == null ? void 0 : _h2.dctoken);
|
|
10652
10347
|
hideLoader();
|
|
10653
10348
|
}
|
|
10654
10349
|
} catch (error2) {
|
|
10655
|
-
console.log((
|
|
10350
|
+
console.log((_j2 = (_i2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _i2.data) == null ? void 0 : _j2.result, "error while getting payment details");
|
|
10656
10351
|
callback({
|
|
10657
|
-
error: ((
|
|
10658
|
-
result: (
|
|
10659
|
-
statusCode: (
|
|
10352
|
+
error: ((_l2 = (_k2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _k2.data) == null ? void 0 : _l2.message) || "Something went wrong!",
|
|
10353
|
+
result: (_n2 = (_m2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _m2.data) == null ? void 0 : _n2.result,
|
|
10354
|
+
statusCode: (_o2 = error2 == null ? void 0 : error2.response) == null ? void 0 : _o2.status
|
|
10660
10355
|
});
|
|
10661
10356
|
hideLoader();
|
|
10662
10357
|
}
|
|
@@ -10792,7 +10487,7 @@ var ModelContentSky = ({ amount, bankAmount, submitBtnText = "Pay", session_toke
|
|
|
10792
10487
|
initialLoader && /* @__PURE__ */ jsx32(Loader_default, { loading: initialLoader }),
|
|
10793
10488
|
error && /* @__PURE__ */ jsx32("div", { style: { maxHeight: "606px", minHeight: "60vh", padding: "40px" }, children: /* @__PURE__ */ jsx32(ErrorCardMessage_default, { error, onClose: handleClose }) }),
|
|
10794
10489
|
!error && /* @__PURE__ */ jsxs19(Fragment18, { children: [
|
|
10795
|
-
(loading || loading2) && /* @__PURE__ */ jsx32(Loader_default, { loading: loading || loading2 || loadingPrev || orderLoader }),
|
|
10490
|
+
(loading || loading2 || loadingIframe) && /* @__PURE__ */ jsx32(Loader_default, { loading: loading || loading2 || loadingPrev || orderLoader || loadingIframe }),
|
|
10796
10491
|
/* @__PURE__ */ jsxs19("div", { className: "frac-card-payment-page frac-form frac-new-form", children: [
|
|
10797
10492
|
/* @__PURE__ */ jsx32("div", { ref: threeDSContainerRef, style: { width: "100%", height: "100%" } }),
|
|
10798
10493
|
(stripeResponse == null ? void 0 : stripeResponse.challenge_url) ? /* @__PURE__ */ jsx32(
|
|
@@ -10985,70 +10680,14 @@ var ModelContentSky = ({ amount, bankAmount, submitBtnText = "Pay", session_toke
|
|
|
10985
10680
|
} }),
|
|
10986
10681
|
(cardError == null ? void 0 : cardError.cardName) && /* @__PURE__ */ jsx32("span", { className: "error-span", children: cardError == null ? void 0 : cardError.cardName })
|
|
10987
10682
|
] }),
|
|
10988
|
-
/* @__PURE__ */
|
|
10989
|
-
|
|
10990
|
-
|
|
10991
|
-
|
|
10992
|
-
|
|
10993
|
-
|
|
10994
|
-
|
|
10995
|
-
|
|
10996
|
-
maxLength: 19,
|
|
10997
|
-
inputMode: "numeric",
|
|
10998
|
-
placeholder: "0000 0000 0000 0000",
|
|
10999
|
-
value: (cardData == null ? void 0 : cardData.cardNumber) || "",
|
|
11000
|
-
onChange: (e) => handleCardNumberChange(e),
|
|
11001
|
-
"data-token": "card_number"
|
|
11002
|
-
}
|
|
11003
|
-
),
|
|
11004
|
-
/* @__PURE__ */ jsx32("div", { className: "card-crdi card-expiry-new", children: /* @__PURE__ */ jsxs19("div", { className: "exp-date-year-container", children: [
|
|
11005
|
-
/* @__PURE__ */ jsx32("div", { className: "exp-date form-group-frac", children: /* @__PURE__ */ jsx32(
|
|
11006
|
-
"input",
|
|
11007
|
-
{
|
|
11008
|
-
"data-token": "exp_month",
|
|
11009
|
-
className: "form-control-frac required card-cvv-in",
|
|
11010
|
-
type: "text",
|
|
11011
|
-
style: { maxHeight: "36px" },
|
|
11012
|
-
placeholder: "MM",
|
|
11013
|
-
maxLength: 2,
|
|
11014
|
-
value: (cardData == null ? void 0 : cardData.expiryMonth) || "",
|
|
11015
|
-
onChange: (e) => handleCardChange("expiryMonth", e.target.value)
|
|
11016
|
-
}
|
|
11017
|
-
) }),
|
|
11018
|
-
/* @__PURE__ */ jsx32("div", { className: "exp-year form-group-frac", children: /* @__PURE__ */ jsx32(
|
|
11019
|
-
"input",
|
|
11020
|
-
{
|
|
11021
|
-
"data-token": "exp_year",
|
|
11022
|
-
className: "form-control-frac required card-cvv-in",
|
|
11023
|
-
type: "text",
|
|
11024
|
-
style: { maxHeight: "36px" },
|
|
11025
|
-
placeholder: "YYYY",
|
|
11026
|
-
maxLength: 4,
|
|
11027
|
-
value: (cardData == null ? void 0 : cardData.expiryYear) || "",
|
|
11028
|
-
onChange: (e) => handleCardChange("expiryYear", e.target.value)
|
|
11029
|
-
}
|
|
11030
|
-
) }),
|
|
11031
|
-
/* @__PURE__ */ jsx32("div", { className: "security-digit form-group-frac", children: /* @__PURE__ */ jsx32(
|
|
11032
|
-
"input",
|
|
11033
|
-
{
|
|
11034
|
-
"data-token": "cvv",
|
|
11035
|
-
className: "form-control-frac card-cvv-in required",
|
|
11036
|
-
type: "text",
|
|
11037
|
-
style: { maxHeight: "36px" },
|
|
11038
|
-
maxLength: 4,
|
|
11039
|
-
placeholder: "CVC",
|
|
11040
|
-
value: (cardData == null ? void 0 : cardData.cvv) || "",
|
|
11041
|
-
onChange: (e) => handleCardChange("cvv", e.target.value)
|
|
11042
|
-
}
|
|
11043
|
-
) })
|
|
11044
|
-
] }) }),
|
|
11045
|
-
(cardError == null ? void 0 : cardError.cardNumber) && /* @__PURE__ */ jsx32("span", { className: "error-span", children: cardError == null ? void 0 : cardError.cardNumber }),
|
|
11046
|
-
/* @__PURE__ */ jsxs19("p", { style: { margin: "0" }, children: [
|
|
11047
|
-
(cardError == null ? void 0 : cardError.expiryMonth) || (cardError == null ? void 0 : cardError.expiryYear) ? /* @__PURE__ */ jsx32("span", { className: "error-span", style: { paddingRight: "4px" }, children: cardError == null ? void 0 : cardError.expiryMonth }) : "",
|
|
11048
|
-
(cardError == null ? void 0 : cardError.cvv) && /* @__PURE__ */ jsx32("span", { className: "error-span", children: cardError == null ? void 0 : cardError.cvv })
|
|
11049
|
-
] })
|
|
11050
|
-
] })
|
|
11051
|
-
] }),
|
|
10683
|
+
/* @__PURE__ */ jsx32("div", { className: "form-group-frac", children: /* @__PURE__ */ jsx32(
|
|
10684
|
+
DataCapFields,
|
|
10685
|
+
{
|
|
10686
|
+
isOpen: show,
|
|
10687
|
+
tokenKey: dcToken,
|
|
10688
|
+
setLoader: setLoadingIframe
|
|
10689
|
+
}
|
|
10690
|
+
) }),
|
|
11052
10691
|
/* @__PURE__ */ jsxs19("div", { className: "form-group-frac", children: [
|
|
11053
10692
|
/* @__PURE__ */ jsx32("label", { htmlFor: "zip", children: "ZIP" }),
|
|
11054
10693
|
/* @__PURE__ */ jsx32("input", { type: "text", className: "form-control-frac", maxLength: 100, placeholder: "000000", value: (_h = cardData == null ? void 0 : cardData.zipCode) != null ? _h : "", onChange: (e) => handleCardChange("zipCode", e.target.value) }),
|
|
@@ -11361,6 +11000,7 @@ var PaymentWidget = ({
|
|
|
11361
11000
|
/* @__PURE__ */ jsx33(SkyChargewidgetstyles, {}),
|
|
11362
11001
|
/* @__PURE__ */ jsx33(CardBankRadioStyles, {}),
|
|
11363
11002
|
/* @__PURE__ */ jsx33(CustomModal2styles_default, {}),
|
|
11003
|
+
/* @__PURE__ */ jsx33(DataCapScriptLoader, {}),
|
|
11364
11004
|
!autoTrigger && /* @__PURE__ */ jsxs20("button", { className: submitBtnClass || "paymentBtn", onClick: () => setShow(true), children: [
|
|
11365
11005
|
submitBtnText,
|
|
11366
11006
|
submitBtnIcon
|