@pinerohit11/testwidget 0.1.55 → 0.1.57
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.d.mts +1 -3
- package/dist/index.d.ts +1 -3
- package/dist/index.js +38 -464
- package/dist/index.mjs +37 -460
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -54,10 +54,10 @@ __export(app_exports, {
|
|
54
54
|
RequestPaymentAllInput: () => RequestPaymentAllInput,
|
55
55
|
RequestPaymentDynamic: () => RequestPaymentDynamic,
|
56
56
|
RequestPaymentonClick: () => RequestPaymentonClick,
|
57
|
-
RqstPaymntInputField: () => RqstPaymntInputField
|
58
|
-
TockenizPay: () => TockenizPay
|
57
|
+
RqstPaymntInputField: () => RqstPaymntInputField
|
59
58
|
});
|
60
59
|
module.exports = __toCommonJS(app_exports);
|
60
|
+
var import_bootstrap_bundle_min = require("bootstrap/dist/js/bootstrap.bundle.min.js");
|
61
61
|
|
62
62
|
// src/app/components/RequestPayment/RequestPayment.tsx
|
63
63
|
var import_react4 = __toESM(require("react"));
|
@@ -67,7 +67,7 @@ var import_react2 = __toESM(require("react"));
|
|
67
67
|
|
68
68
|
// src/app/components/Loader/LoaderStyle.tsx
|
69
69
|
var import_react = __toESM(require("react"));
|
70
|
-
var LoaderStyle = (
|
70
|
+
var LoaderStyle = () => {
|
71
71
|
return /* @__PURE__ */ import_react.default.createElement("style", null, `
|
72
72
|
.loader {
|
73
73
|
position: fixed;
|
@@ -196,7 +196,7 @@ var import_react_bootstrap = require("react-bootstrap");
|
|
196
196
|
|
197
197
|
// src/app/components/RequestPayment/RequestPaymentstyles.tsx
|
198
198
|
var import_react3 = __toESM(require("react"));
|
199
|
-
var RequestPaymentstyles = (
|
199
|
+
var RequestPaymentstyles = () => {
|
200
200
|
return /* @__PURE__ */ import_react3.default.createElement("style", null, `
|
201
201
|
.paymentBtn {
|
202
202
|
background-color: black;
|
@@ -1040,12 +1040,15 @@ var ErrorText = {
|
|
1040
1040
|
onlylettersallowed: "Only letters are allowed",
|
1041
1041
|
phonenumberlength: "Phone number should be 10 digits",
|
1042
1042
|
phonenumberrequired: "Please enter a phone number",
|
1043
|
-
phonenumbervalid:
|
1043
|
+
// phonenumbervalid:'Please enter a valid 10-digit phone number',
|
1044
|
+
phonenumbervalid: "Please enter a valid phone number (max 10 digits)",
|
1045
|
+
phonenumbervalidnumberonly: "Please enter a valid phone number (numbers only)",
|
1044
1046
|
orderidenter: "Please enter an order ID",
|
1045
1047
|
networkresponseerror: "Network response was not ok",
|
1046
1048
|
anerroroccured: "An error occurred. Please try again.",
|
1047
1049
|
montherror: "Please write month only 1 to 12",
|
1048
|
-
fieldrequired: "This field is required"
|
1050
|
+
fieldrequired: "This field is required",
|
1051
|
+
fractalpayclientidrequired: "Fractalpay client key is missing or empty."
|
1049
1052
|
};
|
1050
1053
|
|
1051
1054
|
// src/app/components/RequestPayment/RequestPayment.tsx
|
@@ -1064,7 +1067,6 @@ function RequestPayment(props) {
|
|
1064
1067
|
});
|
1065
1068
|
const [showConfirmationModal, setShowConfirmationModal] = (0, import_react4.useState)(false);
|
1066
1069
|
const phoneNumberRegex = (value) => /^\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$/.test(value);
|
1067
|
-
const amoutRegex = /[+-]?([0-9]*[.])?[0-9]+/;
|
1068
1070
|
const positiveAmountRegex = /^[+]?\d+(\.\d+)?$/;
|
1069
1071
|
const isValidEmail = (value) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
|
1070
1072
|
const isAlpha = (value) => /^[A-Za-z\s]*$/.test(value);
|
@@ -1086,7 +1088,7 @@ function RequestPayment(props) {
|
|
1086
1088
|
});
|
1087
1089
|
};
|
1088
1090
|
const handleSubmit = (event) => {
|
1089
|
-
|
1091
|
+
const message = {
|
1090
1092
|
type: "preview.compiledcheck",
|
1091
1093
|
other: __spreadProps(__spreadValues({}, event), { status: true })
|
1092
1094
|
};
|
@@ -1139,7 +1141,6 @@ function RequestPayment(props) {
|
|
1139
1141
|
setLoading(false);
|
1140
1142
|
}
|
1141
1143
|
};
|
1142
|
-
const validateAmount = (amount) => amoutRegex.test(amount);
|
1143
1144
|
const PositiveAmount = (amount) => positiveAmountRegex.test(amount);
|
1144
1145
|
const handleChange = (e) => {
|
1145
1146
|
const { value } = e.target;
|
@@ -1194,7 +1195,7 @@ function RequestPayment(props) {
|
|
1194
1195
|
}
|
1195
1196
|
};
|
1196
1197
|
const validateForm = () => {
|
1197
|
-
|
1198
|
+
const newErrors = {};
|
1198
1199
|
if (!requestDetails.name) newErrors.name = ErrorText.namerequired;
|
1199
1200
|
if (!requestDetails.amount) newErrors.amount = ErrorText.amountrequired;
|
1200
1201
|
if (!requestDetails.phone_number && !(requestDetails == null ? void 0 : requestDetails.email)) newErrors.phone_number = ErrorText.phoneoremailrequired;
|
@@ -1377,7 +1378,6 @@ function RequestPaymentAllInput({ fractalpayClientKey }) {
|
|
1377
1378
|
const [errorMessageorderid, setErrorMessageorderid] = (0, import_react5.useState)("");
|
1378
1379
|
const [submitClicked, setSubmitClicked] = (0, import_react5.useState)(false);
|
1379
1380
|
const handleClose = () => setShow(false);
|
1380
|
-
const handleShow = () => setShow(true);
|
1381
1381
|
const sendRequestPayment = () => {
|
1382
1382
|
if (!phoneNumber) {
|
1383
1383
|
setErrorMessagephone(ErrorText.phonenumberrequired);
|
@@ -1409,7 +1409,7 @@ function RequestPaymentAllInput({ fractalpayClientKey }) {
|
|
1409
1409
|
setErrorMessageorderid("");
|
1410
1410
|
setSubmitClicked(true);
|
1411
1411
|
setIsLoading(true);
|
1412
|
-
|
1412
|
+
const formData = {
|
1413
1413
|
fractalpayPublicKey: fractalpayClientKey,
|
1414
1414
|
amount,
|
1415
1415
|
phone_number: phoneNumber,
|
@@ -1580,7 +1580,6 @@ function RequestPaymentDynamic({ fractalpayClientKey, amount, phone_number, orde
|
|
1580
1580
|
const [isLoading, setIsLoading] = (0, import_react6.useState)(false);
|
1581
1581
|
const [show, setShow] = (0, import_react6.useState)(false);
|
1582
1582
|
const handleClose = () => setShow(false);
|
1583
|
-
const handleShow = () => setShow(true);
|
1584
1583
|
const sendRequestPayment = () => {
|
1585
1584
|
setIsLoading(true);
|
1586
1585
|
const formData = {
|
@@ -1655,11 +1654,10 @@ function RequestPaymentonClick(props) {
|
|
1655
1654
|
const [isLoading, setIsLoading] = (0, import_react7.useState)(false);
|
1656
1655
|
const [show, setShow] = (0, import_react7.useState)(false);
|
1657
1656
|
const handleClose = () => setShow(false);
|
1658
|
-
const handleShow = () => setShow(true);
|
1659
1657
|
const { fractalpayClientKey, amount, phone_number, orderID, onSuccess, onError } = props;
|
1660
1658
|
const sendRequestPayment = () => {
|
1661
1659
|
setIsLoading(true);
|
1662
|
-
|
1660
|
+
const formData = {
|
1663
1661
|
fractalpayPublicKey: fractalpayClientKey,
|
1664
1662
|
amount,
|
1665
1663
|
phone_number,
|
@@ -1747,7 +1745,6 @@ function RqstPaymntInputField({ fractalpayClientKey, amount, orderID }) {
|
|
1747
1745
|
const [errorMessage, setErrorMessage] = (0, import_react8.useState)("");
|
1748
1746
|
const [submitClicked, setSubmitClicked] = (0, import_react8.useState)(false);
|
1749
1747
|
const handleClose = () => setShow(false);
|
1750
|
-
const handleShow = () => setShow(true);
|
1751
1748
|
const sendRequestPayment = () => {
|
1752
1749
|
if (!phoneNumber) {
|
1753
1750
|
setErrorMessage(ErrorText.phonenumberrequired);
|
@@ -1762,7 +1759,7 @@ function RqstPaymntInputField({ fractalpayClientKey, amount, orderID }) {
|
|
1762
1759
|
setErrorMessage("");
|
1763
1760
|
setSubmitClicked(true);
|
1764
1761
|
setIsLoading(true);
|
1765
|
-
|
1762
|
+
const formData = {
|
1766
1763
|
fractalpayPublicKey: fractalpayClientKey,
|
1767
1764
|
amount,
|
1768
1765
|
phone_number: phoneNumber,
|
@@ -2813,7 +2810,7 @@ function Payment() {
|
|
2813
2810
|
});
|
2814
2811
|
const [isValid, setIsValid] = (0, import_react10.useState)(false);
|
2815
2812
|
const [isValidMonth, setIsValidMonth] = (0, import_react10.useState)(false);
|
2816
|
-
|
2813
|
+
console.log(isValid);
|
2817
2814
|
const handlePaymentClick = async () => {
|
2818
2815
|
try {
|
2819
2816
|
const response = await fetch(`${baseUrl}generate-session`, {
|
@@ -2826,14 +2823,14 @@ function Payment() {
|
|
2826
2823
|
if (!response.ok) {
|
2827
2824
|
throw new Error("Network response was not ok");
|
2828
2825
|
}
|
2829
|
-
const
|
2830
|
-
if (
|
2826
|
+
const data = await response.json();
|
2827
|
+
if (data && data.result === true) {
|
2831
2828
|
setState((prev) => {
|
2832
2829
|
var _a2, _b;
|
2833
2830
|
return __spreadProps(__spreadValues({}, prev), {
|
2834
2831
|
show: true,
|
2835
|
-
publicKey: (_a2 =
|
2836
|
-
sessionKey: (_b =
|
2832
|
+
publicKey: (_a2 = data == null ? void 0 : data.data) == null ? void 0 : _a2.publicKeyPem,
|
2833
|
+
sessionKey: (_b = data == null ? void 0 : data.data) == null ? void 0 : _b.session_key
|
2837
2834
|
});
|
2838
2835
|
});
|
2839
2836
|
}
|
@@ -2903,7 +2900,7 @@ function Payment() {
|
|
2903
2900
|
};
|
2904
2901
|
const handleMonthChange = (e) => {
|
2905
2902
|
setIsValid(false);
|
2906
|
-
|
2903
|
+
const value = e.target.value;
|
2907
2904
|
if (/^\d{0,2}$/.test(value) && (value === "" || parseInt(value, 10) >= 1 && parseInt(value, 10) <= 12)) {
|
2908
2905
|
setState((prev) => __spreadProps(__spreadValues({}, prev), {
|
2909
2906
|
month: value
|
@@ -2916,7 +2913,7 @@ function Payment() {
|
|
2916
2913
|
const handleYearChange = (e) => {
|
2917
2914
|
setIsValid(false);
|
2918
2915
|
setIsValidMonth(false);
|
2919
|
-
|
2916
|
+
const value = e.target.value;
|
2920
2917
|
if (/^\d{0,2}$/.test(value) && (value === "" || parseInt(value, 10) >= 0 && parseInt(value, 10) <= 99)) {
|
2921
2918
|
setState((prev) => __spreadProps(__spreadValues({}, prev), {
|
2922
2919
|
year: value
|
@@ -2926,7 +2923,7 @@ function Payment() {
|
|
2926
2923
|
const handleCVVChange = (e) => {
|
2927
2924
|
setIsValid(false);
|
2928
2925
|
setIsValidMonth(false);
|
2929
|
-
|
2926
|
+
const value = e.target.value;
|
2930
2927
|
if (/^\d{0,4}$/.test(value)) {
|
2931
2928
|
setState((prev) => __spreadProps(__spreadValues({}, prev), {
|
2932
2929
|
cvv: value
|
@@ -2936,7 +2933,7 @@ function Payment() {
|
|
2936
2933
|
const handleZIP = (e) => {
|
2937
2934
|
setIsValid(false);
|
2938
2935
|
setIsValidMonth(false);
|
2939
|
-
|
2936
|
+
const value = e.target.value;
|
2940
2937
|
if (/^\d{0,7}$/.test(value)) {
|
2941
2938
|
setState((prev) => __spreadProps(__spreadValues({}, prev), {
|
2942
2939
|
zip: value
|
@@ -2950,7 +2947,8 @@ function Payment() {
|
|
2950
2947
|
value = value.replace(/[^0-9.]/g, "");
|
2951
2948
|
let parts = value.split(".");
|
2952
2949
|
if (parts.length > 2) {
|
2953
|
-
|
2950
|
+
const p1 = parts.shift();
|
2951
|
+
parts = [p1, parts.join(".")];
|
2954
2952
|
value = parts.join("");
|
2955
2953
|
}
|
2956
2954
|
if (parts.length === 2 && parts[1].length > 2) {
|
@@ -2968,15 +2966,6 @@ function Payment() {
|
|
2968
2966
|
}));
|
2969
2967
|
}
|
2970
2968
|
};
|
2971
|
-
function amountFormat(amt) {
|
2972
|
-
if (amt) {
|
2973
|
-
return `${parseFloat(amt).toLocaleString("en-US", {
|
2974
|
-
minimumFractionDigits: 2,
|
2975
|
-
maximumFractionDigits: 2
|
2976
|
-
})}`;
|
2977
|
-
}
|
2978
|
-
return "";
|
2979
|
-
}
|
2980
2969
|
return /* @__PURE__ */ import_react10.default.createElement(import_react10.default.Fragment, null, /* @__PURE__ */ import_react10.default.createElement(Paymentstyles, null), /* @__PURE__ */ import_react10.default.createElement("div", { className: "" }, /* @__PURE__ */ import_react10.default.createElement(
|
2981
2970
|
"button",
|
2982
2971
|
{
|
@@ -3417,7 +3406,6 @@ function CompletedTransactions(props) {
|
|
3417
3406
|
selectsEnd: true,
|
3418
3407
|
startDate,
|
3419
3408
|
endDate,
|
3420
|
-
minDate: startDate,
|
3421
3409
|
placeholderText: "End Date"
|
3422
3410
|
}
|
3423
3411
|
)), /* @__PURE__ */ import_react12.default.createElement("button", { className: "export-btn1", onClick: handleExport }, "Export")), /* @__PURE__ */ import_react12.default.createElement(
|
@@ -3438,420 +3426,22 @@ function CompletedTransactions(props) {
|
|
3438
3426
|
))));
|
3439
3427
|
}
|
3440
3428
|
|
3441
|
-
// src/app/components/Payment/TockenizPay.tsx
|
3442
|
-
var import_react13 = __toESM(require("react"));
|
3443
|
-
var import_react_bootstrap8 = require("react-bootstrap");
|
3444
|
-
var import_react_toastify5 = require("react-toastify");
|
3445
|
-
var import_node_forge2 = __toESM(require("node-forge"));
|
3446
|
-
var import_credit_card_type = __toESM(require("credit-card-type"));
|
3447
|
-
function TockenizPay() {
|
3448
|
-
const [state, setState] = (0, import_react13.useState)({
|
3449
|
-
show: false,
|
3450
|
-
publicKey: "",
|
3451
|
-
sessionKey: "",
|
3452
|
-
cardNumber: "",
|
3453
|
-
year: "",
|
3454
|
-
month: "",
|
3455
|
-
cvv: "",
|
3456
|
-
zip: "",
|
3457
|
-
amount: ""
|
3458
|
-
});
|
3459
|
-
const [cardTypeDetail, setCardTypeDetail] = (0, import_react13.useState)(null);
|
3460
|
-
const [isValid, setIsValid] = (0, import_react13.useState)(false);
|
3461
|
-
const [isValidMonth, setIsValidMonth] = (0, import_react13.useState)(false);
|
3462
|
-
const [data, setData] = (0, import_react13.useState)(null);
|
3463
|
-
const handlePaymentClick = async () => {
|
3464
|
-
try {
|
3465
|
-
const response = await fetch(`${baseUrl}/generate-session`, {
|
3466
|
-
method: "POST",
|
3467
|
-
headers: {
|
3468
|
-
"Content-Type": "application/json"
|
3469
|
-
},
|
3470
|
-
body: JSON.stringify({})
|
3471
|
-
});
|
3472
|
-
if (!response.ok) {
|
3473
|
-
throw new Error("Network response was not ok");
|
3474
|
-
}
|
3475
|
-
const data2 = await response.json();
|
3476
|
-
if (data2 && data2.result === true) {
|
3477
|
-
setState((prev) => {
|
3478
|
-
var _a, _b;
|
3479
|
-
return __spreadProps(__spreadValues({}, prev), {
|
3480
|
-
show: true,
|
3481
|
-
publicKey: (_a = data2 == null ? void 0 : data2.data) == null ? void 0 : _a.publicKeyPem,
|
3482
|
-
sessionKey: (_b = data2 == null ? void 0 : data2.data) == null ? void 0 : _b.session_key
|
3483
|
-
});
|
3484
|
-
});
|
3485
|
-
}
|
3486
|
-
} catch (error) {
|
3487
|
-
console.log(error);
|
3488
|
-
}
|
3489
|
-
};
|
3490
|
-
const handleSubmitPay = async () => {
|
3491
|
-
var _a, _b, _c;
|
3492
|
-
let track2_data = `${(_a = state == null ? void 0 : state.cardNumber) == null ? void 0 : _a.replaceAll(" ", "")}=${state.year}${((_b = state == null ? void 0 : state.month) == null ? void 0 : _b.length) > 1 ? state == null ? void 0 : state.month : "0" + (state == null ? void 0 : state.month)} ${state.cvv}`;
|
3493
|
-
const publicKey = import_node_forge2.default.pki.publicKeyFromPem(state.publicKey);
|
3494
|
-
const encrypted = publicKey.encrypt(track2_data, "RSA-OAEP", {
|
3495
|
-
md: import_node_forge2.default.md.sha1.create(),
|
3496
|
-
mgf1: {
|
3497
|
-
md: import_node_forge2.default.md.sha1.create()
|
3498
|
-
}
|
3499
|
-
});
|
3500
|
-
const encryptedBase64 = import_node_forge2.default.util.encode64(encrypted);
|
3501
|
-
console.log(encryptedBase64);
|
3502
|
-
const requestBody = {
|
3503
|
-
enc_track2_data: encryptedBase64,
|
3504
|
-
session_key: state.sessionKey,
|
3505
|
-
algorithm: "RSAES_OAEP_SHA_1"
|
3506
|
-
};
|
3507
|
-
try {
|
3508
|
-
const response = await fetch(
|
3509
|
-
"https://m1ao5pku8b.execute-api.us-east-2.amazonaws.com/prod/tokenizer/tokenize",
|
3510
|
-
{
|
3511
|
-
method: "POST",
|
3512
|
-
headers: {
|
3513
|
-
"x-app-session-key": state == null ? void 0 : state.sessionKey,
|
3514
|
-
"Content-Type": "application/json"
|
3515
|
-
},
|
3516
|
-
body: JSON.stringify(requestBody)
|
3517
|
-
}
|
3518
|
-
);
|
3519
|
-
if (!response.ok) {
|
3520
|
-
const errorData = await response.json();
|
3521
|
-
throw new Error(((_c = errorData == null ? void 0 : errorData.data) == null ? void 0 : _c.message) || "Request failed");
|
3522
|
-
}
|
3523
|
-
const responseData = await response.json();
|
3524
|
-
import_react_toastify5.toast.success("Payment Successful");
|
3525
|
-
setState((prev) => __spreadProps(__spreadValues({}, prev), {
|
3526
|
-
show: false,
|
3527
|
-
publicKey: "",
|
3528
|
-
sessionKey: "",
|
3529
|
-
cardNumber: "",
|
3530
|
-
year: "",
|
3531
|
-
month: "",
|
3532
|
-
cvv: "",
|
3533
|
-
zip: "",
|
3534
|
-
amount: ""
|
3535
|
-
}));
|
3536
|
-
console.log("response", responseData);
|
3537
|
-
} catch (error) {
|
3538
|
-
import_react_toastify5.toast.error((error == null ? void 0 : error.message) || "An error occurred");
|
3539
|
-
console.error("Error:", error);
|
3540
|
-
}
|
3541
|
-
};
|
3542
|
-
const formatCreditCardNumber = (cardNumber, cardType) => {
|
3543
|
-
const cleanNumber = cardNumber.replace(/\D+/g, "");
|
3544
|
-
let formattedValue;
|
3545
|
-
switch (cardType) {
|
3546
|
-
case "visa":
|
3547
|
-
case "mastercard":
|
3548
|
-
case "Discover":
|
3549
|
-
case "JCB":
|
3550
|
-
formattedValue = cleanNumber.replace(/(.{4})/g, "$1 ").trim();
|
3551
|
-
break;
|
3552
|
-
case "american-express":
|
3553
|
-
formattedValue = cleanNumber.replace(/(\d{4})(\d{6})(\d{5})/, "$1 $2 $3");
|
3554
|
-
break;
|
3555
|
-
case "diners-club":
|
3556
|
-
formattedValue = cleanNumber.replace(/(\d{4})(\d{6})(\d{4})/, "$1 $2 $3");
|
3557
|
-
break;
|
3558
|
-
case "maestro":
|
3559
|
-
formattedValue = cleanNumber.length <= 19 ? cleanNumber.replace(/(.{4})/g, "$1 ").trim() : cleanNumber;
|
3560
|
-
break;
|
3561
|
-
default:
|
3562
|
-
formattedValue = cleanNumber;
|
3563
|
-
}
|
3564
|
-
return formattedValue;
|
3565
|
-
};
|
3566
|
-
const handleCardNumberChange = (e) => {
|
3567
|
-
e.preventDefault();
|
3568
|
-
e.stopPropagation();
|
3569
|
-
const { value } = e.target;
|
3570
|
-
let cardtyp = (0, import_credit_card_type.default)(value)[0];
|
3571
|
-
const formattedValue = formatCreditCardNumber(value, cardtyp == null ? void 0 : cardtyp.type);
|
3572
|
-
setCardTypeDetail((0, import_credit_card_type.default)(value)[0]);
|
3573
|
-
console.log(formattedValue);
|
3574
|
-
if (value.match(/[a-zA-Z]/)) {
|
3575
|
-
setState((prev) => __spreadProps(__spreadValues({}, prev), {
|
3576
|
-
cardNumber: formattedValue,
|
3577
|
-
error: "Invalid input. Please enter only numbers."
|
3578
|
-
}));
|
3579
|
-
} else {
|
3580
|
-
handleCardNumLength("");
|
3581
|
-
setState((prev) => __spreadProps(__spreadValues({}, prev), {
|
3582
|
-
cardNumber: formattedValue,
|
3583
|
-
error: null
|
3584
|
-
}));
|
3585
|
-
}
|
3586
|
-
};
|
3587
|
-
function handleCardNumLength(cardType) {
|
3588
|
-
const cardLengths = {
|
3589
|
-
"Visa": 16,
|
3590
|
-
"MasterCard": 16,
|
3591
|
-
"AmericanExpress": 15,
|
3592
|
-
"Discover": 16,
|
3593
|
-
"DinersClub": 14,
|
3594
|
-
"JCB": 16
|
3595
|
-
};
|
3596
|
-
return cardLengths[cardType] || "Unknown card type";
|
3597
|
-
}
|
3598
|
-
const handleMonthChange = (e) => {
|
3599
|
-
setIsValid(false);
|
3600
|
-
let value = e.target.value;
|
3601
|
-
if (/^\d{0,2}$/.test(value) && (value === "" || parseInt(value, 10) >= 1 && parseInt(value, 10) <= 12)) {
|
3602
|
-
setState((prev) => __spreadProps(__spreadValues({}, prev), {
|
3603
|
-
month: value
|
3604
|
-
}));
|
3605
|
-
setIsValidMonth(false);
|
3606
|
-
} else {
|
3607
|
-
setIsValidMonth(true);
|
3608
|
-
}
|
3609
|
-
};
|
3610
|
-
const handleYearChange = (e) => {
|
3611
|
-
setIsValid(false);
|
3612
|
-
setIsValidMonth(false);
|
3613
|
-
let value = e.target.value;
|
3614
|
-
if (/^\d{0,2}$/.test(value) && (value === "" || parseInt(value, 10) >= 0 && parseInt(value, 10) <= 99)) {
|
3615
|
-
setState((prev) => __spreadProps(__spreadValues({}, prev), {
|
3616
|
-
year: value
|
3617
|
-
}));
|
3618
|
-
}
|
3619
|
-
};
|
3620
|
-
const handleCVVChange = (e) => {
|
3621
|
-
setIsValid(false);
|
3622
|
-
setIsValidMonth(false);
|
3623
|
-
let value = e.target.value;
|
3624
|
-
if (/^\d{0,4}$/.test(value)) {
|
3625
|
-
setState((prev) => __spreadProps(__spreadValues({}, prev), {
|
3626
|
-
cvv: value
|
3627
|
-
}));
|
3628
|
-
}
|
3629
|
-
};
|
3630
|
-
const handleZIP = (e) => {
|
3631
|
-
setIsValid(false);
|
3632
|
-
setIsValidMonth(false);
|
3633
|
-
let value = e.target.value;
|
3634
|
-
if (/^\d{0,7}$/.test(value)) {
|
3635
|
-
setState((prev) => __spreadProps(__spreadValues({}, prev), {
|
3636
|
-
zip: value
|
3637
|
-
}));
|
3638
|
-
}
|
3639
|
-
};
|
3640
|
-
const handleAmount = (e) => {
|
3641
|
-
setIsValid(false);
|
3642
|
-
setIsValidMonth(false);
|
3643
|
-
let value = e.target.value;
|
3644
|
-
value = value.replace(/[^0-9.]/g, "");
|
3645
|
-
let parts = value.split(".");
|
3646
|
-
if (parts.length > 2) {
|
3647
|
-
parts = [parts.shift(), parts.join(".")];
|
3648
|
-
value = parts.join("");
|
3649
|
-
}
|
3650
|
-
if (parts.length === 2 && parts[1].length > 2) {
|
3651
|
-
value = `${parts[0]}.${parts[1].slice(0, 2)}`;
|
3652
|
-
}
|
3653
|
-
setState((prev) => __spreadProps(__spreadValues({}, prev), {
|
3654
|
-
amount: value
|
3655
|
-
}));
|
3656
|
-
};
|
3657
|
-
const handleAmountBlur = () => {
|
3658
|
-
const value = state.amount;
|
3659
|
-
if (value && !value.includes(".")) {
|
3660
|
-
setState((prev) => __spreadProps(__spreadValues({}, prev), {
|
3661
|
-
amount: `${value}.00`
|
3662
|
-
}));
|
3663
|
-
}
|
3664
|
-
};
|
3665
|
-
function amountFormat(amt) {
|
3666
|
-
if (amt) {
|
3667
|
-
return `${parseFloat(amt).toLocaleString("en-US", {
|
3668
|
-
minimumFractionDigits: 2,
|
3669
|
-
maximumFractionDigits: 2
|
3670
|
-
})}`;
|
3671
|
-
}
|
3672
|
-
return "";
|
3673
|
-
}
|
3674
|
-
return /* @__PURE__ */ import_react13.default.createElement("div", null, /* @__PURE__ */ import_react13.default.createElement(import_react_toastify5.ToastContainer, null), /* @__PURE__ */ import_react13.default.createElement(
|
3675
|
-
"button",
|
3676
|
-
{
|
3677
|
-
className: "export-btn mt-4",
|
3678
|
-
style: { width: "100px" },
|
3679
|
-
onClick: () => handlePaymentClick()
|
3680
|
-
},
|
3681
|
-
"TokenizePay"
|
3682
|
-
), /* @__PURE__ */ import_react13.default.createElement(
|
3683
|
-
import_react_bootstrap8.Modal,
|
3684
|
-
{
|
3685
|
-
show: state.show,
|
3686
|
-
onHide: () => setState((prev) => __spreadProps(__spreadValues({}, prev), {
|
3687
|
-
show: false
|
3688
|
-
})),
|
3689
|
-
centered: true
|
3690
|
-
},
|
3691
|
-
/* @__PURE__ */ import_react13.default.createElement(import_react_bootstrap8.Modal.Header, { closeButton: true }),
|
3692
|
-
/* @__PURE__ */ import_react13.default.createElement(import_react_bootstrap8.Modal.Body, null, /* @__PURE__ */ import_react13.default.createElement("div", { className: "payment-popup" }, /* @__PURE__ */ import_react13.default.createElement("div", { className: "row" }, /* @__PURE__ */ import_react13.default.createElement("div", { className: "" }, /* @__PURE__ */ import_react13.default.createElement("div", { id: "Checkout", className: "inline" }, /* @__PURE__ */ import_react13.default.createElement("div", { className: "header" }, /* @__PURE__ */ import_react13.default.createElement("h1", null, "Pay")), /* @__PURE__ */ import_react13.default.createElement("form", { id: "PaymentForm", className: "payment-form" }, /* @__PURE__ */ import_react13.default.createElement("div", { className: "form-group" }, /* @__PURE__ */ import_react13.default.createElement("label", null, "Name on card"), /* @__PURE__ */ import_react13.default.createElement(
|
3693
|
-
"input",
|
3694
|
-
{
|
3695
|
-
id: "NameOnCard",
|
3696
|
-
className: "form-control required",
|
3697
|
-
type: "text",
|
3698
|
-
maxLength: 100,
|
3699
|
-
placeholder: "Name"
|
3700
|
-
}
|
3701
|
-
), /* @__PURE__ */ import_react13.default.createElement(
|
3702
|
-
"span",
|
3703
|
-
{
|
3704
|
-
id: "NameOnCard-error",
|
3705
|
-
style: { color: "red", display: "none" }
|
3706
|
-
}
|
3707
|
-
)), /* @__PURE__ */ import_react13.default.createElement("div", { className: "form-group" }, /* @__PURE__ */ import_react13.default.createElement(
|
3708
|
-
"input",
|
3709
|
-
{
|
3710
|
-
"data-token": "card_number",
|
3711
|
-
className: "null card-image form-control required",
|
3712
|
-
type: "text",
|
3713
|
-
maxLength: 19,
|
3714
|
-
value: state.cardNumber,
|
3715
|
-
placeholder: "0000 0000 0000 0000",
|
3716
|
-
onChange: handleCardNumberChange
|
3717
|
-
}
|
3718
|
-
), state.error && /* @__PURE__ */ import_react13.default.createElement("div", { style: { color: "red" } }, state.error)), /* @__PURE__ */ import_react13.default.createElement("div", { className: "expiry-date-group form-group" }, /* @__PURE__ */ import_react13.default.createElement(
|
3719
|
-
"input",
|
3720
|
-
{
|
3721
|
-
"data-token": "exp_month",
|
3722
|
-
className: "form-control required",
|
3723
|
-
type: "text",
|
3724
|
-
placeholder: "MM",
|
3725
|
-
value: state.month,
|
3726
|
-
maxLength: 2,
|
3727
|
-
onChange: (e) => handleMonthChange(e)
|
3728
|
-
}
|
3729
|
-
), isValidMonth && /* @__PURE__ */ import_react13.default.createElement(
|
3730
|
-
"span",
|
3731
|
-
{
|
3732
|
-
id: "card_number-error",
|
3733
|
-
style: { color: "red", fontSize: "15px" }
|
3734
|
-
},
|
3735
|
-
"Please write month only 1 to 12"
|
3736
|
-
)), /* @__PURE__ */ import_react13.default.createElement("div", { className: "expiry-date-group form-group" }, /* @__PURE__ */ import_react13.default.createElement(
|
3737
|
-
"input",
|
3738
|
-
{
|
3739
|
-
"data-token": "exp_year",
|
3740
|
-
className: "form-control required",
|
3741
|
-
type: "text",
|
3742
|
-
placeholder: "YY",
|
3743
|
-
maxLength: 2,
|
3744
|
-
value: state.year,
|
3745
|
-
onChange: (e) => handleYearChange(e)
|
3746
|
-
}
|
3747
|
-
), state.yearError && /* @__PURE__ */ import_react13.default.createElement("span", { id: "exp_year-error", style: { color: "red" } }, state.yearError)), /* @__PURE__ */ import_react13.default.createElement("div", { className: "security-code-group form-group" }, /* @__PURE__ */ import_react13.default.createElement("div", { className: "input-container" }, /* @__PURE__ */ import_react13.default.createElement(
|
3748
|
-
"input",
|
3749
|
-
{
|
3750
|
-
"data-token": "cvv",
|
3751
|
-
className: "form-control required",
|
3752
|
-
type: "text",
|
3753
|
-
maxLength: 4,
|
3754
|
-
value: state.cvv,
|
3755
|
-
placeholder: "CVV",
|
3756
|
-
onChange: (e) => handleCVVChange(e)
|
3757
|
-
}
|
3758
|
-
), /* @__PURE__ */ import_react13.default.createElement("i", { id: "cvc", className: "fa fa-question-circle" }), state.cvvError && /* @__PURE__ */ import_react13.default.createElement("span", { id: "cvv-error", style: { color: "red" } }, state.cvvError)), /* @__PURE__ */ import_react13.default.createElement("div", { className: "cvc-preview-container two-card hide" }, /* @__PURE__ */ import_react13.default.createElement("div", { className: "amex-cvc-preview" }), /* @__PURE__ */ import_react13.default.createElement("div", { className: "visa-mc-dis-cvc-preview" }))), /* @__PURE__ */ import_react13.default.createElement("div", { className: "zip-code-group form-group" }, /* @__PURE__ */ import_react13.default.createElement("label", null, "Postal code"), /* @__PURE__ */ import_react13.default.createElement("div", { className: "input-container" }, /* @__PURE__ */ import_react13.default.createElement(
|
3759
|
-
"input",
|
3760
|
-
{
|
3761
|
-
id: "ZIPCode",
|
3762
|
-
className: "form-control required",
|
3763
|
-
name: "zip",
|
3764
|
-
type: "text",
|
3765
|
-
maxLength: 7,
|
3766
|
-
placeholder: "000000",
|
3767
|
-
value: state.zip,
|
3768
|
-
onChange: (e) => handleZIP(e)
|
3769
|
-
}
|
3770
|
-
), /* @__PURE__ */ import_react13.default.createElement(
|
3771
|
-
"a",
|
3772
|
-
{
|
3773
|
-
tabIndex: 0,
|
3774
|
-
role: "button",
|
3775
|
-
"data-toggle": "popover",
|
3776
|
-
"data-trigger": "focus",
|
3777
|
-
"data-placement": "left",
|
3778
|
-
"data-content": "Enter the ZIP/Postal code for your credit card billing address."
|
3779
|
-
},
|
3780
|
-
/* @__PURE__ */ import_react13.default.createElement("i", { className: "fa fa-question-circle" })
|
3781
|
-
), /* @__PURE__ */ import_react13.default.createElement(
|
3782
|
-
"span",
|
3783
|
-
{
|
3784
|
-
id: "ZIPCode-error",
|
3785
|
-
style: { color: "red", display: "none" }
|
3786
|
-
},
|
3787
|
-
"This field is required"
|
3788
|
-
))), /* @__PURE__ */ import_react13.default.createElement("div", { className: "form-group top-amnt" }, /* @__PURE__ */ import_react13.default.createElement("div", null, /* @__PURE__ */ import_react13.default.createElement("label", null, "Payment amount"), /* @__PURE__ */ import_react13.default.createElement("div", { className: "amount-placeholder" }, /* @__PURE__ */ import_react13.default.createElement(
|
3789
|
-
"input",
|
3790
|
-
{
|
3791
|
-
id: "Amount",
|
3792
|
-
className: "form-control required",
|
3793
|
-
name: "amount",
|
3794
|
-
type: "text",
|
3795
|
-
placeholder: "",
|
3796
|
-
value: state.amount,
|
3797
|
-
onChange: (e) => handleAmount(e),
|
3798
|
-
onBlur: handleAmountBlur
|
3799
|
-
}
|
3800
|
-
))), /* @__PURE__ */ import_react13.default.createElement("div", { className: "card-row" }, /* @__PURE__ */ import_react13.default.createElement("span", { className: "visa" }), /* @__PURE__ */ import_react13.default.createElement("span", { className: "mastercard" }), /* @__PURE__ */ import_react13.default.createElement("span", { className: "amex" }), /* @__PURE__ */ import_react13.default.createElement("span", { className: "discover" }))), /* @__PURE__ */ import_react13.default.createElement(
|
3801
|
-
"button",
|
3802
|
-
{
|
3803
|
-
type: "button",
|
3804
|
-
id: "submitButton",
|
3805
|
-
onClick: () => handleSubmitPay(),
|
3806
|
-
className: "btn btn-block btn-success submit-button"
|
3807
|
-
},
|
3808
|
-
"Submit"
|
3809
|
-
)), /* @__PURE__ */ import_react13.default.createElement("div", { className: "powerd-by-part" }, /* @__PURE__ */ import_react13.default.createElement(
|
3810
|
-
"svg",
|
3811
|
-
{
|
3812
|
-
xmlns: "http://www.w3.org/2000/svg",
|
3813
|
-
width: "20",
|
3814
|
-
height: "20",
|
3815
|
-
viewBox: "0 0 26 26"
|
3816
|
-
},
|
3817
|
-
/* @__PURE__ */ import_react13.default.createElement(
|
3818
|
-
"path",
|
3819
|
-
{
|
3820
|
-
fill: "currentColor",
|
3821
|
-
d: "M23.633 5.028a1.074 1.074 0 0 0-.777-.366c-2.295-.06-5.199-2.514-7.119-3.477C14.551.592 13.768.201 13.18.098a1.225 1.225 0 0 0-.36.001c-.588.103-1.371.494-2.556 1.087c-1.92.962-4.824 3.416-7.119 3.476a1.08 1.08 0 0 0-.778.366a1.167 1.167 0 0 0-.291.834c.493 10.023 4.088 16.226 10.396 19.831c.164.093.346.141.527.141s.363-.048.528-.141c6.308-3.605 9.902-9.808 10.396-19.831a1.161 1.161 0 0 0-.29-.834zM18.617 8.97l-5.323 7.855c-.191.282-.491.469-.788.469c-.298 0-.629-.163-.838-.372l-3.752-3.753a.656.656 0 0 1 0-.926l.927-.929a.658.658 0 0 1 .926 0l2.44 2.44l4.239-6.257a.657.657 0 0 1 .91-.173l1.085.736a.657.657 0 0 1 .174.91z"
|
3822
|
-
}
|
3823
|
-
)
|
3824
|
-
), "Secure payments powered by Fractal", /* @__PURE__ */ import_react13.default.createElement(
|
3825
|
-
"img",
|
3826
|
-
{
|
3827
|
-
src: "https://ui.fractalpay.com/favicon.ico",
|
3828
|
-
alt: "Fractal logo",
|
3829
|
-
className: "powered-logo"
|
3830
|
-
}
|
3831
|
-
)))))))
|
3832
|
-
));
|
3833
|
-
}
|
3834
|
-
|
3835
3429
|
// src/app/components/Payment/GetPaymentDynamic.tsx
|
3836
|
-
var
|
3837
|
-
var
|
3430
|
+
var import_react14 = __toESM(require("react"));
|
3431
|
+
var import_react_bootstrap8 = require("react-bootstrap");
|
3838
3432
|
|
3839
3433
|
// src/app/components/Loader/MyLoadingAnimation.tsx
|
3840
|
-
var
|
3434
|
+
var import_react13 = __toESM(require("react"));
|
3841
3435
|
function MyLoadingAnimation() {
|
3842
|
-
return /* @__PURE__ */
|
3436
|
+
return /* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, null, /* @__PURE__ */ import_react13.default.createElement(LoaderStyle_default, null), /* @__PURE__ */ import_react13.default.createElement("div", { className: "loading-animation" }, /* @__PURE__ */ import_react13.default.createElement("div", { className: "spinner" })));
|
3843
3437
|
}
|
3844
3438
|
|
3845
3439
|
// src/app/components/Payment/GetPaymentDynamic.tsx
|
3846
3440
|
function GetPaymentDynamic(props) {
|
3847
3441
|
const { amount, fractalpayClientKey, orderID } = props;
|
3848
|
-
const [loading, setLoading] = (0,
|
3849
|
-
const [show, setShow] = (0,
|
3850
|
-
const [iframeLoaded, setIframeLoaded] = (0,
|
3851
|
-
const [phoneNumber, setPhoneNumber] = (0, import_react15.useState)("");
|
3852
|
-
const [errorMessage, setErrorMessage] = (0, import_react15.useState)("");
|
3853
|
-
const [submitClicked, setSubmitClicked] = (0, import_react15.useState)(false);
|
3854
|
-
const [isValidNumber, setIsValidNumber] = (0, import_react15.useState)(true);
|
3442
|
+
const [loading, setLoading] = (0, import_react14.useState)(false);
|
3443
|
+
const [show, setShow] = (0, import_react14.useState)(false);
|
3444
|
+
const [iframeLoaded, setIframeLoaded] = (0, import_react14.useState)(false);
|
3855
3445
|
const handleClose = () => {
|
3856
3446
|
setIframeLoaded(false);
|
3857
3447
|
setTimeout(() => {
|
@@ -3863,33 +3453,18 @@ function GetPaymentDynamic(props) {
|
|
3863
3453
|
setShow(true);
|
3864
3454
|
setIframeLoaded(true);
|
3865
3455
|
} else {
|
3866
|
-
console.error(
|
3456
|
+
console.error(ErrorText.fractalpayclientidrequired);
|
3867
3457
|
}
|
3868
3458
|
};
|
3869
|
-
(0,
|
3459
|
+
(0, import_react14.useEffect)(() => {
|
3870
3460
|
if (!fractalpayClientKey) {
|
3871
|
-
console.error(
|
3461
|
+
console.error(ErrorText.fractalpayclientidrequired);
|
3872
3462
|
}
|
3873
3463
|
}, [fractalpayClientKey]);
|
3874
|
-
const handlePhoneNumberChange = (e) => {
|
3875
|
-
const number = e.target.value;
|
3876
|
-
const isValid = /^\d*$/.test(number);
|
3877
|
-
if (isValid) {
|
3878
|
-
setPhoneNumber(number);
|
3879
|
-
setIsValidNumber(number.length <= 10);
|
3880
|
-
if (number.length > 10) {
|
3881
|
-
setErrorMessage("Please enter a valid phone number (max 10 digits)");
|
3882
|
-
} else {
|
3883
|
-
setErrorMessage("");
|
3884
|
-
}
|
3885
|
-
} else {
|
3886
|
-
setErrorMessage("Please enter a valid phone number (numbers only)");
|
3887
|
-
}
|
3888
|
-
};
|
3889
3464
|
const handleLoad = () => {
|
3890
3465
|
setLoading(false);
|
3891
3466
|
};
|
3892
|
-
(0,
|
3467
|
+
(0, import_react14.useEffect)(() => {
|
3893
3468
|
const messageListener = (event) => {
|
3894
3469
|
var _a, _b;
|
3895
3470
|
const response = (_b = (_a = event == null ? void 0 : event.data) == null ? void 0 : _a.other) == null ? void 0 : _b.data;
|
@@ -3904,7 +3479,7 @@ function GetPaymentDynamic(props) {
|
|
3904
3479
|
window.removeEventListener("message", messageListener);
|
3905
3480
|
};
|
3906
3481
|
}, []);
|
3907
|
-
return /* @__PURE__ */
|
3482
|
+
return /* @__PURE__ */ import_react14.default.createElement("div", null, /* @__PURE__ */ import_react14.default.createElement("button", { className: "paymentBtn", onClick: handleShow }, "Pay"), /* @__PURE__ */ import_react14.default.createElement(import_react_bootstrap8.Modal, { show: show && iframeLoaded, id: "modal-pay", className: "modal-lg", onHide: handleClose }, /* @__PURE__ */ import_react14.default.createElement(import_react_bootstrap8.Modal.Header, { closeButton: true }), /* @__PURE__ */ import_react14.default.createElement(import_react_bootstrap8.Modal.Body, null, loading && /* @__PURE__ */ import_react14.default.createElement(MyLoadingAnimation, null), /* @__PURE__ */ import_react14.default.createElement(
|
3908
3483
|
"iframe",
|
3909
3484
|
{
|
3910
3485
|
src: `${baseUrl}widget-form/${amount}?fractalpay_public_key=${fractalpayClientKey}&order_id=${orderID}`,
|
@@ -3924,6 +3499,5 @@ function GetPaymentDynamic(props) {
|
|
3924
3499
|
RequestPaymentAllInput,
|
3925
3500
|
RequestPaymentDynamic,
|
3926
3501
|
RequestPaymentonClick,
|
3927
|
-
RqstPaymntInputField
|
3928
|
-
TockenizPay
|
3502
|
+
RqstPaymntInputField
|
3929
3503
|
});
|