@pinerohit11/testwidget 0.1.89 → 0.1.91
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 -8
- package/dist/index.d.ts +1 -8
- package/dist/index.js +333 -118
- package/dist/index.mjs +313 -97
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
@@ -17,6 +17,18 @@ var __spreadValues = (a, b) => {
|
|
17
17
|
return a;
|
18
18
|
};
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
20
|
+
var __objRest = (source, exclude) => {
|
21
|
+
var target = {};
|
22
|
+
for (var prop in source)
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
24
|
+
target[prop] = source[prop];
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
28
|
+
target[prop] = source[prop];
|
29
|
+
}
|
30
|
+
return target;
|
31
|
+
};
|
20
32
|
|
21
33
|
// src/app/components/RequestPayment/RequestPayment.tsx
|
22
34
|
import "bootstrap/dist/js/bootstrap.bundle.min.js";
|
@@ -121,8 +133,8 @@ var Loader = (props) => {
|
|
121
133
|
var Loader_default = Loader;
|
122
134
|
|
123
135
|
// src/app/components/baseurl.ts
|
136
|
+
var baseUrl = "http://192.168.1.62:8082/";
|
124
137
|
var masterBaseUrl = "https://dev-sky-node.fractalpay.com/";
|
125
|
-
var baseUrl = "https://dev-widget.fractalpay.com/";
|
126
138
|
|
127
139
|
// src/app/components/Errortext.ts
|
128
140
|
var ErrorText = {
|
@@ -1147,7 +1159,7 @@ function RequestPreAuthPayment(props) {
|
|
1147
1159
|
}
|
1148
1160
|
|
1149
1161
|
// src/app/components/Charge/GetPaymentPage.tsx
|
1150
|
-
import React11, { useState as useState3 } from "react";
|
1162
|
+
import React11, { useEffect as useEffect4, useState as useState3 } from "react";
|
1151
1163
|
|
1152
1164
|
// src/app/components/Charge/Chargewidgetstyles.tsx
|
1153
1165
|
import React8 from "react";
|
@@ -1599,7 +1611,8 @@ function Chargewidgetstyles() {
|
|
1599
1611
|
background: #FFF;
|
1600
1612
|
box-shadow: 0px 6px 12px 0px rgba(206, 197, 221, 0.31);
|
1601
1613
|
font-size:16px;
|
1602
|
-
curso:pointer
|
1614
|
+
curso:pointer;
|
1615
|
+
color:black
|
1603
1616
|
}
|
1604
1617
|
.btn {
|
1605
1618
|
padding: 11px 23px;
|
@@ -1905,8 +1918,59 @@ function SuccessMsz({ onClose }) {
|
|
1905
1918
|
// src/app/components/Charge/GetPaymentPage.tsx
|
1906
1919
|
import Swal from "sweetalert2";
|
1907
1920
|
import { IoArrowBack } from "react-icons/io5";
|
1921
|
+
|
1922
|
+
// src/app/components/Datascript.tsx
|
1923
|
+
import { useEffect as useEffect3 } from "react";
|
1924
|
+
function DataScript() {
|
1925
|
+
useEffect3(() => {
|
1926
|
+
const src = "https://token-cert.dcap.com/v1/client";
|
1927
|
+
if (typeof window === "undefined") return;
|
1928
|
+
if (window.DatacapWebToken) {
|
1929
|
+
console.log("\u2705 Datacap already available");
|
1930
|
+
return;
|
1931
|
+
}
|
1932
|
+
if (!document.querySelector(`script[src="${src}"]`)) {
|
1933
|
+
const script = document.createElement("script");
|
1934
|
+
script.src = src;
|
1935
|
+
script.async = true;
|
1936
|
+
script.onload = () => {
|
1937
|
+
console.log("\u2705 Datacap script loaded");
|
1938
|
+
if (window.DatacapWebToken) {
|
1939
|
+
console.log("\u2705 DatacapWebToken is ready:", window.DatacapWebToken);
|
1940
|
+
} else {
|
1941
|
+
console.warn("\u26A0\uFE0F Script loaded, but DatacapWebToken not found");
|
1942
|
+
}
|
1943
|
+
};
|
1944
|
+
script.onerror = (err) => {
|
1945
|
+
console.error("\u274C Failed to load Datacap script", err);
|
1946
|
+
};
|
1947
|
+
document.head.appendChild(script);
|
1948
|
+
} else {
|
1949
|
+
console.log("\u2139\uFE0F Script already in DOM, waiting for Datacap...");
|
1950
|
+
}
|
1951
|
+
}, []);
|
1952
|
+
useEffect3(() => {
|
1953
|
+
const scriptId = "forge-cdn-script";
|
1954
|
+
if (!document.getElementById(scriptId)) {
|
1955
|
+
const forgeScript = document.createElement("script");
|
1956
|
+
forgeScript.src = "https://cdn.jsdelivr.net/npm/node-forge@1.0.0/dist/forge.min.js";
|
1957
|
+
forgeScript.id = scriptId;
|
1958
|
+
forgeScript.async = true;
|
1959
|
+
document.head.appendChild(forgeScript);
|
1960
|
+
}
|
1961
|
+
return () => {
|
1962
|
+
const existingScript = document.getElementById(scriptId);
|
1963
|
+
if (existingScript) {
|
1964
|
+
document.head.removeChild(existingScript);
|
1965
|
+
}
|
1966
|
+
};
|
1967
|
+
}, []);
|
1968
|
+
return null;
|
1969
|
+
}
|
1970
|
+
|
1971
|
+
// src/app/components/Charge/GetPaymentPage.tsx
|
1908
1972
|
function GetPaymentPage(props) {
|
1909
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
1973
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
1910
1974
|
const [loading, setLoading] = useState3(false);
|
1911
1975
|
const [success, setSuccess] = useState3(false);
|
1912
1976
|
const [show, setShow] = useState3(false);
|
@@ -1918,21 +1982,9 @@ function GetPaymentPage(props) {
|
|
1918
1982
|
const [cardError, setCardError] = useState3({});
|
1919
1983
|
const [achData, setAchData] = useState3();
|
1920
1984
|
const [achError, setAchError] = useState3({});
|
1921
|
-
const [cardList, setCardList] = useState3([
|
1922
|
-
|
1923
|
-
|
1924
|
-
{ cardNumber: "9876789878999874", expMonth: "11", expYear: "2028", cardType: "visa" },
|
1925
|
-
{ cardNumber: "9876789878999873", expMonth: "08", expYear: "2029", cardType: "visa" },
|
1926
|
-
{ cardNumber: "9876789878999345", expMonth: "10", expYear: "2026", cardType: "visa" },
|
1927
|
-
{ cardNumber: "9876789878999434", expMonth: "05", expYear: "2028", cardType: "visa" },
|
1928
|
-
{ cardNumber: "9876789878999852", expMonth: "07", expYear: "2027", cardType: "visa" },
|
1929
|
-
{ cardNumber: "9876789878994546", expMonth: "04", expYear: "2029", cardType: "visa" },
|
1930
|
-
{ cardNumber: "9876789878999743", expMonth: "09", expYear: "2026", cardType: "visa" },
|
1931
|
-
{ cardNumber: "9876789878997323", expMonth: "12", expYear: "2028", cardType: "visa" },
|
1932
|
-
{ cardNumber: "9876789878998979", expMonth: "07", expYear: "2027", cardType: "visa" },
|
1933
|
-
{ cardNumber: "9876789878992348", expMonth: "03", expYear: "2029", cardType: "visa" },
|
1934
|
-
{ cardNumber: "9876789878999465", expMonth: "01", expYear: "2026", cardType: "visa" }
|
1935
|
-
]);
|
1985
|
+
const [cardList, setCardList] = useState3([]);
|
1986
|
+
const [selectedCard, setSelectedCard] = useState3();
|
1987
|
+
const [paymentData, setPaymentData] = useState3();
|
1936
1988
|
const showLoader = () => setLoading(true);
|
1937
1989
|
const hideLoader = () => setLoading(false);
|
1938
1990
|
const showError = (msz) => {
|
@@ -2051,7 +2103,7 @@ function GetPaymentPage(props) {
|
|
2051
2103
|
return Object.keys(errors).length > 0;
|
2052
2104
|
};
|
2053
2105
|
const validateAchData = () => {
|
2054
|
-
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2,
|
2106
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
|
2055
2107
|
const errors = {};
|
2056
2108
|
const data = achData;
|
2057
2109
|
if (!((_a2 = data == null ? void 0 : data.name) == null ? void 0 : _a2.trim())) errors.name = "Name is required";
|
@@ -2060,7 +2112,7 @@ function GetPaymentPage(props) {
|
|
2060
2112
|
if (!((_f2 = data == null ? void 0 : data.bankName) == null ? void 0 : _f2.trim())) errors.bankName = "Bank name is required";
|
2061
2113
|
if (!((_g2 = data == null ? void 0 : data.routingNumber) == null ? void 0 : _g2.trim())) errors.routingNumber = "Routing Number is required";
|
2062
2114
|
if ((data == null ? void 0 : data.routingNumber) && ((_h2 = data == null ? void 0 : data.routingNumber) == null ? void 0 : _h2.length) !== 9) errors.routingNumber = "Routing number must be 9 digits";
|
2063
|
-
if (((
|
2115
|
+
if (((_i2 = data == null ? void 0 : data.routingNumber) == null ? void 0 : _i2.length) == 9) {
|
2064
2116
|
let routingNumber = data == null ? void 0 : data.routingNumber;
|
2065
2117
|
const weights = [3, 7, 1];
|
2066
2118
|
let sum = 0;
|
@@ -2076,7 +2128,7 @@ function GetPaymentPage(props) {
|
|
2076
2128
|
return Object.keys(errors).length > 0;
|
2077
2129
|
};
|
2078
2130
|
const submitFunc = async (e) => {
|
2079
|
-
var _a2, _b2, _c2, _d2, _e2;
|
2131
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
2080
2132
|
e.preventDefault();
|
2081
2133
|
if (activetab !== "ach") {
|
2082
2134
|
const hasError = validateCardData();
|
@@ -2095,13 +2147,14 @@ function GetPaymentPage(props) {
|
|
2095
2147
|
try {
|
2096
2148
|
const formData = __spreadProps(__spreadValues({}, cardData), {
|
2097
2149
|
amount: `${props.amount || 0}`,
|
2098
|
-
// fractalpayClientKey : fractalpayClientKey,
|
2099
2150
|
fractalpayPublicKey: fractalpayClientKey
|
2100
2151
|
});
|
2101
2152
|
const result = await axios3.post(`${baseUrl}create-widget-order`, formData);
|
2102
2153
|
console.log(result);
|
2103
2154
|
let tokenCallback = async function(response) {
|
2155
|
+
var _a3, _b3;
|
2104
2156
|
if (response.Error) {
|
2157
|
+
console.log(response == null ? void 0 : response.Error);
|
2105
2158
|
showError(response.Error);
|
2106
2159
|
hideLoader();
|
2107
2160
|
} else {
|
@@ -2129,22 +2182,94 @@ function GetPaymentPage(props) {
|
|
2129
2182
|
} catch (err) {
|
2130
2183
|
console.log(err);
|
2131
2184
|
hideLoader();
|
2132
|
-
showError("
|
2185
|
+
showError(((_b3 = (_a3 = err == null ? void 0 : err.response) == null ? void 0 : _a3.data) == null ? void 0 : _b3.message) || (err == null ? void 0 : err.message) || "Something went wrong..");
|
2133
2186
|
}
|
2134
2187
|
}
|
2135
2188
|
};
|
2136
|
-
if (
|
2137
|
-
|
2189
|
+
if ((paymentData == null ? void 0 : paymentData.paymentGateway) === 32) {
|
2190
|
+
const requestOptions = {
|
2191
|
+
method: "POST",
|
2192
|
+
redirect: "follow"
|
2193
|
+
};
|
2194
|
+
try {
|
2195
|
+
let sesionResult = await axios3.post(`${masterBaseUrl}api/v1/widget/generate-session`, requestOptions);
|
2196
|
+
let expYear = Number(cardData == null ? void 0 : cardData.expiryYear) % 100;
|
2197
|
+
let cardNumber = cardData == null ? void 0 : cardData.cardNumber;
|
2198
|
+
cardNumber = cardNumber == null ? void 0 : cardNumber.replace(/\s+/g, "");
|
2199
|
+
let track2_data = `${cardNumber}=${expYear}${cardData == null ? void 0 : cardData.expiryMonth} ${cardData == null ? void 0 : cardData.cvv}`;
|
2200
|
+
const publicKey = forge.pki.publicKeyFromPem((_b2 = (_a2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _a2.data) == null ? void 0 : _b2.publicKeyPem);
|
2201
|
+
const encrypted = publicKey.encrypt(track2_data, "RSA-OAEP", {
|
2202
|
+
md: forge.md.sha1.create(),
|
2203
|
+
mgf1: {
|
2204
|
+
md: forge.md.sha1.create()
|
2205
|
+
}
|
2206
|
+
});
|
2207
|
+
const encryptedBase64 = forge.util.encode64(encrypted);
|
2208
|
+
const myHeaders = {
|
2209
|
+
"Content-Type": "application/json",
|
2210
|
+
"x-app-session-key": (_d2 = (_c2 = sesionResult.data) == null ? void 0 : _c2.data) == null ? void 0 : _d2.session_key
|
2211
|
+
};
|
2212
|
+
const raw = JSON.stringify({
|
2213
|
+
"enc_track2_data": `${encryptedBase64}`,
|
2214
|
+
"algorithm": "RSAES_OAEP_SHA_1",
|
2215
|
+
session_key: `${(_f2 = (_e2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _e2.data) == null ? void 0 : _f2.session_key}`
|
2216
|
+
});
|
2217
|
+
try {
|
2218
|
+
const tokenizeData = await axios3.post("https://api-dev.merchant-trends.com/tokenizer/tokenize", raw, { headers: myHeaders });
|
2219
|
+
const reqData = JSON.stringify(__spreadProps(__spreadValues({}, (_g2 = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _g2.data), {
|
2220
|
+
isSaveCardChecked: saveCardInfo,
|
2221
|
+
name: cardData == null ? void 0 : cardData.cardName,
|
2222
|
+
postal_code: cardData == null ? void 0 : cardData.zipCode,
|
2223
|
+
customer_id: props == null ? void 0 : props.customerId
|
2224
|
+
}));
|
2225
|
+
const reqData2 = {
|
2226
|
+
"pre_sales_id": `${(_i2 = (_h2 = result == null ? void 0 : result.data) == null ? void 0 : _h2.data) == null ? void 0 : _i2.posSalesIdEncode}`,
|
2227
|
+
"token": `${(_j2 = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _j2.data.token}`,
|
2228
|
+
"json_response": `${reqData}`
|
2229
|
+
};
|
2230
|
+
let myHeaders2 = {
|
2231
|
+
"Content-Type": "application/json"
|
2232
|
+
};
|
2233
|
+
const requestOptions2 = __spreadProps(__spreadValues({}, reqData2), {
|
2234
|
+
isChargeviafractal: true
|
2235
|
+
});
|
2236
|
+
try {
|
2237
|
+
let paymentRes = await axios3.post(
|
2238
|
+
`${masterBaseUrl}api/v1/payment-gateway/charge`,
|
2239
|
+
requestOptions2,
|
2240
|
+
{
|
2241
|
+
headers: myHeaders2
|
2242
|
+
}
|
2243
|
+
);
|
2244
|
+
console.log(paymentRes);
|
2245
|
+
if ((_k = paymentRes == null ? void 0 : paymentRes.data) == null ? void 0 : _k.result) {
|
2246
|
+
setSuccess(true);
|
2247
|
+
hideLoader();
|
2248
|
+
}
|
2249
|
+
} catch (err) {
|
2250
|
+
hideLoader();
|
2251
|
+
showError(((_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 wrong..s");
|
2252
|
+
}
|
2253
|
+
} catch (err) {
|
2254
|
+
hideLoader();
|
2255
|
+
showError(((_o = (_n = err == null ? void 0 : err.response) == null ? void 0 : _n.data) == null ? void 0 : _o.message) || (err == null ? void 0 : err.message) || "something wrong..s");
|
2256
|
+
}
|
2257
|
+
} catch (err) {
|
2258
|
+
hideLoader();
|
2259
|
+
showError(((_q = (_p = err == null ? void 0 : err.response) == null ? void 0 : _p.data) == null ? void 0 : _q.message) || (err == null ? void 0 : err.message) || "something wrong..s");
|
2260
|
+
}
|
2261
|
+
} else {
|
2262
|
+
if (typeof DatacapWebToken !== "undefined") {
|
2263
|
+
DatacapWebToken.requestToken(result == null ? void 0 : result.data.data.dctoken, "PaymentForm", tokenCallback);
|
2264
|
+
}
|
2138
2265
|
}
|
2139
2266
|
} catch (err) {
|
2140
|
-
console.log(err);
|
2141
2267
|
hideLoader();
|
2142
|
-
showError("
|
2268
|
+
showError(((_s = (_r = err == null ? void 0 : err.response) == null ? void 0 : _r.data) == null ? void 0 : _s.message) || (err == null ? void 0 : err.message) || "something wrong..s");
|
2143
2269
|
}
|
2144
2270
|
}
|
2145
2271
|
}
|
2146
2272
|
} else {
|
2147
|
-
console.log(achData);
|
2148
2273
|
const hasError = validateAchData();
|
2149
2274
|
if (hasError) return;
|
2150
2275
|
else {
|
@@ -2172,13 +2297,13 @@ function GetPaymentPage(props) {
|
|
2172
2297
|
Swal.fire({
|
2173
2298
|
icon: "success",
|
2174
2299
|
title: "Congrats...",
|
2175
|
-
text: (
|
2300
|
+
text: (_t = result == null ? void 0 : result.data) == null ? void 0 : _t.message
|
2176
2301
|
});
|
2177
2302
|
} catch (error) {
|
2178
2303
|
if (axios3.isAxiosError(error)) {
|
2179
2304
|
console.log(error);
|
2180
2305
|
hideLoader();
|
2181
|
-
showError((
|
2306
|
+
showError((_x = (_w = (_v = (_u = error.response) == null ? void 0 : _u.data) == null ? void 0 : _v.message) == null ? void 0 : _w.error) != null ? _x : "Something went wrong");
|
2182
2307
|
} else {
|
2183
2308
|
console.error("Unexpected error", error);
|
2184
2309
|
}
|
@@ -2186,7 +2311,143 @@ function GetPaymentPage(props) {
|
|
2186
2311
|
}
|
2187
2312
|
}
|
2188
2313
|
};
|
2189
|
-
|
2314
|
+
const getPaymentDetails = async () => {
|
2315
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
|
2316
|
+
showLoader();
|
2317
|
+
try {
|
2318
|
+
const data = {
|
2319
|
+
fractalpayPublicKey: fractalpayClientKey,
|
2320
|
+
"customer_id": props == null ? void 0 : props.customerId
|
2321
|
+
};
|
2322
|
+
let paymentData2 = await axios3.post(`${baseUrl}get-payment-details`, data);
|
2323
|
+
console.log(paymentData2);
|
2324
|
+
setPaymentData((_a2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _a2.data);
|
2325
|
+
if (((_c2 = (_b2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _b2.data) == null ? void 0 : _c2.card_list) && ((_f2 = (_e2 = (_d2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _d2.data) == null ? void 0 : _e2.card_list) == null ? void 0 : _f2.length) > 0) {
|
2326
|
+
setCardList((_h2 = (_g2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _g2.data) == null ? void 0 : _h2.card_list);
|
2327
|
+
} else {
|
2328
|
+
setActive("card");
|
2329
|
+
}
|
2330
|
+
hideLoader();
|
2331
|
+
} catch (err) {
|
2332
|
+
console.log(err);
|
2333
|
+
setActive("card");
|
2334
|
+
hideLoader();
|
2335
|
+
}
|
2336
|
+
};
|
2337
|
+
const handlechargeCustomer = async () => {
|
2338
|
+
var _b2, _c2, _d2, _e2, _f2;
|
2339
|
+
console.log("selected", selectedCard);
|
2340
|
+
let customer_id = props == null ? void 0 : props.customerId;
|
2341
|
+
let discount = props == null ? void 0 : props.discount;
|
2342
|
+
let surcharge = props == null ? void 0 : props.surcharge;
|
2343
|
+
let tax = props == null ? void 0 : props.tax;
|
2344
|
+
let fractalpayPublicKey = props == null ? void 0 : props.fractalpayClientKey;
|
2345
|
+
let order_id = props == null ? void 0 : props.orderID;
|
2346
|
+
let amount = props == null ? void 0 : props.amount;
|
2347
|
+
let card_id = selectedCard == null ? void 0 : selectedCard.id;
|
2348
|
+
let card_type = selectedCard == null ? void 0 : selectedCard.card_type;
|
2349
|
+
if (fractalpayPublicKey && order_id && amount) {
|
2350
|
+
if (customer_id) {
|
2351
|
+
if (card_id) {
|
2352
|
+
let chargeobj = {
|
2353
|
+
amount,
|
2354
|
+
order_id,
|
2355
|
+
customer_id,
|
2356
|
+
card_id,
|
2357
|
+
fractalpayPublicKey,
|
2358
|
+
isCardSave: saveCardInfo,
|
2359
|
+
discount,
|
2360
|
+
surcharge,
|
2361
|
+
tax
|
2362
|
+
};
|
2363
|
+
let _a2 = chargeobj, { isCardSave } = _a2, rest = __objRest(_a2, ["isCardSave"]);
|
2364
|
+
let endpoint = card_type === "Bank" ? "charge-ach" : "charge-by-card";
|
2365
|
+
let chargeurl = baseUrl + endpoint;
|
2366
|
+
const headers = {
|
2367
|
+
"Content-Type": "application/json"
|
2368
|
+
};
|
2369
|
+
showLoader();
|
2370
|
+
try {
|
2371
|
+
let result = await axios3.post(chargeurl, card_type == "Bank" ? rest : chargeobj, { headers });
|
2372
|
+
console.log(result);
|
2373
|
+
if ((_b2 = result == null ? void 0 : result.data) == null ? void 0 : _b2.result) {
|
2374
|
+
setSuccess(true);
|
2375
|
+
hideLoader();
|
2376
|
+
}
|
2377
|
+
} catch (err) {
|
2378
|
+
hideLoader();
|
2379
|
+
console.log(err);
|
2380
|
+
showError(((_d2 = (_c2 = err == null ? void 0 : err.response) == null ? void 0 : _c2.data) == null ? void 0 : _d2.message) || ((_f2 = (_e2 = err == null ? void 0 : err.response) == null ? void 0 : _e2.data) == null ? void 0 : _f2.status) || "Something went erong");
|
2381
|
+
}
|
2382
|
+
} else {
|
2383
|
+
showError("Please Select A Card/ACH");
|
2384
|
+
}
|
2385
|
+
} else {
|
2386
|
+
showError("Please Select Customer");
|
2387
|
+
}
|
2388
|
+
} else {
|
2389
|
+
showError("Something went wrong , Please try again later !!!");
|
2390
|
+
}
|
2391
|
+
};
|
2392
|
+
useEffect4(() => {
|
2393
|
+
if (show && fractalpayClientKey) {
|
2394
|
+
getPaymentDetails();
|
2395
|
+
}
|
2396
|
+
}, [fractalpayClientKey, show]);
|
2397
|
+
const handleDeleteCard = async (cardId) => {
|
2398
|
+
Swal.fire({
|
2399
|
+
icon: "warning",
|
2400
|
+
text: "Do you want to delete the card?",
|
2401
|
+
showCancelButton: true,
|
2402
|
+
confirmButtonText: "Yes",
|
2403
|
+
cancelButtonText: "No",
|
2404
|
+
reverseButtons: true,
|
2405
|
+
buttonsStyling: false,
|
2406
|
+
customClass: {
|
2407
|
+
confirmButton: "swal2-confirm btn btn-dark",
|
2408
|
+
cancelButton: "swal2-cancel btn btn-dark",
|
2409
|
+
popup: "custom-swal-popup",
|
2410
|
+
icon: "custom-swal-icon"
|
2411
|
+
}
|
2412
|
+
}).then(async (result) => {
|
2413
|
+
if (result.isConfirmed) {
|
2414
|
+
showLoader();
|
2415
|
+
try {
|
2416
|
+
let obj = {
|
2417
|
+
card_id: cardId,
|
2418
|
+
customer_id: props == null ? void 0 : props.customerId,
|
2419
|
+
fractalpayPublicKey: props == null ? void 0 : props.fractalpayClientKey
|
2420
|
+
};
|
2421
|
+
const res = await axios3.post(`${baseUrl}delete-customer-card`, obj);
|
2422
|
+
hideLoader();
|
2423
|
+
getPaymentDetails();
|
2424
|
+
console.log("Deleted:", res);
|
2425
|
+
Swal.fire({
|
2426
|
+
icon: "success",
|
2427
|
+
title: "Deleted!",
|
2428
|
+
text: "The card has been deleted.",
|
2429
|
+
confirmButtonText: "OK",
|
2430
|
+
customClass: {
|
2431
|
+
confirmButton: "btn btn-dark"
|
2432
|
+
}
|
2433
|
+
});
|
2434
|
+
} catch (err) {
|
2435
|
+
hideLoader();
|
2436
|
+
console.error("Error:", err);
|
2437
|
+
Swal.fire({
|
2438
|
+
icon: "error",
|
2439
|
+
title: "Error!",
|
2440
|
+
text: "Failed to delete the card.",
|
2441
|
+
confirmButtonText: "OK",
|
2442
|
+
customClass: {
|
2443
|
+
confirmButton: "btn btn-dark"
|
2444
|
+
}
|
2445
|
+
});
|
2446
|
+
}
|
2447
|
+
}
|
2448
|
+
});
|
2449
|
+
};
|
2450
|
+
return /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(DataScript, null), /* @__PURE__ */ React11.createElement(Chargewidgetstyles, null), /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(
|
2190
2451
|
"button",
|
2191
2452
|
{
|
2192
2453
|
className: "paymentBtn",
|
@@ -2200,32 +2461,21 @@ function GetPaymentPage(props) {
|
|
2200
2461
|
onClose: handleClose
|
2201
2462
|
},
|
2202
2463
|
/* @__PURE__ */ React11.createElement(Loader_default, { loading }),
|
2203
|
-
success ? /* @__PURE__ */ React11.createElement(SuccessMsz, { onClose: handleCloseSeccess }) : /* @__PURE__ */ React11.createElement("div", null, /* @__PURE__ */ React11.createElement("div", null, /* @__PURE__ */ React11.createElement("span", { className: "request-payment-close-popup", onClick: handleClose }, /* @__PURE__ */ React11.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, /* @__PURE__ */ React11.createElement("g", { "clip-path": "url(#clip0_12425_52336)" }, /* @__PURE__ */ React11.createElement("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" })), /* @__PURE__ */ React11.createElement("defs", null, /* @__PURE__ */ React11.createElement("clipPath", { id: "clip0_12425_52336" }, /* @__PURE__ */ React11.createElement("rect", { width: "16", height: "16", fill: "white" }))))), /* @__PURE__ */ React11.createElement("div", { className: "pay-container" }, /* @__PURE__ */ React11.createElement("div", { className: "pay-header pay-conatiner-one" }, /* @__PURE__ */ React11.createElement("div", { className: "pay-logo-container" }, /* @__PURE__ */ React11.createElement("div", { className: "pay-main-logo" }, /* @__PURE__ */ React11.createElement("img", { src: "https://fractal-userdata-upload.s3.us-east-1.amazonaws.com/uploaded/merchant_logo/20250311131124_merchant_logo.png", id: "pay-logos" })), /* @__PURE__ */ React11.createElement("h1", { className: "pay-heading" }, "Pay")), /* @__PURE__ */ React11.createElement("div", { className: "pay-amount-conatiner" }, /* @__PURE__ */ React11.createElement("small", { className: "pay-payment-amount" }, "Payment Amount"), /* @__PURE__ */ React11.createElement("strong", { className: "pay-amount" }, "$1.35")), activetab != "ach" && /* @__PURE__ */ React11.createElement("div", { style: { display: "flex", gap: "8px", margin: "8px 0" } }, /* @__PURE__ */ React11.createElement("img", { src: "https://dev-widget.fractalpay.com/images/visa-img.svg", alt: "", width: 33 }), /* @__PURE__ */ React11.createElement("img", { src: "https://dev-widget.fractalpay.com/images/mc-img.svg", width: 33, alt: "" }), /* @__PURE__ */ React11.createElement("img", { src: "https://dev-widget.fractalpay.com/images/ae-img.svg", alt: "", width: 33 }), /* @__PURE__ */ React11.createElement("img", { src: "https://dev-widget.fractalpay.com/images/discover-img.svg", width: 33, alt: "" }))), /* @__PURE__ */ React11.createElement("div", { className: "pay-tab pay-conatiner-two" }, /* @__PURE__ */ React11.createElement("div", { className: "col-md-12" }, /* @__PURE__ */ React11.createElement("div", { id: "payment-form-div" }, activetab !== "cardList" ? /* @__PURE__ */ React11.createElement("div", null, /* @__PURE__ */ React11.createElement("button", { className: "charge-payment-back-btn ", onClick: () => setActive("cardList") }, " ", /* @__PURE__ */ React11.createElement(IoArrowBack, null), " Back"), /* @__PURE__ */ React11.createElement("div", { className: "tab" }, /* @__PURE__ */ React11.createElement("button", { className: "tablinks", onClick: (e) => {
|
2464
|
+
success ? /* @__PURE__ */ React11.createElement(SuccessMsz, { onClose: handleCloseSeccess }) : /* @__PURE__ */ React11.createElement("div", null, /* @__PURE__ */ React11.createElement("div", null, /* @__PURE__ */ React11.createElement("span", { className: "request-payment-close-popup", onClick: handleClose }, /* @__PURE__ */ React11.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, /* @__PURE__ */ React11.createElement("g", { "clip-path": "url(#clip0_12425_52336)" }, /* @__PURE__ */ React11.createElement("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" })), /* @__PURE__ */ React11.createElement("defs", null, /* @__PURE__ */ React11.createElement("clipPath", { id: "clip0_12425_52336" }, /* @__PURE__ */ React11.createElement("rect", { width: "16", height: "16", fill: "white" }))))), /* @__PURE__ */ React11.createElement("div", { className: "pay-container" }, /* @__PURE__ */ React11.createElement("div", { className: "pay-header pay-conatiner-one" }, /* @__PURE__ */ React11.createElement("div", { className: "pay-logo-container" }, /* @__PURE__ */ React11.createElement("div", { className: "pay-main-logo" }, /* @__PURE__ */ React11.createElement("img", { src: "https://fractal-userdata-upload.s3.us-east-1.amazonaws.com/uploaded/merchant_logo/20250311131124_merchant_logo.png", id: "pay-logos" })), /* @__PURE__ */ React11.createElement("h1", { className: "pay-heading" }, "Pay")), /* @__PURE__ */ React11.createElement("div", { className: "pay-amount-conatiner" }, /* @__PURE__ */ React11.createElement("small", { className: "pay-payment-amount" }, "Payment Amount"), /* @__PURE__ */ React11.createElement("strong", { className: "pay-amount" }, "$1.35")), activetab != "ach" && /* @__PURE__ */ React11.createElement("div", { style: { display: "flex", gap: "8px", margin: "8px 0" } }, /* @__PURE__ */ React11.createElement("img", { src: "https://dev-widget.fractalpay.com/images/visa-img.svg", alt: "", width: 33 }), /* @__PURE__ */ React11.createElement("img", { src: "https://dev-widget.fractalpay.com/images/mc-img.svg", width: 33, alt: "" }), /* @__PURE__ */ React11.createElement("img", { src: "https://dev-widget.fractalpay.com/images/ae-img.svg", alt: "", width: 33 }), /* @__PURE__ */ React11.createElement("img", { src: "https://dev-widget.fractalpay.com/images/discover-img.svg", width: 33, alt: "" }))), /* @__PURE__ */ React11.createElement("div", { className: "pay-tab pay-conatiner-two" }, /* @__PURE__ */ React11.createElement("div", { className: "col-md-12" }, /* @__PURE__ */ React11.createElement("div", { id: "payment-form-div" }, activetab !== "cardList" ? /* @__PURE__ */ React11.createElement("div", null, (cardList == null ? void 0 : cardList.length) > 0 && /* @__PURE__ */ React11.createElement("button", { className: "charge-payment-back-btn ", onClick: () => setActive("cardList") }, " ", /* @__PURE__ */ React11.createElement(IoArrowBack, null), " Back"), /* @__PURE__ */ React11.createElement("div", { className: "tab" }, /* @__PURE__ */ React11.createElement("button", { className: "tablinks", onClick: (e) => {
|
2204
2465
|
handletabchange("card");
|
2205
2466
|
}, style: { backgroundColor: activetab === "card" ? "#fff" : "inherit" } }, "Card"), /* @__PURE__ */ React11.createElement("button", { className: "tablinks", onClick: (e) => {
|
2206
2467
|
handletabchange("ach");
|
2207
|
-
}, style: { backgroundColor: activetab === "ach" ? "#fff" : "inherit" } }, "ACH"))) : /* @__PURE__ */ React11.createElement("div", null, /* @__PURE__ */ React11.createElement("p", { className: "charge-customer-name" }, " Charge
|
2208
|
-
|
2209
|
-
|
2210
|
-
|
2211
|
-
|
2212
|
-
|
2213
|
-
|
2214
|
-
|
2215
|
-
|
2216
|
-
|
2217
|
-
|
2218
|
-
buttonsStyling: false,
|
2219
|
-
// disables default styling
|
2220
|
-
customClass: {
|
2221
|
-
confirmButton: "swal2-confirm btn btn-dark",
|
2222
|
-
cancelButton: "swal2-cancel btn btn-dark",
|
2223
|
-
popup: "custom-swal-popup",
|
2224
|
-
icon: "custom-swal-icon"
|
2225
|
-
}
|
2226
|
-
});
|
2227
|
-
} }, /* @__PURE__ */ React11.createElement("img", { src: "https://dev-widget.fractalpay.com/images/Trash.svg", alt: "" }))));
|
2228
|
-
})), /* @__PURE__ */ React11.createElement("div", { className: "pay-with-other-card ", onClick: () => setActive("card") }, "Pay With Other Card", /* @__PURE__ */ React11.createElement("img", { src: "https://dev-widget.fractalpay.com/images/card.svg", alt: "" }))), /* @__PURE__ */ React11.createElement("div", { className: "form-group" }, /* @__PURE__ */ React11.createElement("button", { className: "pay-button", style: { margin: "0px" }, type: "submit" }, "$1.35"))), /* @__PURE__ */ React11.createElement("div", { id: "card", style: { display: activetab === "card" ? "block" : "none" }, className: "tabcontent" }, /* @__PURE__ */ React11.createElement("form", { id: "PaymentForm", onSubmit: submitFunc }, /* @__PURE__ */ React11.createElement("div", { className: "form-group" }, /* @__PURE__ */ React11.createElement("label", { htmlFor: "cardHolderName" }, "Name on Card"), /* @__PURE__ */ React11.createElement("input", { type: "text", className: "form-control", maxLength: 100, placeholder: "John Doe", value: cardData == null ? void 0 : cardData.cardName, onChange: (e) => handleCardChange("cardName", e.target.value) }), (cardError == null ? void 0 : cardError.cardName) && /* @__PURE__ */ React11.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cardName)), /* @__PURE__ */ React11.createElement("div", { className: "form-group" }, /* @__PURE__ */ React11.createElement("label", { htmlFor: "cardNumber" }, "Card Number"), /* @__PURE__ */ React11.createElement("div", { className: "toggle-num-wrapper" }, /* @__PURE__ */ React11.createElement(
|
2468
|
+
}, style: { backgroundColor: activetab === "ach" ? "#fff" : "inherit" } }, "ACH"))) : /* @__PURE__ */ React11.createElement("div", null, /* @__PURE__ */ React11.createElement("p", { className: "charge-customer-name" }, " Charge ", paymentData == null ? void 0 : paymentData.customer_name), /* @__PURE__ */ React11.createElement("p", { className: "card-ach-heading" }, " Cards/ACH")), /* @__PURE__ */ React11.createElement("div", { id: "ach", style: { display: activetab === "cardList" ? "block" : "none" }, className: "tabcontent" }, /* @__PURE__ */ React11.createElement("div", { className: "card-lint-div-in" }, /* @__PURE__ */ React11.createElement("div", { className: "card-list-div" }, (paymentData == null ? void 0 : paymentData.card_list) && ((_a = paymentData == null ? void 0 : paymentData.card_list) == null ? void 0 : _a.length) > 0 && ((_b = paymentData == null ? void 0 : paymentData.card_list) == null ? void 0 : _b.map((card, index) => /* @__PURE__ */ React11.createElement("div", { className: "card-list-single-div", key: index }, /* @__PURE__ */ React11.createElement("div", { className: "card-number-radio" }, /* @__PURE__ */ React11.createElement(
|
2469
|
+
"input",
|
2470
|
+
{
|
2471
|
+
type: "radio",
|
2472
|
+
className: "cardRadio",
|
2473
|
+
name: "selected_card",
|
2474
|
+
id: "",
|
2475
|
+
checked: selectedCard === card,
|
2476
|
+
onChange: (e) => setSelectedCard(card)
|
2477
|
+
}
|
2478
|
+
), /* @__PURE__ */ React11.createElement("label", { htmlFor: "", className: "card-number-last-four" }, "**** ", card == null ? void 0 : card.cardlastfourdigit), /* @__PURE__ */ React11.createElement("h6", { className: "card-expiry-date" }, card == null ? void 0 : card.expmonth, "/", card == null ? void 0 : card.expyear)), /* @__PURE__ */ React11.createElement("div", { className: "card-number-radio" }, /* @__PURE__ */ React11.createElement("span", { className: "visa-card" }, /* @__PURE__ */ React11.createElement("img", { src: (card == null ? void 0 : card.card_type) != "Bank" ? "https://dev-widget.fractalpay.com/images/visa-img.svg" : "https://dev-widget.fractalpay.com/images/bank.svg", alt: "" })), /* @__PURE__ */ React11.createElement("span", { className: "visa-card", style: { cursor: "pointer" }, onClick: () => handleDeleteCard(card == null ? void 0 : card.id) }, /* @__PURE__ */ React11.createElement("img", { src: "https://dev-widget.fractalpay.com/images/Trash.svg", alt: "" }))))))), /* @__PURE__ */ React11.createElement("div", { className: "pay-with-other-card ", onClick: () => setActive("card") }, "Pay With Other Card", /* @__PURE__ */ React11.createElement("img", { src: "https://dev-widget.fractalpay.com/images/card.svg", alt: "" }))), /* @__PURE__ */ React11.createElement("div", { className: "form-group" }, /* @__PURE__ */ React11.createElement("button", { className: "pay-button", style: { margin: "0px" }, type: "submit", onClick: handlechargeCustomer }, "$1.35"))), /* @__PURE__ */ React11.createElement("div", { id: "card", style: { display: activetab === "card" ? "block" : "none" }, className: "tabcontent" }, /* @__PURE__ */ React11.createElement("form", { id: "PaymentForm", onSubmit: submitFunc }, /* @__PURE__ */ React11.createElement("div", { className: "ach-scrl", style: { maxHeight: "380px", overflow: "auto", marginRight: "5px" } }, /* @__PURE__ */ React11.createElement("div", { className: "form-group" }, /* @__PURE__ */ React11.createElement("label", { htmlFor: "cardHolderName" }, "Name on Card"), /* @__PURE__ */ React11.createElement("input", { type: "text", className: "form-control", maxLength: 100, placeholder: "John Doe", value: cardData == null ? void 0 : cardData.cardName, onChange: (e) => handleCardChange("cardName", e.target.value) }), (cardError == null ? void 0 : cardError.cardName) && /* @__PURE__ */ React11.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cardName)), /* @__PURE__ */ React11.createElement("div", { className: "form-group" }, /* @__PURE__ */ React11.createElement("label", { htmlFor: "cardNumber" }, "Card Number"), /* @__PURE__ */ React11.createElement("div", { className: "toggle-num-wrapper" }, /* @__PURE__ */ React11.createElement(
|
2229
2479
|
"input",
|
2230
2480
|
{
|
2231
2481
|
className: "form-control card-number-new",
|
@@ -2278,11 +2528,11 @@ function GetPaymentPage(props) {
|
|
2278
2528
|
maxLength: 100,
|
2279
2529
|
placeholder: "OID123456",
|
2280
2530
|
disabled: true,
|
2281
|
-
value: (
|
2531
|
+
value: (_c = cardData == null ? void 0 : cardData.orderId) != null ? _c : "OID123456",
|
2282
2532
|
onChange: (e) => handleCardChange("orderId", e.target.value),
|
2283
2533
|
style: { background: "#F6F6F7", color: "#727272" }
|
2284
2534
|
}
|
2285
|
-
)), /* @__PURE__ */ React11.createElement("div", { className: "form-group" }, /* @__PURE__ */ React11.createElement("label", { htmlFor: "zip" }, "ZIP"), /* @__PURE__ */ React11.createElement("input", { type: "text", className: "form-control", maxLength: 100, placeholder: "000000", value: (
|
2535
|
+
)), /* @__PURE__ */ React11.createElement("div", { className: "form-group" }, /* @__PURE__ */ React11.createElement("label", { htmlFor: "zip" }, "ZIP"), /* @__PURE__ */ React11.createElement("input", { type: "text", className: "form-control", maxLength: 100, placeholder: "000000", value: (_d = cardData == null ? void 0 : cardData.zipCode) != null ? _d : "", onChange: (e) => handleCardChange("zipCode", e.target.value) }), (cardError == null ? void 0 : cardError.zipCode) && /* @__PURE__ */ React11.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.zipCode)), /* @__PURE__ */ React11.createElement("div", { className: "form-group" }, /* @__PURE__ */ React11.createElement("div", { style: { display: "flex", alignItems: "center", gap: "10px", paddingTop: "10px" } }, /* @__PURE__ */ React11.createElement(
|
2286
2536
|
"input",
|
2287
2537
|
{
|
2288
2538
|
type: "checkbox",
|
@@ -2291,7 +2541,7 @@ function GetPaymentPage(props) {
|
|
2291
2541
|
checked: saveCardInfo,
|
2292
2542
|
onChange: (e) => setSaveCardInfo(e.target.checked)
|
2293
2543
|
}
|
2294
|
-
), /* @__PURE__ */ React11.createElement("label", { htmlFor: "save_card", className: "toggle-label" }), /* @__PURE__ */ React11.createElement("label", { htmlFor: "save_card" }, "Save card for future payments"))), /* @__PURE__ */ React11.createElement("div", { className: "form-group", style: { marginTop: "20px" } }, /* @__PURE__ */ React11.createElement("button", { type: "submit", style: { margin: 0 }, className: "pay-button" }, "$1.35")))), /* @__PURE__ */ React11.createElement("div", { id: "ach", style: { display: activetab === "ach" ? "block" : "none" }, className: "tabcontent" }, /* @__PURE__ */ React11.createElement("form", { id: "ACHPaymentForm", onSubmit: submitFunc }, /* @__PURE__ */ React11.createElement("div", { className: "ach-scrl" }, /* @__PURE__ */ React11.createElement("div", { className: "form-group mb-4" }, /* @__PURE__ */ React11.createElement("label", { htmlFor: "nameonaccount" }, "Name on account"), /* @__PURE__ */ React11.createElement("input", { type: "text", id: "nameonaccount", className: "form-control", maxLength: 100, placeholder: "John Doe", name: "name", value: (
|
2544
|
+
), /* @__PURE__ */ React11.createElement("label", { htmlFor: "save_card", className: "toggle-label" }), /* @__PURE__ */ React11.createElement("label", { htmlFor: "save_card" }, "Save card for future payments")))), /* @__PURE__ */ React11.createElement("div", { className: "form-group", style: { marginTop: "20px" } }, /* @__PURE__ */ React11.createElement("button", { type: "submit", style: { margin: 0 }, className: "pay-button" }, "$1.35")))), /* @__PURE__ */ React11.createElement("div", { id: "ach", style: { display: activetab === "ach" ? "block" : "none" }, className: "tabcontent" }, /* @__PURE__ */ React11.createElement("form", { id: "ACHPaymentForm", onSubmit: submitFunc }, /* @__PURE__ */ React11.createElement("div", { className: "ach-scrl" }, /* @__PURE__ */ React11.createElement("div", { className: "form-group mb-4" }, /* @__PURE__ */ React11.createElement("label", { htmlFor: "nameonaccount" }, "Name on account"), /* @__PURE__ */ React11.createElement("input", { type: "text", id: "nameonaccount", className: "form-control", maxLength: 100, placeholder: "John Doe", name: "name", value: (_e = achData == null ? void 0 : achData.name) != null ? _e : "", onChange: handleChangeAch }), (achError == null ? void 0 : achError.name) && /* @__PURE__ */ React11.createElement("span", { className: "error-span" }, achError == null ? void 0 : achError.name)), /* @__PURE__ */ React11.createElement("div", { className: "form-group mb-4" }, /* @__PURE__ */ React11.createElement("label", { htmlFor: "routingnumber" }, "Routing number"), /* @__PURE__ */ React11.createElement(
|
2295
2545
|
"input",
|
2296
2546
|
{
|
2297
2547
|
type: "text",
|
@@ -2300,7 +2550,7 @@ function GetPaymentPage(props) {
|
|
2300
2550
|
maxLength: 9,
|
2301
2551
|
placeholder: "000000000",
|
2302
2552
|
name: "routingNumber",
|
2303
|
-
value: (
|
2553
|
+
value: (_f = achData == null ? void 0 : achData.routingNumber) != null ? _f : "",
|
2304
2554
|
onChange: handleChangeAch
|
2305
2555
|
}
|
2306
2556
|
), (achError == null ? void 0 : achError.routingNumber) && /* @__PURE__ */ React11.createElement("span", { className: "error-span" }, achError == null ? void 0 : achError.routingNumber)), /* @__PURE__ */ React11.createElement("div", { className: "form-group mb-4" }, /* @__PURE__ */ React11.createElement("label", { htmlFor: "accountnumber" }, "Account number"), /* @__PURE__ */ React11.createElement(
|
@@ -2312,7 +2562,7 @@ function GetPaymentPage(props) {
|
|
2312
2562
|
maxLength: 16,
|
2313
2563
|
placeholder: "0000000000",
|
2314
2564
|
name: "accountNumber",
|
2315
|
-
value: (
|
2565
|
+
value: (_g = achData == null ? void 0 : achData.accountNumber) != null ? _g : "",
|
2316
2566
|
onChange: handleChangeAch
|
2317
2567
|
}
|
2318
2568
|
), (achError == null ? void 0 : achError.accountNumber) && /* @__PURE__ */ React11.createElement("span", { className: "error-span" }, achError == null ? void 0 : achError.accountNumber)), /* @__PURE__ */ React11.createElement("div", { className: "form-group mb-4" }, /* @__PURE__ */ React11.createElement("label", { htmlFor: "confirmaccountnumber" }, "Confirm account number"), /* @__PURE__ */ React11.createElement(
|
@@ -2324,7 +2574,7 @@ function GetPaymentPage(props) {
|
|
2324
2574
|
maxLength: 16,
|
2325
2575
|
placeholder: "0000000000",
|
2326
2576
|
name: "confirmAccountNumber",
|
2327
|
-
value: (
|
2577
|
+
value: (_h = achData == null ? void 0 : achData.confirmAccountNumber) != null ? _h : "",
|
2328
2578
|
onChange: handleChangeAch
|
2329
2579
|
}
|
2330
2580
|
), (achError == null ? void 0 : achError.confirmAccountNumber) && /* @__PURE__ */ React11.createElement("span", { className: "error-span" }, achError == null ? void 0 : achError.confirmAccountNumber)), /* @__PURE__ */ React11.createElement("div", { className: "form-group mb-4" }, /* @__PURE__ */ React11.createElement("label", { htmlFor: "bankname" }, "Bank name"), /* @__PURE__ */ React11.createElement(
|
@@ -2336,47 +2586,13 @@ function GetPaymentPage(props) {
|
|
2336
2586
|
maxLength: 100,
|
2337
2587
|
placeholder: "My Bank",
|
2338
2588
|
name: "bankName",
|
2339
|
-
value: (
|
2589
|
+
value: (_i = achData == null ? void 0 : achData.bankName) != null ? _i : "",
|
2340
2590
|
onChange: handleChangeAch
|
2341
2591
|
}
|
2342
|
-
), (achError == null ? void 0 : achError.bankName) && /* @__PURE__ */ React11.createElement("span", { className: "error-span" }, achError == null ? void 0 : achError.bankName)), /* @__PURE__ */ React11.createElement("div", { className: "form-group mb-4" }, /* @__PURE__ */ React11.createElement("label", { htmlFor: "accounttype" }, "Select account type"), /* @__PURE__ */ React11.createElement("select", { name: "accountType", id: "accounttype", className: "form-control", value: (
|
2592
|
+
), (achError == null ? void 0 : achError.bankName) && /* @__PURE__ */ React11.createElement("span", { className: "error-span" }, achError == null ? void 0 : achError.bankName)), /* @__PURE__ */ React11.createElement("div", { className: "form-group mb-4" }, /* @__PURE__ */ React11.createElement("label", { htmlFor: "accounttype" }, "Select account type"), /* @__PURE__ */ React11.createElement("select", { name: "accountType", id: "accounttype", className: "form-control", value: (_j = achData == null ? void 0 : achData.accountType) != null ? _j : "", onChange: handleChangeAch }, /* @__PURE__ */ React11.createElement("option", { value: "" }, "Select account"), /* @__PURE__ */ React11.createElement("option", { value: "Personal Saving" }, "Personal Saving"), /* @__PURE__ */ React11.createElement("option", { value: "Business Saving" }, "Business Saving"), /* @__PURE__ */ React11.createElement("option", { value: "Personal Checking" }, "Personal Checking"), /* @__PURE__ */ React11.createElement("option", { value: "Business Checking" }, "Business Checking"))), /* @__PURE__ */ React11.createElement("div", { className: "form-group mb-4", style: { paddingTop: "5px" } }, /* @__PURE__ */ React11.createElement("input", { type: "checkbox", id: "saveACH", className: "", maxLength: 100, placeholder: "My Bank", checked: saveACHinfo, onChange: (e) => setSaveACHinfo(e.target.checked) }), /* @__PURE__ */ React11.createElement("label", { htmlFor: "saveACH" }, "Save ACH")), saveACHinfo && /* @__PURE__ */ React11.createElement("div", { className: "form-group mb-4", style: { fontSize: "12px", color: "#727272" } }, /* @__PURE__ */ React11.createElement("p", null, "If checked, I agree for ", /* @__PURE__ */ React11.createElement("b", null, "ecommerce"), " to have my permission to charge this credit card for agreed upon purchases in the future."))), /* @__PURE__ */ React11.createElement("div", { className: "form-group" }, /* @__PURE__ */ React11.createElement("button", { className: "pay-button", style: { margin: "20px 0 0" }, type: "submit" }, "$1.35"))))))))))
|
2343
2593
|
)));
|
2344
2594
|
}
|
2345
|
-
|
2346
|
-
// src/app/components/Datascript.tsx
|
2347
|
-
import { useEffect as useEffect4 } from "react";
|
2348
|
-
function DataScript() {
|
2349
|
-
useEffect4(() => {
|
2350
|
-
const src = "https://token-cert.dcap.com/v1/client";
|
2351
|
-
if (typeof window === "undefined") return;
|
2352
|
-
if (window.DatacapWebToken) {
|
2353
|
-
console.log("\u2705 Datacap already available");
|
2354
|
-
return;
|
2355
|
-
}
|
2356
|
-
if (!document.querySelector(`script[src="${src}"]`)) {
|
2357
|
-
const script = document.createElement("script");
|
2358
|
-
script.src = src;
|
2359
|
-
script.async = true;
|
2360
|
-
script.onload = () => {
|
2361
|
-
console.log("\u2705 Datacap script loaded");
|
2362
|
-
if (window.DatacapWebToken) {
|
2363
|
-
console.log("\u2705 DatacapWebToken is ready:", window.DatacapWebToken);
|
2364
|
-
} else {
|
2365
|
-
console.warn("\u26A0\uFE0F Script loaded, but DatacapWebToken not found");
|
2366
|
-
}
|
2367
|
-
};
|
2368
|
-
script.onerror = (err) => {
|
2369
|
-
console.error("\u274C Failed to load Datacap script", err);
|
2370
|
-
};
|
2371
|
-
document.head.appendChild(script);
|
2372
|
-
} else {
|
2373
|
-
console.log("\u2139\uFE0F Script already in DOM, waiting for Datacap...");
|
2374
|
-
}
|
2375
|
-
}, []);
|
2376
|
-
return null;
|
2377
|
-
}
|
2378
2595
|
export {
|
2379
|
-
DataScript,
|
2380
2596
|
GetPaymentPage,
|
2381
2597
|
RequestPayment,
|
2382
2598
|
RequestPreAuthPayment
|