@pinerohit11/testwidget 0.1.92 → 0.1.95
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 +32 -7
- package/dist/index.d.ts +32 -7
- package/dist/index.js +1400 -35
- package/dist/index.mjs +1398 -35
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
@@ -52,7 +52,7 @@ var LoaderStyle = (props) => {
|
|
52
52
|
justify-content: center;
|
53
53
|
align-items: center;
|
54
54
|
/* background: rgba(255, 255, 0, 0.01); Adjust the blur effect */
|
55
|
-
background-color: rgba(
|
55
|
+
background-color: rgba(31, 29, 29, 0.52); /* Semi-transparent black background */
|
56
56
|
|
57
57
|
backdrop-filter: blur(.5px); /* Blur effect */
|
58
58
|
z-index: 999999999999; /* Ensure it's on top of other elements */
|
@@ -133,8 +133,8 @@ var Loader = (props) => {
|
|
133
133
|
var Loader_default = Loader;
|
134
134
|
|
135
135
|
// src/app/components/baseurl.ts
|
136
|
-
var baseUrl = "http://192.168.1.62:8082/";
|
137
136
|
var masterBaseUrl = "https://dev-sky-node.fractalpay.com/";
|
137
|
+
var baseUrl = "https://dev-widget.fractalpay.com/";
|
138
138
|
|
139
139
|
// src/app/components/Errortext.ts
|
140
140
|
var ErrorText = {
|
@@ -869,7 +869,7 @@ function RequestPayment(props) {
|
|
869
869
|
open: show,
|
870
870
|
onClose: () => setShow(false)
|
871
871
|
},
|
872
|
-
/* @__PURE__ */ React6.createElement("div", { className: "request-payment-amount-detail" }, /* @__PURE__ */ React6.createElement("p", { className: "request-payment-merchantname" }, "Pay ", props == null ? void 0 : props.webname), /* @__PURE__ */ React6.createElement("p", { className: "request-payment-amount" }, formatAmount(props == null ? void 0 : props.amount)), (props == null ? void 0 : props.from) === "merchant" && /* @__PURE__ */ React6.createElement("p", { className: "request-payment-orderid" }, requestDetails == null ? void 0 : requestDetails.order_id), /* @__PURE__ */ React6.createElement("span", { className: "request-payment-close-popup", onClick: handleClose }, /* @__PURE__ */ React6.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, /* @__PURE__ */ React6.createElement("g", {
|
872
|
+
/* @__PURE__ */ React6.createElement("div", { className: "request-payment-amount-detail" }, /* @__PURE__ */ React6.createElement("p", { className: "request-payment-merchantname" }, "Pay ", props == null ? void 0 : props.webname), /* @__PURE__ */ React6.createElement("p", { className: "request-payment-amount" }, formatAmount(props == null ? void 0 : props.amount)), (props == null ? void 0 : props.from) === "merchant" && /* @__PURE__ */ React6.createElement("p", { className: "request-payment-orderid" }, requestDetails == null ? void 0 : requestDetails.order_id), /* @__PURE__ */ React6.createElement("span", { className: "request-payment-close-popup", onClick: handleClose }, /* @__PURE__ */ React6.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, /* @__PURE__ */ React6.createElement("g", { clipPath: "url(#clip0_12425_52336)" }, /* @__PURE__ */ React6.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__ */ React6.createElement("defs", null, /* @__PURE__ */ React6.createElement("clipPath", { id: "clip0_12425_52336" }, /* @__PURE__ */ React6.createElement("rect", { width: "16", height: "16", fill: "white" })))))),
|
873
873
|
/* @__PURE__ */ React6.createElement("form", { className: "request-payment-input-form" }, /* @__PURE__ */ React6.createElement("div", { className: "request-payment-list-div" }, /* @__PURE__ */ React6.createElement("label", { htmlFor: "exampleFormControlInput2", className: "request-payment-input-label" }, "FULL NAME"), /* @__PURE__ */ React6.createElement(
|
874
874
|
"input",
|
875
875
|
{
|
@@ -917,7 +917,7 @@ function RequestPayment(props) {
|
|
917
917
|
open: showConfirmationModal,
|
918
918
|
onClose: handleCloseConfirmationModal
|
919
919
|
},
|
920
|
-
/* @__PURE__ */ React6.createElement("div", { className: "fractal-popup-content", style: { padding: "0px" } }, /* @__PURE__ */ React6.createElement("div", { className: "request-payment-success-container" }, /* @__PURE__ */ React6.createElement("span", { className: "request-payment-close-popup", onClick: handleCloseConfirmationModal }, /* @__PURE__ */ React6.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, /* @__PURE__ */ React6.createElement("g", {
|
920
|
+
/* @__PURE__ */ React6.createElement("div", { className: "fractal-popup-content", style: { padding: "0px" } }, /* @__PURE__ */ React6.createElement("div", { className: "request-payment-success-container" }, /* @__PURE__ */ React6.createElement("span", { className: "request-payment-close-popup", onClick: handleCloseConfirmationModal }, /* @__PURE__ */ React6.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, /* @__PURE__ */ React6.createElement("g", { clipPath: "url(#clip0_12425_52336)" }, /* @__PURE__ */ React6.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__ */ React6.createElement("defs", null, /* @__PURE__ */ React6.createElement("clipPath", { id: "clip0_12425_52336" }, /* @__PURE__ */ React6.createElement("rect", { width: "16", height: "16", fill: "white" }))))), /* @__PURE__ */ React6.createElement("div", { className: "request-payment-success-tick-div" }, /* @__PURE__ */ React6.createElement("div", { className: "request-payment-success-tick" }, /* @__PURE__ */ React6.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, /* @__PURE__ */ React6.createElement("path", { d: "M6.12669 13.9774C5.97396 14.131 5.76558 14.2167 5.54913 14.2167C5.33267 14.2167 5.1243 14.131 4.97157 13.9774L0.359012 9.36408C-0.119671 8.8854 -0.119671 8.10919 0.359012 7.6314L0.936573 7.05369C1.4154 6.57501 2.19072 6.57501 2.6694 7.05369L5.54913 9.93357L13.3306 2.15198C13.8094 1.6733 14.5855 1.6733 15.0634 2.15198L15.641 2.72969C16.1196 3.20837 16.1196 3.98444 15.641 4.46237L6.12669 13.9774Z", fill: "#61C699" })))), /* @__PURE__ */ React6.createElement("h6", { className: "request-payment-success-text" }, "The request ", /* @__PURE__ */ React6.createElement("br", null), "was sent"), /* @__PURE__ */ React6.createElement("h6", { className: "request-payment-success-subtext" }, "Please wait for the customer to pay"), /* @__PURE__ */ React6.createElement("div", { className: "request-payment-success-btn-div" }, /* @__PURE__ */ React6.createElement("button", { onClick: handleCloseConfirmationModal, className: "request-payment-success-btn2" }, "Close"))))
|
921
921
|
)));
|
922
922
|
}
|
923
923
|
|
@@ -1106,7 +1106,7 @@ function RequestPreAuthPayment(props) {
|
|
1106
1106
|
open: show,
|
1107
1107
|
onClose: () => setShow(false)
|
1108
1108
|
},
|
1109
|
-
/* @__PURE__ */ React7.createElement("div", { className: "request-payment-amount-detail" }, /* @__PURE__ */ React7.createElement("p", { className: "request-payment-merchantname" }, "Authorization Request"), /* @__PURE__ */ React7.createElement("p", { className: "request-payment-pre-auth-merchantname" }, "Pay ", props == null ? void 0 : props.webname), /* @__PURE__ */ React7.createElement("p", { className: "request-payment-amount" }, formatAmount(props == null ? void 0 : props.amount)), (props == null ? void 0 : props.from) === "merchant" && /* @__PURE__ */ React7.createElement("p", { className: "request-payment-orderid" }, requestDetails == null ? void 0 : requestDetails.order_id), /* @__PURE__ */ React7.createElement("span", { className: "request-payment-close-popup", onClick: handleClose }, /* @__PURE__ */ React7.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, /* @__PURE__ */ React7.createElement("g", {
|
1109
|
+
/* @__PURE__ */ React7.createElement("div", { className: "request-payment-amount-detail" }, /* @__PURE__ */ React7.createElement("p", { className: "request-payment-merchantname" }, "Authorization Request"), /* @__PURE__ */ React7.createElement("p", { className: "request-payment-pre-auth-merchantname" }, "Pay ", props == null ? void 0 : props.webname), /* @__PURE__ */ React7.createElement("p", { className: "request-payment-amount" }, formatAmount(props == null ? void 0 : props.amount)), (props == null ? void 0 : props.from) === "merchant" && /* @__PURE__ */ React7.createElement("p", { className: "request-payment-orderid" }, requestDetails == null ? void 0 : requestDetails.order_id), /* @__PURE__ */ React7.createElement("span", { className: "request-payment-close-popup", onClick: handleClose }, /* @__PURE__ */ React7.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, /* @__PURE__ */ React7.createElement("g", { clipPath: "url(#clip0_12425_52336)" }, /* @__PURE__ */ React7.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__ */ React7.createElement("defs", null, /* @__PURE__ */ React7.createElement("clipPath", { id: "clip0_12425_52336" }, /* @__PURE__ */ React7.createElement("rect", { width: "16", height: "16", fill: "white" })))))),
|
1110
1110
|
/* @__PURE__ */ React7.createElement("form", { className: "request-payment-input-form" }, /* @__PURE__ */ React7.createElement("div", { className: "request-payment-list-div" }, /* @__PURE__ */ React7.createElement("label", { htmlFor: "exampleFormControlInput2", className: "request-payment-input-label" }, "FULL NAME"), /* @__PURE__ */ React7.createElement(
|
1111
1111
|
"input",
|
1112
1112
|
{
|
@@ -1154,7 +1154,7 @@ function RequestPreAuthPayment(props) {
|
|
1154
1154
|
open: showConfirmationModal,
|
1155
1155
|
onClose: handleCloseConfirmationModal
|
1156
1156
|
},
|
1157
|
-
/* @__PURE__ */ React7.createElement("div", { className: "fractal-popup-content", style: { padding: "0px" } }, /* @__PURE__ */ React7.createElement("div", { className: "request-payment-success-container" }, /* @__PURE__ */ React7.createElement("span", { className: "request-payment-close-popup", onClick: handleCloseConfirmationModal }, /* @__PURE__ */ React7.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, /* @__PURE__ */ React7.createElement("g", {
|
1157
|
+
/* @__PURE__ */ React7.createElement("div", { className: "fractal-popup-content", style: { padding: "0px" } }, /* @__PURE__ */ React7.createElement("div", { className: "request-payment-success-container" }, /* @__PURE__ */ React7.createElement("span", { className: "request-payment-close-popup", onClick: handleCloseConfirmationModal }, /* @__PURE__ */ React7.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, /* @__PURE__ */ React7.createElement("g", { clipPath: "url(#clip0_12425_52336)" }, /* @__PURE__ */ React7.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__ */ React7.createElement("defs", null, /* @__PURE__ */ React7.createElement("clipPath", { id: "clip0_12425_52336" }, /* @__PURE__ */ React7.createElement("rect", { width: "16", height: "16", fill: "white" }))))), /* @__PURE__ */ React7.createElement("div", { className: "request-payment-success-tick-div" }, /* @__PURE__ */ React7.createElement("div", { className: "request-payment-success-tick" }, /* @__PURE__ */ React7.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, /* @__PURE__ */ React7.createElement("path", { d: "M6.12669 13.9774C5.97396 14.131 5.76558 14.2167 5.54913 14.2167C5.33267 14.2167 5.1243 14.131 4.97157 13.9774L0.359012 9.36408C-0.119671 8.8854 -0.119671 8.10919 0.359012 7.6314L0.936573 7.05369C1.4154 6.57501 2.19072 6.57501 2.6694 7.05369L5.54913 9.93357L13.3306 2.15198C13.8094 1.6733 14.5855 1.6733 15.0634 2.15198L15.641 2.72969C16.1196 3.20837 16.1196 3.98444 15.641 4.46237L6.12669 13.9774Z", fill: "#61C699" })))), /* @__PURE__ */ React7.createElement("h6", { className: "request-payment-success-text" }, "The request ", /* @__PURE__ */ React7.createElement("br", null), "was sent"), /* @__PURE__ */ React7.createElement("h6", { className: "request-payment-success-subtext" }, "Please wait for the customer to pay"), /* @__PURE__ */ React7.createElement("div", { className: "request-payment-success-btn-div" }, /* @__PURE__ */ React7.createElement("button", { onClick: handleCloseConfirmationModal, className: "request-payment-success-btn2" }, "Close"))))
|
1158
1158
|
)));
|
1159
1159
|
}
|
1160
1160
|
|
@@ -1242,7 +1242,6 @@ function Chargewidgetstyles() {
|
|
1242
1242
|
}
|
1243
1243
|
.tab {
|
1244
1244
|
overflow: hidden;
|
1245
|
-
background-color: #E0DFE2;
|
1246
1245
|
padding: 5px;
|
1247
1246
|
border-radius: 8px;
|
1248
1247
|
display: flex;
|
@@ -1256,10 +1255,11 @@ function Chargewidgetstyles() {
|
|
1256
1255
|
border: none;
|
1257
1256
|
outline: none;
|
1258
1257
|
cursor: pointer;
|
1258
|
+
background:white;
|
1259
1259
|
padding: 11px 16px;
|
1260
1260
|
transition: 0.3s;
|
1261
1261
|
font-size: 16px;
|
1262
|
-
width:
|
1262
|
+
width: 143px;
|
1263
1263
|
border-radius: 5px;
|
1264
1264
|
box-shadow: inherit;
|
1265
1265
|
outline: none;
|
@@ -1268,22 +1268,24 @@ function Chargewidgetstyles() {
|
|
1268
1268
|
|
1269
1269
|
/* Change background color of buttons on hover */
|
1270
1270
|
.tab button:hover {
|
1271
|
-
background-color: #
|
1271
|
+
background-color: #f0f0f0;
|
1272
1272
|
}
|
1273
1273
|
|
1274
1274
|
/* Create an active/current tablink class */
|
1275
|
-
.tab button.active {
|
1276
|
-
|
1277
|
-
}
|
1275
|
+
// .tab button.active {
|
1276
|
+
// background-color: #ccc;
|
1277
|
+
// }
|
1278
1278
|
|
1279
1279
|
/* Style the tab content */
|
1280
1280
|
|
1281
1281
|
|
1282
|
-
|
1282
|
+
.parent-pay-container{
|
1283
|
+
padding: 20px 10% ;
|
1284
|
+
}
|
1283
1285
|
.pay-container{
|
1284
1286
|
display: grid;
|
1285
1287
|
grid-template-columns: 2fr 3fr;
|
1286
|
-
|
1288
|
+
|
1287
1289
|
}
|
1288
1290
|
.pay-main{
|
1289
1291
|
padding-y: 20px}
|
@@ -1297,6 +1299,20 @@ function Chargewidgetstyles() {
|
|
1297
1299
|
.pay-conatiner-one{
|
1298
1300
|
border-right: 1px solid #E0DFE2;
|
1299
1301
|
}
|
1302
|
+
.pay-conatiner-one-first{
|
1303
|
+
min-height:530px
|
1304
|
+
}
|
1305
|
+
.pay-conatiner-one-last{
|
1306
|
+
display:flex;
|
1307
|
+
font-size:12px;
|
1308
|
+
gap:5px;
|
1309
|
+
max-width:250px;
|
1310
|
+
align-items:center
|
1311
|
+
}
|
1312
|
+
.pay-conatiner-one-last img{
|
1313
|
+
width : 17px;
|
1314
|
+
height:17px
|
1315
|
+
}
|
1300
1316
|
.pay-conatiner-two{
|
1301
1317
|
padding: 0 5% 0;
|
1302
1318
|
}
|
@@ -1316,6 +1332,11 @@ function Chargewidgetstyles() {
|
|
1316
1332
|
.pay-main-logo > img{
|
1317
1333
|
width: 50%;
|
1318
1334
|
}
|
1335
|
+
.pay-main-logo-res > img{
|
1336
|
+
width: 50%;
|
1337
|
+
display : none
|
1338
|
+
}
|
1339
|
+
|
1319
1340
|
.pay-payment-amount{
|
1320
1341
|
display: block;
|
1321
1342
|
font-size: 12px;
|
@@ -1476,7 +1497,8 @@ function Chargewidgetstyles() {
|
|
1476
1497
|
left: 18px;
|
1477
1498
|
}
|
1478
1499
|
.ach-scrl {
|
1479
|
-
max-height:
|
1500
|
+
max-height: 380px;
|
1501
|
+
min-height: 380px;
|
1480
1502
|
overflow-y: auto;
|
1481
1503
|
padding-right: 6px;
|
1482
1504
|
}
|
@@ -1499,10 +1521,32 @@ function Chargewidgetstyles() {
|
|
1499
1521
|
|
1500
1522
|
|
1501
1523
|
@media (max-width: 768px) {
|
1524
|
+
.parent-pay-container{
|
1525
|
+
padding: 20px 5%;
|
1526
|
+
}
|
1502
1527
|
.pay-container {
|
1503
1528
|
grid-template-columns: 1fr;
|
1504
|
-
padding:
|
1529
|
+
padding: 10px 5%;
|
1530
|
+
border:1px solid #E0DFE2;
|
1531
|
+
border-radius : 12px
|
1505
1532
|
}
|
1533
|
+
.pay-conatiner-one{
|
1534
|
+
border-right: none;
|
1535
|
+
}
|
1536
|
+
.pay-conatiner-one-first{
|
1537
|
+
min-height:0
|
1538
|
+
}
|
1539
|
+
.pay-main-logo > img{
|
1540
|
+
display: none;
|
1541
|
+
}
|
1542
|
+
.pay-main-logo-res > img {
|
1543
|
+
display:block;
|
1544
|
+
margin:auto
|
1545
|
+
}
|
1546
|
+
|
1547
|
+
.pay-logo-container{
|
1548
|
+
border :none
|
1549
|
+
}
|
1506
1550
|
}
|
1507
1551
|
.charge-customer-name{
|
1508
1552
|
color: #161616;
|
@@ -1554,7 +1598,7 @@ function Chargewidgetstyles() {
|
|
1554
1598
|
border-bottom: none;
|
1555
1599
|
}
|
1556
1600
|
.card-lint-div-in{
|
1557
|
-
min-height:
|
1601
|
+
min-height:444px}
|
1558
1602
|
.card-number-radio{
|
1559
1603
|
display:flex;
|
1560
1604
|
gap:12px;
|
@@ -1896,7 +1940,7 @@ function SuccessMsz({ onClose }) {
|
|
1896
1940
|
viewBox: "0 0 17 16",
|
1897
1941
|
fill: "none"
|
1898
1942
|
},
|
1899
|
-
/* @__PURE__ */ React10.createElement("g", {
|
1943
|
+
/* @__PURE__ */ React10.createElement("g", { clipPath: "url(#clip0_12420_50683)" }, /* @__PURE__ */ React10.createElement(
|
1900
1944
|
"path",
|
1901
1945
|
{
|
1902
1946
|
d: "M9.30194 4.78664V2.31152C9.30194 2.09629 9.3862 1.88988 9.53631 1.73768C9.68634 1.5855 9.8899 1.5 10.1021 1.5C10.312 1.50089 10.5132 1.58542 10.6622 1.73534L16.2633 7.41595C16.3383 7.49142 16.3978 7.58117 16.4385 7.68001C16.4791 7.77894 16.5 7.885 16.5 7.99212C16.5 8.09924 16.4791 8.20531 16.4385 8.30423C16.3978 8.40307 16.3383 8.49283 16.2633 8.5683L10.6622 14.2489C10.5499 14.3606 10.4076 14.4362 10.2531 14.4663C10.0987 14.4964 9.93887 14.4797 9.79372 14.4182C9.64857 14.3568 9.52455 14.2532 9.43701 14.1206C9.34955 13.9881 9.30258 13.8323 9.30194 13.6727V11.157H8.62181C7.35764 11.1379 6.10443 11.3981 4.94932 11.9193C3.79422 12.4406 2.76481 13.2107 1.93249 14.1759C1.83215 14.3113 1.6926 14.4115 1.53337 14.4624C1.37406 14.5134 1.20306 14.5125 1.04431 14.4599C0.882759 14.4046 0.742811 14.2984 0.644952 14.1568C0.547092 14.0152 0.496363 13.8456 0.500203 13.6727C0.500203 6.27171 6.96548 5.00575 9.30194 4.78664ZM8.62181 9.51777C9.15695 9.51607 9.69162 9.55129 10.2221 9.62327C10.4115 9.6524 10.5844 9.74954 10.7092 9.89699C10.834 10.0444 10.9025 10.2324 10.9023 10.4267V11.717L14.567 7.99212L10.9023 4.26727V5.55758C10.9023 5.77281 10.8179 5.97922 10.6679 6.13141C10.5178 6.28359 10.3143 6.36909 10.1021 6.36909C9.37396 6.36909 3.61282 6.5314 2.36457 11.5871C4.17637 10.2324 6.3708 9.50665 8.62181 9.51777Z",
|
@@ -1974,7 +2018,7 @@ function GetPaymentPage(props) {
|
|
1974
2018
|
const [loading, setLoading] = useState3(false);
|
1975
2019
|
const [success, setSuccess] = useState3(false);
|
1976
2020
|
const [show, setShow] = useState3(false);
|
1977
|
-
const [activetab, setActive] = useState3("
|
2021
|
+
const [activetab, setActive] = useState3("card");
|
1978
2022
|
const [saveCardInfo, setSaveCardInfo] = useState3(false);
|
1979
2023
|
const [saveACHinfo, setSaveACHinfo] = useState3(false);
|
1980
2024
|
const fractalpayClientKey = props.fractalpayClientKey;
|
@@ -1996,7 +2040,7 @@ function GetPaymentPage(props) {
|
|
1996
2040
|
};
|
1997
2041
|
const handleClose = () => {
|
1998
2042
|
setShow(false);
|
1999
|
-
setActive("
|
2043
|
+
setActive("card");
|
2000
2044
|
};
|
2001
2045
|
const handleShow = () => setShow(true);
|
2002
2046
|
const handleCloseSeccess = () => {
|
@@ -2055,6 +2099,17 @@ function GetPaymentPage(props) {
|
|
2055
2099
|
const handleChangeAch = (e) => {
|
2056
2100
|
const { name, value } = e.target;
|
2057
2101
|
const numericFields = ["routingNumber", "accountNumber", "confirmAccountNumber"];
|
2102
|
+
if (name == "name") {
|
2103
|
+
if (/^[a-zA-Z\s]*$/.test(value)) {
|
2104
|
+
setAchError((prev) => __spreadProps(__spreadValues({}, prev), {
|
2105
|
+
[name]: ""
|
2106
|
+
}));
|
2107
|
+
setAchData((prev) => __spreadProps(__spreadValues({}, prev), {
|
2108
|
+
[name]: value
|
2109
|
+
}));
|
2110
|
+
}
|
2111
|
+
return;
|
2112
|
+
}
|
2058
2113
|
if (numericFields.includes(name)) {
|
2059
2114
|
if (value === "" || /^[0-9]+$/.test(value)) {
|
2060
2115
|
setAchError((prev) => __spreadProps(__spreadValues({}, prev), {
|
@@ -2147,7 +2202,12 @@ function GetPaymentPage(props) {
|
|
2147
2202
|
try {
|
2148
2203
|
const formData = __spreadProps(__spreadValues({}, cardData), {
|
2149
2204
|
amount: `${props.amount || 0}`,
|
2150
|
-
fractalpayPublicKey: fractalpayClientKey
|
2205
|
+
fractalpayPublicKey: fractalpayClientKey,
|
2206
|
+
orderId: props == null ? void 0 : props.orderID,
|
2207
|
+
customer_id: props == null ? void 0 : props.customerId,
|
2208
|
+
discount: props == null ? void 0 : props.discount,
|
2209
|
+
surcharge: props == null ? void 0 : props.surcharge,
|
2210
|
+
tax: props == null ? void 0 : props.tax
|
2151
2211
|
});
|
2152
2212
|
const result = await axios3.post(`${baseUrl}create-widget-order`, formData);
|
2153
2213
|
console.log(result);
|
@@ -2158,13 +2218,11 @@ function GetPaymentPage(props) {
|
|
2158
2218
|
showError(response.Error);
|
2159
2219
|
hideLoader();
|
2160
2220
|
} else {
|
2161
|
-
var token = response.Token;
|
2162
|
-
var jsonResponse = JSON.stringify(response, null, 2);
|
2163
2221
|
let name = cardData == null ? void 0 : cardData.cardName;
|
2164
2222
|
let postal_code = cardData == null ? void 0 : cardData.zipCode;
|
2165
2223
|
response.name = name;
|
2166
2224
|
response.postal_code = postal_code;
|
2167
|
-
|
2225
|
+
response.isCardSave = `${saveCardInfo}`;
|
2168
2226
|
try {
|
2169
2227
|
let apiResponse = await axios3.post(`${masterBaseUrl}quick-pay/${result == null ? void 0 : result.data.data.posSalesIdEncode}`, response);
|
2170
2228
|
console.log(apiResponse);
|
@@ -2177,6 +2235,7 @@ function GetPaymentPage(props) {
|
|
2177
2235
|
orderId: "",
|
2178
2236
|
zipCode: ""
|
2179
2237
|
});
|
2238
|
+
setSaveCardInfo(false);
|
2180
2239
|
setSuccess(true);
|
2181
2240
|
hideLoader();
|
2182
2241
|
} catch (err) {
|
@@ -2324,6 +2383,7 @@ function GetPaymentPage(props) {
|
|
2324
2383
|
setPaymentData((_a2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _a2.data);
|
2325
2384
|
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
2385
|
setCardList((_h2 = (_g2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _g2.data) == null ? void 0 : _h2.card_list);
|
2386
|
+
setActive("cardList");
|
2327
2387
|
} else {
|
2328
2388
|
setActive("card");
|
2329
2389
|
}
|
@@ -2425,15 +2485,19 @@ function GetPaymentPage(props) {
|
|
2425
2485
|
Swal.fire({
|
2426
2486
|
icon: "success",
|
2427
2487
|
title: "Deleted!",
|
2428
|
-
text: "
|
2488
|
+
text: "Card deleted.",
|
2429
2489
|
confirmButtonText: "OK",
|
2490
|
+
showConfirmButton: true,
|
2491
|
+
timer: 1e3,
|
2492
|
+
// auto-close after 1 second
|
2493
|
+
timerProgressBar: true,
|
2430
2494
|
customClass: {
|
2431
2495
|
confirmButton: "btn btn-dark"
|
2432
2496
|
}
|
2433
2497
|
});
|
2434
2498
|
} catch (err) {
|
2435
2499
|
hideLoader();
|
2436
|
-
console.
|
2500
|
+
console.log("Error:", err);
|
2437
2501
|
Swal.fire({
|
2438
2502
|
icon: "error",
|
2439
2503
|
title: "Error!",
|
@@ -2444,6 +2508,17 @@ function GetPaymentPage(props) {
|
|
2444
2508
|
}
|
2445
2509
|
});
|
2446
2510
|
}
|
2511
|
+
} else if (result.dismiss === Swal.DismissReason.cancel) {
|
2512
|
+
Swal.fire({
|
2513
|
+
icon: "info",
|
2514
|
+
text: "Card not deleted",
|
2515
|
+
confirmButtonText: "OK",
|
2516
|
+
buttonsStyling: false,
|
2517
|
+
customClass: {
|
2518
|
+
confirmButton: "btn btn-dark float-end",
|
2519
|
+
actions: "swal2-actions-end"
|
2520
|
+
}
|
2521
|
+
});
|
2447
2522
|
}
|
2448
2523
|
});
|
2449
2524
|
};
|
@@ -2461,11 +2536,11 @@ function GetPaymentPage(props) {
|
|
2461
2536
|
onClose: handleClose
|
2462
2537
|
},
|
2463
2538
|
/* @__PURE__ */ React11.createElement(Loader_default, { loading }),
|
2464
|
-
success ? /* @__PURE__ */ React11.createElement(SuccessMsz, { onClose: handleCloseSeccess }) : /* @__PURE__ */ React11.createElement("div", null, /* @__PURE__ */ React11.createElement("div",
|
2539
|
+
success ? /* @__PURE__ */ React11.createElement(SuccessMsz, { onClose: handleCloseSeccess }) : /* @__PURE__ */ React11.createElement("div", null, /* @__PURE__ */ React11.createElement("div", { className: "parent-pay-container" }, /* @__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", { clipPath: "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-main-logo-res" }, /* @__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("div", { className: "pay-container" }, /* @__PURE__ */ React11.createElement("div", { className: "pay-header pay-conatiner-one" }, /* @__PURE__ */ React11.createElement("div", { className: "pay-conatiner-one-first" }, /* @__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" }, "$", props == null ? void 0 : props.amount)), 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-conatiner-one-last" }, /* @__PURE__ */ React11.createElement("img", { src: "https://dev-widget.fractalpay.com/images/secure-img.png", alt: "" }), /* @__PURE__ */ React11.createElement("img", { src: "https://dev-widget.fractalpay.com/images/pov-by.png", alt: "" }), "Secure payments powered by Fractal"), /* @__PURE__ */ React11.createElement("div", null)), /* @__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"), (paymentData == null ? void 0 : paymentData.isSkyFiAccount) && /* @__PURE__ */ React11.createElement("div", { className: "tab" }, /* @__PURE__ */ React11.createElement("button", { className: "tablinks", onClick: (e) => {
|
2465
2540
|
handletabchange("card");
|
2466
|
-
}, style: {
|
2541
|
+
}, style: { border: activetab === "card" ? "1px solid" : "" } }, /* @__PURE__ */ React11.createElement("i", { className: "fas fa-credit-card me-2", style: { marginRight: "8px", fontSize: "15px" } }), "Card"), /* @__PURE__ */ React11.createElement("button", { className: "tablinks", onClick: (e) => {
|
2467
2542
|
handletabchange("ach");
|
2468
|
-
}, style: {
|
2543
|
+
}, style: { border: activetab === "ach" ? "1px solid" : "" } }, /* @__PURE__ */ React11.createElement("i", { className: "fas fa-university me-2", style: { marginRight: "8px", fontSize: "15px" } }), "Bank"))) : /* @__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
2544
|
"input",
|
2470
2545
|
{
|
2471
2546
|
type: "radio",
|
@@ -2475,7 +2550,12 @@ function GetPaymentPage(props) {
|
|
2475
2550
|
checked: selectedCard === card,
|
2476
2551
|
onChange: (e) => setSelectedCard(card)
|
2477
2552
|
}
|
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 }, "$
|
2553
|
+
), /* @__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", style: { padding: "0" } }, /* @__PURE__ */ React11.createElement("button", { className: "pay-button", style: { margin: "0px" }, type: "submit", onClick: handlechargeCustomer }, "$", props == null ? void 0 : props.amount))), /* @__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: { minHeight: (paymentData == null ? void 0 : paymentData.isSkyFiAccount) && (cardList == null ? void 0 : cardList.length) > 0 ? "378px" : (cardList == null ? void 0 : cardList.length) > 0 ? "442px" : "500px", 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) => {
|
2554
|
+
const value = e.target.value;
|
2555
|
+
if (/^[a-zA-Z\s]*$/.test(value)) {
|
2556
|
+
handleCardChange("cardName", value);
|
2557
|
+
}
|
2558
|
+
} }), (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(
|
2479
2559
|
"input",
|
2480
2560
|
{
|
2481
2561
|
className: "form-control card-number-new",
|
@@ -2528,11 +2608,10 @@ function GetPaymentPage(props) {
|
|
2528
2608
|
maxLength: 100,
|
2529
2609
|
placeholder: "OID123456",
|
2530
2610
|
disabled: true,
|
2531
|
-
value: (_c =
|
2532
|
-
onChange: (e) => handleCardChange("orderId", e.target.value),
|
2611
|
+
value: (_c = props == null ? void 0 : props.orderID) != null ? _c : "",
|
2533
2612
|
style: { background: "#F6F6F7", color: "#727272" }
|
2534
2613
|
}
|
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(
|
2614
|
+
)), /* @__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)), (props == null ? void 0 : props.customerId) && /* @__PURE__ */ React11.createElement("div", { className: "form-group" }, /* @__PURE__ */ React11.createElement("div", { style: { display: "flex", alignItems: "center", gap: "10px", paddingTop: "10px" } }, /* @__PURE__ */ React11.createElement(
|
2536
2615
|
"input",
|
2537
2616
|
{
|
2538
2617
|
type: "checkbox",
|
@@ -2541,7 +2620,7 @@ function GetPaymentPage(props) {
|
|
2541
2620
|
checked: saveCardInfo,
|
2542
2621
|
onChange: (e) => setSaveCardInfo(e.target.checked)
|
2543
2622
|
}
|
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" }, "$
|
2623
|
+
), /* @__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("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none" }, /* @__PURE__ */ React11.createElement("g", { clipPath: "url(#clip0_12420_50192)" }, /* @__PURE__ */ React11.createElement("rect", { width: "20", height: "20", fill: "white" }), /* @__PURE__ */ React11.createElement("circle", { cx: "10", cy: "10", r: "10", fill: "#E0DFE2" }), /* @__PURE__ */ React11.createElement("path", { d: "M9.03406 12.0979V12.0072C9.04055 11.4153 9.10057 10.9443 9.21411 10.5943C9.3309 10.2442 9.49635 9.96102 9.71046 9.74463C9.92457 9.52824 10.1825 9.33095 10.4842 9.15274C10.6788 9.03182 10.854 8.89658 11.0097 8.74702C11.1655 8.59745 11.2887 8.42562 11.3796 8.2315C11.4704 8.03739 11.5158 7.82259 11.5158 7.58711C11.5158 7.3039 11.4477 7.05887 11.3114 6.85203C11.1752 6.64519 10.9935 6.48608 10.7664 6.3747C10.5426 6.26014 10.2928 6.20286 10.017 6.20286C9.76723 6.20286 9.52879 6.25378 9.3017 6.35561C9.07461 6.45744 8.88646 6.61655 8.73723 6.83294C8.588 7.04614 8.50203 7.3214 8.47932 7.65871H7C7.02271 7.08592 7.17032 6.60223 7.44282 6.20764C7.71533 5.80986 8.07543 5.50915 8.52311 5.30549C8.97405 5.10183 9.47202 5 10.017 5C10.6139 5 11.1363 5.10979 11.5839 5.32936C12.0316 5.54574 12.3788 5.84964 12.6253 6.24105C12.8751 6.62928 13 7.08274 13 7.60143C13 7.95784 12.9432 8.27924 12.8297 8.56563C12.7161 8.84885 12.5539 9.10183 12.3431 9.32458C12.1354 9.54733 11.8856 9.74463 11.5937 9.91647C11.3179 10.0851 11.0941 10.2601 10.9221 10.4415C10.7534 10.6229 10.6302 10.8377 10.5523 11.0859C10.4745 11.3341 10.4323 11.6412 10.4258 12.0072V12.0979H9.03406ZM9.76886 15C9.50284 15 9.27413 14.9077 9.08273 14.7232C8.89132 14.5354 8.79562 14.3095 8.79562 14.0453C8.79562 13.7844 8.89132 13.5617 9.08273 13.3771C9.27413 13.1893 9.50284 13.0955 9.76886 13.0955C10.0316 13.0955 10.2587 13.1893 10.4501 13.3771C10.6448 13.5617 10.7421 13.7844 10.7421 14.0453C10.7421 14.2204 10.6967 14.3811 10.6058 14.5274C10.5182 14.6706 10.4015 14.7852 10.2555 14.8711C10.1095 14.957 9.94728 15 9.76886 15Z", fill: "#161616" })), /* @__PURE__ */ React11.createElement("defs", null, /* @__PURE__ */ React11.createElement("clipPath", { id: "clip0_12420_50192" }, /* @__PURE__ */ React11.createElement("rect", { width: "20", height: "20", fill: "white" }))))))), /* @__PURE__ */ React11.createElement("div", { className: "form-group", style: { marginTop: "20px", padding: "0" } }, /* @__PURE__ */ React11.createElement("button", { type: "submit", style: { margin: 0 }, className: "pay-button" }, "$", props == null ? void 0 : props.amount)))), /* @__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", style: { minHeight: (paymentData == null ? void 0 : paymentData.isSkyFiAccount) && (cardList == null ? void 0 : cardList.length) > 0 ? "378px" : (cardList == null ? void 0 : cardList.length) > 0 ? "442px" : "500px", overflow: "auto", marginRight: "5px", maxHeight: (paymentData == null ? void 0 : paymentData.isSkyFiAccount) && (cardList == null ? void 0 : cardList.length) > 0 ? "378px" : (cardList == null ? void 0 : cardList.length) > 0 ? "380" : "380" } }, /* @__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(
|
2545
2624
|
"input",
|
2546
2625
|
{
|
2547
2626
|
type: "text",
|
@@ -2589,11 +2668,1295 @@ function GetPaymentPage(props) {
|
|
2589
2668
|
value: (_i = achData == null ? void 0 : achData.bankName) != null ? _i : "",
|
2590
2669
|
onChange: handleChangeAch
|
2591
2670
|
}
|
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" }, "$
|
2671
|
+
), (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" }, "$", props == null ? void 0 : props.amount))))))))))
|
2593
2672
|
)));
|
2594
2673
|
}
|
2674
|
+
|
2675
|
+
// src/app/components/PreAuthCharge/PreAuthPaymentPage.tsx
|
2676
|
+
import React12, { useEffect as useEffect5, useState as useState4 } from "react";
|
2677
|
+
import axios4 from "axios";
|
2678
|
+
import Swal2 from "sweetalert2";
|
2679
|
+
import { IoArrowBack as IoArrowBack2 } from "react-icons/io5";
|
2680
|
+
function PreAuthPayment(props) {
|
2681
|
+
var _a, _b, _c, _d;
|
2682
|
+
const [loading, setLoading] = useState4(false);
|
2683
|
+
const [success, setSuccess] = useState4(false);
|
2684
|
+
const [show, setShow] = useState4(false);
|
2685
|
+
const [activetab, setActive] = useState4("card");
|
2686
|
+
const [saveCardInfo, setSaveCardInfo] = useState4(false);
|
2687
|
+
const fractalpayClientKey = props.fractalpayClientKey;
|
2688
|
+
const [cardData, setCardData] = useState4();
|
2689
|
+
const [cardError, setCardError] = useState4({});
|
2690
|
+
const [cardList, setCardList] = useState4([]);
|
2691
|
+
const [selectedCard, setSelectedCard] = useState4();
|
2692
|
+
const [paymentData, setPaymentData] = useState4();
|
2693
|
+
const showLoader = () => setLoading(true);
|
2694
|
+
const hideLoader = () => setLoading(false);
|
2695
|
+
const showError = (msz) => {
|
2696
|
+
Swal2.fire({
|
2697
|
+
icon: "error",
|
2698
|
+
title: "Oops...",
|
2699
|
+
text: msz
|
2700
|
+
});
|
2701
|
+
};
|
2702
|
+
const handleClose = () => {
|
2703
|
+
setShow(false);
|
2704
|
+
setActive("card");
|
2705
|
+
};
|
2706
|
+
const handleShow = () => setShow(true);
|
2707
|
+
const handleCloseSeccess = () => {
|
2708
|
+
setSuccess(false);
|
2709
|
+
handleClose();
|
2710
|
+
};
|
2711
|
+
const handletabchange = (id) => {
|
2712
|
+
setActive(id);
|
2713
|
+
};
|
2714
|
+
const handleCardChange = (field, value) => {
|
2715
|
+
const name = field;
|
2716
|
+
const numericFields = ["expiryMonth", "expiryYear", "zipCode", "cvv"];
|
2717
|
+
if (numericFields.includes(name)) {
|
2718
|
+
if (value === "" || /^[0-9]+$/.test(value)) {
|
2719
|
+
setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
|
2720
|
+
[name]: ""
|
2721
|
+
}));
|
2722
|
+
setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
|
2723
|
+
[name]: value
|
2724
|
+
}));
|
2725
|
+
}
|
2726
|
+
return;
|
2727
|
+
}
|
2728
|
+
setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
|
2729
|
+
[name]: ""
|
2730
|
+
}));
|
2731
|
+
console.log(value, name);
|
2732
|
+
setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
|
2733
|
+
[name]: value
|
2734
|
+
}));
|
2735
|
+
};
|
2736
|
+
const handleCardNumberChange = (e) => {
|
2737
|
+
const input = e.target;
|
2738
|
+
const rawValue = input.value.replace(/\D/g, "");
|
2739
|
+
let formatted = "";
|
2740
|
+
if (/^3[47]/.test(rawValue)) {
|
2741
|
+
const trimmed = rawValue.slice(0, 15);
|
2742
|
+
formatted = trimmed.replace(
|
2743
|
+
/^(\d{1,4})(\d{1,6})?(\d{1,5})?$/,
|
2744
|
+
(_, g1, g2, g3) => [g1, g2, g3].filter(Boolean).join(" ")
|
2745
|
+
);
|
2746
|
+
} else {
|
2747
|
+
const trimmed = rawValue.slice(0, 16);
|
2748
|
+
formatted = trimmed.replace(
|
2749
|
+
/^(\d{1,4})(\d{1,4})?(\d{1,4})?(\d{1,4})?$/,
|
2750
|
+
(_, g1, g2, g3, g4) => [g1, g2, g3, g4].filter(Boolean).join(" ")
|
2751
|
+
);
|
2752
|
+
}
|
2753
|
+
setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
|
2754
|
+
cardNumber: ""
|
2755
|
+
}));
|
2756
|
+
setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
|
2757
|
+
cardNumber: formatted
|
2758
|
+
}));
|
2759
|
+
};
|
2760
|
+
const validateCardData = () => {
|
2761
|
+
var _a2, _b2, _c2, _d2, _e, _f;
|
2762
|
+
const errors = {};
|
2763
|
+
const data = cardData;
|
2764
|
+
const month = parseInt((data == null ? void 0 : data.expiryMonth) || "", 10);
|
2765
|
+
const year = (data == null ? void 0 : data.expiryYear) || "";
|
2766
|
+
if (!((_a2 = data == null ? void 0 : data.cardName) == null ? void 0 : _a2.trim())) errors.cardName = "Card name is required";
|
2767
|
+
if (!((_b2 = data == null ? void 0 : data.cardNumber) == null ? void 0 : _b2.trim())) errors.cardNumber = "Card number is required";
|
2768
|
+
if (!((_c2 = data == null ? void 0 : data.expiryMonth) == null ? void 0 : _c2.trim()) || !((_d2 = data == null ? void 0 : data.expiryYear) == null ? void 0 : _d2.trim())) {
|
2769
|
+
errors.expiryMonth = "Invalid Expiration Date.";
|
2770
|
+
} else if (isNaN(month) || month < 1 || month > 12 || year.length !== 4) {
|
2771
|
+
errors.expiryMonth = "Invalid Expiration Date.";
|
2772
|
+
}
|
2773
|
+
if (!((_e = data == null ? void 0 : data.cvv) == null ? void 0 : _e.trim())) errors.cvv = "CVV is required";
|
2774
|
+
if (!((_f = data == null ? void 0 : data.zipCode) == null ? void 0 : _f.trim())) errors.zipCode = "ZIP code is required";
|
2775
|
+
if ((data == null ? void 0 : data.expiryMonth) && (data == null ? void 0 : data.expiryYear) && data.expiryMonth.length <= 2 && data.expiryYear.length === 4) {
|
2776
|
+
const month2 = parseInt(data.expiryMonth, 10);
|
2777
|
+
const year2 = parseInt(data.expiryYear, 10);
|
2778
|
+
const now = /* @__PURE__ */ new Date();
|
2779
|
+
const currentMonth = now.getMonth() + 1;
|
2780
|
+
const currentYear = now.getFullYear();
|
2781
|
+
if (year2 < currentYear || year2 === currentYear && month2 < currentMonth) {
|
2782
|
+
errors.expiryMonth = "Card is expired";
|
2783
|
+
}
|
2784
|
+
}
|
2785
|
+
setCardError(errors);
|
2786
|
+
return Object.keys(errors).length > 0;
|
2787
|
+
};
|
2788
|
+
const submitFunc = async (e) => {
|
2789
|
+
var _a2, _b2, _c2, _d2, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
|
2790
|
+
e.preventDefault();
|
2791
|
+
if (activetab == "card") {
|
2792
|
+
const hasError = validateCardData();
|
2793
|
+
if (hasError) return;
|
2794
|
+
else {
|
2795
|
+
let validCard = DatacapWebToken.validateCardNumber(cardData == null ? void 0 : cardData.cardNumber.replaceAll(" ", ""));
|
2796
|
+
let validExpirationDate = DatacapWebToken.validateExpirationDate(cardData == null ? void 0 : cardData.expiryMonth, cardData == null ? void 0 : cardData.expiryYear);
|
2797
|
+
let validCVV = DatacapWebToken.validateCVV(cardData == null ? void 0 : cardData.cvv);
|
2798
|
+
let errors = {};
|
2799
|
+
if (!validCard) errors.cardNumber = "Invalid card Number";
|
2800
|
+
if (!validExpirationDate) errors.expiryMonth = "Invalid Expiration Date.";
|
2801
|
+
if (!validCVV) errors.cvv = "Invalid CVV";
|
2802
|
+
setCardError(errors);
|
2803
|
+
if (validCard && validCVV && validExpirationDate) {
|
2804
|
+
console.log(props == null ? void 0 : props.customerId);
|
2805
|
+
showLoader();
|
2806
|
+
try {
|
2807
|
+
let tokenCallback = async function(response) {
|
2808
|
+
var _a3, _b3;
|
2809
|
+
if (response.Error) {
|
2810
|
+
console.log(response == null ? void 0 : response.Error);
|
2811
|
+
showError(response.Error);
|
2812
|
+
hideLoader();
|
2813
|
+
} else {
|
2814
|
+
let name = cardData == null ? void 0 : cardData.cardName;
|
2815
|
+
let postal_code = cardData == null ? void 0 : cardData.zipCode;
|
2816
|
+
response.name = name;
|
2817
|
+
response.postal_code = postal_code;
|
2818
|
+
response.fractalpayPublicKey = props == null ? void 0 : props.fractalpayClientKey;
|
2819
|
+
response.amount = props == null ? void 0 : props.amount;
|
2820
|
+
response.order_id = props == null ? void 0 : props.orderID;
|
2821
|
+
response.preAuth_id = "";
|
2822
|
+
response.isCardSave = saveCardInfo;
|
2823
|
+
response.customer_id = props == null ? void 0 : props.customerId;
|
2824
|
+
response.link_token = "";
|
2825
|
+
response.gateway_id = paymentData == null ? void 0 : paymentData.paymentGateway;
|
2826
|
+
console.log("Response :", response);
|
2827
|
+
try {
|
2828
|
+
let apiResponse = await axios4.post(`${baseUrl}preauth`, response);
|
2829
|
+
console.log(apiResponse);
|
2830
|
+
setCardData({
|
2831
|
+
cardName: "",
|
2832
|
+
cardNumber: "",
|
2833
|
+
expiryMonth: "",
|
2834
|
+
expiryYear: "",
|
2835
|
+
cvv: "",
|
2836
|
+
orderId: "",
|
2837
|
+
zipCode: ""
|
2838
|
+
});
|
2839
|
+
setSuccess(true);
|
2840
|
+
hideLoader();
|
2841
|
+
} catch (err) {
|
2842
|
+
console.log(err);
|
2843
|
+
hideLoader();
|
2844
|
+
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..");
|
2845
|
+
}
|
2846
|
+
}
|
2847
|
+
};
|
2848
|
+
if ((paymentData == null ? void 0 : paymentData.paymentGateway) === 32) {
|
2849
|
+
const requestOptions = {
|
2850
|
+
method: "POST",
|
2851
|
+
redirect: "follow"
|
2852
|
+
};
|
2853
|
+
try {
|
2854
|
+
let sesionResult = await axios4.post(`${masterBaseUrl}api/v1/widget/generate-session`, requestOptions);
|
2855
|
+
let expYear = Number(cardData == null ? void 0 : cardData.expiryYear) % 100;
|
2856
|
+
let cardNumber = cardData == null ? void 0 : cardData.cardNumber;
|
2857
|
+
cardNumber = cardNumber == null ? void 0 : cardNumber.replace(/\s+/g, "");
|
2858
|
+
let track2_data = `${cardNumber}=${expYear}${cardData == null ? void 0 : cardData.expiryMonth} ${cardData == null ? void 0 : cardData.cvv}`;
|
2859
|
+
const publicKey = forge.pki.publicKeyFromPem((_b2 = (_a2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _a2.data) == null ? void 0 : _b2.publicKeyPem);
|
2860
|
+
const encrypted = publicKey.encrypt(track2_data, "RSA-OAEP", {
|
2861
|
+
md: forge.md.sha1.create(),
|
2862
|
+
mgf1: {
|
2863
|
+
md: forge.md.sha1.create()
|
2864
|
+
}
|
2865
|
+
});
|
2866
|
+
const encryptedBase64 = forge.util.encode64(encrypted);
|
2867
|
+
const myHeaders = {
|
2868
|
+
"Content-Type": "application/json",
|
2869
|
+
"x-app-session-key": (_d2 = (_c2 = sesionResult.data) == null ? void 0 : _c2.data) == null ? void 0 : _d2.session_key
|
2870
|
+
};
|
2871
|
+
const raw = JSON.stringify({
|
2872
|
+
"enc_track2_data": `${encryptedBase64}`,
|
2873
|
+
"algorithm": "RSAES_OAEP_SHA_1",
|
2874
|
+
session_key: `${(_f = (_e = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _e.data) == null ? void 0 : _f.session_key}`
|
2875
|
+
});
|
2876
|
+
try {
|
2877
|
+
const tokenizeData = await axios4.post("https://api-dev.merchant-trends.com/tokenizer/tokenize", raw, { headers: myHeaders });
|
2878
|
+
const reqData = JSON.stringify(__spreadProps(__spreadValues({}, (_g = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _g.data), {
|
2879
|
+
// isSaveCardChecked: saveCardInfo,
|
2880
|
+
name: cardData == null ? void 0 : cardData.cardName,
|
2881
|
+
postal_code: cardData == null ? void 0 : cardData.zipCode,
|
2882
|
+
customer_id: props == null ? void 0 : props.customerId,
|
2883
|
+
"amount": props == null ? void 0 : props.amount,
|
2884
|
+
"Token": `${(_i = (_h = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _h.data) == null ? void 0 : _i.token}`,
|
2885
|
+
"fractalpayPublicKey": fractalpayClientKey,
|
2886
|
+
"order_id": props == null ? void 0 : props.orderID,
|
2887
|
+
"preAuth_id": "",
|
2888
|
+
"isCardSave": saveCardInfo,
|
2889
|
+
"discount": props == null ? void 0 : props.discount,
|
2890
|
+
"surcharge": props == null ? void 0 : props.surcharge,
|
2891
|
+
"tax": props == null ? void 0 : props.tax,
|
2892
|
+
"link_token": "",
|
2893
|
+
"ExpirationYear": cardData == null ? void 0 : cardData.expiryYear,
|
2894
|
+
"ExpirationMonth": cardData == null ? void 0 : cardData.expiryMonth,
|
2895
|
+
"CVV": cardData == null ? void 0 : cardData.cvv,
|
2896
|
+
"Last4": (_k = (_j = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _j.data) == null ? void 0 : _k.last4,
|
2897
|
+
"Brand": (_m = (_l = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _l.data) == null ? void 0 : _m.brand,
|
2898
|
+
"gateway_id": paymentData == null ? void 0 : paymentData.paymentGateway
|
2899
|
+
}));
|
2900
|
+
let myHeaders2 = {
|
2901
|
+
"Content-Type": "application/json"
|
2902
|
+
};
|
2903
|
+
try {
|
2904
|
+
let paymentRes = await axios4.post(
|
2905
|
+
`${baseUrl}preauth`,
|
2906
|
+
reqData,
|
2907
|
+
{
|
2908
|
+
headers: myHeaders2
|
2909
|
+
}
|
2910
|
+
);
|
2911
|
+
console.log(paymentRes);
|
2912
|
+
if ((_n = paymentRes == null ? void 0 : paymentRes.data) == null ? void 0 : _n.result) {
|
2913
|
+
setSuccess(true);
|
2914
|
+
hideLoader();
|
2915
|
+
}
|
2916
|
+
} catch (err) {
|
2917
|
+
hideLoader();
|
2918
|
+
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 wrong..s");
|
2919
|
+
}
|
2920
|
+
} catch (err) {
|
2921
|
+
console.log(err);
|
2922
|
+
hideLoader();
|
2923
|
+
showError(((_r = (_q = err == null ? void 0 : err.response) == null ? void 0 : _q.data) == null ? void 0 : _r.message) || (err == null ? void 0 : err.message) || "something wrong..s");
|
2924
|
+
}
|
2925
|
+
} catch (err) {
|
2926
|
+
hideLoader();
|
2927
|
+
showError(((_t = (_s = err == null ? void 0 : err.response) == null ? void 0 : _s.data) == null ? void 0 : _t.message) || (err == null ? void 0 : err.message) || "something wrong..s");
|
2928
|
+
}
|
2929
|
+
} else {
|
2930
|
+
DatacapWebToken.requestToken(paymentData == null ? void 0 : paymentData.dctoken, "PaymentForm", tokenCallback);
|
2931
|
+
}
|
2932
|
+
} catch (err) {
|
2933
|
+
hideLoader();
|
2934
|
+
showError(((_v = (_u = err == null ? void 0 : err.response) == null ? void 0 : _u.data) == null ? void 0 : _v.message) || (err == null ? void 0 : err.message) || "something wrong..s");
|
2935
|
+
}
|
2936
|
+
}
|
2937
|
+
}
|
2938
|
+
}
|
2939
|
+
};
|
2940
|
+
const getPaymentDetails = async () => {
|
2941
|
+
var _a2, _b2, _c2, _d2, _e, _f, _g, _h;
|
2942
|
+
showLoader();
|
2943
|
+
try {
|
2944
|
+
const data = {
|
2945
|
+
fractalpayPublicKey: fractalpayClientKey,
|
2946
|
+
"customer_id": props == null ? void 0 : props.customerId,
|
2947
|
+
preauth: true
|
2948
|
+
};
|
2949
|
+
let paymentData2 = await axios4.post(`${baseUrl}get-payment-details`, data);
|
2950
|
+
console.log(paymentData2);
|
2951
|
+
setPaymentData((_a2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _a2.data);
|
2952
|
+
if (((_c2 = (_b2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _b2.data) == null ? void 0 : _c2.card_list) && ((_f = (_e = (_d2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _d2.data) == null ? void 0 : _e.card_list) == null ? void 0 : _f.length) > 0) {
|
2953
|
+
setCardList((_h = (_g = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _g.data) == null ? void 0 : _h.card_list);
|
2954
|
+
setActive("cardList");
|
2955
|
+
} else {
|
2956
|
+
setActive("card");
|
2957
|
+
}
|
2958
|
+
hideLoader();
|
2959
|
+
} catch (err) {
|
2960
|
+
console.log(err);
|
2961
|
+
setActive("card");
|
2962
|
+
hideLoader();
|
2963
|
+
}
|
2964
|
+
};
|
2965
|
+
const handlechargeCustomer = async () => {
|
2966
|
+
var _b2, _c2, _d2, _e, _f;
|
2967
|
+
console.log("selected", selectedCard);
|
2968
|
+
let customer_id = props == null ? void 0 : props.customerId;
|
2969
|
+
let discount = props == null ? void 0 : props.discount;
|
2970
|
+
let surcharge = props == null ? void 0 : props.surcharge;
|
2971
|
+
let tax = props == null ? void 0 : props.tax;
|
2972
|
+
let fractalpayPublicKey = props == null ? void 0 : props.fractalpayClientKey;
|
2973
|
+
let order_id = props == null ? void 0 : props.orderID;
|
2974
|
+
let amount = props == null ? void 0 : props.amount;
|
2975
|
+
let card_id = selectedCard == null ? void 0 : selectedCard.id;
|
2976
|
+
let card_type = selectedCard == null ? void 0 : selectedCard.card_type;
|
2977
|
+
if (fractalpayPublicKey && order_id && amount) {
|
2978
|
+
if (customer_id) {
|
2979
|
+
if (card_id) {
|
2980
|
+
let chargeobj = {
|
2981
|
+
amount,
|
2982
|
+
order_id,
|
2983
|
+
customer_id,
|
2984
|
+
card_id,
|
2985
|
+
fractalpayPublicKey,
|
2986
|
+
isCardSave: card_type != "Bank",
|
2987
|
+
discount,
|
2988
|
+
surcharge,
|
2989
|
+
tax
|
2990
|
+
};
|
2991
|
+
let _a2 = chargeobj, { isCardSave } = _a2, rest = __objRest(_a2, ["isCardSave"]);
|
2992
|
+
let endpoint = card_type === "Bank" ? "charge-ach" : "charge-by-card";
|
2993
|
+
let chargeurl = baseUrl + endpoint;
|
2994
|
+
const headers = {
|
2995
|
+
"Content-Type": "application/json"
|
2996
|
+
};
|
2997
|
+
showLoader();
|
2998
|
+
try {
|
2999
|
+
let result = await axios4.post(chargeurl, card_type == "Bank" ? rest : chargeobj, { headers });
|
3000
|
+
console.log(result);
|
3001
|
+
if ((_b2 = result == null ? void 0 : result.data) == null ? void 0 : _b2.result) {
|
3002
|
+
setSuccess(true);
|
3003
|
+
hideLoader();
|
3004
|
+
}
|
3005
|
+
} catch (err) {
|
3006
|
+
hideLoader();
|
3007
|
+
console.log(err);
|
3008
|
+
showError(((_d2 = (_c2 = err == null ? void 0 : err.response) == null ? void 0 : _c2.data) == null ? void 0 : _d2.message) || ((_f = (_e = err == null ? void 0 : err.response) == null ? void 0 : _e.data) == null ? void 0 : _f.status) || "Something went erong");
|
3009
|
+
}
|
3010
|
+
} else {
|
3011
|
+
showError("Please Select A Card/ACH");
|
3012
|
+
}
|
3013
|
+
} else {
|
3014
|
+
showError("Please Select Customer");
|
3015
|
+
}
|
3016
|
+
} else {
|
3017
|
+
showError("Something went wrong , Please try again later !!!");
|
3018
|
+
}
|
3019
|
+
};
|
3020
|
+
useEffect5(() => {
|
3021
|
+
if (show && fractalpayClientKey) {
|
3022
|
+
getPaymentDetails();
|
3023
|
+
}
|
3024
|
+
}, [fractalpayClientKey, show]);
|
3025
|
+
const handleDeleteCard = async (cardId) => {
|
3026
|
+
Swal2.fire({
|
3027
|
+
icon: "warning",
|
3028
|
+
text: "Do you want to delete the card?",
|
3029
|
+
showCancelButton: true,
|
3030
|
+
confirmButtonText: "Yes",
|
3031
|
+
cancelButtonText: "No",
|
3032
|
+
reverseButtons: true,
|
3033
|
+
buttonsStyling: false,
|
3034
|
+
customClass: {
|
3035
|
+
confirmButton: "swal2-confirm btn btn-dark",
|
3036
|
+
cancelButton: "swal2-cancel btn btn-dark",
|
3037
|
+
popup: "custom-swal-popup",
|
3038
|
+
icon: "custom-swal-icon"
|
3039
|
+
}
|
3040
|
+
}).then(async (result) => {
|
3041
|
+
if (result.isConfirmed) {
|
3042
|
+
showLoader();
|
3043
|
+
try {
|
3044
|
+
let obj = {
|
3045
|
+
card_id: cardId,
|
3046
|
+
customer_id: props == null ? void 0 : props.customerId,
|
3047
|
+
fractalpayPublicKey: props == null ? void 0 : props.fractalpayClientKey
|
3048
|
+
};
|
3049
|
+
const res = await axios4.post(`${baseUrl}delete-customer-card`, obj);
|
3050
|
+
hideLoader();
|
3051
|
+
getPaymentDetails();
|
3052
|
+
console.log("Deleted:", res);
|
3053
|
+
Swal2.fire({
|
3054
|
+
icon: "success",
|
3055
|
+
title: "Deleted!",
|
3056
|
+
text: "The card has been deleted.",
|
3057
|
+
confirmButtonText: "OK",
|
3058
|
+
customClass: {
|
3059
|
+
confirmButton: "btn btn-dark"
|
3060
|
+
}
|
3061
|
+
});
|
3062
|
+
} catch (err) {
|
3063
|
+
hideLoader();
|
3064
|
+
console.error("Error:", err);
|
3065
|
+
Swal2.fire({
|
3066
|
+
icon: "error",
|
3067
|
+
title: "Error!",
|
3068
|
+
text: "Failed to delete the card.",
|
3069
|
+
confirmButtonText: "OK",
|
3070
|
+
customClass: {
|
3071
|
+
confirmButton: "btn btn-dark"
|
3072
|
+
}
|
3073
|
+
});
|
3074
|
+
}
|
3075
|
+
}
|
3076
|
+
});
|
3077
|
+
};
|
3078
|
+
return /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(DataScript, null), /* @__PURE__ */ React12.createElement(Chargewidgetstyles, null), /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(
|
3079
|
+
"button",
|
3080
|
+
{
|
3081
|
+
className: "paymentBtn",
|
3082
|
+
onClick: handleShow
|
3083
|
+
},
|
3084
|
+
"Pre Auth Pay"
|
3085
|
+
), /* @__PURE__ */ React12.createElement(
|
3086
|
+
CustomModal2_default,
|
3087
|
+
{
|
3088
|
+
open: show,
|
3089
|
+
onClose: handleClose
|
3090
|
+
},
|
3091
|
+
/* @__PURE__ */ React12.createElement(Loader_default, { loading }),
|
3092
|
+
success ? /* @__PURE__ */ React12.createElement(SuccessMsz, { onClose: handleCloseSeccess }) : /* @__PURE__ */ React12.createElement("div", null, /* @__PURE__ */ React12.createElement("div", null, /* @__PURE__ */ React12.createElement("div", { className: "parent-pay-container" }, /* @__PURE__ */ React12.createElement("span", { className: "request-payment-close-popup", onClick: handleClose }, /* @__PURE__ */ React12.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, /* @__PURE__ */ React12.createElement("g", { clipPath: "url(#clip0_12425_52336)" }, /* @__PURE__ */ React12.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__ */ React12.createElement("defs", null, /* @__PURE__ */ React12.createElement("clipPath", { id: "clip0_12425_52336" }, /* @__PURE__ */ React12.createElement("rect", { width: "16", height: "16", fill: "white" }))))), /* @__PURE__ */ React12.createElement("div", { className: "pay-container" }, /* @__PURE__ */ React12.createElement("div", { className: "pay-header pay-conatiner-one" }, /* @__PURE__ */ React12.createElement("div", { className: "pay-conatiner-one-first" }, /* @__PURE__ */ React12.createElement("div", { className: "pay-logo-container" }, /* @__PURE__ */ React12.createElement("div", { className: "pay-main-logo" }, /* @__PURE__ */ React12.createElement("img", { src: "https://fractal-userdata-upload.s3.us-east-1.amazonaws.com/uploaded/merchant_logo/20250311131124_merchant_logo.png", id: "pay-logos" })), /* @__PURE__ */ React12.createElement("h1", { className: "pay-heading" }, "Pay")), /* @__PURE__ */ React12.createElement("div", { className: "pay-amount-conatiner" }, /* @__PURE__ */ React12.createElement("small", { className: "pay-payment-amount" }, "Payment Amount"), /* @__PURE__ */ React12.createElement("strong", { className: "pay-amount" }, "$", props == null ? void 0 : props.amount)), activetab != "ach" && /* @__PURE__ */ React12.createElement("div", { style: { display: "flex", gap: "8px", margin: "8px 0" } }, /* @__PURE__ */ React12.createElement("img", { src: "https://dev-widget.fractalpay.com/images/visa-img.svg", alt: "", width: 33 }), /* @__PURE__ */ React12.createElement("img", { src: "https://dev-widget.fractalpay.com/images/mc-img.svg", width: 33, alt: "" }), /* @__PURE__ */ React12.createElement("img", { src: "https://dev-widget.fractalpay.com/images/ae-img.svg", alt: "", width: 33 }), /* @__PURE__ */ React12.createElement("img", { src: "https://dev-widget.fractalpay.com/images/discover-img.svg", width: 33, alt: "" }))), /* @__PURE__ */ React12.createElement("div", { className: "pay-conatiner-one-last" }, /* @__PURE__ */ React12.createElement("img", { src: "https://dev-widget.fractalpay.com/images/secure-img.png", alt: "" }), /* @__PURE__ */ React12.createElement("img", { src: "https://dev-widget.fractalpay.com/images/pov-by.png", alt: "" }), "Secure payments powered by Fractal"), /* @__PURE__ */ React12.createElement("div", null)), /* @__PURE__ */ React12.createElement("div", { className: "pay-tab pay-conatiner-two" }, /* @__PURE__ */ React12.createElement("div", { className: "col-md-12" }, /* @__PURE__ */ React12.createElement("div", { id: "payment-form-div" }, activetab !== "cardList" ? /* @__PURE__ */ React12.createElement("div", null, (cardList == null ? void 0 : cardList.length) > 0 && /* @__PURE__ */ React12.createElement("button", { className: "charge-payment-back-btn ", onClick: () => setActive("cardList") }, " ", /* @__PURE__ */ React12.createElement(IoArrowBack2, null), " Back")) : /* @__PURE__ */ React12.createElement("div", null, /* @__PURE__ */ React12.createElement("p", { className: "charge-customer-name" }, " Charge ", paymentData == null ? void 0 : paymentData.customer_name), /* @__PURE__ */ React12.createElement("p", { className: "card-ach-heading" }, " Cards")), /* @__PURE__ */ React12.createElement("div", { style: { display: activetab === "cardList" ? "block" : "none" }, className: "tabcontent" }, /* @__PURE__ */ React12.createElement("div", { className: "card-lint-div-in" }, /* @__PURE__ */ React12.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__ */ React12.createElement("div", { className: "card-list-single-div", key: index }, /* @__PURE__ */ React12.createElement("div", { className: "card-number-radio" }, /* @__PURE__ */ React12.createElement(
|
3093
|
+
"input",
|
3094
|
+
{
|
3095
|
+
type: "radio",
|
3096
|
+
className: "cardRadio",
|
3097
|
+
name: "selected_card",
|
3098
|
+
id: "",
|
3099
|
+
checked: selectedCard === card,
|
3100
|
+
onChange: (e) => setSelectedCard(card)
|
3101
|
+
}
|
3102
|
+
), /* @__PURE__ */ React12.createElement("label", { htmlFor: "", className: "card-number-last-four" }, "**** ", card == null ? void 0 : card.cardlastfourdigit), /* @__PURE__ */ React12.createElement("h6", { className: "card-expiry-date" }, card == null ? void 0 : card.expmonth, "/", card == null ? void 0 : card.expyear)), /* @__PURE__ */ React12.createElement("div", { className: "card-number-radio" }, /* @__PURE__ */ React12.createElement("span", { className: "visa-card" }, /* @__PURE__ */ React12.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__ */ React12.createElement("span", { className: "visa-card", style: { cursor: "pointer" }, onClick: () => handleDeleteCard(card == null ? void 0 : card.id) }, /* @__PURE__ */ React12.createElement("img", { src: "https://dev-widget.fractalpay.com/images/Trash.svg", alt: "" }))))))), /* @__PURE__ */ React12.createElement("div", { className: "pay-with-other-card ", onClick: () => setActive("card") }, "Authorize With Other Card", /* @__PURE__ */ React12.createElement("img", { src: "https://dev-widget.fractalpay.com/images/card.svg", alt: "" }))), /* @__PURE__ */ React12.createElement("div", { className: "form-group" }, /* @__PURE__ */ React12.createElement("button", { className: "pay-button", style: { margin: "0px" }, type: "submit", onClick: handlechargeCustomer }, "$", props == null ? void 0 : props.amount))), /* @__PURE__ */ React12.createElement("div", { id: "card", style: { display: activetab === "card" ? "block" : "none" }, className: "tabcontent" }, /* @__PURE__ */ React12.createElement("form", { id: "PaymentForm", onSubmit: submitFunc }, /* @__PURE__ */ React12.createElement("div", { className: "ach-scrl", style: { minHeight: (cardList == null ? void 0 : cardList.length) > 0 ? "442px" : "500px", overflow: "auto", marginRight: "5px" } }, /* @__PURE__ */ React12.createElement("div", { className: "form-group" }, /* @__PURE__ */ React12.createElement("label", { htmlFor: "cardHolderName" }, "Name on Card"), /* @__PURE__ */ React12.createElement(
|
3103
|
+
"input",
|
3104
|
+
{
|
3105
|
+
type: "text",
|
3106
|
+
className: "form-control",
|
3107
|
+
placeholder: "John Doe",
|
3108
|
+
value: (cardData == null ? void 0 : cardData.cardName) || "",
|
3109
|
+
onChange: (e) => {
|
3110
|
+
const value = e.target.value;
|
3111
|
+
if (/^[a-zA-Z\s]*$/.test(value)) {
|
3112
|
+
handleCardChange("cardName", value);
|
3113
|
+
}
|
3114
|
+
}
|
3115
|
+
}
|
3116
|
+
), (cardError == null ? void 0 : cardError.cardName) && /* @__PURE__ */ React12.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cardName)), /* @__PURE__ */ React12.createElement("div", { className: "form-group" }, /* @__PURE__ */ React12.createElement("label", { htmlFor: "cardNumber" }, "Card Number"), /* @__PURE__ */ React12.createElement("div", { className: "toggle-num-wrapper" }, /* @__PURE__ */ React12.createElement(
|
3117
|
+
"input",
|
3118
|
+
{
|
3119
|
+
className: "form-control card-number-new",
|
3120
|
+
type: "text",
|
3121
|
+
maxLength: 19,
|
3122
|
+
inputMode: "numeric",
|
3123
|
+
placeholder: "0000 0000 0000 0000",
|
3124
|
+
value: (cardData == null ? void 0 : cardData.cardNumber) || "",
|
3125
|
+
onChange: (e) => handleCardNumberChange(e),
|
3126
|
+
"data-token": "card_number"
|
3127
|
+
}
|
3128
|
+
), /* @__PURE__ */ React12.createElement("div", { className: "card-crdi card-expiry-new" }, /* @__PURE__ */ React12.createElement("div", { className: "exp-date-year-container" }, /* @__PURE__ */ React12.createElement("div", { className: "exp-date form-group" }, /* @__PURE__ */ React12.createElement(
|
3129
|
+
"input",
|
3130
|
+
{
|
3131
|
+
"data-token": "exp_month",
|
3132
|
+
className: "form-control required",
|
3133
|
+
type: "text",
|
3134
|
+
placeholder: "MM",
|
3135
|
+
maxLength: 2,
|
3136
|
+
value: (cardData == null ? void 0 : cardData.expiryMonth) || "",
|
3137
|
+
onChange: (e) => handleCardChange("expiryMonth", e.target.value)
|
3138
|
+
}
|
3139
|
+
)), /* @__PURE__ */ React12.createElement("div", { className: "exp-year form-group" }, /* @__PURE__ */ React12.createElement(
|
3140
|
+
"input",
|
3141
|
+
{
|
3142
|
+
"data-token": "exp_year",
|
3143
|
+
className: "form-control required",
|
3144
|
+
type: "text",
|
3145
|
+
placeholder: "YYYY",
|
3146
|
+
maxLength: 4,
|
3147
|
+
value: (cardData == null ? void 0 : cardData.expiryYear) || "",
|
3148
|
+
onChange: (e) => handleCardChange("expiryYear", e.target.value)
|
3149
|
+
}
|
3150
|
+
)), /* @__PURE__ */ React12.createElement("div", { className: "security-digit form-group" }, /* @__PURE__ */ React12.createElement(
|
3151
|
+
"input",
|
3152
|
+
{
|
3153
|
+
"data-token": "cvv",
|
3154
|
+
className: "form-control required",
|
3155
|
+
type: "text",
|
3156
|
+
maxLength: 4,
|
3157
|
+
placeholder: "CVC",
|
3158
|
+
value: (cardData == null ? void 0 : cardData.cvv) || "",
|
3159
|
+
onChange: (e) => handleCardChange("cvv", e.target.value)
|
3160
|
+
}
|
3161
|
+
)))), (cardError == null ? void 0 : cardError.cardNumber) && /* @__PURE__ */ React12.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cardNumber), /* @__PURE__ */ React12.createElement("p", { style: { margin: "0" } }, (cardError == null ? void 0 : cardError.expiryMonth) || (cardError == null ? void 0 : cardError.expiryYear) ? /* @__PURE__ */ React12.createElement("span", { className: "error-span", style: { paddingRight: "4px" } }, cardError == null ? void 0 : cardError.expiryMonth) : "", (cardError == null ? void 0 : cardError.cvv) && /* @__PURE__ */ React12.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cvv)))), /* @__PURE__ */ React12.createElement("div", { className: "form-group" }, /* @__PURE__ */ React12.createElement("label", { htmlFor: "OrderId" }, "Order ID / Description"), /* @__PURE__ */ React12.createElement(
|
3162
|
+
"input",
|
3163
|
+
{
|
3164
|
+
type: "text",
|
3165
|
+
className: "form-control",
|
3166
|
+
maxLength: 100,
|
3167
|
+
placeholder: "OID123456",
|
3168
|
+
disabled: true,
|
3169
|
+
value: (_c = cardData == null ? void 0 : cardData.orderId) != null ? _c : "OID123456",
|
3170
|
+
onChange: (e) => handleCardChange("orderId", e.target.value),
|
3171
|
+
style: { background: "#F6F6F7", color: "#727272" }
|
3172
|
+
}
|
3173
|
+
)), /* @__PURE__ */ React12.createElement("div", { className: "form-group" }, /* @__PURE__ */ React12.createElement("label", { htmlFor: "zip" }, "ZIP"), /* @__PURE__ */ React12.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__ */ React12.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.zipCode)), /* @__PURE__ */ React12.createElement("div", { className: "form-group" }, /* @__PURE__ */ React12.createElement("div", { style: { display: "flex", alignItems: "center", gap: "10px", paddingTop: "10px" } }, /* @__PURE__ */ React12.createElement(
|
3174
|
+
"input",
|
3175
|
+
{
|
3176
|
+
type: "checkbox",
|
3177
|
+
id: "save_card",
|
3178
|
+
className: "toggle-checkbox",
|
3179
|
+
checked: saveCardInfo,
|
3180
|
+
onChange: (e) => setSaveCardInfo(e.target.checked)
|
3181
|
+
}
|
3182
|
+
), /* @__PURE__ */ React12.createElement("label", { htmlFor: "save_card", className: "toggle-label" }), /* @__PURE__ */ React12.createElement("label", { htmlFor: "save_card" }, "Save card for future payments")))), /* @__PURE__ */ React12.createElement("div", { className: "form-group", style: { marginTop: "20px", padding: 0 } }, /* @__PURE__ */ React12.createElement("button", { type: "submit", style: { margin: 0 }, className: "pay-button" }, "$", props == null ? void 0 : props.amount)))))))))))
|
3183
|
+
)));
|
3184
|
+
}
|
3185
|
+
|
3186
|
+
// src/app/components/AddCard/AddCard.tsx
|
3187
|
+
import React17, { useEffect as useEffect6, useState as useState5 } from "react";
|
3188
|
+
import Swal3 from "sweetalert2";
|
3189
|
+
import axios5 from "axios";
|
3190
|
+
|
3191
|
+
// src/app/components/AddCard/AddCardStyles.tsx
|
3192
|
+
import React13 from "react";
|
3193
|
+
function AddCardStyle() {
|
3194
|
+
const primarycolor = "#000";
|
3195
|
+
const primarybgcolor = "#fff";
|
3196
|
+
const primarybodycolor = "#212529";
|
3197
|
+
const primarybordercolor = "#dee2e6";
|
3198
|
+
return /* @__PURE__ */ React13.createElement("style", null, `
|
3199
|
+
.add-card {
|
3200
|
+
max-width:380px;
|
3201
|
+
padding: 0 20px
|
3202
|
+
}
|
3203
|
+
.add-card .form-group {
|
3204
|
+
margin-bottom: 5px;
|
3205
|
+
}
|
3206
|
+
|
3207
|
+
.add-card .idle-green-btn {
|
3208
|
+
color: white;
|
3209
|
+
background-color: rgba(97, 198, 153, 1);
|
3210
|
+
border-radius: 100px;
|
3211
|
+
border: none !important;
|
3212
|
+
padding: 12px 24px 12px 24px;
|
3213
|
+
width: 100%;
|
3214
|
+
cursor:pointer
|
3215
|
+
}
|
3216
|
+
|
3217
|
+
.add-card .idle-green-btn:hover {
|
3218
|
+
background-color: rgba(65, 164, 120, 1) !important;
|
3219
|
+
}
|
3220
|
+
|
3221
|
+
.add-card .idle-green-btn:focus {
|
3222
|
+
border: 2px solid rgba(90, 172, 136, 1) !important;
|
3223
|
+
background-color: rgba(97, 198, 153, 1) !important;
|
3224
|
+
padding: 10px 24px 10px 24px;
|
3225
|
+
}
|
3226
|
+
|
3227
|
+
.add-card .container-creditcard {
|
3228
|
+
width: 426px;
|
3229
|
+
padding: 24px;
|
3230
|
+
background-color: #FFFFFF;
|
3231
|
+
border-radius: 24px;
|
3232
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
3233
|
+
}
|
3234
|
+
.add-card .container-creditcard .request-payment-close-popup{
|
3235
|
+
position:absolute;
|
3236
|
+
// background:red
|
3237
|
+
}
|
3238
|
+
|
3239
|
+
.add-card h2 {
|
3240
|
+
font-size: 24px;
|
3241
|
+
line-height: 32px;
|
3242
|
+
font-weight: 500;
|
3243
|
+
color: #35254D;
|
3244
|
+
margin-bottom: 24px;
|
3245
|
+
text-align: center;
|
3246
|
+
}
|
3247
|
+
.add-card .form-group {
|
3248
|
+
margin-top: 20px;
|
3249
|
+
margin-bottom : 10px
|
3250
|
+
}
|
3251
|
+
|
3252
|
+
.add-card .credit-card {
|
3253
|
+
display: flex;
|
3254
|
+
flex-direction: column;
|
3255
|
+
justify-content: space-between;
|
3256
|
+
align-items: flex-start;
|
3257
|
+
padding: 20px;
|
3258
|
+
background-color: #35254D;
|
3259
|
+
color: #FFFFFF;
|
3260
|
+
border-radius: 15px;
|
3261
|
+
margin-bottom: 20px;
|
3262
|
+
}
|
3263
|
+
|
3264
|
+
.add-card .credit-card .chip {
|
3265
|
+
width: 50px;
|
3266
|
+
height: 30px;
|
3267
|
+
background-image: url('https://raw.githubusercontent.com/danieldasilvaa/creditcard-html-css/main/chip.png');
|
3268
|
+
background-size: cover;
|
3269
|
+
margin-bottom: 10px;
|
3270
|
+
}
|
3271
|
+
|
3272
|
+
.add-card .credit-card .card-number {
|
3273
|
+
font-size: 18px;
|
3274
|
+
letter-spacing: 2px;
|
3275
|
+
margin-bottom: 10px;
|
3276
|
+
}
|
3277
|
+
|
3278
|
+
.add-card .credit-card .card-info {
|
3279
|
+
font-size: 14px;
|
3280
|
+
margin-bottom: 5px;
|
3281
|
+
}
|
3282
|
+
|
3283
|
+
.add-card label {
|
3284
|
+
font-size: 12px;
|
3285
|
+
font-family: 'IBM Plex Mono', monospace;
|
3286
|
+
font-weight: 400;
|
3287
|
+
text-transform: uppercase;
|
3288
|
+
color: #35254D;
|
3289
|
+
margin-bottom: 6px;
|
3290
|
+
}
|
3291
|
+
|
3292
|
+
.add-card input[type="text"],
|
3293
|
+
.add-card input[type="number"],
|
3294
|
+
.add-card input[type="date"],
|
3295
|
+
.add-card input[type="email"],
|
3296
|
+
.add-card select {
|
3297
|
+
width: 100%;
|
3298
|
+
padding: 12px;
|
3299
|
+
font-size: 14px;
|
3300
|
+
font-weight: 500;
|
3301
|
+
color: #35254D;
|
3302
|
+
border: 1px solid #D4CDDF;
|
3303
|
+
border-radius: 6px;
|
3304
|
+
background-color: #FFFFFF;
|
3305
|
+
box-sizing: border-box;
|
3306
|
+
// margin-bottom: 20px;
|
3307
|
+
}
|
3308
|
+
|
3309
|
+
.add-card input[type="text"]::placeholder {
|
3310
|
+
color: #867C94;
|
3311
|
+
}
|
3312
|
+
|
3313
|
+
// .add-card input[type="submit"] {
|
3314
|
+
// width: 100%;
|
3315
|
+
// padding: 12px;
|
3316
|
+
// background-color: #161616;
|
3317
|
+
// color: #FFFFFF;
|
3318
|
+
// font-size: 14px;
|
3319
|
+
// font-weight: 500;
|
3320
|
+
// border: none;
|
3321
|
+
// border-radius: 1000px;
|
3322
|
+
// cursor: pointer;
|
3323
|
+
// text-align: center;
|
3324
|
+
// }
|
3325
|
+
|
3326
|
+
.add-card input[type="submit"]:hover {
|
3327
|
+
background-color: #000000;
|
3328
|
+
}
|
3329
|
+
|
3330
|
+
.add-card .error {
|
3331
|
+
font-size: 12px;
|
3332
|
+
color: red;
|
3333
|
+
margin-top: -15px;
|
3334
|
+
margin-bottom: 15px;
|
3335
|
+
}
|
3336
|
+
|
3337
|
+
/* Tab Styling */
|
3338
|
+
.add-card .tabs {
|
3339
|
+
display: flex;
|
3340
|
+
gap: 4px;
|
3341
|
+
margin-bottom: 24px;
|
3342
|
+
justify-content: center;
|
3343
|
+
}
|
3344
|
+
|
3345
|
+
.add-card .tab {
|
3346
|
+
display: flex;
|
3347
|
+
justify-content: center;
|
3348
|
+
align-items: center;
|
3349
|
+
padding: 6px 16px;
|
3350
|
+
font-size: 14px;
|
3351
|
+
font-weight: 500;
|
3352
|
+
border: 1px solid #D4CDDF;
|
3353
|
+
border-radius: 1000px;
|
3354
|
+
cursor: pointer;
|
3355
|
+
}
|
3356
|
+
|
3357
|
+
.add-card .tab.active {
|
3358
|
+
border-color: #35254D;
|
3359
|
+
color: #35254D;
|
3360
|
+
}
|
3361
|
+
|
3362
|
+
.add-card .tab:hover {
|
3363
|
+
border-color: #867C94;
|
3364
|
+
}
|
3365
|
+
|
3366
|
+
/* Buttons */
|
3367
|
+
.add-card .button-close {
|
3368
|
+
display: inline-block;
|
3369
|
+
background-color: #161616;
|
3370
|
+
color: #FFFFFF;
|
3371
|
+
font-size: 14px;
|
3372
|
+
font-weight: 500;
|
3373
|
+
padding: 12px 32px;
|
3374
|
+
border-radius: 1000px;
|
3375
|
+
text-align: center;
|
3376
|
+
cursor: pointer;
|
3377
|
+
width: 48%;
|
3378
|
+
box-sizing: border-box;
|
3379
|
+
}
|
3380
|
+
|
3381
|
+
.add-card .button-close:hover {
|
3382
|
+
background-color: #000000;
|
3383
|
+
}
|
3384
|
+
|
3385
|
+
.add-card .btn-add1 {
|
3386
|
+
display: inline-block;
|
3387
|
+
background-color: #61c699;
|
3388
|
+
color: #FFFFFF;
|
3389
|
+
font-size: 14px;
|
3390
|
+
font-weight: 500;
|
3391
|
+
padding: 12px 32px;
|
3392
|
+
border-radius: 1000px;
|
3393
|
+
text-align: center;
|
3394
|
+
cursor: pointer;
|
3395
|
+
width: 48%;
|
3396
|
+
box-sizing: border-box;
|
3397
|
+
}
|
3398
|
+
|
3399
|
+
.add-card .btn-add1:hover {
|
3400
|
+
background-color: #B5E1CB;
|
3401
|
+
}
|
3402
|
+
|
3403
|
+
/* Combined Expiration Date and CVC Row */
|
3404
|
+
.add-card .exp-cvc-container {
|
3405
|
+
display: flex;
|
3406
|
+
justify-content: space-between;
|
3407
|
+
gap: 16px;
|
3408
|
+
margin-bottom: 5px;
|
3409
|
+
}
|
3410
|
+
|
3411
|
+
.add-card .exp-cvc-container input {
|
3412
|
+
flex: 1;
|
3413
|
+
padding: 12px;
|
3414
|
+
font-size: 14px;
|
3415
|
+
font-weight: 500;
|
3416
|
+
color: #35254D;
|
3417
|
+
border: 1px solid #D4CDDF;
|
3418
|
+
border-radius: 6px;
|
3419
|
+
background-color: #FFFFFF;
|
3420
|
+
box-sizing: border-box;
|
3421
|
+
}
|
3422
|
+
|
3423
|
+
.add-card .exp-cvc-container input::placeholder {
|
3424
|
+
color: #867C94;
|
3425
|
+
}
|
3426
|
+
|
3427
|
+
/* Responsive Design */
|
3428
|
+
@media screen and (max-width: 768px) {
|
3429
|
+
.add-card .container-creditcard {
|
3430
|
+
width: 90%;
|
3431
|
+
padding: 20px;
|
3432
|
+
}
|
3433
|
+
|
3434
|
+
.add-card input[type="submit"] {
|
3435
|
+
font-size: 12px;
|
3436
|
+
padding: 10px;
|
3437
|
+
}
|
3438
|
+
}
|
3439
|
+
|
3440
|
+
`);
|
3441
|
+
}
|
3442
|
+
|
3443
|
+
// src/app/components/CustomModal/CustomModal.tsx
|
3444
|
+
import React14 from "react";
|
3445
|
+
var CustomModal = ({
|
3446
|
+
open,
|
3447
|
+
onClose,
|
3448
|
+
children
|
3449
|
+
}) => {
|
3450
|
+
if (!open) return null;
|
3451
|
+
return /* @__PURE__ */ React14.createElement("div", { style: {
|
3452
|
+
position: "fixed",
|
3453
|
+
top: 0,
|
3454
|
+
left: 0,
|
3455
|
+
width: "100%",
|
3456
|
+
height: "100%",
|
3457
|
+
zIndex: 5,
|
3458
|
+
backgroundColor: "rgba(0,0,0,0.5)",
|
3459
|
+
display: "flex",
|
3460
|
+
justifyContent: "center",
|
3461
|
+
alignItems: "center"
|
3462
|
+
} }, /* @__PURE__ */ React14.createElement("div", { style: { background: "white", padding: "20px", borderRadius: "8px", minWidth: "300px" } }, /* @__PURE__ */ React14.createElement("div", { className: "", style: { display: "flex", justifyContent: "end" } }, /* @__PURE__ */ React14.createElement("button", { onClick: onClose, style: { border: "none", background: "transparent" } }, "X")), /* @__PURE__ */ React14.createElement("div", null, children)));
|
3463
|
+
};
|
3464
|
+
var CustomModal_default = CustomModal;
|
3465
|
+
|
3466
|
+
// src/app/components/SuccessCardMessage/SuccessCardMsz.tsx
|
3467
|
+
import React16 from "react";
|
3468
|
+
|
3469
|
+
// src/app/components/SuccessCardMessage/SuccessCardMszStyle.tsx
|
3470
|
+
import React15 from "react";
|
3471
|
+
function SuccessCardMszStyle() {
|
3472
|
+
return /* @__PURE__ */ React15.createElement("style", null, `
|
3473
|
+
.card-success .logo-container {
|
3474
|
+
display: flex;
|
3475
|
+
justify-content: center;
|
3476
|
+
align-items: center;
|
3477
|
+
margin-bottom: -50px; /* Adjust this to overlap the content */
|
3478
|
+
z-index: 10;
|
3479
|
+
}
|
3480
|
+
|
3481
|
+
.card-success .client-logo {
|
3482
|
+
max-width: 100px;
|
3483
|
+
height: auto;
|
3484
|
+
object-fit: contain;
|
3485
|
+
display: block;
|
3486
|
+
}
|
3487
|
+
|
3488
|
+
.card-success .payment-success-container {
|
3489
|
+
display: flex;
|
3490
|
+
flex-direction: column;
|
3491
|
+
align-items: center;
|
3492
|
+
padding: 18px 20px 24px;
|
3493
|
+
width: 335px;
|
3494
|
+
height: 400px; /* Fixed height */
|
3495
|
+
background: #FFFFFF;
|
3496
|
+
border-radius: 12px;
|
3497
|
+
position: relative;
|
3498
|
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
3499
|
+
border: 1px solid #e3e3e3;
|
3500
|
+
justify-content: center;
|
3501
|
+
text-align: center;
|
3502
|
+
margin-top: 50px; /* Adjust this to move the content down */
|
3503
|
+
}
|
3504
|
+
|
3505
|
+
.card-success .success-icon {
|
3506
|
+
display: flex;
|
3507
|
+
flex-direction: column;
|
3508
|
+
align-items: center;
|
3509
|
+
gap: 12px;
|
3510
|
+
width: 227px;
|
3511
|
+
height: 116px;
|
3512
|
+
z-index: 2;
|
3513
|
+
}
|
3514
|
+
|
3515
|
+
.card-success .circle {
|
3516
|
+
width: 40px;
|
3517
|
+
height: 40px;
|
3518
|
+
border: 1px solid #49B182;
|
3519
|
+
border-radius: 50%;
|
3520
|
+
display: flex;
|
3521
|
+
justify-content: center;
|
3522
|
+
align-items: center;
|
3523
|
+
}
|
3524
|
+
|
3525
|
+
.card-success .circle .fa-check-circle {
|
3526
|
+
font-size: 20px;
|
3527
|
+
color: #49B182;
|
3528
|
+
}
|
3529
|
+
|
3530
|
+
.card-success .success-text {
|
3531
|
+
display: flex;
|
3532
|
+
flex-direction: column;
|
3533
|
+
justify-content: center;
|
3534
|
+
align-items: center;
|
3535
|
+
gap: 4px;
|
3536
|
+
width: 227px;
|
3537
|
+
}
|
3538
|
+
|
3539
|
+
.card-success .payment-success-text {
|
3540
|
+
font-family: 'Inter', sans-serif;
|
3541
|
+
font-weight: 500;
|
3542
|
+
font-size: 18px;
|
3543
|
+
line-height: 21px;
|
3544
|
+
text-align: center;
|
3545
|
+
letter-spacing: -0.02em;
|
3546
|
+
color: #161616;
|
3547
|
+
}
|
3548
|
+
|
3549
|
+
.card-success .thank-you-text {
|
3550
|
+
font-family: 'Inter', sans-serif;
|
3551
|
+
font-weight: 500;
|
3552
|
+
font-size: 14px;
|
3553
|
+
line-height: 18px;
|
3554
|
+
text-align: center;
|
3555
|
+
letter-spacing: -0.02em;
|
3556
|
+
color: #161616;
|
3557
|
+
opacity: 0.5;
|
3558
|
+
}
|
3559
|
+
`);
|
3560
|
+
}
|
3561
|
+
|
3562
|
+
// src/app/components/SuccessCardMessage/SuccessCardMsz.tsx
|
3563
|
+
var SuccessCardMsz = ({ onClose }) => {
|
3564
|
+
return /* @__PURE__ */ React16.createElement(React16.Fragment, null, /* @__PURE__ */ React16.createElement(SuccessCardMszStyle, null), /* @__PURE__ */ React16.createElement("div", { className: "card-success" }, /* @__PURE__ */ React16.createElement("div", { className: "logo-container" }, /* @__PURE__ */ React16.createElement("img", { src: "<%= merchant_logo %>", alt: "", className: "client-logo" })), /* @__PURE__ */ React16.createElement("div", { className: "payment-success-container" }, /* @__PURE__ */ React16.createElement("div", { className: "success-icon" }, /* @__PURE__ */ React16.createElement("div", { className: "circle" }, /* @__PURE__ */ React16.createElement("i", { className: "fa fa-check-circle", "aria-hidden": "true" })), /* @__PURE__ */ React16.createElement("div", { className: "success-text" }, /* @__PURE__ */ React16.createElement("div", { className: "payment-success-text" }, "Your card was added successfully."), /* @__PURE__ */ React16.createElement("div", { className: "thank-you-text" }, "Thank you "))))));
|
3565
|
+
};
|
3566
|
+
var SuccessCardMsz_default = SuccessCardMsz;
|
3567
|
+
|
3568
|
+
// src/app/components/AddCard/AddCard.tsx
|
3569
|
+
function AddCard(props) {
|
3570
|
+
var _a;
|
3571
|
+
const [loading, setLoading] = useState5(false);
|
3572
|
+
const [success, setSuccess] = useState5(false);
|
3573
|
+
const [show, setShow] = useState5(false);
|
3574
|
+
const [cardData, setCardData] = useState5();
|
3575
|
+
const [cardError, setCardError] = useState5({});
|
3576
|
+
const [paymentData, setPaymentData] = useState5();
|
3577
|
+
const showLoader = () => setLoading(true);
|
3578
|
+
const hideLoader = () => setLoading(false);
|
3579
|
+
const showError = (msz) => {
|
3580
|
+
Swal3.fire({
|
3581
|
+
icon: "error",
|
3582
|
+
text: msz
|
3583
|
+
});
|
3584
|
+
};
|
3585
|
+
const handleClose = () => {
|
3586
|
+
setShow(false);
|
3587
|
+
setSuccess(false);
|
3588
|
+
setCardData({
|
3589
|
+
cardName: "",
|
3590
|
+
cardNumber: "",
|
3591
|
+
expiryMonth: "",
|
3592
|
+
expiryYear: "",
|
3593
|
+
cvv: "",
|
3594
|
+
orderId: "",
|
3595
|
+
zipCode: ""
|
3596
|
+
});
|
3597
|
+
};
|
3598
|
+
const handleShow = () => setShow(true);
|
3599
|
+
const handleCloseSeccess = () => {
|
3600
|
+
handleClose();
|
3601
|
+
};
|
3602
|
+
const handleCardChange = (field, value) => {
|
3603
|
+
const name = field;
|
3604
|
+
const numericFields = ["expiryMonth", "expiryYear", "zipCode", "cvv"];
|
3605
|
+
if (numericFields.includes(name)) {
|
3606
|
+
if (value === "" || /^[0-9]+$/.test(value)) {
|
3607
|
+
setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
|
3608
|
+
[name]: ""
|
3609
|
+
}));
|
3610
|
+
setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
|
3611
|
+
[name]: value
|
3612
|
+
}));
|
3613
|
+
}
|
3614
|
+
return;
|
3615
|
+
}
|
3616
|
+
setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
|
3617
|
+
[name]: ""
|
3618
|
+
}));
|
3619
|
+
console.log(value, name);
|
3620
|
+
setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
|
3621
|
+
[name]: value
|
3622
|
+
}));
|
3623
|
+
};
|
3624
|
+
const handleCardNumberChange = (e) => {
|
3625
|
+
const input = e.target;
|
3626
|
+
const rawValue = input.value.replace(/\D/g, "");
|
3627
|
+
let formatted = "";
|
3628
|
+
if (/^3[47]/.test(rawValue)) {
|
3629
|
+
const trimmed = rawValue.slice(0, 15);
|
3630
|
+
formatted = trimmed.replace(
|
3631
|
+
/^(\d{1,4})(\d{1,6})?(\d{1,5})?$/,
|
3632
|
+
(_, g1, g2, g3) => [g1, g2, g3].filter(Boolean).join(" ")
|
3633
|
+
);
|
3634
|
+
} else {
|
3635
|
+
const trimmed = rawValue.slice(0, 16);
|
3636
|
+
formatted = trimmed.replace(
|
3637
|
+
/^(\d{1,4})(\d{1,4})?(\d{1,4})?(\d{1,4})?$/,
|
3638
|
+
(_, g1, g2, g3, g4) => [g1, g2, g3, g4].filter(Boolean).join(" ")
|
3639
|
+
);
|
3640
|
+
}
|
3641
|
+
setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
|
3642
|
+
cardNumber: ""
|
3643
|
+
}));
|
3644
|
+
setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
|
3645
|
+
cardNumber: formatted
|
3646
|
+
}));
|
3647
|
+
};
|
3648
|
+
const validateCardData = () => {
|
3649
|
+
var _a2, _b, _c, _d, _e, _f, _g;
|
3650
|
+
const errors = {};
|
3651
|
+
const data = cardData;
|
3652
|
+
const month = parseInt((data == null ? void 0 : data.expiryMonth) || "", 10);
|
3653
|
+
const year = (data == null ? void 0 : data.expiryYear) || "";
|
3654
|
+
if (!((_a2 = data == null ? void 0 : data.cardName) == null ? void 0 : _a2.trim())) errors.cardName = "Card name is required";
|
3655
|
+
if (!((_b = data == null ? void 0 : data.cardNumber) == null ? void 0 : _b.trim())) errors.cardNumber = "Card number is required";
|
3656
|
+
if (!((_c = data == null ? void 0 : data.expiryMonth) == null ? void 0 : _c.trim())) {
|
3657
|
+
errors.expiryMonth = "Expiration month is required";
|
3658
|
+
} else if (Number(data == null ? void 0 : data.expiryMonth) > 12 || Number(data == null ? void 0 : data.expiryMonth) < 1) {
|
3659
|
+
errors.expiryMonth = "Invalid Expiration Month.";
|
3660
|
+
}
|
3661
|
+
if (!((_d = data == null ? void 0 : data.expiryYear) == null ? void 0 : _d.trim())) {
|
3662
|
+
errors.expiryYear = "Expiration year is required";
|
3663
|
+
} else if (((_e = data == null ? void 0 : data.expiryYear) == null ? void 0 : _e.trim().length) !== 4 || Number(data == null ? void 0 : data.expiryYear) < 2025) {
|
3664
|
+
errors.expiryYear = "Invalid Expiration Year.";
|
3665
|
+
} else if (isNaN(month) || month < 1 || month > 12 || year.length !== 4) {
|
3666
|
+
errors.expiryMonth = "Invalid Expiration Date.";
|
3667
|
+
}
|
3668
|
+
if (!((_f = data == null ? void 0 : data.cvv) == null ? void 0 : _f.trim())) errors.cvv = "CVC is required";
|
3669
|
+
if (!((_g = data == null ? void 0 : data.zipCode) == null ? void 0 : _g.trim())) errors.zipCode = "ZIP code is required";
|
3670
|
+
if ((data == null ? void 0 : data.expiryMonth) && (data == null ? void 0 : data.expiryYear) && data.expiryMonth.length <= 2 && data.expiryYear.length === 4) {
|
3671
|
+
const month2 = parseInt(data.expiryMonth, 10);
|
3672
|
+
const year2 = parseInt(data.expiryYear, 10);
|
3673
|
+
const now = /* @__PURE__ */ new Date();
|
3674
|
+
const currentMonth = now.getMonth() + 1;
|
3675
|
+
const currentYear = now.getFullYear();
|
3676
|
+
if (year2 < currentYear || year2 === currentYear && month2 < currentMonth) {
|
3677
|
+
errors.expiryMonth = "Card is expired";
|
3678
|
+
}
|
3679
|
+
}
|
3680
|
+
setCardError(errors);
|
3681
|
+
return Object.keys(errors).length > 0;
|
3682
|
+
};
|
3683
|
+
const getPaymentDetails = async () => {
|
3684
|
+
var _a2, _b, _c, _d, _e, _f;
|
3685
|
+
showLoader();
|
3686
|
+
try {
|
3687
|
+
const data = {
|
3688
|
+
fractalpayPublicKey: props == null ? void 0 : props.fractalpayClientKey,
|
3689
|
+
"customer_id": props == null ? void 0 : props.customerId,
|
3690
|
+
addcard: true
|
3691
|
+
};
|
3692
|
+
let paymentData2 = await axios5.post(`${baseUrl}get-payment-details`, data);
|
3693
|
+
console.log(paymentData2);
|
3694
|
+
setPaymentData((_a2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _a2.data);
|
3695
|
+
if (((_c = (_b = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _b.data) == null ? void 0 : _c.card_list) && ((_f = (_e = (_d = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _d.data) == null ? void 0 : _e.card_list) == null ? void 0 : _f.length) > 0) {
|
3696
|
+
} else {
|
3697
|
+
}
|
3698
|
+
hideLoader();
|
3699
|
+
} catch (err) {
|
3700
|
+
console.log(err);
|
3701
|
+
hideLoader();
|
3702
|
+
}
|
3703
|
+
};
|
3704
|
+
useEffect6(() => {
|
3705
|
+
if (show && props.fractalpayClientKey) {
|
3706
|
+
getPaymentDetails();
|
3707
|
+
}
|
3708
|
+
}, [props == null ? void 0 : props.fractalpayClientKey, show]);
|
3709
|
+
const addCardFunc = async (e) => {
|
3710
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
3711
|
+
e.preventDefault();
|
3712
|
+
const hasError = validateCardData();
|
3713
|
+
console.log(cardData);
|
3714
|
+
if (hasError) return;
|
3715
|
+
else {
|
3716
|
+
let validCard = DatacapWebToken.validateCardNumber(cardData == null ? void 0 : cardData.cardNumber.replaceAll(" ", ""));
|
3717
|
+
let validExpirationDate = DatacapWebToken.validateExpirationDate(cardData == null ? void 0 : cardData.expiryMonth, cardData == null ? void 0 : cardData.expiryYear);
|
3718
|
+
let validCVV = DatacapWebToken.validateCVV(cardData == null ? void 0 : cardData.cvv);
|
3719
|
+
let errors = {};
|
3720
|
+
if (!validCard) errors.cardNumber = "Invalid card Number";
|
3721
|
+
if (!validExpirationDate) errors.expiryMonth = "Invalid Expiration Date.";
|
3722
|
+
if (!validCVV) errors.cvv = "Invalid CVV";
|
3723
|
+
setCardError(errors);
|
3724
|
+
if (validCard && validCVV && validExpirationDate) {
|
3725
|
+
showLoader();
|
3726
|
+
try {
|
3727
|
+
let getTokenCallback = async function(token) {
|
3728
|
+
var _a3, _b2, _c2, _d2, _e2;
|
3729
|
+
console.log(token);
|
3730
|
+
if (token.Error) {
|
3731
|
+
console.log(token == null ? void 0 : token.Error);
|
3732
|
+
showError(token.Error);
|
3733
|
+
hideLoader();
|
3734
|
+
} else {
|
3735
|
+
const reqData = {
|
3736
|
+
userId: props == null ? void 0 : props.customerId,
|
3737
|
+
cardName: cardData == null ? void 0 : cardData.cardName,
|
3738
|
+
zip: cardData == null ? void 0 : cardData.zipCode,
|
3739
|
+
fractalpayPublicKey: props == null ? void 0 : props.fractalpayClientKey,
|
3740
|
+
token
|
3741
|
+
};
|
3742
|
+
try {
|
3743
|
+
let apiResponse = await axios5.post(`${baseUrl}add-card`, reqData);
|
3744
|
+
console.log(apiResponse);
|
3745
|
+
let formData = {
|
3746
|
+
fractalpayPublicKey: props == null ? void 0 : props.fractalpayClientKey,
|
3747
|
+
wallet_id: "",
|
3748
|
+
card_number: cardData == null ? void 0 : cardData.cardNumber.replaceAll(" ", ""),
|
3749
|
+
exp_month: cardData == null ? void 0 : cardData.expiryMonth,
|
3750
|
+
exp_year: (_a3 = cardData == null ? void 0 : cardData.expiryYear) == null ? void 0 : _a3.slice(-2),
|
3751
|
+
cvv: cardData == null ? void 0 : cardData.cvv
|
3752
|
+
};
|
3753
|
+
try {
|
3754
|
+
const result = await axios5.post(`${baseUrl}link-wallet`, formData);
|
3755
|
+
console.log(result);
|
3756
|
+
setSuccess(true);
|
3757
|
+
hideLoader();
|
3758
|
+
setCardData({
|
3759
|
+
cardName: "",
|
3760
|
+
cardNumber: "",
|
3761
|
+
expiryMonth: "",
|
3762
|
+
expiryYear: "",
|
3763
|
+
cvv: "",
|
3764
|
+
orderId: "",
|
3765
|
+
zipCode: ""
|
3766
|
+
});
|
3767
|
+
} catch (err) {
|
3768
|
+
console.log(err);
|
3769
|
+
hideLoader();
|
3770
|
+
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..");
|
3771
|
+
}
|
3772
|
+
} catch (err) {
|
3773
|
+
console.log(err);
|
3774
|
+
hideLoader();
|
3775
|
+
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..");
|
3776
|
+
}
|
3777
|
+
}
|
3778
|
+
};
|
3779
|
+
if ((paymentData == null ? void 0 : paymentData.paymentGateway) === 32) {
|
3780
|
+
const requestOptions = {
|
3781
|
+
method: "POST",
|
3782
|
+
redirect: "follow"
|
3783
|
+
};
|
3784
|
+
try {
|
3785
|
+
let sesionResult = await axios5.post(`${masterBaseUrl}api/v1/widget/generate-session`, requestOptions);
|
3786
|
+
let expYear = Number(cardData == null ? void 0 : cardData.expiryYear) % 100;
|
3787
|
+
let cardNumber = cardData == null ? void 0 : cardData.cardNumber;
|
3788
|
+
cardNumber = cardNumber == null ? void 0 : cardNumber.replace(/\s+/g, "");
|
3789
|
+
let track2_data = `${cardNumber}=${expYear}${cardData == null ? void 0 : cardData.expiryMonth} ${cardData == null ? void 0 : cardData.cvv}`;
|
3790
|
+
const publicKey = forge.pki.publicKeyFromPem((_b = (_a2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _a2.data) == null ? void 0 : _b.publicKeyPem);
|
3791
|
+
const encrypted = publicKey.encrypt(track2_data, "RSA-OAEP", {
|
3792
|
+
md: forge.md.sha1.create(),
|
3793
|
+
mgf1: {
|
3794
|
+
md: forge.md.sha1.create()
|
3795
|
+
}
|
3796
|
+
});
|
3797
|
+
const encryptedBase64 = forge.util.encode64(encrypted);
|
3798
|
+
const myHeaders = {
|
3799
|
+
"Content-Type": "application/json",
|
3800
|
+
"x-app-session-key": (_d = (_c = sesionResult.data) == null ? void 0 : _c.data) == null ? void 0 : _d.session_key
|
3801
|
+
};
|
3802
|
+
const raw = JSON.stringify({
|
3803
|
+
"enc_track2_data": `${encryptedBase64}`,
|
3804
|
+
"algorithm": "RSAES_OAEP_SHA_1",
|
3805
|
+
session_key: `${(_f = (_e = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _e.data) == null ? void 0 : _f.session_key}`
|
3806
|
+
});
|
3807
|
+
try {
|
3808
|
+
const tokenizeData = await axios5.post("https://api-dev.merchant-trends.com/tokenizer/tokenize", raw, { headers: myHeaders });
|
3809
|
+
const reqData = JSON.stringify(__spreadProps(__spreadValues({}, (_g = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _g.data), {
|
3810
|
+
cvv: cardData == null ? void 0 : cardData.cvv,
|
3811
|
+
cardName: cardData == null ? void 0 : cardData.cardName,
|
3812
|
+
zip: cardData == null ? void 0 : cardData.zipCode,
|
3813
|
+
userId: props == null ? void 0 : props.customerId,
|
3814
|
+
fractalpayPublicKey: props == null ? void 0 : props.fractalpayClientKey
|
3815
|
+
}));
|
3816
|
+
let myHeaders2 = {
|
3817
|
+
"Content-Type": "application/json"
|
3818
|
+
};
|
3819
|
+
try {
|
3820
|
+
let addCardRes = await axios5.post(
|
3821
|
+
`${baseUrl}add-card`,
|
3822
|
+
reqData,
|
3823
|
+
{
|
3824
|
+
headers: myHeaders2
|
3825
|
+
}
|
3826
|
+
);
|
3827
|
+
console.log(addCardRes);
|
3828
|
+
if ((_h = addCardRes == null ? void 0 : addCardRes.data) == null ? void 0 : _h.result) {
|
3829
|
+
setSuccess(true);
|
3830
|
+
hideLoader();
|
3831
|
+
}
|
3832
|
+
} catch (err) {
|
3833
|
+
hideLoader();
|
3834
|
+
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 wrong..s");
|
3835
|
+
}
|
3836
|
+
} catch (err) {
|
3837
|
+
hideLoader();
|
3838
|
+
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 wrong..s");
|
3839
|
+
}
|
3840
|
+
} catch (err) {
|
3841
|
+
hideLoader();
|
3842
|
+
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 wrong..s");
|
3843
|
+
}
|
3844
|
+
} else {
|
3845
|
+
if (typeof DatacapWebToken !== "undefined") {
|
3846
|
+
DatacapWebToken.requestToken(paymentData == null ? void 0 : paymentData.dctoken, "creditCardForm", getTokenCallback);
|
3847
|
+
}
|
3848
|
+
}
|
3849
|
+
} catch (err) {
|
3850
|
+
hideLoader();
|
3851
|
+
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 wrong..s");
|
3852
|
+
}
|
3853
|
+
}
|
3854
|
+
}
|
3855
|
+
};
|
3856
|
+
return /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(DataScript, null), /* @__PURE__ */ React17.createElement(AddCardStyle, null), /* @__PURE__ */ React17.createElement(
|
3857
|
+
"button",
|
3858
|
+
{
|
3859
|
+
className: "paymentBtn",
|
3860
|
+
onClick: handleShow
|
3861
|
+
},
|
3862
|
+
"Pay"
|
3863
|
+
), /* @__PURE__ */ React17.createElement(
|
3864
|
+
CustomModal_default,
|
3865
|
+
{
|
3866
|
+
open: show,
|
3867
|
+
onClose: handleClose
|
3868
|
+
},
|
3869
|
+
/* @__PURE__ */ React17.createElement(Loader_default, { loading }),
|
3870
|
+
success ? /* @__PURE__ */ React17.createElement(SuccessCardMsz_default, { onClose: handleCloseSeccess }) : /* @__PURE__ */ React17.createElement(
|
3871
|
+
"div",
|
3872
|
+
{
|
3873
|
+
className: "container-creditcard add-card modal-content ",
|
3874
|
+
id: "add-credit-card-panel"
|
3875
|
+
},
|
3876
|
+
/* @__PURE__ */ React17.createElement("form", { id: "creditCardForm", onSubmit: addCardFunc }, /* @__PURE__ */ React17.createElement("div", { className: "form-group", style: { marginTop: "0" } }, /* @__PURE__ */ React17.createElement("label", { htmlFor: "cardNumber" }, "Card Number"), /* @__PURE__ */ React17.createElement(
|
3877
|
+
"input",
|
3878
|
+
{
|
3879
|
+
type: "text",
|
3880
|
+
"data-token": "card_number",
|
3881
|
+
placeholder: "Enter card number",
|
3882
|
+
maxLength: 19,
|
3883
|
+
inputMode: "numeric",
|
3884
|
+
value: (cardData == null ? void 0 : cardData.cardNumber) || "",
|
3885
|
+
onChange: (e) => handleCardNumberChange(e)
|
3886
|
+
}
|
3887
|
+
), (cardError == null ? void 0 : cardError.cardNumber) && /* @__PURE__ */ React17.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cardNumber), /* @__PURE__ */ React17.createElement("br", null)), /* @__PURE__ */ React17.createElement("div", { className: "card-dtl" }, /* @__PURE__ */ React17.createElement("div", { className: "exp-cvc-container" }, /* @__PURE__ */ React17.createElement("div", { className: "form-group" }, /* @__PURE__ */ React17.createElement("label", { htmlFor: "expMonth" }, "MM"), /* @__PURE__ */ React17.createElement(
|
3888
|
+
"input",
|
3889
|
+
{
|
3890
|
+
"data-token": "exp_month",
|
3891
|
+
className: "form-control required",
|
3892
|
+
type: "text",
|
3893
|
+
placeholder: "MM",
|
3894
|
+
maxLength: 2,
|
3895
|
+
value: (cardData == null ? void 0 : cardData.expiryMonth) || "",
|
3896
|
+
onChange: (e) => handleCardChange("expiryMonth", e.target.value)
|
3897
|
+
}
|
3898
|
+
), (cardError == null ? void 0 : cardError.expiryMonth) && /* @__PURE__ */ React17.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.expiryMonth)), /* @__PURE__ */ React17.createElement("div", { className: "form-group" }, /* @__PURE__ */ React17.createElement("label", { htmlFor: "expYear" }, "YYYY"), /* @__PURE__ */ React17.createElement(
|
3899
|
+
"input",
|
3900
|
+
{
|
3901
|
+
"data-token": "exp_year",
|
3902
|
+
className: "form-control required",
|
3903
|
+
type: "text",
|
3904
|
+
placeholder: "YYYY",
|
3905
|
+
maxLength: 4,
|
3906
|
+
value: (cardData == null ? void 0 : cardData.expiryYear) || "",
|
3907
|
+
onChange: (e) => handleCardChange("expiryYear", e.target.value)
|
3908
|
+
}
|
3909
|
+
), (cardError == null ? void 0 : cardError.expiryYear) && /* @__PURE__ */ React17.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.expiryYear)), /* @__PURE__ */ React17.createElement("div", { className: "form-group" }, /* @__PURE__ */ React17.createElement("label", { htmlFor: "cvc" }, "CVC"), /* @__PURE__ */ React17.createElement(
|
3910
|
+
"input",
|
3911
|
+
{
|
3912
|
+
"data-token": "cvv",
|
3913
|
+
className: "form-control required",
|
3914
|
+
type: "text",
|
3915
|
+
placeholder: "CVC",
|
3916
|
+
maxLength: 4,
|
3917
|
+
value: (cardData == null ? void 0 : cardData.cvv) || "",
|
3918
|
+
onChange: (e) => handleCardChange("cvv", e.target.value)
|
3919
|
+
}
|
3920
|
+
), (cardError == null ? void 0 : cardError.cvv) && /* @__PURE__ */ React17.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cvv)))), /* @__PURE__ */ React17.createElement("div", { className: "form-group" }, /* @__PURE__ */ React17.createElement("label", { htmlFor: "cardholderName" }, "Name on card"), /* @__PURE__ */ React17.createElement(
|
3921
|
+
"input",
|
3922
|
+
{
|
3923
|
+
type: "text",
|
3924
|
+
id: "cardholderName",
|
3925
|
+
name: "cardholderName",
|
3926
|
+
placeholder: "Name on card required",
|
3927
|
+
value: (cardData == null ? void 0 : cardData.cardName) || "",
|
3928
|
+
onChange: (e) => {
|
3929
|
+
const value = e.target.value;
|
3930
|
+
if (/^[a-zA-Z\s]*$/.test(value)) {
|
3931
|
+
handleCardChange("cardName", value);
|
3932
|
+
}
|
3933
|
+
}
|
3934
|
+
}
|
3935
|
+
), (cardError == null ? void 0 : cardError.cardName) && /* @__PURE__ */ React17.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cardName)), /* @__PURE__ */ React17.createElement("div", { className: "form-group", style: { marginBottom: "20px" } }, /* @__PURE__ */ React17.createElement("label", { htmlFor: "zipcode" }, "Zip"), /* @__PURE__ */ React17.createElement(
|
3936
|
+
"input",
|
3937
|
+
{
|
3938
|
+
type: "text",
|
3939
|
+
id: "zipcode",
|
3940
|
+
name: "zipcode",
|
3941
|
+
placeholder: "Zip",
|
3942
|
+
value: (_a = cardData == null ? void 0 : cardData.zipCode) != null ? _a : "",
|
3943
|
+
onChange: (e) => handleCardChange("zipCode", e.target.value)
|
3944
|
+
}
|
3945
|
+
), (cardError == null ? void 0 : cardError.zipCode) && /* @__PURE__ */ React17.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.zipCode)), /* @__PURE__ */ React17.createElement(
|
3946
|
+
"input",
|
3947
|
+
{
|
3948
|
+
type: "submit",
|
3949
|
+
className: "idle-green-btn w-100",
|
3950
|
+
defaultValue: "Submit"
|
3951
|
+
}
|
3952
|
+
))
|
3953
|
+
)
|
3954
|
+
));
|
3955
|
+
}
|
2595
3956
|
export {
|
3957
|
+
AddCard,
|
2596
3958
|
GetPaymentPage,
|
3959
|
+
PreAuthPayment,
|
2597
3960
|
RequestPayment,
|
2598
3961
|
RequestPreAuthPayment
|
2599
3962
|
};
|