@fractalpay/fractalpay-next-dev 0.0.1 → 0.0.2
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/README.md +0 -30
- package/dist/index.d.mts +9 -15
- package/dist/index.d.ts +9 -15
- package/dist/index.js +30 -441
- package/dist/index.mjs +25 -435
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3539,8 +3539,8 @@ function PreAuthPayment(props) {
|
|
|
3539
3539
|
)));
|
|
3540
3540
|
}
|
|
3541
3541
|
|
|
3542
|
-
// src/app/components/AddCard/
|
|
3543
|
-
import
|
|
3542
|
+
// src/app/components/AddCard/AddCardEasyPay.tsx
|
|
3543
|
+
import React18, { useEffect as useEffect6, useState as useState5 } from "react";
|
|
3544
3544
|
import Swal3 from "sweetalert2";
|
|
3545
3545
|
import axios5 from "axios";
|
|
3546
3546
|
|
|
@@ -3813,36 +3813,13 @@ function AddCardStyle() {
|
|
|
3813
3813
|
`);
|
|
3814
3814
|
}
|
|
3815
3815
|
|
|
3816
|
-
// src/app/components/CustomModal/CustomModal.tsx
|
|
3817
|
-
import React16 from "react";
|
|
3818
|
-
var CustomModal = ({
|
|
3819
|
-
open,
|
|
3820
|
-
onClose,
|
|
3821
|
-
children
|
|
3822
|
-
}) => {
|
|
3823
|
-
if (!open) return null;
|
|
3824
|
-
return /* @__PURE__ */ React16.createElement("div", { style: {
|
|
3825
|
-
position: "fixed",
|
|
3826
|
-
top: 0,
|
|
3827
|
-
left: 0,
|
|
3828
|
-
width: "100%",
|
|
3829
|
-
height: "100%",
|
|
3830
|
-
zIndex: 5,
|
|
3831
|
-
backgroundColor: "rgba(0,0,0,0.5)",
|
|
3832
|
-
display: "flex",
|
|
3833
|
-
justifyContent: "center",
|
|
3834
|
-
alignItems: "center"
|
|
3835
|
-
} }, /* @__PURE__ */ React16.createElement("div", { style: { background: "white", padding: "20px", borderRadius: "8px", minWidth: "300px" } }, /* @__PURE__ */ React16.createElement("div", { className: "", style: { display: "flex", justifyContent: "end" } }, /* @__PURE__ */ React16.createElement("button", { onClick: onClose, style: { border: "none", background: "transparent", color: "black" } }, "X")), /* @__PURE__ */ React16.createElement("div", null, children)));
|
|
3836
|
-
};
|
|
3837
|
-
var CustomModal_default = CustomModal;
|
|
3838
|
-
|
|
3839
3816
|
// src/app/components/SuccessCardMessage/SuccessCardMsz.tsx
|
|
3840
|
-
import
|
|
3817
|
+
import React17 from "react";
|
|
3841
3818
|
|
|
3842
3819
|
// src/app/components/SuccessCardMessage/SuccessCardMszStyle.tsx
|
|
3843
|
-
import
|
|
3820
|
+
import React16 from "react";
|
|
3844
3821
|
function SuccessCardMszStyle() {
|
|
3845
|
-
return /* @__PURE__ */
|
|
3822
|
+
return /* @__PURE__ */ React16.createElement("style", null, `
|
|
3846
3823
|
.card-success .logo-container {
|
|
3847
3824
|
display: flex;
|
|
3848
3825
|
justify-content: center;
|
|
@@ -3935,15 +3912,16 @@ function SuccessCardMszStyle() {
|
|
|
3935
3912
|
|
|
3936
3913
|
// src/app/components/SuccessCardMessage/SuccessCardMsz.tsx
|
|
3937
3914
|
var SuccessCardMsz = ({ onClose }) => {
|
|
3938
|
-
return /* @__PURE__ */
|
|
3915
|
+
return /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(SuccessCardMszStyle, null), /* @__PURE__ */ React17.createElement("div", { className: "card-success" }, /* @__PURE__ */ React17.createElement("div", { className: "payment-success-container" }, /* @__PURE__ */ React17.createElement("div", { className: "success-icon" }, /* @__PURE__ */ React17.createElement("div", { className: "circle" }, /* @__PURE__ */ React17.createElement("i", { className: "fa fa-check-circle", "aria-hidden": "true" })), /* @__PURE__ */ React17.createElement("div", { className: "success-text" }, /* @__PURE__ */ React17.createElement("div", { className: "payment-success-text" }, "Your card was added successfully."), /* @__PURE__ */ React17.createElement("div", { className: "thank-you-text" }, "Thank you "))))));
|
|
3939
3916
|
};
|
|
3940
3917
|
var SuccessCardMsz_default = SuccessCardMsz;
|
|
3941
3918
|
|
|
3942
|
-
// src/app/components/AddCard/
|
|
3943
|
-
function
|
|
3919
|
+
// src/app/components/AddCard/AddCardEasyPay.tsx
|
|
3920
|
+
function AddCardEasyPay(props) {
|
|
3944
3921
|
var _a;
|
|
3945
3922
|
const [loading, setLoading] = useState5(false);
|
|
3946
3923
|
const [success, setSuccess] = useState5(false);
|
|
3924
|
+
const [error, setError] = useState5("");
|
|
3947
3925
|
const [show, setShow] = useState5(false);
|
|
3948
3926
|
const [cardData, setCardData] = useState5();
|
|
3949
3927
|
const [cardError, setCardError] = useState5({});
|
|
@@ -3952,393 +3930,6 @@ function AddCard(props) {
|
|
|
3952
3930
|
const hideLoader = () => setLoading(false);
|
|
3953
3931
|
const showError = (msz) => {
|
|
3954
3932
|
Swal3.fire({
|
|
3955
|
-
icon: "error",
|
|
3956
|
-
text: msz
|
|
3957
|
-
});
|
|
3958
|
-
};
|
|
3959
|
-
const handleClose = () => {
|
|
3960
|
-
setShow(false);
|
|
3961
|
-
setSuccess(false);
|
|
3962
|
-
setCardData({
|
|
3963
|
-
cardName: "",
|
|
3964
|
-
cardNumber: "",
|
|
3965
|
-
expiryMonth: "",
|
|
3966
|
-
expiryYear: "",
|
|
3967
|
-
cvv: "",
|
|
3968
|
-
orderId: "",
|
|
3969
|
-
zipCode: ""
|
|
3970
|
-
});
|
|
3971
|
-
setCardError({
|
|
3972
|
-
cardName: "",
|
|
3973
|
-
cardNumber: "",
|
|
3974
|
-
expiryMonth: "",
|
|
3975
|
-
expiryYear: "",
|
|
3976
|
-
cvv: "",
|
|
3977
|
-
orderId: "",
|
|
3978
|
-
zipCode: ""
|
|
3979
|
-
});
|
|
3980
|
-
};
|
|
3981
|
-
const handleShow = () => setShow(true);
|
|
3982
|
-
const handleCardChange = (field, value) => {
|
|
3983
|
-
const name = field;
|
|
3984
|
-
const numericFields = ["expiryMonth", "expiryYear", "zipCode", "cvv"];
|
|
3985
|
-
if (numericFields.includes(name)) {
|
|
3986
|
-
if (value === "" || /^[0-9]+$/.test(value)) {
|
|
3987
|
-
setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
3988
|
-
[name]: ""
|
|
3989
|
-
}));
|
|
3990
|
-
setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
3991
|
-
[name]: value
|
|
3992
|
-
}));
|
|
3993
|
-
}
|
|
3994
|
-
return;
|
|
3995
|
-
}
|
|
3996
|
-
setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
3997
|
-
[name]: ""
|
|
3998
|
-
}));
|
|
3999
|
-
setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
4000
|
-
[name]: value
|
|
4001
|
-
}));
|
|
4002
|
-
};
|
|
4003
|
-
const handleCardNumberChange = (e) => {
|
|
4004
|
-
const input = e.target;
|
|
4005
|
-
const rawValue = input.value.replace(/\D/g, "");
|
|
4006
|
-
let formatted = "";
|
|
4007
|
-
if (/^3[47]/.test(rawValue)) {
|
|
4008
|
-
const trimmed = rawValue.slice(0, 15);
|
|
4009
|
-
formatted = trimmed.replace(
|
|
4010
|
-
/^(\d{1,4})(\d{1,6})?(\d{1,5})?$/,
|
|
4011
|
-
(_, g1, g2, g3) => [g1, g2, g3].filter(Boolean).join(" ")
|
|
4012
|
-
);
|
|
4013
|
-
} else {
|
|
4014
|
-
const trimmed = rawValue.slice(0, 16);
|
|
4015
|
-
formatted = trimmed.replace(
|
|
4016
|
-
/^(\d{1,4})(\d{1,4})?(\d{1,4})?(\d{1,4})?$/,
|
|
4017
|
-
(_, g1, g2, g3, g4) => [g1, g2, g3, g4].filter(Boolean).join(" ")
|
|
4018
|
-
);
|
|
4019
|
-
}
|
|
4020
|
-
setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
4021
|
-
cardNumber: ""
|
|
4022
|
-
}));
|
|
4023
|
-
setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
4024
|
-
cardNumber: formatted
|
|
4025
|
-
}));
|
|
4026
|
-
};
|
|
4027
|
-
const validateCardData = () => {
|
|
4028
|
-
var _a2, _b, _c, _d, _e, _f;
|
|
4029
|
-
const errors = {};
|
|
4030
|
-
const data = cardData;
|
|
4031
|
-
const month = parseInt((data == null ? void 0 : data.expiryMonth) || "", 10);
|
|
4032
|
-
const year = (data == null ? void 0 : data.expiryYear) || "";
|
|
4033
|
-
if (!((_a2 = data == null ? void 0 : data.cardName) == null ? void 0 : _a2.trim())) errors.cardName = "Card name is required";
|
|
4034
|
-
if (!((_b = data == null ? void 0 : data.cardNumber) == null ? void 0 : _b.trim())) errors.cardNumber = "Card number is required";
|
|
4035
|
-
if (!((_c = data == null ? void 0 : data.expiryMonth) == null ? void 0 : _c.trim())) {
|
|
4036
|
-
errors.expiryMonth = "Expiration month is required";
|
|
4037
|
-
} else if (Number(data == null ? void 0 : data.expiryMonth) > 12 || Number(data == null ? void 0 : data.expiryMonth) < 1) {
|
|
4038
|
-
errors.expiryMonth = "Invalid Expiration Month.";
|
|
4039
|
-
}
|
|
4040
|
-
if (!((_d = data == null ? void 0 : data.expiryYear) == null ? void 0 : _d.trim())) {
|
|
4041
|
-
errors.expiryYear = "Expiration year is required";
|
|
4042
|
-
} else if (((_e = data == null ? void 0 : data.expiryYear) == null ? void 0 : _e.trim().length) !== 4 || Number(data == null ? void 0 : data.expiryYear) < 2025) {
|
|
4043
|
-
errors.expiryYear = "Invalid Expiration Year.";
|
|
4044
|
-
} else if (isNaN(month) || month < 1 || month > 12 || year.length !== 4) {
|
|
4045
|
-
errors.expiryMonth = "Invalid Expiration Date.";
|
|
4046
|
-
}
|
|
4047
|
-
if (!((_f = data == null ? void 0 : data.cvv) == null ? void 0 : _f.trim())) errors.cvv = "CVC is required";
|
|
4048
|
-
if ((data == null ? void 0 : data.expiryMonth) && (data == null ? void 0 : data.expiryYear) && data.expiryMonth.length <= 2 && data.expiryYear.length === 4) {
|
|
4049
|
-
const month2 = parseInt(data.expiryMonth, 10);
|
|
4050
|
-
const year2 = parseInt(data.expiryYear, 10);
|
|
4051
|
-
const now = /* @__PURE__ */ new Date();
|
|
4052
|
-
const currentMonth = now.getMonth() + 1;
|
|
4053
|
-
const currentYear = now.getFullYear();
|
|
4054
|
-
if (year2 < currentYear || year2 === currentYear && month2 < currentMonth) {
|
|
4055
|
-
errors.expiryMonth = "Card is expired";
|
|
4056
|
-
}
|
|
4057
|
-
}
|
|
4058
|
-
setCardError(errors);
|
|
4059
|
-
return Object.keys(errors).length > 0;
|
|
4060
|
-
};
|
|
4061
|
-
const getPaymentDetails = async () => {
|
|
4062
|
-
var _a2;
|
|
4063
|
-
showLoader();
|
|
4064
|
-
try {
|
|
4065
|
-
const data = {
|
|
4066
|
-
fractalpayPublicKey: props == null ? void 0 : props.fractalpayClientKey,
|
|
4067
|
-
"customer_id": props == null ? void 0 : props.customerId,
|
|
4068
|
-
addcard: true
|
|
4069
|
-
};
|
|
4070
|
-
let paymentData2 = await axios5.post(`${baseUrl}get-payment-details`, data);
|
|
4071
|
-
setPaymentData((_a2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _a2.data);
|
|
4072
|
-
hideLoader();
|
|
4073
|
-
} catch (err) {
|
|
4074
|
-
hideLoader();
|
|
4075
|
-
handleClose();
|
|
4076
|
-
showError("Something went wrong , Try again later");
|
|
4077
|
-
}
|
|
4078
|
-
};
|
|
4079
|
-
useEffect6(() => {
|
|
4080
|
-
if (show && props.fractalpayClientKey) {
|
|
4081
|
-
getPaymentDetails();
|
|
4082
|
-
}
|
|
4083
|
-
}, [props == null ? void 0 : props.fractalpayClientKey, show]);
|
|
4084
|
-
const addCardFunc = async (e) => {
|
|
4085
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
4086
|
-
console.log("called");
|
|
4087
|
-
e.preventDefault();
|
|
4088
|
-
const hasError = validateCardData();
|
|
4089
|
-
if (hasError) return;
|
|
4090
|
-
else {
|
|
4091
|
-
let validCard = DatacapWebToken.validateCardNumber(cardData == null ? void 0 : cardData.cardNumber.replaceAll(" ", ""));
|
|
4092
|
-
let validExpirationDate = DatacapWebToken.validateExpirationDate(cardData == null ? void 0 : cardData.expiryMonth, cardData == null ? void 0 : cardData.expiryYear);
|
|
4093
|
-
let validCVV = DatacapWebToken.validateCVV(cardData == null ? void 0 : cardData.cvv);
|
|
4094
|
-
let errors = {};
|
|
4095
|
-
if (!validCard) errors.cardNumber = "Invalid card Number";
|
|
4096
|
-
if (!validExpirationDate) errors.expiryMonth = "Invalid Expiration Date.";
|
|
4097
|
-
if (!validCVV) errors.cvv = "Invalid CVV";
|
|
4098
|
-
setCardError(errors);
|
|
4099
|
-
if (validCard && validCVV && validExpirationDate) {
|
|
4100
|
-
showLoader();
|
|
4101
|
-
try {
|
|
4102
|
-
let getTokenCallback = async function(token) {
|
|
4103
|
-
var _a3, _b2, _c2, _d2, _e2;
|
|
4104
|
-
if (token.Error) {
|
|
4105
|
-
showError(token.Error);
|
|
4106
|
-
hideLoader();
|
|
4107
|
-
} else {
|
|
4108
|
-
const reqData = {
|
|
4109
|
-
userId: props == null ? void 0 : props.customerId,
|
|
4110
|
-
cardName: cardData == null ? void 0 : cardData.cardName,
|
|
4111
|
-
zip: cardData == null ? void 0 : cardData.zipCode,
|
|
4112
|
-
fractalpayPublicKey: props == null ? void 0 : props.fractalpayClientKey,
|
|
4113
|
-
token
|
|
4114
|
-
};
|
|
4115
|
-
try {
|
|
4116
|
-
let apiResponse = await axios5.post(`${baseUrl}add-card`, reqData);
|
|
4117
|
-
let formData = {
|
|
4118
|
-
fractalpayPublicKey: props == null ? void 0 : props.fractalpayClientKey,
|
|
4119
|
-
wallet_id: "",
|
|
4120
|
-
card_number: cardData == null ? void 0 : cardData.cardNumber.replaceAll(" ", ""),
|
|
4121
|
-
exp_month: cardData == null ? void 0 : cardData.expiryMonth,
|
|
4122
|
-
exp_year: (_a3 = cardData == null ? void 0 : cardData.expiryYear) == null ? void 0 : _a3.slice(-2),
|
|
4123
|
-
cvv: cardData == null ? void 0 : cardData.cvv
|
|
4124
|
-
};
|
|
4125
|
-
try {
|
|
4126
|
-
const result = await axios5.post(`${baseUrl}link-wallet`, formData);
|
|
4127
|
-
setSuccess(true);
|
|
4128
|
-
hideLoader();
|
|
4129
|
-
setCardData({
|
|
4130
|
-
cardName: "",
|
|
4131
|
-
cardNumber: "",
|
|
4132
|
-
expiryMonth: "",
|
|
4133
|
-
expiryYear: "",
|
|
4134
|
-
cvv: "",
|
|
4135
|
-
orderId: "",
|
|
4136
|
-
zipCode: ""
|
|
4137
|
-
});
|
|
4138
|
-
} catch (err) {
|
|
4139
|
-
hideLoader();
|
|
4140
|
-
showError(((_c2 = (_b2 = err == null ? void 0 : err.response) == null ? void 0 : _b2.data) == null ? void 0 : _c2.message) || (err == null ? void 0 : err.message) || "Something went wrong..");
|
|
4141
|
-
}
|
|
4142
|
-
} catch (err) {
|
|
4143
|
-
hideLoader();
|
|
4144
|
-
showError(((_e2 = (_d2 = err == null ? void 0 : err.response) == null ? void 0 : _d2.data) == null ? void 0 : _e2.message) || (err == null ? void 0 : err.message) || "Something went wrong..");
|
|
4145
|
-
}
|
|
4146
|
-
}
|
|
4147
|
-
};
|
|
4148
|
-
if ((paymentData == null ? void 0 : paymentData.paymentGateway) === 32) {
|
|
4149
|
-
const requestOptions = {
|
|
4150
|
-
method: "POST",
|
|
4151
|
-
redirect: "follow"
|
|
4152
|
-
};
|
|
4153
|
-
try {
|
|
4154
|
-
let sesionResult = await axios5.post(`${masterBaseUrl}api/v1/widget/generate-session`, requestOptions);
|
|
4155
|
-
let expYear = Number(cardData == null ? void 0 : cardData.expiryYear) % 100;
|
|
4156
|
-
let cardNumber = cardData == null ? void 0 : cardData.cardNumber;
|
|
4157
|
-
cardNumber = cardNumber == null ? void 0 : cardNumber.replace(/\s+/g, "");
|
|
4158
|
-
let track2_data = `${cardNumber}=${expYear}${cardData == null ? void 0 : cardData.expiryMonth} ${cardData == null ? void 0 : cardData.cvv}`;
|
|
4159
|
-
const publicKey = forge.pki.publicKeyFromPem((_b = (_a2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _a2.data) == null ? void 0 : _b.publicKeyPem);
|
|
4160
|
-
const encrypted = publicKey.encrypt(track2_data, "RSA-OAEP", {
|
|
4161
|
-
md: forge.md.sha1.create(),
|
|
4162
|
-
mgf1: {
|
|
4163
|
-
md: forge.md.sha1.create()
|
|
4164
|
-
}
|
|
4165
|
-
});
|
|
4166
|
-
const encryptedBase64 = forge.util.encode64(encrypted);
|
|
4167
|
-
const myHeaders = {
|
|
4168
|
-
"Content-Type": "application/json",
|
|
4169
|
-
"x-app-session-key": (_d = (_c = sesionResult.data) == null ? void 0 : _c.data) == null ? void 0 : _d.session_key
|
|
4170
|
-
};
|
|
4171
|
-
const raw = JSON.stringify({
|
|
4172
|
-
"enc_track2_data": `${encryptedBase64}`,
|
|
4173
|
-
"algorithm": "RSAES_OAEP_SHA_1",
|
|
4174
|
-
session_key: `${(_f = (_e = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _e.data) == null ? void 0 : _f.session_key}`
|
|
4175
|
-
});
|
|
4176
|
-
try {
|
|
4177
|
-
const tokenizeData = await axios5.post(`${fractalGatewayUrl}tokenizer/tokenize`, raw, { headers: myHeaders });
|
|
4178
|
-
const reqData = JSON.stringify(__spreadProps(__spreadValues({}, (_g = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _g.data), {
|
|
4179
|
-
cvv: cardData == null ? void 0 : cardData.cvv,
|
|
4180
|
-
cardName: cardData == null ? void 0 : cardData.cardName,
|
|
4181
|
-
zip: cardData == null ? void 0 : cardData.zipCode,
|
|
4182
|
-
userId: props == null ? void 0 : props.customerId,
|
|
4183
|
-
fractalpayPublicKey: props == null ? void 0 : props.fractalpayClientKey
|
|
4184
|
-
}));
|
|
4185
|
-
let myHeaders2 = {
|
|
4186
|
-
"Content-Type": "application/json"
|
|
4187
|
-
};
|
|
4188
|
-
try {
|
|
4189
|
-
let addCardRes = await axios5.post(
|
|
4190
|
-
`${baseUrl}add-card`,
|
|
4191
|
-
reqData,
|
|
4192
|
-
{
|
|
4193
|
-
headers: myHeaders2
|
|
4194
|
-
}
|
|
4195
|
-
);
|
|
4196
|
-
if ((_h = addCardRes == null ? void 0 : addCardRes.data) == null ? void 0 : _h.result) {
|
|
4197
|
-
setSuccess(true);
|
|
4198
|
-
hideLoader();
|
|
4199
|
-
}
|
|
4200
|
-
} catch (err) {
|
|
4201
|
-
hideLoader();
|
|
4202
|
-
showError(((_j = (_i = err == null ? void 0 : err.response) == null ? void 0 : _i.data) == null ? void 0 : _j.message) || (err == null ? void 0 : err.message) || "Something went wrong , Try again later");
|
|
4203
|
-
}
|
|
4204
|
-
} catch (err) {
|
|
4205
|
-
hideLoader();
|
|
4206
|
-
showError(((_l = (_k = err == null ? void 0 : err.response) == null ? void 0 : _k.data) == null ? void 0 : _l.message) || (err == null ? void 0 : err.message) || "Something went wrong , Try again later");
|
|
4207
|
-
}
|
|
4208
|
-
} catch (err) {
|
|
4209
|
-
hideLoader();
|
|
4210
|
-
showError(((_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 , Try again later");
|
|
4211
|
-
}
|
|
4212
|
-
} else {
|
|
4213
|
-
if (typeof DatacapWebToken !== "undefined") {
|
|
4214
|
-
DatacapWebToken.requestToken(paymentData == null ? void 0 : paymentData.dctoken, "creditCardForm", getTokenCallback);
|
|
4215
|
-
}
|
|
4216
|
-
}
|
|
4217
|
-
} catch (err) {
|
|
4218
|
-
hideLoader();
|
|
4219
|
-
showError(((_p = (_o = err == null ? void 0 : err.response) == null ? void 0 : _o.data) == null ? void 0 : _p.message) || (err == null ? void 0 : err.message) || "Something went wrong , Try again later");
|
|
4220
|
-
}
|
|
4221
|
-
}
|
|
4222
|
-
}
|
|
4223
|
-
};
|
|
4224
|
-
return /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(DataScript, null), /* @__PURE__ */ React19.createElement(AddCardStyle, null), /* @__PURE__ */ React19.createElement(
|
|
4225
|
-
"button",
|
|
4226
|
-
{
|
|
4227
|
-
className: "paymentBtn",
|
|
4228
|
-
onClick: handleShow
|
|
4229
|
-
},
|
|
4230
|
-
"Add Card"
|
|
4231
|
-
), /* @__PURE__ */ React19.createElement(
|
|
4232
|
-
CustomModal_default,
|
|
4233
|
-
{
|
|
4234
|
-
open: show,
|
|
4235
|
-
onClose: handleClose
|
|
4236
|
-
},
|
|
4237
|
-
/* @__PURE__ */ React19.createElement(Loader_default, { loading }),
|
|
4238
|
-
success ? /* @__PURE__ */ React19.createElement(SuccessCardMsz_default, { onClose: handleClose }) : /* @__PURE__ */ React19.createElement(
|
|
4239
|
-
"div",
|
|
4240
|
-
{
|
|
4241
|
-
className: "container-creditcard add-card modal-content frac-form",
|
|
4242
|
-
id: "add-credit-card-panel"
|
|
4243
|
-
},
|
|
4244
|
-
/* @__PURE__ */ React19.createElement("form", { id: "creditCardForm", onSubmit: addCardFunc }, /* @__PURE__ */ React19.createElement("div", { className: "form-group", style: { marginTop: "0", marginBottom: "10px" } }, /* @__PURE__ */ React19.createElement("label", { htmlFor: "cardNumber" }, "Card Number"), /* @__PURE__ */ React19.createElement(
|
|
4245
|
-
"input",
|
|
4246
|
-
{
|
|
4247
|
-
type: "text",
|
|
4248
|
-
"data-token": "card_number",
|
|
4249
|
-
placeholder: "Enter card number",
|
|
4250
|
-
maxLength: 19,
|
|
4251
|
-
inputMode: "numeric",
|
|
4252
|
-
value: (cardData == null ? void 0 : cardData.cardNumber) || "",
|
|
4253
|
-
onChange: (e) => handleCardNumberChange(e)
|
|
4254
|
-
}
|
|
4255
|
-
), (cardError == null ? void 0 : cardError.cardNumber) && /* @__PURE__ */ React19.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cardNumber)), /* @__PURE__ */ React19.createElement("div", { className: "card-dtl" }, /* @__PURE__ */ React19.createElement("div", { className: "exp-cvc-container" }, /* @__PURE__ */ React19.createElement("div", { className: "form-group", style: { marginTop: "0", marginBottom: "10px" } }, /* @__PURE__ */ React19.createElement("label", { htmlFor: "expMonth" }, "MM"), /* @__PURE__ */ React19.createElement(
|
|
4256
|
-
"input",
|
|
4257
|
-
{
|
|
4258
|
-
"data-token": "exp_month",
|
|
4259
|
-
className: "form-control required",
|
|
4260
|
-
type: "text",
|
|
4261
|
-
placeholder: "MM",
|
|
4262
|
-
maxLength: 2,
|
|
4263
|
-
value: (cardData == null ? void 0 : cardData.expiryMonth) || "",
|
|
4264
|
-
onChange: (e) => handleCardChange("expiryMonth", e.target.value)
|
|
4265
|
-
}
|
|
4266
|
-
), (cardError == null ? void 0 : cardError.expiryMonth) && /* @__PURE__ */ React19.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.expiryMonth)), /* @__PURE__ */ React19.createElement("div", { className: "form-group", style: { marginTop: "0", marginBottom: "10px" } }, /* @__PURE__ */ React19.createElement("label", { htmlFor: "expYear" }, "YYYY"), /* @__PURE__ */ React19.createElement(
|
|
4267
|
-
"input",
|
|
4268
|
-
{
|
|
4269
|
-
"data-token": "exp_year",
|
|
4270
|
-
className: "form-control required",
|
|
4271
|
-
type: "text",
|
|
4272
|
-
placeholder: "YYYY",
|
|
4273
|
-
maxLength: 4,
|
|
4274
|
-
value: (cardData == null ? void 0 : cardData.expiryYear) || "",
|
|
4275
|
-
onChange: (e) => handleCardChange("expiryYear", e.target.value)
|
|
4276
|
-
}
|
|
4277
|
-
), (cardError == null ? void 0 : cardError.expiryYear) && /* @__PURE__ */ React19.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.expiryYear)), /* @__PURE__ */ React19.createElement("div", { className: "form-group", style: { marginTop: "0", marginBottom: "10px" } }, /* @__PURE__ */ React19.createElement("label", { htmlFor: "cvc" }, "CVC"), /* @__PURE__ */ React19.createElement(
|
|
4278
|
-
"input",
|
|
4279
|
-
{
|
|
4280
|
-
"data-token": "cvv",
|
|
4281
|
-
className: "form-control required",
|
|
4282
|
-
type: "text",
|
|
4283
|
-
placeholder: "CVC",
|
|
4284
|
-
maxLength: 4,
|
|
4285
|
-
value: (cardData == null ? void 0 : cardData.cvv) || "",
|
|
4286
|
-
onChange: (e) => handleCardChange("cvv", e.target.value)
|
|
4287
|
-
}
|
|
4288
|
-
), (cardError == null ? void 0 : cardError.cvv) && /* @__PURE__ */ React19.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cvv)))), /* @__PURE__ */ React19.createElement("div", { className: "form-group", style: { marginTop: "0", marginBottom: "10px" } }, /* @__PURE__ */ React19.createElement("label", { htmlFor: "cardholderName" }, "Name on card"), /* @__PURE__ */ React19.createElement(
|
|
4289
|
-
"input",
|
|
4290
|
-
{
|
|
4291
|
-
type: "text",
|
|
4292
|
-
id: "cardholderName",
|
|
4293
|
-
name: "cardholderName",
|
|
4294
|
-
placeholder: "Name on card required",
|
|
4295
|
-
value: (cardData == null ? void 0 : cardData.cardName) || "",
|
|
4296
|
-
onChange: (e) => {
|
|
4297
|
-
const value = e.target.value;
|
|
4298
|
-
if (/^[a-zA-Z\s]*$/.test(value)) {
|
|
4299
|
-
handleCardChange("cardName", value);
|
|
4300
|
-
}
|
|
4301
|
-
}
|
|
4302
|
-
}
|
|
4303
|
-
), (cardError == null ? void 0 : cardError.cardName) && /* @__PURE__ */ React19.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cardName)), /* @__PURE__ */ React19.createElement("div", { className: "form-group", style: { marginBottom: "20px" } }, /* @__PURE__ */ React19.createElement("label", { htmlFor: "zipcode" }, "Zip"), /* @__PURE__ */ React19.createElement(
|
|
4304
|
-
"input",
|
|
4305
|
-
{
|
|
4306
|
-
type: "text",
|
|
4307
|
-
id: "zipcode",
|
|
4308
|
-
name: "zipcode",
|
|
4309
|
-
placeholder: "Zip",
|
|
4310
|
-
value: (_a = cardData == null ? void 0 : cardData.zipCode) != null ? _a : "",
|
|
4311
|
-
onChange: (e) => handleCardChange("zipCode", e.target.value)
|
|
4312
|
-
}
|
|
4313
|
-
), (cardError == null ? void 0 : cardError.zipCode) && /* @__PURE__ */ React19.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.zipCode)), /* @__PURE__ */ React19.createElement(
|
|
4314
|
-
"input",
|
|
4315
|
-
{
|
|
4316
|
-
type: "submit",
|
|
4317
|
-
className: "idle-green-btn w-100",
|
|
4318
|
-
defaultValue: "Submit"
|
|
4319
|
-
}
|
|
4320
|
-
))
|
|
4321
|
-
)
|
|
4322
|
-
));
|
|
4323
|
-
}
|
|
4324
|
-
|
|
4325
|
-
// src/app/components/AddCard/AddCardEasyPay.tsx
|
|
4326
|
-
import React20, { useEffect as useEffect7, useState as useState6 } from "react";
|
|
4327
|
-
import Swal4 from "sweetalert2";
|
|
4328
|
-
import axios6 from "axios";
|
|
4329
|
-
function AddCardEasyPay(props) {
|
|
4330
|
-
var _a;
|
|
4331
|
-
const [loading, setLoading] = useState6(false);
|
|
4332
|
-
const [success, setSuccess] = useState6(false);
|
|
4333
|
-
const [error, setError] = useState6("");
|
|
4334
|
-
const [show, setShow] = useState6(false);
|
|
4335
|
-
const [cardData, setCardData] = useState6();
|
|
4336
|
-
const [cardError, setCardError] = useState6({});
|
|
4337
|
-
const [paymentData, setPaymentData] = useState6();
|
|
4338
|
-
const showLoader = () => setLoading(true);
|
|
4339
|
-
const hideLoader = () => setLoading(false);
|
|
4340
|
-
const showError = (msz) => {
|
|
4341
|
-
Swal4.fire({
|
|
4342
3933
|
icon: "error",
|
|
4343
3934
|
text: msz,
|
|
4344
3935
|
customClass: {
|
|
@@ -4453,7 +4044,7 @@ function AddCardEasyPay(props) {
|
|
|
4453
4044
|
"customer_id": props == null ? void 0 : props.customerId,
|
|
4454
4045
|
addcard: true
|
|
4455
4046
|
};
|
|
4456
|
-
let paymentData2 = await
|
|
4047
|
+
let paymentData2 = await axios5.post(`${baseUrl}get-payment-details`, data);
|
|
4457
4048
|
console.log(paymentData2);
|
|
4458
4049
|
setPaymentData((_a2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _a2.data);
|
|
4459
4050
|
if (!((_c = (_b = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _b.data) == null ? void 0 : _c.paymentGateway)) {
|
|
@@ -4468,7 +4059,7 @@ function AddCardEasyPay(props) {
|
|
|
4468
4059
|
setError("Something went wrong.");
|
|
4469
4060
|
}
|
|
4470
4061
|
};
|
|
4471
|
-
|
|
4062
|
+
useEffect6(() => {
|
|
4472
4063
|
if (props.fractalpayClientKey) {
|
|
4473
4064
|
getPaymentDetails();
|
|
4474
4065
|
}
|
|
@@ -4507,7 +4098,7 @@ function AddCardEasyPay(props) {
|
|
|
4507
4098
|
token
|
|
4508
4099
|
};
|
|
4509
4100
|
try {
|
|
4510
|
-
let apiResponse = await
|
|
4101
|
+
let apiResponse = await axios5.post(`${baseUrl}add-card`, reqData);
|
|
4511
4102
|
console.log(apiResponse);
|
|
4512
4103
|
let formData = {
|
|
4513
4104
|
fractalpayPublicKey: props == null ? void 0 : props.fractalpayClientKey,
|
|
@@ -4518,7 +4109,7 @@ function AddCardEasyPay(props) {
|
|
|
4518
4109
|
cvv: cardData == null ? void 0 : cardData.cvv
|
|
4519
4110
|
};
|
|
4520
4111
|
try {
|
|
4521
|
-
const result = await
|
|
4112
|
+
const result = await axios5.post(`${baseUrl}link-wallet`, formData);
|
|
4522
4113
|
console.log(result);
|
|
4523
4114
|
setSuccess(true);
|
|
4524
4115
|
hideLoader();
|
|
@@ -4550,7 +4141,7 @@ function AddCardEasyPay(props) {
|
|
|
4550
4141
|
redirect: "follow"
|
|
4551
4142
|
};
|
|
4552
4143
|
try {
|
|
4553
|
-
let sesionResult = await
|
|
4144
|
+
let sesionResult = await axios5.post(`${masterBaseUrl}api/v1/widget/generate-session`, requestOptions);
|
|
4554
4145
|
let expYear = Number(cardData == null ? void 0 : cardData.expiryYear) % 100;
|
|
4555
4146
|
let cardNumber = cardData == null ? void 0 : cardData.cardNumber;
|
|
4556
4147
|
cardNumber = cardNumber == null ? void 0 : cardNumber.replace(/\s+/g, "");
|
|
@@ -4573,7 +4164,7 @@ function AddCardEasyPay(props) {
|
|
|
4573
4164
|
session_key: `${(_f = (_e = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _e.data) == null ? void 0 : _f.session_key}`
|
|
4574
4165
|
});
|
|
4575
4166
|
try {
|
|
4576
|
-
const tokenizeData = await
|
|
4167
|
+
const tokenizeData = await axios5.post(`${fractalGatewayUrl}tokenizer/tokenize`, raw, { headers: myHeaders });
|
|
4577
4168
|
const reqData = JSON.stringify(__spreadProps(__spreadValues({}, (_g = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _g.data), {
|
|
4578
4169
|
cvv: cardData == null ? void 0 : cardData.cvv,
|
|
4579
4170
|
cardName: cardData == null ? void 0 : cardData.cardName,
|
|
@@ -4585,7 +4176,7 @@ function AddCardEasyPay(props) {
|
|
|
4585
4176
|
"Content-Type": "application/json"
|
|
4586
4177
|
};
|
|
4587
4178
|
try {
|
|
4588
|
-
let addCardRes = await
|
|
4179
|
+
let addCardRes = await axios5.post(
|
|
4589
4180
|
`${baseUrl}add-card`,
|
|
4590
4181
|
reqData,
|
|
4591
4182
|
{
|
|
@@ -4622,14 +4213,14 @@ function AddCardEasyPay(props) {
|
|
|
4622
4213
|
}
|
|
4623
4214
|
}
|
|
4624
4215
|
};
|
|
4625
|
-
return /* @__PURE__ */
|
|
4216
|
+
return /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(DataScript, null), /* @__PURE__ */ React18.createElement(AddCardStyle, null), /* @__PURE__ */ React18.createElement(Loader_default, { loading }), error && /* @__PURE__ */ React18.createElement("div", { style: { maxHeight: "606px", minHeight: "60vh", padding: "40px" } }, /* @__PURE__ */ React18.createElement(ErrorCardMessage_default, { error, onClose: handleClose })), success && /* @__PURE__ */ React18.createElement(SuccessCardMsz_default, { onClose: handleCloseSeccess }), !error && !success && /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(
|
|
4626
4217
|
"div",
|
|
4627
4218
|
{
|
|
4628
4219
|
className: "container-creditcard add-card modal-content",
|
|
4629
4220
|
id: "add-credit-card-panel",
|
|
4630
4221
|
style: { margin: "auto" }
|
|
4631
4222
|
},
|
|
4632
|
-
/* @__PURE__ */
|
|
4223
|
+
/* @__PURE__ */ React18.createElement("form", { id: "creditCardForm", onSubmit: addCardFunc, style: { padding: "0 10px" } }, /* @__PURE__ */ React18.createElement("div", { style: { maxHeight: "350px", minHeight: "0" }, className: "card-scrl" }, /* @__PURE__ */ React18.createElement("div", { className: "form-group", style: { marginTop: "0", marginBottom: "10px" } }, /* @__PURE__ */ React18.createElement("label", { htmlFor: "cardNumber" }, "Card Number"), /* @__PURE__ */ React18.createElement(
|
|
4633
4224
|
"input",
|
|
4634
4225
|
{
|
|
4635
4226
|
type: "text",
|
|
@@ -4640,7 +4231,7 @@ function AddCardEasyPay(props) {
|
|
|
4640
4231
|
value: (cardData == null ? void 0 : cardData.cardNumber) || "",
|
|
4641
4232
|
onChange: (e) => handleCardNumberChange(e)
|
|
4642
4233
|
}
|
|
4643
|
-
), (cardError == null ? void 0 : cardError.cardNumber) && /* @__PURE__ */
|
|
4234
|
+
), (cardError == null ? void 0 : cardError.cardNumber) && /* @__PURE__ */ React18.createElement("span", { className: "error-span", style: { color: "red", fontSize: "12px" } }, cardError == null ? void 0 : cardError.cardNumber), /* @__PURE__ */ React18.createElement("br", null)), /* @__PURE__ */ React18.createElement("div", { className: "card-dtl" }, /* @__PURE__ */ React18.createElement("div", { className: "exp-cvc-container", style: { margin: "0" } }, /* @__PURE__ */ React18.createElement("div", { className: "form-group", style: { marginTop: "0" } }, /* @__PURE__ */ React18.createElement("label", { htmlFor: "expMonth" }, "MM"), /* @__PURE__ */ React18.createElement(
|
|
4644
4235
|
"input",
|
|
4645
4236
|
{
|
|
4646
4237
|
"data-token": "exp_month",
|
|
@@ -4651,7 +4242,7 @@ function AddCardEasyPay(props) {
|
|
|
4651
4242
|
value: (cardData == null ? void 0 : cardData.expiryMonth) || "",
|
|
4652
4243
|
onChange: (e) => handleCardChange("expiryMonth", e.target.value)
|
|
4653
4244
|
}
|
|
4654
|
-
), (cardError == null ? void 0 : cardError.expiryMonth) && /* @__PURE__ */
|
|
4245
|
+
), (cardError == null ? void 0 : cardError.expiryMonth) && /* @__PURE__ */ React18.createElement("span", { className: "error-span", style: { color: "red", fontSize: "12px" } }, cardError == null ? void 0 : cardError.expiryMonth)), /* @__PURE__ */ React18.createElement("div", { className: "form-group", style: { marginTop: "0" } }, /* @__PURE__ */ React18.createElement("label", { htmlFor: "expYear" }, "YYYY"), /* @__PURE__ */ React18.createElement(
|
|
4655
4246
|
"input",
|
|
4656
4247
|
{
|
|
4657
4248
|
"data-token": "exp_year",
|
|
@@ -4662,7 +4253,7 @@ function AddCardEasyPay(props) {
|
|
|
4662
4253
|
value: (cardData == null ? void 0 : cardData.expiryYear) || "",
|
|
4663
4254
|
onChange: (e) => handleCardChange("expiryYear", e.target.value)
|
|
4664
4255
|
}
|
|
4665
|
-
), (cardError == null ? void 0 : cardError.expiryYear) && /* @__PURE__ */
|
|
4256
|
+
), (cardError == null ? void 0 : cardError.expiryYear) && /* @__PURE__ */ React18.createElement("span", { className: "error-span", style: { color: "red", fontSize: "12px" } }, cardError == null ? void 0 : cardError.expiryYear)), /* @__PURE__ */ React18.createElement("div", { className: "form-group", style: { marginTop: "0" } }, /* @__PURE__ */ React18.createElement("label", { htmlFor: "cvc" }, "CVC"), /* @__PURE__ */ React18.createElement(
|
|
4666
4257
|
"input",
|
|
4667
4258
|
{
|
|
4668
4259
|
"data-token": "cvv",
|
|
@@ -4673,7 +4264,7 @@ function AddCardEasyPay(props) {
|
|
|
4673
4264
|
value: (cardData == null ? void 0 : cardData.cvv) || "",
|
|
4674
4265
|
onChange: (e) => handleCardChange("cvv", e.target.value)
|
|
4675
4266
|
}
|
|
4676
|
-
), (cardError == null ? void 0 : cardError.cvv) && /* @__PURE__ */
|
|
4267
|
+
), (cardError == null ? void 0 : cardError.cvv) && /* @__PURE__ */ React18.createElement("span", { className: "error-span", style: { color: "red", fontSize: "12px" } }, cardError == null ? void 0 : cardError.cvv)))), /* @__PURE__ */ React18.createElement("div", { className: "form-group", style: { marginTop: "0" } }, /* @__PURE__ */ React18.createElement("label", { htmlFor: "cardholderName" }, "Name on card"), /* @__PURE__ */ React18.createElement(
|
|
4677
4268
|
"input",
|
|
4678
4269
|
{
|
|
4679
4270
|
type: "text",
|
|
@@ -4688,7 +4279,7 @@ function AddCardEasyPay(props) {
|
|
|
4688
4279
|
}
|
|
4689
4280
|
}
|
|
4690
4281
|
}
|
|
4691
|
-
), (cardError == null ? void 0 : cardError.cardName) && /* @__PURE__ */
|
|
4282
|
+
), (cardError == null ? void 0 : cardError.cardName) && /* @__PURE__ */ React18.createElement("span", { className: "error-span", style: { color: "red", fontSize: "12px" } }, cardError == null ? void 0 : cardError.cardName)), /* @__PURE__ */ React18.createElement("div", { className: "form-group", style: { marginTop: "0" } }, /* @__PURE__ */ React18.createElement("label", { htmlFor: "zipcode" }, "Zip"), /* @__PURE__ */ React18.createElement(
|
|
4692
4283
|
"input",
|
|
4693
4284
|
{
|
|
4694
4285
|
type: "text",
|
|
@@ -4698,7 +4289,7 @@ function AddCardEasyPay(props) {
|
|
|
4698
4289
|
value: (_a = cardData == null ? void 0 : cardData.zipCode) != null ? _a : "",
|
|
4699
4290
|
onChange: (e) => handleCardChange("zipCode", e.target.value)
|
|
4700
4291
|
}
|
|
4701
|
-
), (cardError == null ? void 0 : cardError.zipCode) && /* @__PURE__ */
|
|
4292
|
+
), (cardError == null ? void 0 : cardError.zipCode) && /* @__PURE__ */ React18.createElement("span", { className: "error-span", style: { color: "red", fontSize: "12px" } }, cardError == null ? void 0 : cardError.zipCode))), /* @__PURE__ */ React18.createElement(
|
|
4702
4293
|
"input",
|
|
4703
4294
|
{
|
|
4704
4295
|
type: "submit",
|
|
@@ -4709,8 +4300,7 @@ function AddCardEasyPay(props) {
|
|
|
4709
4300
|
)));
|
|
4710
4301
|
}
|
|
4711
4302
|
export {
|
|
4712
|
-
AddCard,
|
|
4713
|
-
AddCardEasyPay,
|
|
4303
|
+
AddCardEasyPay as AddCard,
|
|
4714
4304
|
GetPaymentPage,
|
|
4715
4305
|
PreAuthPayment,
|
|
4716
4306
|
RequestPayment,
|