@fractalpay/fractalpay-next-dev 0.0.1
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/.eslintrc.json +3 -0
- package/README.md +154 -0
- package/dist/index.d.mts +84 -0
- package/dist/index.d.ts +84 -0
- package/dist/index.js +4757 -0
- package/dist/index.mjs +4718 -0
- package/global.d.ts +3 -0
- package/next-env.d.ts +5 -0
- package/next.config.ts +7 -0
- package/package.json +65 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,4718 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// src/app/components/RequestPayment/RequestPayment.tsx
|
|
34
|
+
import "bootstrap/dist/js/bootstrap.bundle.min.js";
|
|
35
|
+
import React6, { useState, useEffect } from "react";
|
|
36
|
+
|
|
37
|
+
// src/app/components/Loader/Loader.tsx
|
|
38
|
+
import React2 from "react";
|
|
39
|
+
|
|
40
|
+
// src/app/components/Loader/LoaderStyle.tsx
|
|
41
|
+
import React from "react";
|
|
42
|
+
var LoaderStyle = (props) => {
|
|
43
|
+
return /* @__PURE__ */ React.createElement("style", null, `
|
|
44
|
+
|
|
45
|
+
.loader {
|
|
46
|
+
position: fixed; /* Fixed position to cover the viewport */
|
|
47
|
+
top: 0;
|
|
48
|
+
left: 0;
|
|
49
|
+
width: 100%;
|
|
50
|
+
height: 100%;
|
|
51
|
+
display: flex;
|
|
52
|
+
justify-content: center;
|
|
53
|
+
align-items: center;
|
|
54
|
+
/* background: rgba(255, 255, 0, 0.01); Adjust the blur effect */
|
|
55
|
+
background-color: rgba(31, 29, 29, 0.52); /* Semi-transparent black background */
|
|
56
|
+
|
|
57
|
+
backdrop-filter: blur(.5px); /* Blur effect */
|
|
58
|
+
z-index: 999999999999; /* Ensure it's on top of other elements */
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.lds-ellipsis {
|
|
62
|
+
display: inline-block;
|
|
63
|
+
position: relative;
|
|
64
|
+
width: 80px;
|
|
65
|
+
height: 80px;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.lds-ellipsis div {
|
|
69
|
+
position: absolute;
|
|
70
|
+
top: 33px;
|
|
71
|
+
width: 13px;
|
|
72
|
+
height: 13px;
|
|
73
|
+
border-radius: 50%;
|
|
74
|
+
background: #000;
|
|
75
|
+
animation-timing-function: cubic-bezier(0, 1, 1, 0);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.lds-ellipsis div:nth-child(1) {
|
|
79
|
+
left: 8px;
|
|
80
|
+
animation: lds-ellipsis1 0.6s infinite;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.lds-ellipsis div:nth-child(2) {
|
|
84
|
+
left: 8px;
|
|
85
|
+
animation: lds-ellipsis2 0.6s infinite;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.lds-ellipsis div:nth-child(3) {
|
|
89
|
+
left: 32px;
|
|
90
|
+
animation: lds-ellipsis2 0.6s infinite;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.lds-ellipsis div:nth-child(4) {
|
|
94
|
+
left: 56px;
|
|
95
|
+
animation: lds-ellipsis3 0.6s infinite;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@keyframes lds-ellipsis1 {
|
|
99
|
+
0% {
|
|
100
|
+
transform: scale(0);
|
|
101
|
+
}
|
|
102
|
+
100% {
|
|
103
|
+
transform: scale(1);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
@keyframes lds-ellipsis2 {
|
|
108
|
+
0% {
|
|
109
|
+
transform: translate(0, 0);
|
|
110
|
+
}
|
|
111
|
+
100% {
|
|
112
|
+
transform: translate(24px, 0);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
@keyframes lds-ellipsis3 {
|
|
117
|
+
0% {
|
|
118
|
+
transform: scale(1);
|
|
119
|
+
}
|
|
120
|
+
100% {
|
|
121
|
+
transform: scale(0);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
`);
|
|
126
|
+
};
|
|
127
|
+
var LoaderStyle_default = LoaderStyle;
|
|
128
|
+
|
|
129
|
+
// src/app/components/Loader/Loader.tsx
|
|
130
|
+
var Loader = (props) => {
|
|
131
|
+
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(LoaderStyle_default, null), (props == null ? void 0 : props.loading) && /* @__PURE__ */ React2.createElement("div", { className: "loader" }, /* @__PURE__ */ React2.createElement("div", { className: "lds-ellipsis" }, /* @__PURE__ */ React2.createElement("div", null), /* @__PURE__ */ React2.createElement("div", null), /* @__PURE__ */ React2.createElement("div", null), /* @__PURE__ */ React2.createElement("div", null))));
|
|
132
|
+
};
|
|
133
|
+
var Loader_default = Loader;
|
|
134
|
+
|
|
135
|
+
// src/app/components/baseurl.ts
|
|
136
|
+
var fractalGatewayUrl = "https://api-dev.merchant-trends.com/";
|
|
137
|
+
var masterBaseUrl = "https://dev-sky-node.fractalpay.com/";
|
|
138
|
+
var baseUrl = "https://dev-widget.fractalpay.com/";
|
|
139
|
+
|
|
140
|
+
// src/app/components/Errortext.ts
|
|
141
|
+
var ErrorText = {
|
|
142
|
+
namerequired: "Full Name is required",
|
|
143
|
+
amountrequired: "Amount is required",
|
|
144
|
+
amountpositive: "Amount should be positive",
|
|
145
|
+
amountzero: "Amount should not be zero",
|
|
146
|
+
amountenter: "Please enter an amount",
|
|
147
|
+
amountvalid: "Please enter a valid amount",
|
|
148
|
+
phoneoremailrequired: "Phone or Email is required",
|
|
149
|
+
invalidemail: "Please enter a valid email",
|
|
150
|
+
invalidemailformat: "Invalid email format",
|
|
151
|
+
onlylettersallowed: "Only letters are allowed",
|
|
152
|
+
phonenumberlength: "Phone number should be 10 digits",
|
|
153
|
+
phonenumberrequired: "Please enter a phone number",
|
|
154
|
+
// phonenumbervalid:'Please enter a valid 10-digit phone number',
|
|
155
|
+
phonenumbervalid: "Please enter a valid phone number",
|
|
156
|
+
phonenumbervalidnumberonly: "Please enter a valid phone number (numbers only)",
|
|
157
|
+
orderidenter: "Please enter an order ID",
|
|
158
|
+
orderidrequired: "Order ID is required",
|
|
159
|
+
networkresponseerror: "Network response was not ok",
|
|
160
|
+
anerroroccured: "An error occurred. Please try again.",
|
|
161
|
+
montherror: "Please write month only 1 to 12",
|
|
162
|
+
fieldrequired: "This field is required",
|
|
163
|
+
fractalpayclientidrequired: "Fractalpay client key is missing or empty."
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
// src/app/components/CustomModal/CustomModal2.tsx
|
|
167
|
+
import React4 from "react";
|
|
168
|
+
|
|
169
|
+
// src/app/components/CustomModal/CustomModal2styles.tsx
|
|
170
|
+
import React3 from "react";
|
|
171
|
+
var CustomModal2styles = (props) => {
|
|
172
|
+
return /* @__PURE__ */ React3.createElement("style", null, `
|
|
173
|
+
.fractal-input::placeholder {
|
|
174
|
+
color: #35254D;
|
|
175
|
+
opacity: 1;
|
|
176
|
+
font-size: 15px;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.fractal-input::-ms-input-placeholder {
|
|
180
|
+
color: #35254D;
|
|
181
|
+
font-size: 15px;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.trigger{
|
|
185
|
+
text-align: center;
|
|
186
|
+
padding: 7px 13px;
|
|
187
|
+
background: #3e3e3e;
|
|
188
|
+
color: #fff;
|
|
189
|
+
font-size: 15px;
|
|
190
|
+
outline: none;
|
|
191
|
+
border: none;
|
|
192
|
+
border-radius: 5px;
|
|
193
|
+
font-family: cursive;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// .fractal-popup {
|
|
197
|
+
// position: fixed;
|
|
198
|
+
// z-index: 9999;
|
|
199
|
+
// top: 0;
|
|
200
|
+
// right: 0;
|
|
201
|
+
// bottom: 0;
|
|
202
|
+
// left: 0;
|
|
203
|
+
// width: 100%;
|
|
204
|
+
// // max-width:810px;
|
|
205
|
+
// height: 100%;
|
|
206
|
+
// background-color: rgba(0, 0, 0, 0.5);
|
|
207
|
+
// transition: visibility 0s linear 0.25s, opacity 0.25s 0s, transform 0.25s;
|
|
208
|
+
// display: flex;
|
|
209
|
+
// justify-content: center;
|
|
210
|
+
// align-items: center;
|
|
211
|
+
// overflow:auto;
|
|
212
|
+
// }
|
|
213
|
+
|
|
214
|
+
.fractal-popup {
|
|
215
|
+
position: fixed;
|
|
216
|
+
z-index: 1050;
|
|
217
|
+
left: 0;
|
|
218
|
+
top: 0;
|
|
219
|
+
width: 100%;
|
|
220
|
+
height: 100%;
|
|
221
|
+
overflow: auto;
|
|
222
|
+
background-color: rgba(0, 0, 0, 0.8);
|
|
223
|
+
// padding:20px
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.fractal-popup-content {
|
|
227
|
+
margin:20px auto !important;
|
|
228
|
+
transform :none;
|
|
229
|
+
background-color: white;
|
|
230
|
+
padding:20px;
|
|
231
|
+
border-radius: 0.5rem;
|
|
232
|
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
|
233
|
+
box-sizing: border-box;
|
|
234
|
+
position: relative;
|
|
235
|
+
// min-height : 585px;
|
|
236
|
+
max-width:810px;
|
|
237
|
+
width:90vw
|
|
238
|
+
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
// @media only screen and (min-width: 600px){
|
|
243
|
+
// .fractal-popup-content {
|
|
244
|
+
// max-width:810px;
|
|
245
|
+
// }
|
|
246
|
+
// }
|
|
247
|
+
// @media only screen and (max-width: 600px){
|
|
248
|
+
// .fractal-popup-content {
|
|
249
|
+
// width: 350px;
|
|
250
|
+
// }
|
|
251
|
+
// }
|
|
252
|
+
// @media only screen and (max-width: 450px){
|
|
253
|
+
// .fractal-popup-content {
|
|
254
|
+
// width: 300px;
|
|
255
|
+
// }
|
|
256
|
+
// }
|
|
257
|
+
.close-popup {
|
|
258
|
+
max-height:25px;
|
|
259
|
+
width:25px;
|
|
260
|
+
height: 25px;
|
|
261
|
+
color: #999;
|
|
262
|
+
position: absolute;
|
|
263
|
+
top: 2px;
|
|
264
|
+
right: 4px;
|
|
265
|
+
z-index: 7;
|
|
266
|
+
text-align: center;
|
|
267
|
+
cursor: pointer;
|
|
268
|
+
border-radius: 0.25rem;
|
|
269
|
+
font-size: 30px;
|
|
270
|
+
line-height: 30px;
|
|
271
|
+
display: flex;
|
|
272
|
+
align-items: center;
|
|
273
|
+
justify-content: center;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
.close-popup:hover {
|
|
277
|
+
color: #000;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
.fractal-inpt-list {
|
|
281
|
+
margin-bottom: 15px;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.fractal-label {
|
|
285
|
+
color: #727272;
|
|
286
|
+
margin-bottom: 3px;
|
|
287
|
+
font-family: "Inter", sans-serif;
|
|
288
|
+
font-weight: 500;
|
|
289
|
+
font-size: 12px;
|
|
290
|
+
display: block;
|
|
291
|
+
text-align: left;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.fractal-input {
|
|
295
|
+
display: block;
|
|
296
|
+
width: 100%;
|
|
297
|
+
padding: .320rem .75rem;
|
|
298
|
+
font-size: 1rem;
|
|
299
|
+
font-weight: 400;
|
|
300
|
+
line-height: 1.5;
|
|
301
|
+
color: #35254D;
|
|
302
|
+
appearance: none;
|
|
303
|
+
background-color:#ffffff;
|
|
304
|
+
background-clip: padding-box;
|
|
305
|
+
border:1px solid #dee2e6;
|
|
306
|
+
border-radius: 0.375rem;
|
|
307
|
+
transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.fractal-input:focus {border:#86b7fe 1px solid; outline: none;}
|
|
311
|
+
|
|
312
|
+
.fractal-group {
|
|
313
|
+
position: relative;
|
|
314
|
+
display: flex;
|
|
315
|
+
align-items: stretch;
|
|
316
|
+
width: 100%;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
.fractal-group-icons {
|
|
320
|
+
display: flex;
|
|
321
|
+
align-items: center;
|
|
322
|
+
padding: 0.375rem 0.75rem;
|
|
323
|
+
font-size: 1rem;
|
|
324
|
+
font-weight: 400;
|
|
325
|
+
line-height: 1.5;
|
|
326
|
+
color: #212529;
|
|
327
|
+
text-align: center;
|
|
328
|
+
white-space: nowrap;
|
|
329
|
+
background-color: #f8f9fa;
|
|
330
|
+
border:#dee2e6 1px solid;
|
|
331
|
+
border-radius: 0.375rem 0 0 0.375rem ;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
.fractal-group .fractal-input{
|
|
335
|
+
border-radius:0 0.375rem 0.375rem 0;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
.pay-button {
|
|
340
|
+
outline: 0;
|
|
341
|
+
height: 46px;
|
|
342
|
+
font-size: 16px;
|
|
343
|
+
background: #727272;
|
|
344
|
+
border: none;
|
|
345
|
+
display: block;
|
|
346
|
+
color: #fff;
|
|
347
|
+
width: 100%;
|
|
348
|
+
border-radius: 180px;
|
|
349
|
+
margin: 10px 0;
|
|
350
|
+
text-decoration: none;
|
|
351
|
+
cursor:pointer,
|
|
352
|
+
font-family:
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
.pay-button:hover, .pay-button:focus {background: #222; color: #fff; cursor:pointer}
|
|
356
|
+
|
|
357
|
+
.fractal-powerd-by {
|
|
358
|
+
display: flex;
|
|
359
|
+
font-size: 12px;
|
|
360
|
+
text-align: center;
|
|
361
|
+
align-items: center;
|
|
362
|
+
justify-content: center;
|
|
363
|
+
margin: 5px 0 20px 0;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
/* ................................................................ */
|
|
373
|
+
|
|
374
|
+
.fractal-pay-popup {
|
|
375
|
+
position: fixed;
|
|
376
|
+
z-index: 9999;
|
|
377
|
+
top: 0;
|
|
378
|
+
right: 0;
|
|
379
|
+
bottom: 0;
|
|
380
|
+
left: 0;
|
|
381
|
+
width: 100%;
|
|
382
|
+
height: 100%;
|
|
383
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
384
|
+
transition: visibility 0s linear 0.25s, opacity 0.25s 0s, transform 0.25s;
|
|
385
|
+
display: flex;
|
|
386
|
+
justify-content: center;
|
|
387
|
+
align-items: center;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
.fractal-pay-popup-content {
|
|
391
|
+
background-color: white;
|
|
392
|
+
padding:0px;
|
|
393
|
+
border-radius: 0.5rem;
|
|
394
|
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
|
395
|
+
box-sizing: border-box;
|
|
396
|
+
position: relative;
|
|
397
|
+
height: 100%;
|
|
398
|
+
max-height:90%;
|
|
399
|
+
overflow: hidden;
|
|
400
|
+
}
|
|
401
|
+
.fractal-pay-popup-content iframe{height: 100% !important; }
|
|
402
|
+
.fractal-pay-popup-content iframe body{overflow: hidden;}
|
|
403
|
+
@media only screen and (min-width: 768px){
|
|
404
|
+
.fractal-pay-popup-content iframe{width: 768px;}
|
|
405
|
+
.fractal-pay-popup-content {
|
|
406
|
+
width: 750px;
|
|
407
|
+
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
@media only screen and (max-width: 600px){
|
|
411
|
+
.fractal-pay-popup-content {
|
|
412
|
+
width: 350px;
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
@media only screen and (max-width: 450px){
|
|
416
|
+
.fractal-pay-popup-content {
|
|
417
|
+
width: 300px;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
.request-payment-popup-container {
|
|
422
|
+
padding: 0px !important;
|
|
423
|
+
border-radius: 12px !important;
|
|
424
|
+
}
|
|
425
|
+
`);
|
|
426
|
+
};
|
|
427
|
+
var CustomModal2styles_default = CustomModal2styles;
|
|
428
|
+
|
|
429
|
+
// src/app/components/CustomModal/CustomModal2.tsx
|
|
430
|
+
var CustomModal2 = ({
|
|
431
|
+
open,
|
|
432
|
+
onClose,
|
|
433
|
+
children,
|
|
434
|
+
maxWidth
|
|
435
|
+
}) => {
|
|
436
|
+
if (!open) return null;
|
|
437
|
+
return /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(CustomModal2styles_default, null), /* @__PURE__ */ React4.createElement("div", { className: "fractal-popup" }, /* @__PURE__ */ React4.createElement("div", { className: "fractal-popup-content request-payment-popup-container", style: { maxWidth: `${maxWidth != null ? maxWidth : "auto"}` } }, children)));
|
|
438
|
+
};
|
|
439
|
+
var CustomModal2_default = CustomModal2;
|
|
440
|
+
|
|
441
|
+
// src/app/components/RequestPayment/RequestPayment.tsx
|
|
442
|
+
import axios from "axios";
|
|
443
|
+
import { PatternFormat } from "react-number-format";
|
|
444
|
+
|
|
445
|
+
// src/app/components/RequestPayment/RequestPaymentstyles.tsx
|
|
446
|
+
import React5 from "react";
|
|
447
|
+
var RequestPaymentstyles = (props) => {
|
|
448
|
+
return /* @__PURE__ */ React5.createElement("style", null, `
|
|
449
|
+
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');
|
|
450
|
+
body {
|
|
451
|
+
font-family: 'Inter', sans-serif !important;
|
|
452
|
+
}
|
|
453
|
+
input{
|
|
454
|
+
font-family: 'Inter', sans-serif !important;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
.paymentBtn {
|
|
458
|
+
background-color: black;
|
|
459
|
+
border: none;
|
|
460
|
+
color: white;
|
|
461
|
+
padding: 15px 32px;
|
|
462
|
+
text-align: center;
|
|
463
|
+
text-decoration: none;
|
|
464
|
+
display: inline-block;
|
|
465
|
+
font-size: 16px;
|
|
466
|
+
margin: 4px 2px;
|
|
467
|
+
cursor: pointer;
|
|
468
|
+
border-radius: 180px;
|
|
469
|
+
/* width: auto; */
|
|
470
|
+
}
|
|
471
|
+
/*****************************************REDESIGNING STYLES **************************************/
|
|
472
|
+
|
|
473
|
+
.request-payment-amount {
|
|
474
|
+
color: #161616;
|
|
475
|
+
text-align: center;
|
|
476
|
+
font-size: 42px;
|
|
477
|
+
font-style: normal;
|
|
478
|
+
font-weight: 600;
|
|
479
|
+
text-transform: uppercase;
|
|
480
|
+
margin: 8px 0px !important;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
.request-payment-orderid {
|
|
484
|
+
color: #727272;
|
|
485
|
+
text-align: center;
|
|
486
|
+
font-size: 14px;
|
|
487
|
+
font-style: normal;
|
|
488
|
+
font-weight: 500;
|
|
489
|
+
margin: 0px;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
.request-payment-pre-auth-merchantname {
|
|
493
|
+
color: #727272;
|
|
494
|
+
text-align: center;
|
|
495
|
+
font-size: 14px;
|
|
496
|
+
font-style: normal;
|
|
497
|
+
font-weight: 500;
|
|
498
|
+
margin-top: 10px !important;
|
|
499
|
+
margin-bottom: 0px !important;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
.request-payment-merchantname {
|
|
503
|
+
color: #727272;
|
|
504
|
+
text-align: center;
|
|
505
|
+
font-size: 14px;
|
|
506
|
+
font-style: normal;
|
|
507
|
+
font-weight: 500;
|
|
508
|
+
margin-top: 20px !important;
|
|
509
|
+
margin-bottom: 0px !important;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
.request-payment-close-popup {
|
|
513
|
+
position: absolute;
|
|
514
|
+
right: 20px;
|
|
515
|
+
top: 20px;
|
|
516
|
+
cursor: pointer;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
.request-payment-amount-detail {
|
|
520
|
+
padding: 32px 0px;
|
|
521
|
+
border-bottom: 1px solid #E0DFE2;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
.request-payment-popup-container {
|
|
525
|
+
padding: 0px !important;
|
|
526
|
+
border-radius: 12px !important;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
.request-payment-input-form {
|
|
530
|
+
padding: 24px 48px 32px 48px;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
.request-payment-input-label {
|
|
534
|
+
color: #727272;
|
|
535
|
+
font-size: 12px;
|
|
536
|
+
font-style: normal;
|
|
537
|
+
font-weight: 500;
|
|
538
|
+
margin-bottom: 6px !important;
|
|
539
|
+
text-align: start !important;
|
|
540
|
+
width: 100% !important;
|
|
541
|
+
margin-bottom: 6px !important;
|
|
542
|
+
text-transform: uppercase;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
.request-payment-input-box {
|
|
546
|
+
border-radius: 8px;
|
|
547
|
+
border: 1px solid #E0DFE2;
|
|
548
|
+
padding: 11px;
|
|
549
|
+
display: block;
|
|
550
|
+
width: 100%;
|
|
551
|
+
color: #161616;
|
|
552
|
+
margin-top: 6px !important;
|
|
553
|
+
font-size: 14px;
|
|
554
|
+
font-style: normal;
|
|
555
|
+
font-weight: 500;
|
|
556
|
+
box-sizing: border-box;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
.request-payment-list-div {
|
|
560
|
+
margin-bottom: 12px;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
.request-payment-submit-button {
|
|
564
|
+
border-radius: 80px;
|
|
565
|
+
background: #161616;
|
|
566
|
+
height: 48px;
|
|
567
|
+
padding: 12px 24px;
|
|
568
|
+
margin-top: 20px;
|
|
569
|
+
color: #fff;
|
|
570
|
+
width: 100% !important;
|
|
571
|
+
border: none !important;
|
|
572
|
+
font-size: 16px;
|
|
573
|
+
font-style: normal;
|
|
574
|
+
font-weight: 500;
|
|
575
|
+
cursor: pointer;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
.request-payment-submit-button:disabled {
|
|
579
|
+
cursor: not-allowed;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
.request-payment-fractal-powerd-by {
|
|
583
|
+
color: #727272;
|
|
584
|
+
font-size: 14px;
|
|
585
|
+
font-style: normal;
|
|
586
|
+
font-weight: 500;
|
|
587
|
+
margin-top: 16px;
|
|
588
|
+
display: flex;
|
|
589
|
+
text-align: center;
|
|
590
|
+
align-items: center;
|
|
591
|
+
justify-content: center;
|
|
592
|
+
gap: 6px;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
.request-payment-fractal-powerd-by span {
|
|
596
|
+
color: #61C699;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
.request-payment-success-container {
|
|
600
|
+
display: flex;
|
|
601
|
+
padding: 120px 48px 32px 48px;
|
|
602
|
+
flex-direction: column;
|
|
603
|
+
justify-content: center;
|
|
604
|
+
align-items: center;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
.request-payment-success-tick {
|
|
608
|
+
border-radius: 1000px;
|
|
609
|
+
background: rgba(97, 198, 153, 0.14);
|
|
610
|
+
display: flex;
|
|
611
|
+
width: 60px;
|
|
612
|
+
height: 60px;
|
|
613
|
+
justify-content: center;
|
|
614
|
+
align-items: center;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
.request-payment-success-text {
|
|
618
|
+
color: #161616;
|
|
619
|
+
text-align: center;
|
|
620
|
+
font-size: 32px;
|
|
621
|
+
font-style: normal;
|
|
622
|
+
font-weight: 500;
|
|
623
|
+
line-height: 36px;
|
|
624
|
+
/* 112.5% */
|
|
625
|
+
letter-spacing: -0.64px;
|
|
626
|
+
margin-top: 20px;
|
|
627
|
+
margin-bottom: 5px !important;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
.request-payment-success-subtext {
|
|
631
|
+
color: #727272;
|
|
632
|
+
text-align: center;
|
|
633
|
+
font-size: 14px;
|
|
634
|
+
font-style: normal;
|
|
635
|
+
font-weight: 500;
|
|
636
|
+
line-height: 18px;
|
|
637
|
+
letter-spacing: -0.28px;
|
|
638
|
+
margin-bottom: 6rem !important;
|
|
639
|
+
margin-top: 8px !important;
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
.request-payment-success-btn-div {
|
|
643
|
+
display: flex;
|
|
644
|
+
align-items: flex-start;
|
|
645
|
+
justify-content: center;
|
|
646
|
+
gap: 8px;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
.request-payment-success-tick-div {
|
|
650
|
+
display: flex;
|
|
651
|
+
justify-content: center;
|
|
652
|
+
align-items: center;
|
|
653
|
+
margin-top: 32px;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
.request-payment-success-btn1 {
|
|
657
|
+
cursor: pointer;
|
|
658
|
+
border-radius: 80px;
|
|
659
|
+
border: 1px solid #E0DFE2;
|
|
660
|
+
display: flex;
|
|
661
|
+
padding: 12px 32px;
|
|
662
|
+
justify-content: center;
|
|
663
|
+
align-items: center;
|
|
664
|
+
gap: 6px;
|
|
665
|
+
background-color: #fff;
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
.request-payment-success-btn2 {
|
|
669
|
+
border-radius: 80px;
|
|
670
|
+
cursor: pointer;
|
|
671
|
+
border: 1px solid #E0DFE2;
|
|
672
|
+
display: flex;
|
|
673
|
+
padding: 12px 32px;
|
|
674
|
+
justify-content: center;
|
|
675
|
+
align-items: center;
|
|
676
|
+
gap: 6px;
|
|
677
|
+
background-color: #161616;
|
|
678
|
+
color: #fff;
|
|
679
|
+
font-size: 14px;
|
|
680
|
+
font-style: normal;
|
|
681
|
+
font-weight: 500;
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
.request-payment-error-msg{
|
|
685
|
+
color: #dc3545;
|
|
686
|
+
|
|
687
|
+
font-size: 12px;
|
|
688
|
+
}
|
|
689
|
+
`);
|
|
690
|
+
};
|
|
691
|
+
var RequestPaymentstyles_default = RequestPaymentstyles;
|
|
692
|
+
|
|
693
|
+
// src/app/components/RequestPayment/RequestPayment.tsx
|
|
694
|
+
function RequestPayment(props) {
|
|
695
|
+
const fractalpayClientKey = props.fractalpayClientKey;
|
|
696
|
+
const discount = props == null ? void 0 : props.discount;
|
|
697
|
+
const tax = props == null ? void 0 : props.tax;
|
|
698
|
+
const surcharge = props == null ? void 0 : props.surcharge;
|
|
699
|
+
const [show, setShow] = useState(false);
|
|
700
|
+
const [loading, setLoading] = useState(false);
|
|
701
|
+
const [errors, setErrors] = useState({});
|
|
702
|
+
const [phone, setPhone] = useState(null);
|
|
703
|
+
const [requestDetails, setRequestDetails] = useState({
|
|
704
|
+
email: "",
|
|
705
|
+
phone_number: "",
|
|
706
|
+
order_id: "",
|
|
707
|
+
name: "",
|
|
708
|
+
fractalpayPublicKey: fractalpayClientKey
|
|
709
|
+
});
|
|
710
|
+
const [amount, setAmount] = useState("");
|
|
711
|
+
const [showConfirmationModal, setShowConfirmationModal] = useState(false);
|
|
712
|
+
const [apiResponse, setApiResponse] = useState(null);
|
|
713
|
+
const phoneNumberRegex = (value) => /^\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$/.test(value);
|
|
714
|
+
const amoutRegex = /[+-]?([0-9]*[.])?[0-9]+/;
|
|
715
|
+
const isValidEmail = (value) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
|
|
716
|
+
const isAlpha = (value) => /^[A-Za-z\s]*$/.test(value);
|
|
717
|
+
const handleClose = () => {
|
|
718
|
+
setShow(false);
|
|
719
|
+
setErrors({});
|
|
720
|
+
};
|
|
721
|
+
const handleShow = () => setShow(true);
|
|
722
|
+
const handleCloseConfirmationModal = () => {
|
|
723
|
+
console.log(apiResponse, "apiresponse");
|
|
724
|
+
handleSubmit(apiResponse);
|
|
725
|
+
setShowConfirmationModal(false);
|
|
726
|
+
};
|
|
727
|
+
function emptyFields() {
|
|
728
|
+
setRequestDetails({
|
|
729
|
+
email: "",
|
|
730
|
+
phone_number: "",
|
|
731
|
+
order_id: "",
|
|
732
|
+
name: "",
|
|
733
|
+
fractalpayPublicKey: fractalpayClientKey
|
|
734
|
+
});
|
|
735
|
+
setAmount("");
|
|
736
|
+
}
|
|
737
|
+
function handleSubmit(event) {
|
|
738
|
+
let message = {
|
|
739
|
+
type: "preview.compiledcheck",
|
|
740
|
+
other: __spreadProps(__spreadValues({}, event), { status: true })
|
|
741
|
+
};
|
|
742
|
+
window.parent.postMessage(message, "*");
|
|
743
|
+
}
|
|
744
|
+
const sendRequestPayment = async () => {
|
|
745
|
+
if (Object.keys(errors).length > 0) {
|
|
746
|
+
return;
|
|
747
|
+
}
|
|
748
|
+
setErrors({});
|
|
749
|
+
if (!(requestDetails == null ? void 0 : requestDetails.email) && phone && !phoneNumberRegex(phone)) {
|
|
750
|
+
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
|
751
|
+
phone: ErrorText.phonenumbervalid
|
|
752
|
+
}));
|
|
753
|
+
return;
|
|
754
|
+
}
|
|
755
|
+
if (!validateForm()) {
|
|
756
|
+
return;
|
|
757
|
+
}
|
|
758
|
+
try {
|
|
759
|
+
setLoading(true);
|
|
760
|
+
const formData = {
|
|
761
|
+
fractalpayPublicKey: fractalpayClientKey,
|
|
762
|
+
amount,
|
|
763
|
+
phone_number: phone,
|
|
764
|
+
order_id: requestDetails.order_id,
|
|
765
|
+
action: "request",
|
|
766
|
+
name: requestDetails.name,
|
|
767
|
+
email: requestDetails.email,
|
|
768
|
+
customer_id: (props == null ? void 0 : props.customerId) ? props == null ? void 0 : props.customerId : "",
|
|
769
|
+
discount,
|
|
770
|
+
surcharge,
|
|
771
|
+
tax,
|
|
772
|
+
require_3ds: props == null ? void 0 : props.require_3ds
|
|
773
|
+
};
|
|
774
|
+
let response = await axios.post(`${baseUrl}create-widget-order`, formData);
|
|
775
|
+
if ((response == null ? void 0 : response.status) === 200) {
|
|
776
|
+
setShowConfirmationModal(true);
|
|
777
|
+
setShow(false);
|
|
778
|
+
emptyFields();
|
|
779
|
+
setApiResponse(response == null ? void 0 : response.data);
|
|
780
|
+
}
|
|
781
|
+
setLoading(false);
|
|
782
|
+
} catch (error) {
|
|
783
|
+
console.log(error);
|
|
784
|
+
setLoading(false);
|
|
785
|
+
}
|
|
786
|
+
};
|
|
787
|
+
let favicon_logo = baseUrl + "images/logo-img.png";
|
|
788
|
+
const handleChange = (e) => {
|
|
789
|
+
const { value } = e.target;
|
|
790
|
+
const token = e.target.dataset.token;
|
|
791
|
+
setRequestDetails(__spreadProps(__spreadValues({}, requestDetails), { [token]: value }));
|
|
792
|
+
if (token === "name" && !isAlpha(value)) {
|
|
793
|
+
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
|
794
|
+
[token]: ErrorText.onlylettersallowed
|
|
795
|
+
}));
|
|
796
|
+
return;
|
|
797
|
+
}
|
|
798
|
+
let errorobj = errors;
|
|
799
|
+
if (token === "email" && !phone) {
|
|
800
|
+
delete errorobj.phone;
|
|
801
|
+
setErrors(errorobj);
|
|
802
|
+
}
|
|
803
|
+
if (value) {
|
|
804
|
+
delete errorobj[token];
|
|
805
|
+
setErrors(errorobj);
|
|
806
|
+
}
|
|
807
|
+
if (token === "email" && !value) {
|
|
808
|
+
delete errorobj[token];
|
|
809
|
+
setErrors(errorobj);
|
|
810
|
+
}
|
|
811
|
+
};
|
|
812
|
+
const handleAmountChange = (data) => {
|
|
813
|
+
const { value } = data;
|
|
814
|
+
if (Number(value) > 0) {
|
|
815
|
+
let errorobj = errors;
|
|
816
|
+
delete errorobj.amount;
|
|
817
|
+
setErrors(errorobj);
|
|
818
|
+
}
|
|
819
|
+
setAmount(value);
|
|
820
|
+
};
|
|
821
|
+
const validateForm = () => {
|
|
822
|
+
let newErrors = {};
|
|
823
|
+
if (!amount) newErrors.amount = ErrorText.amountrequired;
|
|
824
|
+
if (requestDetails.email && !isValidEmail(requestDetails == null ? void 0 : requestDetails.email)) newErrors.email = ErrorText.invalidemail;
|
|
825
|
+
if (!phone && !(requestDetails == null ? void 0 : requestDetails.email)) newErrors.phone = ErrorText.phoneoremailrequired;
|
|
826
|
+
if (!phone && !(requestDetails == null ? void 0 : requestDetails.email)) newErrors.email = ErrorText.phoneoremailrequired;
|
|
827
|
+
if (!phone && requestDetails.email && !isValidEmail(requestDetails == null ? void 0 : requestDetails.email)) newErrors.email = ErrorText.invalidemail;
|
|
828
|
+
if (props.from === "merchant" && !requestDetails.order_id) newErrors.order_id = ErrorText.orderidrequired;
|
|
829
|
+
setErrors(newErrors);
|
|
830
|
+
return Object.keys(newErrors).length === 0;
|
|
831
|
+
};
|
|
832
|
+
useEffect(() => {
|
|
833
|
+
if (props) {
|
|
834
|
+
setRequestDetails((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
835
|
+
order_id: props.orderID ? props.orderID : "",
|
|
836
|
+
name: (props == null ? void 0 : props.name) ? props == null ? void 0 : props.name : "",
|
|
837
|
+
email: (props == null ? void 0 : props.email) ? props == null ? void 0 : props.email : ""
|
|
838
|
+
}));
|
|
839
|
+
setAmount(props.amount ? props.amount : "");
|
|
840
|
+
setPhone(props.phone ? `${props.phone}` : null);
|
|
841
|
+
}
|
|
842
|
+
}, [props]);
|
|
843
|
+
const handlePhoneChange = (e) => {
|
|
844
|
+
let value = e == null ? void 0 : e.value;
|
|
845
|
+
if (value && (value == null ? void 0 : value.length) > 0 && (value == null ? void 0 : value.length) !== 10) {
|
|
846
|
+
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
|
847
|
+
phone: ErrorText.phonenumberlength
|
|
848
|
+
}));
|
|
849
|
+
setPhone(value);
|
|
850
|
+
return;
|
|
851
|
+
} else {
|
|
852
|
+
setPhone(value);
|
|
853
|
+
}
|
|
854
|
+
let errorobj = errors;
|
|
855
|
+
delete errorobj.phone;
|
|
856
|
+
if (value && !(requestDetails == null ? void 0 : requestDetails.email)) {
|
|
857
|
+
delete errorobj.email;
|
|
858
|
+
}
|
|
859
|
+
setErrors(errorobj);
|
|
860
|
+
};
|
|
861
|
+
function formatAmount(amount2) {
|
|
862
|
+
return new Intl.NumberFormat("en-US", {
|
|
863
|
+
style: "currency",
|
|
864
|
+
currency: "USD",
|
|
865
|
+
minimumFractionDigits: 2,
|
|
866
|
+
maximumFractionDigits: 2
|
|
867
|
+
}).format(Number(amount2));
|
|
868
|
+
}
|
|
869
|
+
return /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(RequestPaymentstyles_default, null), /* @__PURE__ */ React6.createElement(Loader_default, { loading }), /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement("button", { className: "paymentBtn", onClick: handleShow }, "Request Payment"), /* @__PURE__ */ React6.createElement(
|
|
870
|
+
CustomModal2_default,
|
|
871
|
+
{
|
|
872
|
+
open: show,
|
|
873
|
+
onClose: () => setShow(false),
|
|
874
|
+
maxWidth: "500px"
|
|
875
|
+
},
|
|
876
|
+
/* @__PURE__ */ React6.createElement("div", { style: { maxWidth: "500px" } }, /* @__PURE__ */ React6.createElement("div", { className: "request-payment-amount-detail frac-form" }, /* @__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" })))))), /* @__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(
|
|
877
|
+
"input",
|
|
878
|
+
{
|
|
879
|
+
className: "request-payment-input-box",
|
|
880
|
+
type: "text",
|
|
881
|
+
placeholder: "Full Name",
|
|
882
|
+
"data-token": "name",
|
|
883
|
+
onChange: handleChange,
|
|
884
|
+
value: requestDetails == null ? void 0 : requestDetails.name
|
|
885
|
+
}
|
|
886
|
+
), errors.name && /* @__PURE__ */ React6.createElement("small", { className: "request-payment-error-msg" }, errors.name)), /* @__PURE__ */ React6.createElement("div", { className: "request-payment-list-div" }, /* @__PURE__ */ React6.createElement("label", { htmlFor: "requestPhoneNumber", className: "request-payment-input-label" }, "Phone Number"), /* @__PURE__ */ React6.createElement(
|
|
887
|
+
PatternFormat,
|
|
888
|
+
{
|
|
889
|
+
className: "request-payment-input-box",
|
|
890
|
+
placeholder: "Mobile number",
|
|
891
|
+
format: "+1 (###) ###-####",
|
|
892
|
+
value: phone,
|
|
893
|
+
onValueChange: (e) => {
|
|
894
|
+
handlePhoneChange(e);
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
), errors.phone && /* @__PURE__ */ React6.createElement("small", { className: "request-payment-error-msg" }, errors.phone)), /* @__PURE__ */ React6.createElement("div", { className: "request-payment-list-div" }, /* @__PURE__ */ React6.createElement("label", { htmlFor: "exampleFormControlInput2", className: "request-payment-input-label" }, "EMAIL"), /* @__PURE__ */ React6.createElement(
|
|
898
|
+
"input",
|
|
899
|
+
{
|
|
900
|
+
className: "request-payment-input-box",
|
|
901
|
+
type: "text",
|
|
902
|
+
placeholder: "Email",
|
|
903
|
+
onChange: handleChange,
|
|
904
|
+
"data-token": "email",
|
|
905
|
+
value: requestDetails == null ? void 0 : requestDetails.email
|
|
906
|
+
}
|
|
907
|
+
), errors.email && /* @__PURE__ */ React6.createElement("small", { className: "request-payment-error-msg" }, errors.email)), /* @__PURE__ */ React6.createElement(
|
|
908
|
+
"button",
|
|
909
|
+
{
|
|
910
|
+
type: "button",
|
|
911
|
+
className: "request-payment-submit-button",
|
|
912
|
+
onClick: sendRequestPayment,
|
|
913
|
+
disabled: loading
|
|
914
|
+
},
|
|
915
|
+
loading ? "Loading..." : "Send Request"
|
|
916
|
+
), /* @__PURE__ */ React6.createElement("div", { className: "request-payment-fractal-powerd-by" }, /* @__PURE__ */ React6.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "17", height: "16", viewBox: "0 0 17 16", fill: "none" }, /* @__PURE__ */ React6.createElement("path", { d: "M15.2165 4.11839C15.1973 3.69746 15.1973 3.29567 15.1973 2.89387C15.1973 2.56861 14.9486 2.31988 14.6234 2.31988C12.2317 2.31988 10.4141 1.63109 8.90257 0.157848C8.67298 -0.0526158 8.32858 -0.0526158 8.09898 0.157848C6.58748 1.63109 4.76984 2.31988 2.37821 2.31988C2.05295 2.31988 1.80422 2.56861 1.80422 2.89387C1.80422 3.29567 1.80422 3.69746 1.78508 4.11839C1.70855 8.13632 1.59375 13.6466 8.30945 15.9617L8.50078 16L8.69211 15.9617C15.3887 13.6466 15.293 8.15546 15.2165 4.11839ZM8.04159 9.6861C7.92679 9.78176 7.79286 9.83916 7.63979 9.83916H7.62066C7.46759 9.83916 7.31453 9.76263 7.21887 9.64783L5.43949 7.67713L6.30048 6.91181L7.69719 8.46158L10.7967 5.5151L11.5812 6.35695L8.04159 9.6861Z", fill: "#727272" })), "Secure payments powered by ", /* @__PURE__ */ React6.createElement("span", null, "Fractal"), /* @__PURE__ */ React6.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 18 18", fill: "none" }, /* @__PURE__ */ React6.createElement("path", { d: "M17.4999 5.49758V7.01156C17.4999 7.05924 17.4595 7.09898 17.411 7.09898H12.3516C12.9169 6.54266 13.4781 5.99032 14.0434 5.434C14.0596 5.4181 14.0838 5.41016 14.104 5.41016H17.411C17.4595 5.41016 17.4999 5.44989 17.4999 5.49758Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M12.3462 10.9037V9.29836C12.3462 9.25067 12.3866 9.21094 12.435 9.21094H13.8523C13.929 9.21094 13.9694 9.30631 13.9129 9.35796C13.392 9.87455 12.8711 10.3911 12.3462 10.9037Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M12.4404 9.00523H15.6949C15.7434 9.00523 15.7838 8.96549 15.7838 8.91781V7.40383C15.7838 7.35614 15.7434 7.31641 15.6949 7.31641H12.4404C12.3919 7.31641 12.3516 7.35614 12.3516 7.40383V8.91781C12.3516 8.96549 12.3919 9.00523 12.4404 9.00523Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M10.1581 0.0120725L11.4906 0.77105C11.531 0.794892 11.5471 0.84655 11.5229 0.890261L8.99114 5.20173C8.78521 4.44275 8.57927 3.68775 8.37334 2.92877C8.36527 2.90493 8.3693 2.88109 8.38142 2.86122L10.0329 0.0438621C10.0612 0.000151419 10.1177 -0.0117697 10.1581 0.0120725Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M12.3382 7.10006L10.9289 6.29737C10.8886 6.27353 10.8724 6.22187 10.8966 6.17816L11.6033 4.97015C11.6436 4.9026 11.7446 4.91452 11.7648 4.99002C11.9546 5.69734 12.1484 6.40068 12.3382 7.10006Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M10.7107 6.0771L12.338 3.30345C12.3622 3.26372 12.346 3.20808 12.3057 3.18424L10.9732 2.42526C10.9328 2.40142 10.8763 2.41732 10.852 2.45705L9.22476 5.2307C9.20053 5.27044 9.21669 5.32607 9.25706 5.34991L10.5896 6.10889C10.634 6.13273 10.6865 6.11683 10.7107 6.0771Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M1.66713 3.51237L2.99963 2.75339C3.04001 2.72955 3.09654 2.74544 3.12077 2.78518L5.65251 7.09665C4.88128 6.89399 4.11408 6.69133 3.34285 6.48867C3.31862 6.4847 3.30247 6.4688 3.29036 6.44893L1.63483 3.63158C1.6106 3.58787 1.62271 3.53621 1.66713 3.51237Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M8.99793 5.20018L7.58871 5.99889C7.54833 6.02274 7.4918 6.00684 7.46757 5.9671L6.76095 4.76307C6.72057 4.69552 6.78517 4.61605 6.86189 4.63591C7.57256 4.82268 8.28726 5.00944 8.99793 5.20018Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M7.27986 6.07054L5.6526 3.2969C5.62837 3.25716 5.57588 3.24127 5.53146 3.26511L4.19896 4.02409C4.15858 4.04793 4.14243 4.09959 4.16666 4.1433L5.79392 6.91694C5.81815 6.95668 5.87064 6.97257 5.91506 6.94873L7.24756 6.18975C7.28794 6.16591 7.30409 6.11425 7.27986 6.07054Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M0.5 12.4998V10.9859C0.5 10.9382 0.540379 10.8984 0.588833 10.8984H5.64829C5.08299 11.4548 4.52172 12.0071 3.95642 12.5634C3.94027 12.5793 3.91604 12.5873 3.89585 12.5873H0.588833C0.540379 12.5873 0.5 12.5475 0.5 12.4998Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M5.65129 7.09766V8.70303C5.65129 8.75072 5.61091 8.79045 5.56246 8.79045H4.14516C4.06844 8.79045 4.02806 8.69508 4.08459 8.64343C4.60548 8.12685 5.12637 7.61424 5.65129 7.09766Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M5.55967 8.99609H2.30514C2.25669 8.99609 2.21631 9.03583 2.21631 9.08352V10.5975C2.21631 10.6452 2.25669 10.6849 2.30514 10.6849H5.55967C5.60813 10.6849 5.6485 10.6452 5.6485 10.5975V9.08352C5.6485 9.03583 5.60813 8.99609 5.55967 8.99609Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M7.82638 17.9865L6.49388 17.2276C6.4535 17.2037 6.43735 17.1521 6.46158 17.1083L8.99333 12.7969C9.19926 13.5559 9.40519 14.3109 9.61112 15.0698C9.6192 15.0937 9.61516 15.1175 9.60305 15.1374L7.95155 17.9547C7.91925 17.9985 7.86676 18.0104 7.82638 17.9865Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M5.64795 10.8984L7.05717 11.7011C7.09755 11.725 7.1137 11.7766 7.08947 11.8203L6.38284 13.0283C6.34246 13.0959 6.24152 13.084 6.22133 13.0085C6.02751 12.3012 5.83773 11.5978 5.64795 10.8984Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M7.2739 11.9258L5.64664 14.6994C5.62241 14.7392 5.63856 14.7948 5.67894 14.8187L7.01144 15.5776C7.05182 15.6015 7.10835 15.5856 7.13258 15.5458L8.75984 12.7722C8.78407 12.7325 8.76792 12.6768 8.72754 12.653L7.39504 11.894C7.35062 11.8702 7.29813 11.8861 7.2739 11.9258Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M16.3199 14.4866L14.9874 15.2456C14.947 15.2694 14.8904 15.2535 14.8662 15.2138L12.3345 10.9023C13.1057 11.105 13.8729 11.3077 14.6441 11.5103C14.6684 11.5143 14.6845 11.5302 14.6966 11.5501L16.3481 14.3674C16.3764 14.4111 16.3643 14.4628 16.3199 14.4866Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M8.99121 12.7983L10.4004 11.9956C10.4408 11.9717 10.4973 11.9876 10.5216 12.0274L11.2282 13.2354C11.2686 13.3029 11.204 13.3824 11.1272 13.3625C10.4166 13.1758 9.70188 12.989 8.99121 12.7983Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M10.7077 11.9285L12.3349 14.7021C12.3592 14.7418 12.4117 14.7577 12.4561 14.7339L13.7886 13.9749C13.829 13.9511 13.8451 13.8994 13.8209 13.8557L12.1936 11.0821C12.1694 11.0423 12.1169 11.0264 12.0725 11.0503L10.74 11.8092C10.6996 11.8331 10.6834 11.8847 10.7077 11.9285Z", fill: "#61C699" })))))
|
|
917
|
+
), /* @__PURE__ */ React6.createElement(
|
|
918
|
+
CustomModal2_default,
|
|
919
|
+
{
|
|
920
|
+
open: showConfirmationModal,
|
|
921
|
+
onClose: handleCloseConfirmationModal,
|
|
922
|
+
maxWidth: "500px"
|
|
923
|
+
},
|
|
924
|
+
/* @__PURE__ */ React6.createElement("div", { className: "fractal-popup-content", style: { padding: "0px", maxWidth: "500px" } }, /* @__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"))))
|
|
925
|
+
)));
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
// src/app/components/RequestPayment/RequestPreAuthPayment.tsx
|
|
929
|
+
import "bootstrap/dist/js/bootstrap.bundle.min.js";
|
|
930
|
+
import React7, { useState as useState2, useEffect as useEffect2 } from "react";
|
|
931
|
+
import axios2 from "axios";
|
|
932
|
+
import { PatternFormat as PatternFormat2 } from "react-number-format";
|
|
933
|
+
function RequestPreAuthPayment(props) {
|
|
934
|
+
const fractalpayClientKey = props.fractalpayClientKey;
|
|
935
|
+
const discount = props == null ? void 0 : props.discount;
|
|
936
|
+
const tax = props == null ? void 0 : props.tax;
|
|
937
|
+
const surcharge = props == null ? void 0 : props.surcharge;
|
|
938
|
+
const [show, setShow] = useState2(false);
|
|
939
|
+
const [loading, setLoading] = useState2(false);
|
|
940
|
+
const [errors, setErrors] = useState2({});
|
|
941
|
+
const [phone, setPhone] = useState2(null);
|
|
942
|
+
const [requestDetails, setRequestDetails] = useState2({
|
|
943
|
+
email: "",
|
|
944
|
+
phone_number: "",
|
|
945
|
+
order_id: "",
|
|
946
|
+
name: "",
|
|
947
|
+
fractalpayPublicKey: fractalpayClientKey
|
|
948
|
+
});
|
|
949
|
+
const [amount, setAmount] = useState2("");
|
|
950
|
+
const [showConfirmationModal, setShowConfirmationModal] = useState2(false);
|
|
951
|
+
const [apiResponse, setApiResponse] = useState2(null);
|
|
952
|
+
const phoneNumberRegex = (value) => /^\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$/.test(value);
|
|
953
|
+
const amoutRegex = /[+-]?([0-9]*[.])?[0-9]+/;
|
|
954
|
+
const isValidEmail = (value) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
|
|
955
|
+
const isAlpha = (value) => /^[A-Za-z\s]*$/.test(value);
|
|
956
|
+
const handleClose = () => {
|
|
957
|
+
setShow(false);
|
|
958
|
+
setErrors({});
|
|
959
|
+
};
|
|
960
|
+
const handleShow = () => setShow(true);
|
|
961
|
+
const handleCloseConfirmationModal = () => {
|
|
962
|
+
console.log(apiResponse, "apiresponse");
|
|
963
|
+
handleSubmit(apiResponse);
|
|
964
|
+
setShowConfirmationModal(false);
|
|
965
|
+
};
|
|
966
|
+
function emptyFields() {
|
|
967
|
+
setRequestDetails({
|
|
968
|
+
email: "",
|
|
969
|
+
phone_number: "",
|
|
970
|
+
order_id: "",
|
|
971
|
+
name: "",
|
|
972
|
+
fractalpayPublicKey: fractalpayClientKey
|
|
973
|
+
});
|
|
974
|
+
setAmount("");
|
|
975
|
+
}
|
|
976
|
+
function handleSubmit(event) {
|
|
977
|
+
let message = {
|
|
978
|
+
type: "preview.compiledcheck",
|
|
979
|
+
other: __spreadProps(__spreadValues({}, event), { status: true })
|
|
980
|
+
};
|
|
981
|
+
window.parent.postMessage(message, "*");
|
|
982
|
+
}
|
|
983
|
+
const sendRequestPayment = async () => {
|
|
984
|
+
if (Object.keys(errors).length > 0) {
|
|
985
|
+
return;
|
|
986
|
+
}
|
|
987
|
+
setErrors({});
|
|
988
|
+
if (!(requestDetails == null ? void 0 : requestDetails.email) && phone && !phoneNumberRegex(phone)) {
|
|
989
|
+
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
|
990
|
+
phone: ErrorText.phonenumbervalid
|
|
991
|
+
}));
|
|
992
|
+
return;
|
|
993
|
+
}
|
|
994
|
+
if (!validateForm()) {
|
|
995
|
+
return;
|
|
996
|
+
}
|
|
997
|
+
try {
|
|
998
|
+
setLoading(true);
|
|
999
|
+
const formData = {
|
|
1000
|
+
fractalpayPublicKey: fractalpayClientKey,
|
|
1001
|
+
amount,
|
|
1002
|
+
phone_number: phone,
|
|
1003
|
+
order_id: requestDetails.order_id,
|
|
1004
|
+
action: "request",
|
|
1005
|
+
name: requestDetails.name,
|
|
1006
|
+
email: requestDetails.email,
|
|
1007
|
+
customer_id: (props == null ? void 0 : props.customerId) ? props == null ? void 0 : props.customerId : "",
|
|
1008
|
+
discount,
|
|
1009
|
+
surcharge,
|
|
1010
|
+
tax,
|
|
1011
|
+
require_3ds: props == null ? void 0 : props.require_3ds
|
|
1012
|
+
};
|
|
1013
|
+
let response = await axios2.post(`${baseUrl}send-request-pre-auth-payment`, formData);
|
|
1014
|
+
if ((response == null ? void 0 : response.status) === 200) {
|
|
1015
|
+
setShowConfirmationModal(true);
|
|
1016
|
+
setShow(false);
|
|
1017
|
+
emptyFields();
|
|
1018
|
+
setApiResponse(response == null ? void 0 : response.data);
|
|
1019
|
+
}
|
|
1020
|
+
setLoading(false);
|
|
1021
|
+
} catch (error) {
|
|
1022
|
+
console.log(error);
|
|
1023
|
+
setLoading(false);
|
|
1024
|
+
}
|
|
1025
|
+
};
|
|
1026
|
+
let favicon_logo = baseUrl + "images/logo-img.png";
|
|
1027
|
+
const handleChange = (e) => {
|
|
1028
|
+
const { value } = e.target;
|
|
1029
|
+
const token = e.target.dataset.token;
|
|
1030
|
+
setRequestDetails(__spreadProps(__spreadValues({}, requestDetails), { [token]: value }));
|
|
1031
|
+
if (token === "name" && !isAlpha(value)) {
|
|
1032
|
+
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
|
1033
|
+
[token]: ErrorText.onlylettersallowed
|
|
1034
|
+
}));
|
|
1035
|
+
return;
|
|
1036
|
+
}
|
|
1037
|
+
let errorobj = errors;
|
|
1038
|
+
if (token === "email" && !phone) {
|
|
1039
|
+
delete errorobj.phone;
|
|
1040
|
+
setErrors(errorobj);
|
|
1041
|
+
}
|
|
1042
|
+
if (value) {
|
|
1043
|
+
delete errorobj[token];
|
|
1044
|
+
setErrors(errorobj);
|
|
1045
|
+
}
|
|
1046
|
+
if (token === "email" && !value) {
|
|
1047
|
+
delete errorobj[token];
|
|
1048
|
+
setErrors(errorobj);
|
|
1049
|
+
}
|
|
1050
|
+
};
|
|
1051
|
+
const handleAmountChange = (data) => {
|
|
1052
|
+
const { value } = data;
|
|
1053
|
+
if (Number(value) > 0) {
|
|
1054
|
+
let errorobj = errors;
|
|
1055
|
+
delete errorobj.amount;
|
|
1056
|
+
setErrors(errorobj);
|
|
1057
|
+
}
|
|
1058
|
+
setAmount(value);
|
|
1059
|
+
};
|
|
1060
|
+
const validateForm = () => {
|
|
1061
|
+
let newErrors = {};
|
|
1062
|
+
if (!amount) newErrors.amount = ErrorText.amountrequired;
|
|
1063
|
+
if (requestDetails.email && !isValidEmail(requestDetails == null ? void 0 : requestDetails.email)) newErrors.email = ErrorText.invalidemail;
|
|
1064
|
+
if (!phone && !(requestDetails == null ? void 0 : requestDetails.email)) newErrors.phone = ErrorText.phoneoremailrequired;
|
|
1065
|
+
if (!phone && !(requestDetails == null ? void 0 : requestDetails.email)) newErrors.email = ErrorText.phoneoremailrequired;
|
|
1066
|
+
if (!phone && requestDetails.email && !isValidEmail(requestDetails == null ? void 0 : requestDetails.email)) newErrors.email = ErrorText.invalidemail;
|
|
1067
|
+
if (props.from === "merchant" && !requestDetails.order_id) newErrors.order_id = ErrorText.orderidrequired;
|
|
1068
|
+
setErrors(newErrors);
|
|
1069
|
+
return Object.keys(newErrors).length === 0;
|
|
1070
|
+
};
|
|
1071
|
+
useEffect2(() => {
|
|
1072
|
+
if (props) {
|
|
1073
|
+
setRequestDetails((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
1074
|
+
order_id: props.orderID ? props.orderID : "",
|
|
1075
|
+
name: (props == null ? void 0 : props.name) ? props == null ? void 0 : props.name : "",
|
|
1076
|
+
email: (props == null ? void 0 : props.email) ? props == null ? void 0 : props.email : ""
|
|
1077
|
+
}));
|
|
1078
|
+
setAmount(props.amount ? props.amount : "");
|
|
1079
|
+
setPhone(props.phone ? `${props.phone}` : null);
|
|
1080
|
+
}
|
|
1081
|
+
}, [props]);
|
|
1082
|
+
const handlePhoneChange = (e) => {
|
|
1083
|
+
let value = e == null ? void 0 : e.value;
|
|
1084
|
+
if (value && (value == null ? void 0 : value.length) > 0 && (value == null ? void 0 : value.length) !== 10) {
|
|
1085
|
+
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
|
1086
|
+
phone: ErrorText.phonenumberlength
|
|
1087
|
+
}));
|
|
1088
|
+
setPhone(value);
|
|
1089
|
+
return;
|
|
1090
|
+
} else {
|
|
1091
|
+
setPhone(value);
|
|
1092
|
+
}
|
|
1093
|
+
let errorobj = errors;
|
|
1094
|
+
delete errorobj.phone;
|
|
1095
|
+
if (value && !(requestDetails == null ? void 0 : requestDetails.email)) {
|
|
1096
|
+
delete errorobj.email;
|
|
1097
|
+
}
|
|
1098
|
+
setErrors(errorobj);
|
|
1099
|
+
};
|
|
1100
|
+
function formatAmount(amount2) {
|
|
1101
|
+
return new Intl.NumberFormat("en-US", {
|
|
1102
|
+
style: "currency",
|
|
1103
|
+
currency: "USD",
|
|
1104
|
+
minimumFractionDigits: 2,
|
|
1105
|
+
maximumFractionDigits: 2
|
|
1106
|
+
}).format(Number(amount2));
|
|
1107
|
+
}
|
|
1108
|
+
return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(RequestPaymentstyles_default, null), /* @__PURE__ */ React7.createElement(Loader_default, { loading }), /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement("button", { className: "paymentBtn", onClick: handleShow }, "Send Request"), /* @__PURE__ */ React7.createElement("div", { className: "frac-form" }, /* @__PURE__ */ React7.createElement(
|
|
1109
|
+
CustomModal2_default,
|
|
1110
|
+
{
|
|
1111
|
+
open: show,
|
|
1112
|
+
onClose: () => setShow(false),
|
|
1113
|
+
maxWidth: "500px"
|
|
1114
|
+
},
|
|
1115
|
+
/* @__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" })))))),
|
|
1116
|
+
/* @__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(
|
|
1117
|
+
"input",
|
|
1118
|
+
{
|
|
1119
|
+
className: "request-payment-input-box",
|
|
1120
|
+
type: "text",
|
|
1121
|
+
placeholder: "Full Name",
|
|
1122
|
+
"data-token": "name",
|
|
1123
|
+
onChange: handleChange,
|
|
1124
|
+
value: requestDetails == null ? void 0 : requestDetails.name
|
|
1125
|
+
}
|
|
1126
|
+
), errors.name && /* @__PURE__ */ React7.createElement("small", { className: "request-payment-error-msg" }, errors.name)), /* @__PURE__ */ React7.createElement("div", { className: "request-payment-list-div" }, /* @__PURE__ */ React7.createElement("label", { htmlFor: "requestPhoneNumber", className: "request-payment-input-label" }, "Phone Number"), /* @__PURE__ */ React7.createElement(
|
|
1127
|
+
PatternFormat2,
|
|
1128
|
+
{
|
|
1129
|
+
className: "request-payment-input-box",
|
|
1130
|
+
placeholder: "Mobile number",
|
|
1131
|
+
format: "+1 (###) ###-####",
|
|
1132
|
+
value: phone,
|
|
1133
|
+
onValueChange: (e) => {
|
|
1134
|
+
handlePhoneChange(e);
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
), errors.phone && /* @__PURE__ */ React7.createElement("small", { className: "request-payment-error-msg" }, errors.phone)), /* @__PURE__ */ React7.createElement("div", { className: "request-payment-list-div" }, /* @__PURE__ */ React7.createElement("label", { htmlFor: "exampleFormControlInput2", className: "request-payment-input-label" }, "EMAIL"), /* @__PURE__ */ React7.createElement(
|
|
1138
|
+
"input",
|
|
1139
|
+
{
|
|
1140
|
+
className: "request-payment-input-box",
|
|
1141
|
+
type: "text",
|
|
1142
|
+
placeholder: "Email",
|
|
1143
|
+
onChange: handleChange,
|
|
1144
|
+
"data-token": "email",
|
|
1145
|
+
value: requestDetails == null ? void 0 : requestDetails.email
|
|
1146
|
+
}
|
|
1147
|
+
), errors.email && /* @__PURE__ */ React7.createElement("small", { className: "request-payment-error-msg" }, errors.email)), /* @__PURE__ */ React7.createElement(
|
|
1148
|
+
"button",
|
|
1149
|
+
{
|
|
1150
|
+
type: "button",
|
|
1151
|
+
className: "request-payment-submit-button",
|
|
1152
|
+
onClick: sendRequestPayment,
|
|
1153
|
+
disabled: loading
|
|
1154
|
+
},
|
|
1155
|
+
loading ? "Loading..." : "Send Request"
|
|
1156
|
+
), /* @__PURE__ */ React7.createElement("div", { className: "request-payment-fractal-powerd-by" }, /* @__PURE__ */ React7.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "17", height: "16", viewBox: "0 0 17 16", fill: "none" }, /* @__PURE__ */ React7.createElement("path", { d: "M15.2165 4.11839C15.1973 3.69746 15.1973 3.29567 15.1973 2.89387C15.1973 2.56861 14.9486 2.31988 14.6234 2.31988C12.2317 2.31988 10.4141 1.63109 8.90257 0.157848C8.67298 -0.0526158 8.32858 -0.0526158 8.09898 0.157848C6.58748 1.63109 4.76984 2.31988 2.37821 2.31988C2.05295 2.31988 1.80422 2.56861 1.80422 2.89387C1.80422 3.29567 1.80422 3.69746 1.78508 4.11839C1.70855 8.13632 1.59375 13.6466 8.30945 15.9617L8.50078 16L8.69211 15.9617C15.3887 13.6466 15.293 8.15546 15.2165 4.11839ZM8.04159 9.6861C7.92679 9.78176 7.79286 9.83916 7.63979 9.83916H7.62066C7.46759 9.83916 7.31453 9.76263 7.21887 9.64783L5.43949 7.67713L6.30048 6.91181L7.69719 8.46158L10.7967 5.5151L11.5812 6.35695L8.04159 9.6861Z", fill: "#727272" })), "Secure payments powered by ", /* @__PURE__ */ React7.createElement("span", null, "Fractal"), /* @__PURE__ */ React7.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 18 18", fill: "none" }, /* @__PURE__ */ React7.createElement("path", { d: "M17.4999 5.49758V7.01156C17.4999 7.05924 17.4595 7.09898 17.411 7.09898H12.3516C12.9169 6.54266 13.4781 5.99032 14.0434 5.434C14.0596 5.4181 14.0838 5.41016 14.104 5.41016H17.411C17.4595 5.41016 17.4999 5.44989 17.4999 5.49758Z", fill: "#61C699" }), /* @__PURE__ */ React7.createElement("path", { d: "M12.3462 10.9037V9.29836C12.3462 9.25067 12.3866 9.21094 12.435 9.21094H13.8523C13.929 9.21094 13.9694 9.30631 13.9129 9.35796C13.392 9.87455 12.8711 10.3911 12.3462 10.9037Z", fill: "#61C699" }), /* @__PURE__ */ React7.createElement("path", { d: "M12.4404 9.00523H15.6949C15.7434 9.00523 15.7838 8.96549 15.7838 8.91781V7.40383C15.7838 7.35614 15.7434 7.31641 15.6949 7.31641H12.4404C12.3919 7.31641 12.3516 7.35614 12.3516 7.40383V8.91781C12.3516 8.96549 12.3919 9.00523 12.4404 9.00523Z", fill: "#61C699" }), /* @__PURE__ */ React7.createElement("path", { d: "M10.1581 0.0120725L11.4906 0.77105C11.531 0.794892 11.5471 0.84655 11.5229 0.890261L8.99114 5.20173C8.78521 4.44275 8.57927 3.68775 8.37334 2.92877C8.36527 2.90493 8.3693 2.88109 8.38142 2.86122L10.0329 0.0438621C10.0612 0.000151419 10.1177 -0.0117697 10.1581 0.0120725Z", fill: "#61C699" }), /* @__PURE__ */ React7.createElement("path", { d: "M12.3382 7.10006L10.9289 6.29737C10.8886 6.27353 10.8724 6.22187 10.8966 6.17816L11.6033 4.97015C11.6436 4.9026 11.7446 4.91452 11.7648 4.99002C11.9546 5.69734 12.1484 6.40068 12.3382 7.10006Z", fill: "#61C699" }), /* @__PURE__ */ React7.createElement("path", { d: "M10.7107 6.0771L12.338 3.30345C12.3622 3.26372 12.346 3.20808 12.3057 3.18424L10.9732 2.42526C10.9328 2.40142 10.8763 2.41732 10.852 2.45705L9.22476 5.2307C9.20053 5.27044 9.21669 5.32607 9.25706 5.34991L10.5896 6.10889C10.634 6.13273 10.6865 6.11683 10.7107 6.0771Z", fill: "#61C699" }), /* @__PURE__ */ React7.createElement("path", { d: "M1.66713 3.51237L2.99963 2.75339C3.04001 2.72955 3.09654 2.74544 3.12077 2.78518L5.65251 7.09665C4.88128 6.89399 4.11408 6.69133 3.34285 6.48867C3.31862 6.4847 3.30247 6.4688 3.29036 6.44893L1.63483 3.63158C1.6106 3.58787 1.62271 3.53621 1.66713 3.51237Z", fill: "#61C699" }), /* @__PURE__ */ React7.createElement("path", { d: "M8.99793 5.20018L7.58871 5.99889C7.54833 6.02274 7.4918 6.00684 7.46757 5.9671L6.76095 4.76307C6.72057 4.69552 6.78517 4.61605 6.86189 4.63591C7.57256 4.82268 8.28726 5.00944 8.99793 5.20018Z", fill: "#61C699" }), /* @__PURE__ */ React7.createElement("path", { d: "M7.27986 6.07054L5.6526 3.2969C5.62837 3.25716 5.57588 3.24127 5.53146 3.26511L4.19896 4.02409C4.15858 4.04793 4.14243 4.09959 4.16666 4.1433L5.79392 6.91694C5.81815 6.95668 5.87064 6.97257 5.91506 6.94873L7.24756 6.18975C7.28794 6.16591 7.30409 6.11425 7.27986 6.07054Z", fill: "#61C699" }), /* @__PURE__ */ React7.createElement("path", { d: "M0.5 12.4998V10.9859C0.5 10.9382 0.540379 10.8984 0.588833 10.8984H5.64829C5.08299 11.4548 4.52172 12.0071 3.95642 12.5634C3.94027 12.5793 3.91604 12.5873 3.89585 12.5873H0.588833C0.540379 12.5873 0.5 12.5475 0.5 12.4998Z", fill: "#61C699" }), /* @__PURE__ */ React7.createElement("path", { d: "M5.65129 7.09766V8.70303C5.65129 8.75072 5.61091 8.79045 5.56246 8.79045H4.14516C4.06844 8.79045 4.02806 8.69508 4.08459 8.64343C4.60548 8.12685 5.12637 7.61424 5.65129 7.09766Z", fill: "#61C699" }), /* @__PURE__ */ React7.createElement("path", { d: "M5.55967 8.99609H2.30514C2.25669 8.99609 2.21631 9.03583 2.21631 9.08352V10.5975C2.21631 10.6452 2.25669 10.6849 2.30514 10.6849H5.55967C5.60813 10.6849 5.6485 10.6452 5.6485 10.5975V9.08352C5.6485 9.03583 5.60813 8.99609 5.55967 8.99609Z", fill: "#61C699" }), /* @__PURE__ */ React7.createElement("path", { d: "M7.82638 17.9865L6.49388 17.2276C6.4535 17.2037 6.43735 17.1521 6.46158 17.1083L8.99333 12.7969C9.19926 13.5559 9.40519 14.3109 9.61112 15.0698C9.6192 15.0937 9.61516 15.1175 9.60305 15.1374L7.95155 17.9547C7.91925 17.9985 7.86676 18.0104 7.82638 17.9865Z", fill: "#61C699" }), /* @__PURE__ */ React7.createElement("path", { d: "M5.64795 10.8984L7.05717 11.7011C7.09755 11.725 7.1137 11.7766 7.08947 11.8203L6.38284 13.0283C6.34246 13.0959 6.24152 13.084 6.22133 13.0085C6.02751 12.3012 5.83773 11.5978 5.64795 10.8984Z", fill: "#61C699" }), /* @__PURE__ */ React7.createElement("path", { d: "M7.2739 11.9258L5.64664 14.6994C5.62241 14.7392 5.63856 14.7948 5.67894 14.8187L7.01144 15.5776C7.05182 15.6015 7.10835 15.5856 7.13258 15.5458L8.75984 12.7722C8.78407 12.7325 8.76792 12.6768 8.72754 12.653L7.39504 11.894C7.35062 11.8702 7.29813 11.8861 7.2739 11.9258Z", fill: "#61C699" }), /* @__PURE__ */ React7.createElement("path", { d: "M16.3199 14.4866L14.9874 15.2456C14.947 15.2694 14.8904 15.2535 14.8662 15.2138L12.3345 10.9023C13.1057 11.105 13.8729 11.3077 14.6441 11.5103C14.6684 11.5143 14.6845 11.5302 14.6966 11.5501L16.3481 14.3674C16.3764 14.4111 16.3643 14.4628 16.3199 14.4866Z", fill: "#61C699" }), /* @__PURE__ */ React7.createElement("path", { d: "M8.99121 12.7983L10.4004 11.9956C10.4408 11.9717 10.4973 11.9876 10.5216 12.0274L11.2282 13.2354C11.2686 13.3029 11.204 13.3824 11.1272 13.3625C10.4166 13.1758 9.70188 12.989 8.99121 12.7983Z", fill: "#61C699" }), /* @__PURE__ */ React7.createElement("path", { d: "M10.7077 11.9285L12.3349 14.7021C12.3592 14.7418 12.4117 14.7577 12.4561 14.7339L13.7886 13.9749C13.829 13.9511 13.8451 13.8994 13.8209 13.8557L12.1936 11.0821C12.1694 11.0423 12.1169 11.0264 12.0725 11.0503L10.74 11.8092C10.6996 11.8331 10.6834 11.8847 10.7077 11.9285Z", fill: "#61C699" }))))
|
|
1157
|
+
), /* @__PURE__ */ React7.createElement(
|
|
1158
|
+
CustomModal2_default,
|
|
1159
|
+
{
|
|
1160
|
+
open: showConfirmationModal,
|
|
1161
|
+
onClose: handleCloseConfirmationModal,
|
|
1162
|
+
maxWidth: "500px"
|
|
1163
|
+
},
|
|
1164
|
+
/* @__PURE__ */ React7.createElement("div", { className: "fractal-popup-content", style: { padding: "0px", maxWidth: "500px" } }, /* @__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"))))
|
|
1165
|
+
))));
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
// src/app/components/Charge/GetPaymentPage.tsx
|
|
1169
|
+
import React13, { useEffect as useEffect4, useState as useState3 } from "react";
|
|
1170
|
+
|
|
1171
|
+
// src/app/components/Charge/Chargewidgetstyles.tsx
|
|
1172
|
+
import React8 from "react";
|
|
1173
|
+
function Chargewidgetstyles() {
|
|
1174
|
+
const primarycolor = "#000";
|
|
1175
|
+
const primarybgcolor = "#fff";
|
|
1176
|
+
const primarybodycolor = "#212529";
|
|
1177
|
+
const primarybordercolor = "#dee2e6";
|
|
1178
|
+
return /* @__PURE__ */ React8.createElement("style", null, `
|
|
1179
|
+
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');
|
|
1180
|
+
body
|
|
1181
|
+
{
|
|
1182
|
+
font-family: 'Inter', sans-serif !important;
|
|
1183
|
+
}
|
|
1184
|
+
input
|
|
1185
|
+
{
|
|
1186
|
+
font-family: 'Inter', sans-serif !important;
|
|
1187
|
+
}
|
|
1188
|
+
.frac-form .form-group{
|
|
1189
|
+
margin:0 !important
|
|
1190
|
+
}
|
|
1191
|
+
.frac-form .mb-4{
|
|
1192
|
+
margin-bottom : 10px !important
|
|
1193
|
+
}
|
|
1194
|
+
.frac-form .save-ach-div{
|
|
1195
|
+
display:flex !important;
|
|
1196
|
+
gap:5px !important;
|
|
1197
|
+
align-items:center
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1200
|
+
.frac-form .card-cvv-in{
|
|
1201
|
+
height : 36px !importantt;
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
.frac-form .pay-payment-amount{
|
|
1205
|
+
text-align:start !important
|
|
1206
|
+
}
|
|
1207
|
+
.frac-form .pay-amount{
|
|
1208
|
+
text-align:start !important
|
|
1209
|
+
}
|
|
1210
|
+
.frac-form .pay-main-logo{
|
|
1211
|
+
text-align:start !important
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
|
|
1215
|
+
|
|
1216
|
+
.paymentBtn {
|
|
1217
|
+
background-color: black;
|
|
1218
|
+
border: none;
|
|
1219
|
+
color: white;
|
|
1220
|
+
padding: 15px 32px;
|
|
1221
|
+
text-align: center;
|
|
1222
|
+
text-decoration: none;
|
|
1223
|
+
display: inline-block;
|
|
1224
|
+
font-size: 16px;
|
|
1225
|
+
margin: 4px 2px;
|
|
1226
|
+
cursor: pointer;
|
|
1227
|
+
border-radius: 180px;
|
|
1228
|
+
/* width: auto; */
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
.main-logo {
|
|
1232
|
+
text-align: center;
|
|
1233
|
+
margin-bottom: 20px;
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1236
|
+
.main-logo img {
|
|
1237
|
+
max-width: 180px;
|
|
1238
|
+
}
|
|
1239
|
+
|
|
1240
|
+
.pay-main-box {
|
|
1241
|
+
width: 365px !important;
|
|
1242
|
+
height: 93%;
|
|
1243
|
+
background: 0 0 #ffffff;
|
|
1244
|
+
border-radius: 12px;
|
|
1245
|
+
|
|
1246
|
+
|
|
1247
|
+
border: 1px solid #E0DFE2;
|
|
1248
|
+
margin: 0 auto;
|
|
1249
|
+
display: block;
|
|
1250
|
+
padding: 0px 26px !important
|
|
1251
|
+
}
|
|
1252
|
+
.pay-main-box .pay-header {
|
|
1253
|
+
display: flex;
|
|
1254
|
+
justify-content: center;
|
|
1255
|
+
align-items: center;
|
|
1256
|
+
text-align: center;
|
|
1257
|
+
}
|
|
1258
|
+
|
|
1259
|
+
.pay-main-box .pay-header button {
|
|
1260
|
+
border: 0;
|
|
1261
|
+
background: none;
|
|
1262
|
+
padding: 0;
|
|
1263
|
+
box-shadow: 0;
|
|
1264
|
+
outline: inherit;
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1267
|
+
.pay-main-box h1 {
|
|
1268
|
+
margin: 0;
|
|
1269
|
+
flex: 1;
|
|
1270
|
+
padding: 10px 0;
|
|
1271
|
+
font-size: 23px;
|
|
1272
|
+
font-weight: 500;
|
|
1273
|
+
color: #35254D;
|
|
1274
|
+
align-items: start;
|
|
1275
|
+
display: flex;
|
|
1276
|
+
}
|
|
1277
|
+
.tab {
|
|
1278
|
+
overflow: hidden;
|
|
1279
|
+
padding: 5px;
|
|
1280
|
+
border-radius: 8px;
|
|
1281
|
+
display: flex;
|
|
1282
|
+
justify-content: space-around;
|
|
1283
|
+
margin-bottom:12px
|
|
1284
|
+
}
|
|
1285
|
+
|
|
1286
|
+
/* Style the buttons inside the tab */
|
|
1287
|
+
.tab button {
|
|
1288
|
+
float: left;
|
|
1289
|
+
border: none;
|
|
1290
|
+
outline: none;
|
|
1291
|
+
cursor: pointer;
|
|
1292
|
+
background:white;
|
|
1293
|
+
padding: 11px 16px;
|
|
1294
|
+
transition: 0.3s;
|
|
1295
|
+
font-size: 16px;
|
|
1296
|
+
width: 143px;
|
|
1297
|
+
border-radius: 5px;
|
|
1298
|
+
box-shadow: inherit;
|
|
1299
|
+
outline: none;
|
|
1300
|
+
color: ${primarycolor};
|
|
1301
|
+
}
|
|
1302
|
+
|
|
1303
|
+
/* Change background color of buttons on hover */
|
|
1304
|
+
.tab button:hover {
|
|
1305
|
+
background-color: #f0f0f0;
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
/* Create an active/current tablink class */
|
|
1309
|
+
// .tab button.active {
|
|
1310
|
+
// background-color: #ccc;
|
|
1311
|
+
// }
|
|
1312
|
+
|
|
1313
|
+
/* Style the tab content */
|
|
1314
|
+
|
|
1315
|
+
|
|
1316
|
+
.parent-pay-container{
|
|
1317
|
+
padding: 20px 10% ;
|
|
1318
|
+
}
|
|
1319
|
+
.pay-container{
|
|
1320
|
+
display: grid;
|
|
1321
|
+
grid-template-columns: 2fr 3fr;
|
|
1322
|
+
|
|
1323
|
+
}
|
|
1324
|
+
.pay-main{
|
|
1325
|
+
padding-y: 20px}
|
|
1326
|
+
|
|
1327
|
+
.request-payment-close-popup {
|
|
1328
|
+
position: absolute;
|
|
1329
|
+
right: 20px;
|
|
1330
|
+
top: 20px;
|
|
1331
|
+
cursor: pointer;
|
|
1332
|
+
}
|
|
1333
|
+
.pay-conatiner-one{
|
|
1334
|
+
border-right: 1px solid #E0DFE2;
|
|
1335
|
+
}
|
|
1336
|
+
.pay-conatiner-one-first{
|
|
1337
|
+
min-height:530px
|
|
1338
|
+
}
|
|
1339
|
+
.pay-conatiner-one-last{
|
|
1340
|
+
display:flex;
|
|
1341
|
+
font-size:12px;
|
|
1342
|
+
gap:5px;
|
|
1343
|
+
max-width:250px;
|
|
1344
|
+
align-items:center;
|
|
1345
|
+
color:black !important
|
|
1346
|
+
}
|
|
1347
|
+
.pay-conatiner-one-last img{
|
|
1348
|
+
width : 17px;
|
|
1349
|
+
height:17px
|
|
1350
|
+
}
|
|
1351
|
+
.pay-conatiner-two{
|
|
1352
|
+
padding: 0 5% 0;
|
|
1353
|
+
}
|
|
1354
|
+
.pay-logo-container{
|
|
1355
|
+
border-bottom: 1px solid #E0DFE2
|
|
1356
|
+
}
|
|
1357
|
+
.pay-heading{
|
|
1358
|
+
margin: 0;
|
|
1359
|
+
flex: 1;
|
|
1360
|
+
padding: 10px 0;
|
|
1361
|
+
font-size: 23px;
|
|
1362
|
+
font-weight: 500;
|
|
1363
|
+
color: #35254D;
|
|
1364
|
+
align-items: start;
|
|
1365
|
+
display: flex;
|
|
1366
|
+
}
|
|
1367
|
+
.pay-main-logo > img{
|
|
1368
|
+
width: 50%;
|
|
1369
|
+
}
|
|
1370
|
+
.pay-main-logo-res > img{
|
|
1371
|
+
width: 50%;
|
|
1372
|
+
display : none
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1375
|
+
.pay-payment-amount{
|
|
1376
|
+
display: block;
|
|
1377
|
+
font-size: 12px;
|
|
1378
|
+
color: #727272;
|
|
1379
|
+
margin-bottom: 8px;
|
|
1380
|
+
}
|
|
1381
|
+
.pay-amount-conatiner{
|
|
1382
|
+
margin-top: 6%;
|
|
1383
|
+
}
|
|
1384
|
+
.pay-amount{
|
|
1385
|
+
color: #000000;
|
|
1386
|
+
font-size: 38px;
|
|
1387
|
+
display: block;
|
|
1388
|
+
line-height: 110%;
|
|
1389
|
+
letter-spacing: -1px;
|
|
1390
|
+
}
|
|
1391
|
+
.frac-form label{
|
|
1392
|
+
font-family: 'IBM Plex Mono', monospace !important;
|
|
1393
|
+
color: #727272 !important;
|
|
1394
|
+
margin-bottom: 2px !important;
|
|
1395
|
+
font-weight: 600 !important;
|
|
1396
|
+
font-size: 12px !important;
|
|
1397
|
+
display:block !important;
|
|
1398
|
+
text-align : left !important
|
|
1399
|
+
}
|
|
1400
|
+
.form-control{
|
|
1401
|
+
display: block;
|
|
1402
|
+
width: 100%;
|
|
1403
|
+
padding: .375rem .75rem;
|
|
1404
|
+
font-size: 1rem;
|
|
1405
|
+
font-weight: 400;
|
|
1406
|
+
line-height: 1.5;
|
|
1407
|
+
color: ${primarybodycolor};
|
|
1408
|
+
-webkit-appearance: none;
|
|
1409
|
+
-moz-appearance: none;
|
|
1410
|
+
appearance: none;
|
|
1411
|
+
background-color: ${primarybgcolor};
|
|
1412
|
+
background-clip: padding-box;
|
|
1413
|
+
border: 1px solid ${primarybordercolor};
|
|
1414
|
+
border-radius: 0.375rem;
|
|
1415
|
+
transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
|
|
1416
|
+
}
|
|
1417
|
+
.form-control:focus{
|
|
1418
|
+
border-color: #86b7fe;
|
|
1419
|
+
outline: 0;
|
|
1420
|
+
}
|
|
1421
|
+
.toggle-num-wrapper {
|
|
1422
|
+
position: relative;
|
|
1423
|
+
}
|
|
1424
|
+
.card-number-new{
|
|
1425
|
+
border-bottom: none;
|
|
1426
|
+
border-bottom-left-radius: 0px;
|
|
1427
|
+
border-bottom-right-radius: 0px;
|
|
1428
|
+
}
|
|
1429
|
+
.card-crdi {
|
|
1430
|
+
display: flex;
|
|
1431
|
+
border: 1px solid ${primarybordercolor};
|
|
1432
|
+
border-radius: 0.375rem;
|
|
1433
|
+
}
|
|
1434
|
+
.card-expiry-new{
|
|
1435
|
+
border-top-left-radius: 0px;
|
|
1436
|
+
border-top-right-radius: 0px;
|
|
1437
|
+
}
|
|
1438
|
+
.exp-date-year-container{
|
|
1439
|
+
display: flex;
|
|
1440
|
+
flex-wrap: wrap;
|
|
1441
|
+
}
|
|
1442
|
+
.exp-date-year-container .form-group{
|
|
1443
|
+
flex:1;
|
|
1444
|
+
|
|
1445
|
+
}
|
|
1446
|
+
|
|
1447
|
+
.exp-date {
|
|
1448
|
+
float: left;
|
|
1449
|
+
// width: 30%
|
|
1450
|
+
}
|
|
1451
|
+
|
|
1452
|
+
.exp-date input {
|
|
1453
|
+
width: calc(100% + 1px);
|
|
1454
|
+
border-top-right-radius: 0;
|
|
1455
|
+
border-bottom-right-radius: 0;
|
|
1456
|
+
border: 0;
|
|
1457
|
+
border-right: 1px solid ${primarybordercolor};
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1460
|
+
|
|
1461
|
+
.exp-year {
|
|
1462
|
+
float: left;
|
|
1463
|
+
// width: 30%
|
|
1464
|
+
}
|
|
1465
|
+
|
|
1466
|
+
.exp-year input {
|
|
1467
|
+
width: calc(100% + 1px);
|
|
1468
|
+
border-radius: 0;
|
|
1469
|
+
border-top: 0;
|
|
1470
|
+
border-bottom: 0;
|
|
1471
|
+
border-right: 1px solid ${primarybordercolor};
|
|
1472
|
+
}
|
|
1473
|
+
|
|
1474
|
+
.exp-date input:focus {
|
|
1475
|
+
position: relative;
|
|
1476
|
+
z-index: 10;
|
|
1477
|
+
}
|
|
1478
|
+
|
|
1479
|
+
.security-digit {
|
|
1480
|
+
float: right;
|
|
1481
|
+
// width: 40%;
|
|
1482
|
+
position: relative;
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1485
|
+
.security-digit input {
|
|
1486
|
+
border-top-left-radius: 0;
|
|
1487
|
+
border-bottom-left-radius: 0;
|
|
1488
|
+
border-top: 0;
|
|
1489
|
+
border-bottom: 0;
|
|
1490
|
+
border-right:0;
|
|
1491
|
+
}
|
|
1492
|
+
.card-expiry-new{
|
|
1493
|
+
border-top-left-radius: 0px;
|
|
1494
|
+
border-top-right-radius: 0px;
|
|
1495
|
+
}
|
|
1496
|
+
.form-control{box-sizing: border-box ;}
|
|
1497
|
+
#PaymentForm .form-group{
|
|
1498
|
+
padding:5px 0 ;
|
|
1499
|
+
matgin: 0 !important
|
|
1500
|
+
}
|
|
1501
|
+
|
|
1502
|
+
.toggle-label {
|
|
1503
|
+
position: relative;
|
|
1504
|
+
display: inline-block;
|
|
1505
|
+
width: 40px;
|
|
1506
|
+
height: 24px;
|
|
1507
|
+
background-color: #ccc;
|
|
1508
|
+
border-radius: 12px;
|
|
1509
|
+
cursor: pointer;
|
|
1510
|
+
transition: background-color 0.3s;
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1513
|
+
.toggle-label::before {
|
|
1514
|
+
content: "";
|
|
1515
|
+
position: absolute;
|
|
1516
|
+
top: 2px;
|
|
1517
|
+
left: 2px;
|
|
1518
|
+
width: 20px;
|
|
1519
|
+
height: 20px;
|
|
1520
|
+
background: #ffffff;
|
|
1521
|
+
border-radius: 50%;
|
|
1522
|
+
transition: left 300ms linear;
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1525
|
+
.toggle-checkbox {
|
|
1526
|
+
display: none;
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1529
|
+
.toggle-checkbox:checked + .toggle-label {
|
|
1530
|
+
background-color: #4caf50;
|
|
1531
|
+
}
|
|
1532
|
+
|
|
1533
|
+
.toggle-checkbox:checked + .toggle-label::before {
|
|
1534
|
+
left: 18px;
|
|
1535
|
+
}
|
|
1536
|
+
.ach-scrl {
|
|
1537
|
+
max-height: 380px;
|
|
1538
|
+
min-height: 380px;
|
|
1539
|
+
overflow-y: auto;
|
|
1540
|
+
padding-right: 6px;
|
|
1541
|
+
}
|
|
1542
|
+
.mb-4{
|
|
1543
|
+
margin-bottom:4px
|
|
1544
|
+
}
|
|
1545
|
+
.ach-scrl::-webkit-scrollbar {
|
|
1546
|
+
width: 3px;
|
|
1547
|
+
background-color: #F5F5F5;
|
|
1548
|
+
}
|
|
1549
|
+
.ach-scrl::-webkit-scrollbar-thumb {
|
|
1550
|
+
background-color: #35254D;
|
|
1551
|
+
}
|
|
1552
|
+
|
|
1553
|
+
.error-span{
|
|
1554
|
+
color:red !important;
|
|
1555
|
+
font-size:12px !important;
|
|
1556
|
+
text-align: left !important;
|
|
1557
|
+
width: 100% !important;
|
|
1558
|
+
display: block;
|
|
1559
|
+
}
|
|
1560
|
+
|
|
1561
|
+
.charge-customer-name{
|
|
1562
|
+
color: #161616;
|
|
1563
|
+
font-family: Inter;
|
|
1564
|
+
font-size: 24px;
|
|
1565
|
+
font-style: normal;
|
|
1566
|
+
font-weight: 600;
|
|
1567
|
+
line-height: 32px;
|
|
1568
|
+
letter-spacing: -0.48px;
|
|
1569
|
+
text-transform: capitalize;
|
|
1570
|
+
margin-top:0;
|
|
1571
|
+
margin-bottom:16px !important;
|
|
1572
|
+
text-align:left !important
|
|
1573
|
+
}
|
|
1574
|
+
.card-ach-heading {
|
|
1575
|
+
color: #727272;
|
|
1576
|
+
font-family: Inter;
|
|
1577
|
+
font-size: 12px;
|
|
1578
|
+
font-style: normal;
|
|
1579
|
+
font-weight: 500;
|
|
1580
|
+
line-height: 18px;
|
|
1581
|
+
letter-spacing: -0.24px;
|
|
1582
|
+
margin : 0 0 10px !important;
|
|
1583
|
+
text-align : left
|
|
1584
|
+
}
|
|
1585
|
+
.card-list-div{
|
|
1586
|
+
max-height : 190px;
|
|
1587
|
+
overflow-y : auto;
|
|
1588
|
+
border:1px solid #E0DFE2;
|
|
1589
|
+
border-radius : 8px
|
|
1590
|
+
}
|
|
1591
|
+
|
|
1592
|
+
|
|
1593
|
+
.card-list-div::-webkit-scrollbar{
|
|
1594
|
+
width:2px;
|
|
1595
|
+
background-color:#F5F5F5
|
|
1596
|
+
}
|
|
1597
|
+
.card-list-div::-webkit-scrollbar-thumb{
|
|
1598
|
+
background-color:#35254D
|
|
1599
|
+
}
|
|
1600
|
+
|
|
1601
|
+
.card-list-single-div{
|
|
1602
|
+
border-bottom: 1px solid #E0DFE2;
|
|
1603
|
+
padding : 8px 11px;
|
|
1604
|
+
display : flex ;
|
|
1605
|
+
align-items:center;
|
|
1606
|
+
justify-content : space-between;
|
|
1607
|
+
gap:12px
|
|
1608
|
+
}
|
|
1609
|
+
.card-list-single-div:last-child {
|
|
1610
|
+
border-bottom: none;
|
|
1611
|
+
}
|
|
1612
|
+
.card-lint-div-in{
|
|
1613
|
+
min-height:444px}
|
|
1614
|
+
.card-number-radio{
|
|
1615
|
+
display:flex;
|
|
1616
|
+
gap:12px;
|
|
1617
|
+
}
|
|
1618
|
+
.card-number-radio .card-number-last-four{
|
|
1619
|
+
color:#161616 !important;
|
|
1620
|
+
font-family:Inter !important;
|
|
1621
|
+
font-size:14px !important;
|
|
1622
|
+
font-weight:500 !important;
|
|
1623
|
+
font-style:normal !important;
|
|
1624
|
+
line-height : 18px !important;
|
|
1625
|
+
latter-spacing:-0.18px !important
|
|
1626
|
+
}
|
|
1627
|
+
.card-expiry-date{
|
|
1628
|
+
margin:0;
|
|
1629
|
+
color:#00000080;
|
|
1630
|
+
font-family:Inter;
|
|
1631
|
+
font-size:14px;
|
|
1632
|
+
font-weight:500;
|
|
1633
|
+
font-style"normal;
|
|
1634
|
+
line-height : 18px;
|
|
1635
|
+
latter-spacing:-0.18px
|
|
1636
|
+
}
|
|
1637
|
+
.pay-with-other-card {
|
|
1638
|
+
margin-top : 12px;
|
|
1639
|
+
padding:12px 32px;
|
|
1640
|
+
border :1px solid #E0DFE2;
|
|
1641
|
+
border-radius : 1000px;
|
|
1642
|
+
display: flex;
|
|
1643
|
+
justify-content : center;
|
|
1644
|
+
align-items:center;
|
|
1645
|
+
gap:10px;
|
|
1646
|
+
// width:100%;
|
|
1647
|
+
background:white;
|
|
1648
|
+
cursor:pointer;
|
|
1649
|
+
color:#161616;
|
|
1650
|
+
text-align:center
|
|
1651
|
+
font-family: Inter;
|
|
1652
|
+
font-size: 14px;
|
|
1653
|
+
font-style: normal;
|
|
1654
|
+
font-weight: 500;
|
|
1655
|
+
line-height: 24px;
|
|
1656
|
+
letter-spacing: -0.28px;
|
|
1657
|
+
margin-bottom: 50px;
|
|
1658
|
+
}
|
|
1659
|
+
.charge-payment-back-btn {
|
|
1660
|
+
display: flex;
|
|
1661
|
+
padding: 9px 16px;
|
|
1662
|
+
align-items: center;
|
|
1663
|
+
gap: 6px;
|
|
1664
|
+
margin-bottom: 20px;
|
|
1665
|
+
border-radius: 1000px;
|
|
1666
|
+
border: 1px solid #E0DFE2;
|
|
1667
|
+
background: #FFF;
|
|
1668
|
+
box-shadow: 0px 6px 12px 0px rgba(206, 197, 221, 0.31);
|
|
1669
|
+
font-size:16px;
|
|
1670
|
+
curso:pointer;
|
|
1671
|
+
color:black
|
|
1672
|
+
}
|
|
1673
|
+
.res-charge-payment-back-btn{
|
|
1674
|
+
padding: 9px 16px;
|
|
1675
|
+
align-items: center;
|
|
1676
|
+
gap: 6px;
|
|
1677
|
+
margin-bottom: 20px;
|
|
1678
|
+
border-radius: 1000px;
|
|
1679
|
+
border: 1px solid #E0DFE2;
|
|
1680
|
+
background: #FFF;
|
|
1681
|
+
box-shadow: 0px 6px 12px 0px rgba(206, 197, 221, 0.31);
|
|
1682
|
+
font-size:16px;
|
|
1683
|
+
curso:pointer;
|
|
1684
|
+
color:black;
|
|
1685
|
+
display:none
|
|
1686
|
+
}
|
|
1687
|
+
.btn {
|
|
1688
|
+
padding: 11px 23px;
|
|
1689
|
+
background-color: black;
|
|
1690
|
+
color: white;
|
|
1691
|
+
border: none;
|
|
1692
|
+
border-radius: 6px;
|
|
1693
|
+
font-weight: bold;
|
|
1694
|
+
margin: 0 10px;
|
|
1695
|
+
cursor: pointer;
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1698
|
+
.custom-swal-icon {
|
|
1699
|
+
margin: 20px auto;
|
|
1700
|
+
}
|
|
1701
|
+
|
|
1702
|
+
.custom-swal-popup {
|
|
1703
|
+
font-size: 16px;
|
|
1704
|
+
text-align: center;
|
|
1705
|
+
}
|
|
1706
|
+
|
|
1707
|
+
.frac-form .res-pay-con{
|
|
1708
|
+
display:none
|
|
1709
|
+
}
|
|
1710
|
+
|
|
1711
|
+
@media (max-width: 768px) {
|
|
1712
|
+
.parent-pay-container{
|
|
1713
|
+
padding: 20px 5%;
|
|
1714
|
+
}
|
|
1715
|
+
.pay-container {
|
|
1716
|
+
grid-template-columns: 1fr;
|
|
1717
|
+
padding: 10px 5%;
|
|
1718
|
+
border:1px solid #E0DFE2;
|
|
1719
|
+
border-radius : 12px
|
|
1720
|
+
}
|
|
1721
|
+
.pay-conatiner-one{
|
|
1722
|
+
border-right: none;
|
|
1723
|
+
}
|
|
1724
|
+
.pay-conatiner-one-first{
|
|
1725
|
+
min-height:0
|
|
1726
|
+
}
|
|
1727
|
+
.pay-main-logo > img{
|
|
1728
|
+
display: none;
|
|
1729
|
+
}
|
|
1730
|
+
.pay-main-logo-res > img {
|
|
1731
|
+
display:block;
|
|
1732
|
+
margin:auto
|
|
1733
|
+
}
|
|
1734
|
+
|
|
1735
|
+
.pay-logo-container{
|
|
1736
|
+
border :none
|
|
1737
|
+
}
|
|
1738
|
+
.res-charge-payment-back-btn {
|
|
1739
|
+
display:flex !important
|
|
1740
|
+
}
|
|
1741
|
+
.charge-payment-back-btn{
|
|
1742
|
+
display:none !important
|
|
1743
|
+
}
|
|
1744
|
+
.frac-form .res-pay-con{
|
|
1745
|
+
display:flex;
|
|
1746
|
+
justify-content :space-between;
|
|
1747
|
+
align-items:center;
|
|
1748
|
+
padding-bottom : 10px
|
|
1749
|
+
}
|
|
1750
|
+
.frac-form .amt-pay-con{
|
|
1751
|
+
display:none
|
|
1752
|
+
}
|
|
1753
|
+
.pay-conatiner-one-last{
|
|
1754
|
+
display:none}
|
|
1755
|
+
.pay-conatiner-two{
|
|
1756
|
+
padding:0
|
|
1757
|
+
}
|
|
1758
|
+
|
|
1759
|
+
|
|
1760
|
+
}
|
|
1761
|
+
@media (max-width : 512px){
|
|
1762
|
+
.tab button {
|
|
1763
|
+
padding: 6px 16px;
|
|
1764
|
+
}
|
|
1765
|
+
}
|
|
1766
|
+
|
|
1767
|
+
|
|
1768
|
+
|
|
1769
|
+
|
|
1770
|
+
|
|
1771
|
+
|
|
1772
|
+
`);
|
|
1773
|
+
}
|
|
1774
|
+
|
|
1775
|
+
// src/app/components/Charge/GetPaymentPage.tsx
|
|
1776
|
+
import axios3 from "axios";
|
|
1777
|
+
|
|
1778
|
+
// src/app/components/SuccessMessage/SuccessMsz.tsx
|
|
1779
|
+
import React10 from "react";
|
|
1780
|
+
|
|
1781
|
+
// src/app/components/SuccessMessage/SuccessMszStyle.tsx
|
|
1782
|
+
import React9 from "react";
|
|
1783
|
+
function SuccessMszStyle() {
|
|
1784
|
+
return /* @__PURE__ */ React9.createElement("style", null, `
|
|
1785
|
+
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');
|
|
1786
|
+
|
|
1787
|
+
body{
|
|
1788
|
+
display: flex;
|
|
1789
|
+
justify-content: center;
|
|
1790
|
+
align-items: center;
|
|
1791
|
+
padding-top: 30px;
|
|
1792
|
+
margin: 0;
|
|
1793
|
+
/* background-color: #f8f9fa; */
|
|
1794
|
+
flex-direction: column;
|
|
1795
|
+
}
|
|
1796
|
+
.payment-msg-container{
|
|
1797
|
+
min-height : 550px
|
|
1798
|
+
}
|
|
1799
|
+
|
|
1800
|
+
.logo-container {
|
|
1801
|
+
display: flex;
|
|
1802
|
+
justify-content: center;
|
|
1803
|
+
align-items: center;
|
|
1804
|
+
margin-bottom: -50px; /* Adjust this to overlap the content */
|
|
1805
|
+
z-index: 10;
|
|
1806
|
+
}
|
|
1807
|
+
|
|
1808
|
+
.client-logo {
|
|
1809
|
+
max-width: 100px;
|
|
1810
|
+
height: auto;
|
|
1811
|
+
object-fit: contain;
|
|
1812
|
+
display: block;
|
|
1813
|
+
}
|
|
1814
|
+
|
|
1815
|
+
.payment-success-container {
|
|
1816
|
+
display: flex;
|
|
1817
|
+
flex-direction: column;
|
|
1818
|
+
align-items: center;
|
|
1819
|
+
padding: 18px 20px 24px;
|
|
1820
|
+
width: 335px;
|
|
1821
|
+
height: 400px; /* Fixed height */
|
|
1822
|
+
background: #ffffff;
|
|
1823
|
+
border-radius: 12px;
|
|
1824
|
+
position: relative;
|
|
1825
|
+
/* box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
|
1826
|
+
border: 1px solid #e3e3e3; */
|
|
1827
|
+
justify-content: center;
|
|
1828
|
+
text-align: center;
|
|
1829
|
+
margin-top: 50px; /* Adjust this to move the content down */
|
|
1830
|
+
}
|
|
1831
|
+
|
|
1832
|
+
.success-icon {
|
|
1833
|
+
display: flex;
|
|
1834
|
+
flex-direction: column;
|
|
1835
|
+
align-items: center;
|
|
1836
|
+
gap: 12px;
|
|
1837
|
+
width: 227px;
|
|
1838
|
+
height: 116px;
|
|
1839
|
+
z-index: 2;
|
|
1840
|
+
}
|
|
1841
|
+
|
|
1842
|
+
.circle {
|
|
1843
|
+
width: 40px;
|
|
1844
|
+
height: 40px;
|
|
1845
|
+
border: 1px solid #49b182;
|
|
1846
|
+
border-radius: 50%;
|
|
1847
|
+
display: flex;
|
|
1848
|
+
justify-content: center;
|
|
1849
|
+
align-items: center;
|
|
1850
|
+
}
|
|
1851
|
+
|
|
1852
|
+
.circle .fa-check-circle {
|
|
1853
|
+
font-size: 20px;
|
|
1854
|
+
color: #49b182;
|
|
1855
|
+
}
|
|
1856
|
+
|
|
1857
|
+
.success-text {
|
|
1858
|
+
display: flex;
|
|
1859
|
+
flex-direction: column;
|
|
1860
|
+
justify-content: center;
|
|
1861
|
+
align-items: center;
|
|
1862
|
+
gap: 4px;
|
|
1863
|
+
width: 227px;
|
|
1864
|
+
}
|
|
1865
|
+
|
|
1866
|
+
.payment-success-text {
|
|
1867
|
+
font-family: "Inter", sans-serif;
|
|
1868
|
+
font-weight: 500;
|
|
1869
|
+
font-size: 18px;
|
|
1870
|
+
line-height: 21px;
|
|
1871
|
+
text-align: center;
|
|
1872
|
+
letter-spacing: -0.02em;
|
|
1873
|
+
color: #161616;
|
|
1874
|
+
}
|
|
1875
|
+
|
|
1876
|
+
.thank-you-text {
|
|
1877
|
+
font-family: "Inter", sans-serif;
|
|
1878
|
+
font-weight: 500;
|
|
1879
|
+
font-size: 14px;
|
|
1880
|
+
line-height: 18px;
|
|
1881
|
+
text-align: center;
|
|
1882
|
+
letter-spacing: -0.02em;
|
|
1883
|
+
color: #161616;
|
|
1884
|
+
opacity: 0.5;
|
|
1885
|
+
}
|
|
1886
|
+
|
|
1887
|
+
.charge-payment-success-tick-div {
|
|
1888
|
+
display: flex;
|
|
1889
|
+
justify-content: center;
|
|
1890
|
+
align-items: center;
|
|
1891
|
+
margin-top: 32px;
|
|
1892
|
+
}
|
|
1893
|
+
.charge-payment-success-tick {
|
|
1894
|
+
border-radius: 1000px;
|
|
1895
|
+
background: rgba(97, 198, 153, 0.14);
|
|
1896
|
+
display: flex;
|
|
1897
|
+
width: 60px;
|
|
1898
|
+
height: 60px;
|
|
1899
|
+
justify-content: center;
|
|
1900
|
+
align-items: center;
|
|
1901
|
+
}
|
|
1902
|
+
.charge-payment-success-text {
|
|
1903
|
+
color: #161616;
|
|
1904
|
+
text-align: center;
|
|
1905
|
+
font-family: Inter;
|
|
1906
|
+
font-size: 32px;
|
|
1907
|
+
font-style: normal;
|
|
1908
|
+
font-weight: 500;
|
|
1909
|
+
line-height: 36px;
|
|
1910
|
+
letter-spacing: -0.64px;
|
|
1911
|
+
margin-top: 20px;
|
|
1912
|
+
margin-bottom: 5px !important;
|
|
1913
|
+
}
|
|
1914
|
+
.charge-payment-success-container {
|
|
1915
|
+
display: flex;
|
|
1916
|
+
padding: 120px 48px 32px 48px;
|
|
1917
|
+
flex-direction: column;
|
|
1918
|
+
justify-content: center;
|
|
1919
|
+
align-items: center;
|
|
1920
|
+
}
|
|
1921
|
+
.charge-payment-success-subtext {
|
|
1922
|
+
color: #727272;
|
|
1923
|
+
text-align: center;
|
|
1924
|
+
font-family: Inter;
|
|
1925
|
+
font-size: 14px;
|
|
1926
|
+
font-style: normal;
|
|
1927
|
+
font-weight: 500;
|
|
1928
|
+
line-height: 18px; /* 128.571% */
|
|
1929
|
+
letter-spacing: -0.28px;
|
|
1930
|
+
margin:14px 0 !important
|
|
1931
|
+
|
|
1932
|
+
}
|
|
1933
|
+
.charge-success-payment-button-div {
|
|
1934
|
+
display: flex;
|
|
1935
|
+
gap: 10px;
|
|
1936
|
+
align-items: baseline;
|
|
1937
|
+
}
|
|
1938
|
+
.charge-success-btn1 {
|
|
1939
|
+
display: flex;
|
|
1940
|
+
padding: 9px 16px;
|
|
1941
|
+
align-items: center;
|
|
1942
|
+
gap: 6px;
|
|
1943
|
+
border-radius: 1000px;
|
|
1944
|
+
border: 1px solid #e0dfe2;
|
|
1945
|
+
background: #fff;
|
|
1946
|
+
color: #161616;
|
|
1947
|
+
}
|
|
1948
|
+
|
|
1949
|
+
.charge-payment-success-btn-div {
|
|
1950
|
+
display: flex;
|
|
1951
|
+
align-items: flex-start;
|
|
1952
|
+
justify-content: center;
|
|
1953
|
+
gap: 8px;
|
|
1954
|
+
}
|
|
1955
|
+
|
|
1956
|
+
.charge-payment-success-btn1 {
|
|
1957
|
+
cursor: pointer;
|
|
1958
|
+
border-radius: 80px;
|
|
1959
|
+
border: 1px solid #e0dfe2;
|
|
1960
|
+
display: flex;
|
|
1961
|
+
padding: 12px 32px;
|
|
1962
|
+
justify-content: center;
|
|
1963
|
+
align-items: center;
|
|
1964
|
+
gap: 6px;
|
|
1965
|
+
background-color: #fff;
|
|
1966
|
+
}
|
|
1967
|
+
|
|
1968
|
+
.charge-payment-success-btn2 {
|
|
1969
|
+
border-radius: 80px;
|
|
1970
|
+
cursor: pointer;
|
|
1971
|
+
border: 1px solid #e0dfe2;
|
|
1972
|
+
display: flex;
|
|
1973
|
+
padding: 12px 32px;
|
|
1974
|
+
justify-content: center;
|
|
1975
|
+
align-items: center;
|
|
1976
|
+
gap: 6px;
|
|
1977
|
+
background-color: #161616;
|
|
1978
|
+
color: #fff;
|
|
1979
|
+
}`);
|
|
1980
|
+
}
|
|
1981
|
+
|
|
1982
|
+
// src/app/components/SuccessMessage/HandleSubmit.tsx
|
|
1983
|
+
function HandleSubmit(event, key, tranId) {
|
|
1984
|
+
event.preventDefault();
|
|
1985
|
+
const status = key === "close";
|
|
1986
|
+
const message = {
|
|
1987
|
+
type: "preview.compiledcheck",
|
|
1988
|
+
other: {
|
|
1989
|
+
msg: "Payment success!",
|
|
1990
|
+
status,
|
|
1991
|
+
data: {
|
|
1992
|
+
tran_id: tranId,
|
|
1993
|
+
key
|
|
1994
|
+
}
|
|
1995
|
+
}
|
|
1996
|
+
};
|
|
1997
|
+
console.log("message:", message);
|
|
1998
|
+
window.parent.postMessage(message, "*");
|
|
1999
|
+
}
|
|
2000
|
+
|
|
2001
|
+
// src/app/components/SuccessMessage/SuccessMsz.tsx
|
|
2002
|
+
function SuccessMsz({ onClose, tranId }) {
|
|
2003
|
+
return /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement(SuccessMszStyle, null), /* @__PURE__ */ React10.createElement("div", { className: "payment-msg-container" }, /* @__PURE__ */ React10.createElement("div", { className: "charge-payment-success-container" }, /* @__PURE__ */ React10.createElement("div", { className: "charge-payment-success-tick-div" }, /* @__PURE__ */ React10.createElement("div", { className: "charge-payment-success-tick" }, /* @__PURE__ */ React10.createElement(
|
|
2004
|
+
"svg",
|
|
2005
|
+
{
|
|
2006
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2007
|
+
width: "16",
|
|
2008
|
+
height: "16",
|
|
2009
|
+
viewBox: "0 0 16 16",
|
|
2010
|
+
fill: "none"
|
|
2011
|
+
},
|
|
2012
|
+
/* @__PURE__ */ React10.createElement(
|
|
2013
|
+
"path",
|
|
2014
|
+
{
|
|
2015
|
+
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",
|
|
2016
|
+
fill: "#61C699"
|
|
2017
|
+
}
|
|
2018
|
+
)
|
|
2019
|
+
))), /* @__PURE__ */ React10.createElement("h6", { className: "charge-payment-success-text" }, "Your charge", /* @__PURE__ */ React10.createElement("br", null), "was successful"), /* @__PURE__ */ React10.createElement("h6", { className: "charge-payment-success-subtext" }, "We\u2019ve processed your charge"), /* @__PURE__ */ React10.createElement("div", { className: "charge-success-payment-button-div" }, /* @__PURE__ */ React10.createElement("button", { className: "charge-success-btn1", onClick: (e) => HandleSubmit(e, "print", tranId) }, /* @__PURE__ */ React10.createElement(
|
|
2020
|
+
"svg",
|
|
2021
|
+
{
|
|
2022
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2023
|
+
width: "17",
|
|
2024
|
+
height: "16",
|
|
2025
|
+
viewBox: "0 0 17 16",
|
|
2026
|
+
fill: "none"
|
|
2027
|
+
},
|
|
2028
|
+
/* @__PURE__ */ React10.createElement(
|
|
2029
|
+
"path",
|
|
2030
|
+
{
|
|
2031
|
+
d: "M15.7729 8.7272C15.58 8.7272 15.395 8.80383 15.2586 8.94022C15.1222 9.07661 15.0456 9.2616 15.0456 9.45448V12.5185C15.045 13.0559 14.8313 13.5711 14.4513 13.9511C14.0713 14.3311 13.5561 14.5449 13.0187 14.5454H3.98149C3.44409 14.5449 2.92887 14.3311 2.54887 13.9511C2.16887 13.5711 1.95514 13.0559 1.95456 12.5185V9.45448C1.95456 9.2616 1.87794 9.07661 1.74154 8.94022C1.60515 8.80383 1.42017 8.7272 1.22728 8.7272C1.03439 8.7272 0.849407 8.80383 0.713015 8.94022C0.576624 9.07661 0.5 9.2616 0.5 9.45448V12.5185C0.500963 13.4416 0.86807 14.3265 1.52077 14.9792C2.17346 15.6319 3.05844 15.999 3.98149 16H13.0187C13.9417 15.999 14.8267 15.6319 15.4794 14.9792C16.1321 14.3265 16.4992 13.4416 16.5002 12.5185V9.45448C16.5002 9.2616 16.4235 9.07661 16.2871 8.94022C16.1507 8.80383 15.9658 8.7272 15.7729 8.7272Z",
|
|
2032
|
+
fill: "#161616"
|
|
2033
|
+
}
|
|
2034
|
+
),
|
|
2035
|
+
/* @__PURE__ */ React10.createElement(
|
|
2036
|
+
"path",
|
|
2037
|
+
{
|
|
2038
|
+
d: "M4.65059 6.75861L7.7728 9.88082V0.72728C7.7728 0.534394 7.84942 0.349407 7.98581 0.213015C8.1222 0.0766239 8.30719 0 8.50008 0C8.69296 0 8.87795 0.0766239 9.01434 0.213015C9.15073 0.349407 9.22736 0.534394 9.22736 0.72728V9.88082L12.3496 6.75861C12.4867 6.62613 12.6704 6.55283 12.8611 6.55448C13.0518 6.55614 13.2342 6.63263 13.3691 6.76747C13.5039 6.90231 13.5804 7.08472 13.5821 7.27541C13.5837 7.46611 13.5104 7.64982 13.3779 7.78698L9.01427 12.1507C8.87788 12.287 8.69293 12.3636 8.50008 12.3636C8.30723 12.3636 8.12228 12.287 7.98589 12.1507L3.62221 7.78698C3.48973 7.64982 3.41643 7.46611 3.41808 7.27541C3.41974 7.08472 3.49623 6.90231 3.63107 6.76747C3.76592 6.63263 3.94833 6.55614 4.13902 6.55448C4.32971 6.55283 4.51342 6.62613 4.65059 6.75861Z",
|
|
2039
|
+
fill: "#161616"
|
|
2040
|
+
}
|
|
2041
|
+
)
|
|
2042
|
+
), "Print receipt"), /* @__PURE__ */ React10.createElement("button", { className: "charge-success-btn1", onClick: (e) => HandleSubmit(e, "share", tranId) }, /* @__PURE__ */ React10.createElement(
|
|
2043
|
+
"svg",
|
|
2044
|
+
{
|
|
2045
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2046
|
+
width: "17",
|
|
2047
|
+
height: "16",
|
|
2048
|
+
viewBox: "0 0 17 16",
|
|
2049
|
+
fill: "none"
|
|
2050
|
+
},
|
|
2051
|
+
/* @__PURE__ */ React10.createElement("g", { clipPath: "url(#clip0_12420_50683)" }, /* @__PURE__ */ React10.createElement(
|
|
2052
|
+
"path",
|
|
2053
|
+
{
|
|
2054
|
+
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",
|
|
2055
|
+
fill: "#161616"
|
|
2056
|
+
}
|
|
2057
|
+
)),
|
|
2058
|
+
/* @__PURE__ */ React10.createElement("defs", null, /* @__PURE__ */ React10.createElement("clipPath", { id: "clip0_12420_50683" }, /* @__PURE__ */ React10.createElement(
|
|
2059
|
+
"rect",
|
|
2060
|
+
{
|
|
2061
|
+
width: "16",
|
|
2062
|
+
height: "16",
|
|
2063
|
+
fill: "white",
|
|
2064
|
+
transform: "translate(0.5)"
|
|
2065
|
+
}
|
|
2066
|
+
)))
|
|
2067
|
+
), "Send receipt"))), /* @__PURE__ */ React10.createElement("div", { className: "charge-payment-success-btn-div" }, /* @__PURE__ */ React10.createElement("button", { className: "charge-payment-success-btn1", onClick: (e) => HandleSubmit(e, "tran", tranId) }, "Go to Transactions"), /* @__PURE__ */ React10.createElement("button", { className: "charge-payment-success-btn2", onClick: (e) => {
|
|
2068
|
+
onClose();
|
|
2069
|
+
HandleSubmit(e, "close", tranId);
|
|
2070
|
+
} }, "Close"))));
|
|
2071
|
+
}
|
|
2072
|
+
|
|
2073
|
+
// src/app/components/Charge/GetPaymentPage.tsx
|
|
2074
|
+
import Swal from "sweetalert2";
|
|
2075
|
+
import { IoArrowBack } from "react-icons/io5";
|
|
2076
|
+
|
|
2077
|
+
// src/app/components/Datascript.tsx
|
|
2078
|
+
import { useEffect as useEffect3 } from "react";
|
|
2079
|
+
function DataScript() {
|
|
2080
|
+
useEffect3(() => {
|
|
2081
|
+
const src = "https://token-cert.dcap.com/v1/client";
|
|
2082
|
+
if (typeof window === "undefined") return;
|
|
2083
|
+
if (window.DatacapWebToken) {
|
|
2084
|
+
console.log("\u2705 Datacap already available");
|
|
2085
|
+
return;
|
|
2086
|
+
}
|
|
2087
|
+
if (!document.querySelector(`script[src="${src}"]`)) {
|
|
2088
|
+
const script = document.createElement("script");
|
|
2089
|
+
script.src = src;
|
|
2090
|
+
script.async = true;
|
|
2091
|
+
script.onload = () => {
|
|
2092
|
+
console.log("\u2705 Datacap script loaded");
|
|
2093
|
+
if (window.DatacapWebToken) {
|
|
2094
|
+
console.log("\u2705 DatacapWebToken is ready:", window.DatacapWebToken);
|
|
2095
|
+
} else {
|
|
2096
|
+
console.warn("\u26A0\uFE0F Script loaded, but DatacapWebToken not found");
|
|
2097
|
+
}
|
|
2098
|
+
};
|
|
2099
|
+
script.onerror = (err) => {
|
|
2100
|
+
console.error("\u274C Failed to load Datacap script", err);
|
|
2101
|
+
};
|
|
2102
|
+
document.head.appendChild(script);
|
|
2103
|
+
} else {
|
|
2104
|
+
console.log("\u2139\uFE0F Script already in DOM, waiting for Datacap...");
|
|
2105
|
+
}
|
|
2106
|
+
}, []);
|
|
2107
|
+
useEffect3(() => {
|
|
2108
|
+
const scriptId = "forge-cdn-script";
|
|
2109
|
+
if (!document.getElementById(scriptId)) {
|
|
2110
|
+
const forgeScript = document.createElement("script");
|
|
2111
|
+
forgeScript.src = "https://cdn.jsdelivr.net/npm/node-forge@1.0.0/dist/forge.min.js";
|
|
2112
|
+
forgeScript.id = scriptId;
|
|
2113
|
+
forgeScript.async = true;
|
|
2114
|
+
document.head.appendChild(forgeScript);
|
|
2115
|
+
}
|
|
2116
|
+
return () => {
|
|
2117
|
+
const existingScript = document.getElementById(scriptId);
|
|
2118
|
+
if (existingScript) {
|
|
2119
|
+
document.head.removeChild(existingScript);
|
|
2120
|
+
}
|
|
2121
|
+
};
|
|
2122
|
+
}, []);
|
|
2123
|
+
return null;
|
|
2124
|
+
}
|
|
2125
|
+
|
|
2126
|
+
// src/app/components/ErrorCardMessage/ErrorCardMessage.tsx
|
|
2127
|
+
import React12 from "react";
|
|
2128
|
+
|
|
2129
|
+
// src/app/components/ErrorCardMessage/ErrorCardMessageStyle.tsx
|
|
2130
|
+
import React11 from "react";
|
|
2131
|
+
function ErrorCardMszStyle() {
|
|
2132
|
+
return /* @__PURE__ */ React11.createElement("style", null, `
|
|
2133
|
+
.card-error .logo-container {
|
|
2134
|
+
display: flex;
|
|
2135
|
+
justify-content: center;
|
|
2136
|
+
align-items: center;
|
|
2137
|
+
margin-bottom: -50px; /* Adjust this to overlap the content */
|
|
2138
|
+
z-index: 10;
|
|
2139
|
+
}
|
|
2140
|
+
|
|
2141
|
+
.card-error .client-logo {
|
|
2142
|
+
max-width: 100px;
|
|
2143
|
+
height: auto;
|
|
2144
|
+
object-fit: contain;
|
|
2145
|
+
display: block;
|
|
2146
|
+
}
|
|
2147
|
+
|
|
2148
|
+
.card-error .payment-error-container {
|
|
2149
|
+
display: flex;
|
|
2150
|
+
flex-direction: column;
|
|
2151
|
+
align-items: center;
|
|
2152
|
+
padding: 18px 20px 24px;
|
|
2153
|
+
// width: 335px;
|
|
2154
|
+
min-height: 250px; /* Fixed height */
|
|
2155
|
+
background: #FFFFFF;
|
|
2156
|
+
border-radius: 12px;
|
|
2157
|
+
position: relative;
|
|
2158
|
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
|
2159
|
+
border: 1px solid #e3e3e3;
|
|
2160
|
+
justify-content: center;
|
|
2161
|
+
text-align: center;
|
|
2162
|
+
// margin-top: 50px; /* Adjust this to move the content down */
|
|
2163
|
+
margin: 50px auto 0 auto !important;
|
|
2164
|
+
}
|
|
2165
|
+
|
|
2166
|
+
.card-error .error-icon {
|
|
2167
|
+
display: flex;
|
|
2168
|
+
flex-direction: column;
|
|
2169
|
+
align-items: center;
|
|
2170
|
+
gap: 12px;
|
|
2171
|
+
min-height: 116px;
|
|
2172
|
+
z-index: 2;
|
|
2173
|
+
}
|
|
2174
|
+
|
|
2175
|
+
.card-error .circle {
|
|
2176
|
+
width: 50px;
|
|
2177
|
+
height: 50px;
|
|
2178
|
+
border: 1px solid red;
|
|
2179
|
+
border-radius: 50%;
|
|
2180
|
+
display: flex;
|
|
2181
|
+
justify-content: center;
|
|
2182
|
+
align-items: center;
|
|
2183
|
+
margin-bottom:20px
|
|
2184
|
+
}
|
|
2185
|
+
|
|
2186
|
+
.card-error .circle .fa-times {
|
|
2187
|
+
font-size: 30px;
|
|
2188
|
+
color: red;
|
|
2189
|
+
}
|
|
2190
|
+
|
|
2191
|
+
.card-error .error-text {
|
|
2192
|
+
display: flex;
|
|
2193
|
+
flex-direction: column;
|
|
2194
|
+
justify-content: center;
|
|
2195
|
+
align-items: center;
|
|
2196
|
+
gap: 4px;
|
|
2197
|
+
// width: 227px;
|
|
2198
|
+
}
|
|
2199
|
+
|
|
2200
|
+
.card-error .payment-error-text {
|
|
2201
|
+
font-family: 'Inter', sans-serif;
|
|
2202
|
+
font-weight: 500;
|
|
2203
|
+
font-size: 18px;
|
|
2204
|
+
line-height: 21px;
|
|
2205
|
+
text-align: center;
|
|
2206
|
+
letter-spacing: -0.02em;
|
|
2207
|
+
color: #161616;
|
|
2208
|
+
}
|
|
2209
|
+
|
|
2210
|
+
.card-error .thank-you-text {
|
|
2211
|
+
font-family: 'Inter', sans-serif;
|
|
2212
|
+
font-weight: 500;
|
|
2213
|
+
font-size: 16px;
|
|
2214
|
+
line-height: 18px;
|
|
2215
|
+
text-align: center;
|
|
2216
|
+
letter-spacing: -0.02em;
|
|
2217
|
+
color: #161616 !important;
|
|
2218
|
+
opacity: 0.5;
|
|
2219
|
+
padding-top:10px
|
|
2220
|
+
}
|
|
2221
|
+
|
|
2222
|
+
.card-error .error-btn-div{
|
|
2223
|
+
padding-top:30px;
|
|
2224
|
+
|
|
2225
|
+
}
|
|
2226
|
+
.card-error .error-btn-div button{
|
|
2227
|
+
border-radius: 0.25em;
|
|
2228
|
+
border:none;
|
|
2229
|
+
background: initial;
|
|
2230
|
+
background-color: #7066e0;
|
|
2231
|
+
box-shadow: var(--swal2-confirm-button-box-shadow);
|
|
2232
|
+
color: white;
|
|
2233
|
+
font-size: 1em;
|
|
2234
|
+
padding:10px 17px;
|
|
2235
|
+
cursor:pointer;
|
|
2236
|
+
}
|
|
2237
|
+
`);
|
|
2238
|
+
}
|
|
2239
|
+
|
|
2240
|
+
// src/app/components/ErrorCardMessage/ErrorCardMessage.tsx
|
|
2241
|
+
var ErrorCardMessage = ({ onClose, error }) => {
|
|
2242
|
+
return /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(ErrorCardMszStyle, null), /* @__PURE__ */ React12.createElement("div", { className: "card-error" }, /* @__PURE__ */ React12.createElement("div", { className: "payment-error-container" }, /* @__PURE__ */ React12.createElement("div", { className: "error-icon" }, /* @__PURE__ */ React12.createElement("div", { className: "circle" }, /* @__PURE__ */ React12.createElement("i", { className: "fa fa-times", "aria-hidden": "true" })), /* @__PURE__ */ React12.createElement("div", { className: "error-text" }, /* @__PURE__ */ React12.createElement("div", { className: "payment-error-text" }, error), /* @__PURE__ */ React12.createElement("div", { className: "thank-you-text" }, "Try again later ")), /* @__PURE__ */ React12.createElement("div", { className: "error-btn-div" }, /* @__PURE__ */ React12.createElement("button", { onClick: onClose }, "OK"))))));
|
|
2243
|
+
};
|
|
2244
|
+
var ErrorCardMessage_default = ErrorCardMessage;
|
|
2245
|
+
|
|
2246
|
+
// src/app/components/socketClient.js
|
|
2247
|
+
import { io } from "socket.io-client";
|
|
2248
|
+
var socket = io(baseUrl, {
|
|
2249
|
+
transports: ["websocket"],
|
|
2250
|
+
// Optional: force WebSocket
|
|
2251
|
+
withCredentials: false
|
|
2252
|
+
});
|
|
2253
|
+
var socketClient_default = socket;
|
|
2254
|
+
|
|
2255
|
+
// src/app/utils/Common.js
|
|
2256
|
+
var isValidJson = (jsonString) => {
|
|
2257
|
+
try {
|
|
2258
|
+
const parsed = JSON.parse(jsonString);
|
|
2259
|
+
return typeof parsed === "object" && parsed !== null;
|
|
2260
|
+
} catch (e) {
|
|
2261
|
+
return false;
|
|
2262
|
+
}
|
|
2263
|
+
};
|
|
2264
|
+
|
|
2265
|
+
// src/app/components/Charge/GetPaymentPage.tsx
|
|
2266
|
+
function GetPaymentPage(props) {
|
|
2267
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
2268
|
+
const [loading, setLoading] = useState3(false);
|
|
2269
|
+
const [loading2, setLoading2] = useState3(false);
|
|
2270
|
+
const [error, setError] = useState3("");
|
|
2271
|
+
const [success, setSuccess] = useState3(false);
|
|
2272
|
+
const [show, setShow] = useState3(false);
|
|
2273
|
+
const [activetab, setActive] = useState3("card");
|
|
2274
|
+
const [saveCardInfo, setSaveCardInfo] = useState3(false);
|
|
2275
|
+
const [saveACHinfo, setSaveACHinfo] = useState3(false);
|
|
2276
|
+
const fractalpayClientKey = props.fractalpayClientKey;
|
|
2277
|
+
const [cardData, setCardData] = useState3();
|
|
2278
|
+
const [cardError, setCardError] = useState3({});
|
|
2279
|
+
const [achData, setAchData] = useState3();
|
|
2280
|
+
const [achError, setAchError] = useState3({});
|
|
2281
|
+
const [cardList, setCardList] = useState3([]);
|
|
2282
|
+
const [selectedCard, setSelectedCard] = useState3();
|
|
2283
|
+
const [paymentData, setPaymentData] = useState3();
|
|
2284
|
+
let [tranId, setTranId] = useState3("");
|
|
2285
|
+
const showLoader = () => setLoading(true);
|
|
2286
|
+
const hideLoader = () => setLoading(false);
|
|
2287
|
+
const handleClose = () => {
|
|
2288
|
+
setShow(false);
|
|
2289
|
+
setActive("card");
|
|
2290
|
+
setError("");
|
|
2291
|
+
setSuccess(false);
|
|
2292
|
+
setTranId("");
|
|
2293
|
+
setAchData({
|
|
2294
|
+
name: "",
|
|
2295
|
+
routingNumber: "",
|
|
2296
|
+
accountNumber: "",
|
|
2297
|
+
confirmAccountNumber: "",
|
|
2298
|
+
bankName: "",
|
|
2299
|
+
accountType: ""
|
|
2300
|
+
});
|
|
2301
|
+
setAchError({
|
|
2302
|
+
name: "",
|
|
2303
|
+
routingNumber: "",
|
|
2304
|
+
accountNumber: "",
|
|
2305
|
+
confirmAccountNumber: "",
|
|
2306
|
+
bankName: "",
|
|
2307
|
+
accountType: ""
|
|
2308
|
+
});
|
|
2309
|
+
setCardData({
|
|
2310
|
+
cardName: "",
|
|
2311
|
+
cardNumber: "",
|
|
2312
|
+
expiryMonth: "",
|
|
2313
|
+
expiryYear: "",
|
|
2314
|
+
cvv: "",
|
|
2315
|
+
orderId: "",
|
|
2316
|
+
zipCode: ""
|
|
2317
|
+
});
|
|
2318
|
+
setCardError({
|
|
2319
|
+
cardName: "",
|
|
2320
|
+
cardNumber: "",
|
|
2321
|
+
expiryMonth: "",
|
|
2322
|
+
expiryYear: "",
|
|
2323
|
+
cvv: "",
|
|
2324
|
+
orderId: "",
|
|
2325
|
+
zipCode: ""
|
|
2326
|
+
});
|
|
2327
|
+
setSaveACHinfo(false);
|
|
2328
|
+
setSaveCardInfo(false);
|
|
2329
|
+
setSelectedCard({
|
|
2330
|
+
card_type: "",
|
|
2331
|
+
cardlastfourdigit: "",
|
|
2332
|
+
expmonth: 1,
|
|
2333
|
+
expyear: 2025,
|
|
2334
|
+
primary_card: 0,
|
|
2335
|
+
firstname: "",
|
|
2336
|
+
id: "",
|
|
2337
|
+
lastname: ""
|
|
2338
|
+
});
|
|
2339
|
+
};
|
|
2340
|
+
const handleShow = () => setShow(true);
|
|
2341
|
+
const handletabchange = (id) => {
|
|
2342
|
+
setActive(id);
|
|
2343
|
+
};
|
|
2344
|
+
const handleCardChange = (field, value) => {
|
|
2345
|
+
const name = field;
|
|
2346
|
+
const numericFields = ["expiryMonth", "expiryYear", "zipCode", "cvv"];
|
|
2347
|
+
if (numericFields.includes(name)) {
|
|
2348
|
+
if (value === "" || /^[0-9]+$/.test(value)) {
|
|
2349
|
+
setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
2350
|
+
[name]: ""
|
|
2351
|
+
}));
|
|
2352
|
+
setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
2353
|
+
[name]: value
|
|
2354
|
+
}));
|
|
2355
|
+
}
|
|
2356
|
+
return;
|
|
2357
|
+
}
|
|
2358
|
+
setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
2359
|
+
[name]: ""
|
|
2360
|
+
}));
|
|
2361
|
+
setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
2362
|
+
[name]: value
|
|
2363
|
+
}));
|
|
2364
|
+
};
|
|
2365
|
+
const handleCardNumberChange = (e) => {
|
|
2366
|
+
const input = e.target;
|
|
2367
|
+
const rawValue = input.value.replace(/\D/g, "");
|
|
2368
|
+
let formatted = "";
|
|
2369
|
+
if (/^3[47]/.test(rawValue)) {
|
|
2370
|
+
const trimmed = rawValue.slice(0, 15);
|
|
2371
|
+
formatted = trimmed.replace(
|
|
2372
|
+
/^(\d{1,4})(\d{1,6})?(\d{1,5})?$/,
|
|
2373
|
+
(_, g1, g2, g3) => [g1, g2, g3].filter(Boolean).join(" ")
|
|
2374
|
+
);
|
|
2375
|
+
} else {
|
|
2376
|
+
const trimmed = rawValue.slice(0, 16);
|
|
2377
|
+
formatted = trimmed.replace(
|
|
2378
|
+
/^(\d{1,4})(\d{1,4})?(\d{1,4})?(\d{1,4})?$/,
|
|
2379
|
+
(_, g1, g2, g3, g4) => [g1, g2, g3, g4].filter(Boolean).join(" ")
|
|
2380
|
+
);
|
|
2381
|
+
}
|
|
2382
|
+
setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
2383
|
+
cardNumber: ""
|
|
2384
|
+
}));
|
|
2385
|
+
setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
2386
|
+
cardNumber: formatted
|
|
2387
|
+
}));
|
|
2388
|
+
};
|
|
2389
|
+
const handleChangeAch = (e) => {
|
|
2390
|
+
const { name, value } = e.target;
|
|
2391
|
+
const numericFields = ["routingNumber", "accountNumber", "confirmAccountNumber"];
|
|
2392
|
+
if (name == "name") {
|
|
2393
|
+
if (/^[a-zA-Z\s]*$/.test(value)) {
|
|
2394
|
+
setAchError((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
2395
|
+
[name]: ""
|
|
2396
|
+
}));
|
|
2397
|
+
setAchData((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
2398
|
+
[name]: value
|
|
2399
|
+
}));
|
|
2400
|
+
}
|
|
2401
|
+
return;
|
|
2402
|
+
}
|
|
2403
|
+
if (numericFields.includes(name)) {
|
|
2404
|
+
if (value === "" || /^[0-9]+$/.test(value)) {
|
|
2405
|
+
setAchError((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
2406
|
+
[name]: ""
|
|
2407
|
+
}));
|
|
2408
|
+
setAchData((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
2409
|
+
[name]: value
|
|
2410
|
+
}));
|
|
2411
|
+
}
|
|
2412
|
+
return;
|
|
2413
|
+
}
|
|
2414
|
+
setAchError((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
2415
|
+
[name]: ""
|
|
2416
|
+
}));
|
|
2417
|
+
setAchData((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
2418
|
+
[name]: value
|
|
2419
|
+
}));
|
|
2420
|
+
};
|
|
2421
|
+
const validateCardData = () => {
|
|
2422
|
+
var _a2, _b2, _c2, _d2, _e2, _f2;
|
|
2423
|
+
const errors = {};
|
|
2424
|
+
const data = cardData;
|
|
2425
|
+
const month = parseInt((data == null ? void 0 : data.expiryMonth) || "", 10);
|
|
2426
|
+
const year = (data == null ? void 0 : data.expiryYear) || "";
|
|
2427
|
+
if (!((_a2 = data == null ? void 0 : data.cardName) == null ? void 0 : _a2.trim())) errors.cardName = "Card name is required";
|
|
2428
|
+
if (!((_b2 = data == null ? void 0 : data.cardNumber) == null ? void 0 : _b2.trim())) errors.cardNumber = "Card number is required";
|
|
2429
|
+
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())) {
|
|
2430
|
+
errors.expiryMonth = "Invalid Expiration Date.";
|
|
2431
|
+
} else if (isNaN(month) || month < 1 || month > 12 || year.length !== 4) {
|
|
2432
|
+
errors.expiryMonth = "Invalid Expiration Date.";
|
|
2433
|
+
}
|
|
2434
|
+
if (!((_e2 = data == null ? void 0 : data.cvv) == null ? void 0 : _e2.trim())) errors.cvv = "CVV is required";
|
|
2435
|
+
if (!((_f2 = data == null ? void 0 : data.zipCode) == null ? void 0 : _f2.trim())) errors.zipCode = "ZIP code is required";
|
|
2436
|
+
if ((data == null ? void 0 : data.expiryMonth) && (data == null ? void 0 : data.expiryYear) && data.expiryMonth.length <= 2 && data.expiryYear.length === 4) {
|
|
2437
|
+
const month2 = parseInt(data.expiryMonth, 10);
|
|
2438
|
+
const year2 = parseInt(data.expiryYear, 10);
|
|
2439
|
+
const now = /* @__PURE__ */ new Date();
|
|
2440
|
+
const currentMonth = now.getMonth() + 1;
|
|
2441
|
+
const currentYear = now.getFullYear();
|
|
2442
|
+
if (year2 < currentYear || year2 === currentYear && month2 < currentMonth) {
|
|
2443
|
+
errors.expiryMonth = "Card is expired";
|
|
2444
|
+
}
|
|
2445
|
+
}
|
|
2446
|
+
setCardError(errors);
|
|
2447
|
+
return Object.keys(errors).length > 0;
|
|
2448
|
+
};
|
|
2449
|
+
const validateAchData = () => {
|
|
2450
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
|
|
2451
|
+
const errors = {};
|
|
2452
|
+
const data = achData;
|
|
2453
|
+
if (!((_a2 = data == null ? void 0 : data.name) == null ? void 0 : _a2.trim())) errors.name = "Name is required";
|
|
2454
|
+
if (!((_b2 = data == null ? void 0 : data.accountNumber) == null ? void 0 : _b2.trim())) errors.accountNumber = "account number is required";
|
|
2455
|
+
if (((_c2 = data == null ? void 0 : data.accountNumber) == null ? void 0 : _c2.trim()) && ((_d2 = data == null ? void 0 : data.accountNumber) == null ? void 0 : _d2.trim()) !== ((_e2 = data == null ? void 0 : data.confirmAccountNumber) == null ? void 0 : _e2.trim())) errors.confirmAccountNumber = "Account numbers must match";
|
|
2456
|
+
if (!((_f2 = data == null ? void 0 : data.bankName) == null ? void 0 : _f2.trim())) errors.bankName = "Bank name is required";
|
|
2457
|
+
if (!((_g2 = data == null ? void 0 : data.routingNumber) == null ? void 0 : _g2.trim())) errors.routingNumber = "Routing Number is required";
|
|
2458
|
+
if ((data == null ? void 0 : data.routingNumber) && ((_h2 = data == null ? void 0 : data.routingNumber) == null ? void 0 : _h2.length) !== 9) errors.routingNumber = "Routing number must be 9 digits";
|
|
2459
|
+
if (((_i2 = data == null ? void 0 : data.routingNumber) == null ? void 0 : _i2.length) == 9) {
|
|
2460
|
+
let routingNumber = data == null ? void 0 : data.routingNumber;
|
|
2461
|
+
const weights = [3, 7, 1];
|
|
2462
|
+
let sum = 0;
|
|
2463
|
+
for (let i = 0; i < routingNumber.length; i++) {
|
|
2464
|
+
sum += parseInt(routingNumber[i], 10) * weights[i % 3];
|
|
2465
|
+
}
|
|
2466
|
+
if (sum % 10 !== 0) {
|
|
2467
|
+
errors.routingNumber = "Invalid routing number";
|
|
2468
|
+
}
|
|
2469
|
+
}
|
|
2470
|
+
setAchError(errors);
|
|
2471
|
+
return Object.keys(errors).length > 0;
|
|
2472
|
+
};
|
|
2473
|
+
const submitFunc = async (e) => {
|
|
2474
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2;
|
|
2475
|
+
e.preventDefault();
|
|
2476
|
+
if (activetab !== "ach") {
|
|
2477
|
+
const hasError = validateCardData();
|
|
2478
|
+
if (hasError) return;
|
|
2479
|
+
else {
|
|
2480
|
+
let validCard = DatacapWebToken.validateCardNumber(cardData == null ? void 0 : cardData.cardNumber.replaceAll(" ", ""));
|
|
2481
|
+
let validExpirationDate = DatacapWebToken.validateExpirationDate(cardData == null ? void 0 : cardData.expiryMonth, cardData == null ? void 0 : cardData.expiryYear);
|
|
2482
|
+
let validCVV = DatacapWebToken.validateCVV(cardData == null ? void 0 : cardData.cvv);
|
|
2483
|
+
let errors = {};
|
|
2484
|
+
if (!validCard) errors.cardNumber = "Invalid card Number";
|
|
2485
|
+
if (!validExpirationDate) errors.expiryMonth = "Invalid Expiration Date.";
|
|
2486
|
+
if (!validCVV) errors.cvv = "Invalid CVV";
|
|
2487
|
+
setCardError(errors);
|
|
2488
|
+
if (validCard && validCVV && validExpirationDate) {
|
|
2489
|
+
setLoading2(true);
|
|
2490
|
+
try {
|
|
2491
|
+
const formData = __spreadProps(__spreadValues({}, cardData), {
|
|
2492
|
+
amount: `${props.amount || 0}`,
|
|
2493
|
+
fractalpayPublicKey: fractalpayClientKey,
|
|
2494
|
+
orderId: props == null ? void 0 : props.orderID,
|
|
2495
|
+
customer_id: props == null ? void 0 : props.customerId,
|
|
2496
|
+
discount: props == null ? void 0 : props.discount,
|
|
2497
|
+
surcharge: props == null ? void 0 : props.surcharge,
|
|
2498
|
+
tax: props == null ? void 0 : props.tax
|
|
2499
|
+
});
|
|
2500
|
+
const result = await axios3.post(`${baseUrl}create-widget-order`, formData);
|
|
2501
|
+
let tokenCallback = async function(response) {
|
|
2502
|
+
if (response.Error) {
|
|
2503
|
+
setError(response.Error);
|
|
2504
|
+
setLoading2(false);
|
|
2505
|
+
} else {
|
|
2506
|
+
let name = cardData == null ? void 0 : cardData.cardName;
|
|
2507
|
+
let postal_code = cardData == null ? void 0 : cardData.zipCode;
|
|
2508
|
+
response.name = name;
|
|
2509
|
+
response.postal_code = postal_code;
|
|
2510
|
+
response.isCardSave = `${saveCardInfo}`;
|
|
2511
|
+
response.isCharge = true;
|
|
2512
|
+
response.posSalesIdEncode = result == null ? void 0 : result.data.data.posSalesIdEncode;
|
|
2513
|
+
console.log(response, "resppp");
|
|
2514
|
+
console.log(result == null ? void 0 : result.data.data.posSalesIdEncode, "fkjdashgfuh");
|
|
2515
|
+
socketClient_default.emit("sendMessage", response);
|
|
2516
|
+
socketClient_default.on(result == null ? void 0 : result.data.data.posSalesIdEncode, (data) => {
|
|
2517
|
+
console.log(data, "socket data");
|
|
2518
|
+
if (isValidJson(data == null ? void 0 : data.data)) {
|
|
2519
|
+
let apiResponse = JSON.parse(data.data);
|
|
2520
|
+
console.log("return data : ", apiResponse);
|
|
2521
|
+
if (apiResponse == null ? void 0 : apiResponse.result) {
|
|
2522
|
+
setCardData({
|
|
2523
|
+
cardName: "",
|
|
2524
|
+
cardNumber: "",
|
|
2525
|
+
expiryMonth: "",
|
|
2526
|
+
expiryYear: "",
|
|
2527
|
+
cvv: "",
|
|
2528
|
+
orderId: "",
|
|
2529
|
+
zipCode: ""
|
|
2530
|
+
});
|
|
2531
|
+
setSaveCardInfo(false);
|
|
2532
|
+
setTranId(apiResponse == null ? void 0 : apiResponse.transactionId);
|
|
2533
|
+
setSuccess(true);
|
|
2534
|
+
setLoading2(false);
|
|
2535
|
+
} else {
|
|
2536
|
+
setLoading2(false);
|
|
2537
|
+
setError((apiResponse == null ? void 0 : apiResponse.message) || "Something went wrong.");
|
|
2538
|
+
}
|
|
2539
|
+
} else {
|
|
2540
|
+
setError("Something went wrong.");
|
|
2541
|
+
}
|
|
2542
|
+
});
|
|
2543
|
+
}
|
|
2544
|
+
};
|
|
2545
|
+
if ((paymentData == null ? void 0 : paymentData.paymentGateway) === 32) {
|
|
2546
|
+
const requestOptions = {
|
|
2547
|
+
method: "POST",
|
|
2548
|
+
redirect: "follow"
|
|
2549
|
+
};
|
|
2550
|
+
try {
|
|
2551
|
+
let sesionResult = await axios3.post(`${masterBaseUrl}api/v1/widget/generate-session`, requestOptions);
|
|
2552
|
+
let expYear = Number(cardData == null ? void 0 : cardData.expiryYear) % 100;
|
|
2553
|
+
let cardNumber = cardData == null ? void 0 : cardData.cardNumber;
|
|
2554
|
+
cardNumber = cardNumber == null ? void 0 : cardNumber.replace(/\s+/g, "");
|
|
2555
|
+
let track2_data = `${cardNumber}=${expYear}${cardData == null ? void 0 : cardData.expiryMonth} ${cardData == null ? void 0 : cardData.cvv}`;
|
|
2556
|
+
const publicKey = forge.pki.publicKeyFromPem((_b2 = (_a2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _a2.data) == null ? void 0 : _b2.publicKeyPem);
|
|
2557
|
+
const encrypted = publicKey.encrypt(track2_data, "RSA-OAEP", {
|
|
2558
|
+
md: forge.md.sha1.create(),
|
|
2559
|
+
mgf1: {
|
|
2560
|
+
md: forge.md.sha1.create()
|
|
2561
|
+
}
|
|
2562
|
+
});
|
|
2563
|
+
const encryptedBase64 = forge.util.encode64(encrypted);
|
|
2564
|
+
const myHeaders = {
|
|
2565
|
+
"Content-Type": "application/json",
|
|
2566
|
+
"x-app-session-key": (_d2 = (_c2 = sesionResult.data) == null ? void 0 : _c2.data) == null ? void 0 : _d2.session_key
|
|
2567
|
+
};
|
|
2568
|
+
const raw = JSON.stringify({
|
|
2569
|
+
"enc_track2_data": `${encryptedBase64}`,
|
|
2570
|
+
"algorithm": "RSAES_OAEP_SHA_1",
|
|
2571
|
+
session_key: `${(_f2 = (_e2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _e2.data) == null ? void 0 : _f2.session_key}`
|
|
2572
|
+
});
|
|
2573
|
+
try {
|
|
2574
|
+
const tokenizeData = await axios3.post(`${fractalGatewayUrl}tokenizer/tokenize`, raw, { headers: myHeaders });
|
|
2575
|
+
const reqData = JSON.stringify(__spreadProps(__spreadValues({}, (_g2 = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _g2.data), {
|
|
2576
|
+
isSaveCardChecked: saveCardInfo,
|
|
2577
|
+
name: cardData == null ? void 0 : cardData.cardName,
|
|
2578
|
+
postal_code: cardData == null ? void 0 : cardData.zipCode,
|
|
2579
|
+
customer_id: props == null ? void 0 : props.customerId
|
|
2580
|
+
}));
|
|
2581
|
+
const reqData2 = JSON.stringify({
|
|
2582
|
+
"pre_sales_id": `${(_i2 = (_h2 = result == null ? void 0 : result.data) == null ? void 0 : _h2.data) == null ? void 0 : _i2.posSalesIdEncode}`,
|
|
2583
|
+
"token": `${(_j2 = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _j2.data.token}`,
|
|
2584
|
+
"json_response": `${reqData}`
|
|
2585
|
+
});
|
|
2586
|
+
let myHeaders2 = JSON.stringify({
|
|
2587
|
+
"Content-Type": "application/json"
|
|
2588
|
+
});
|
|
2589
|
+
const requestOptions2 = {
|
|
2590
|
+
method: "POST",
|
|
2591
|
+
headers: myHeaders2,
|
|
2592
|
+
body: reqData2,
|
|
2593
|
+
redirect: "follow",
|
|
2594
|
+
isChargeviafractal: true
|
|
2595
|
+
};
|
|
2596
|
+
socketClient_default.emit("sendMessage", requestOptions2);
|
|
2597
|
+
socketClient_default.on("chargeviafractalgateway", (data) => {
|
|
2598
|
+
var _a3;
|
|
2599
|
+
console.log(data, "socket data");
|
|
2600
|
+
if (isValidJson(data == null ? void 0 : data.data)) {
|
|
2601
|
+
let paymentRes = JSON.parse(data == null ? void 0 : data.data);
|
|
2602
|
+
console.log(paymentRes, "dfuigdasuf");
|
|
2603
|
+
if (paymentRes == null ? void 0 : paymentRes.result) {
|
|
2604
|
+
setTranId((_a3 = paymentRes == null ? void 0 : paymentRes.data) == null ? void 0 : _a3.transactionId);
|
|
2605
|
+
setSuccess(true);
|
|
2606
|
+
setLoading2(false);
|
|
2607
|
+
} else {
|
|
2608
|
+
setLoading2(false);
|
|
2609
|
+
setError((paymentRes == null ? void 0 : paymentRes.message) || "Something went wrong.");
|
|
2610
|
+
}
|
|
2611
|
+
} else {
|
|
2612
|
+
setError("Something went wrong.");
|
|
2613
|
+
}
|
|
2614
|
+
});
|
|
2615
|
+
} catch (err) {
|
|
2616
|
+
setLoading2(false);
|
|
2617
|
+
setError(((_l2 = (_k2 = err == null ? void 0 : err.response) == null ? void 0 : _k2.data) == null ? void 0 : _l2.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
|
|
2618
|
+
}
|
|
2619
|
+
} catch (err) {
|
|
2620
|
+
setLoading2(false);
|
|
2621
|
+
setError(((_n2 = (_m2 = err == null ? void 0 : err.response) == null ? void 0 : _m2.data) == null ? void 0 : _n2.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
|
|
2622
|
+
}
|
|
2623
|
+
} else {
|
|
2624
|
+
if (typeof DatacapWebToken !== "undefined") {
|
|
2625
|
+
DatacapWebToken.requestToken(result == null ? void 0 : result.data.data.dctoken, "PaymentForm", tokenCallback);
|
|
2626
|
+
}
|
|
2627
|
+
}
|
|
2628
|
+
} catch (err) {
|
|
2629
|
+
setLoading2(false);
|
|
2630
|
+
setError(((_p2 = (_o2 = err == null ? void 0 : err.response) == null ? void 0 : _o2.data) == null ? void 0 : _p2.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
|
|
2631
|
+
}
|
|
2632
|
+
}
|
|
2633
|
+
}
|
|
2634
|
+
} else {
|
|
2635
|
+
const hasError = validateAchData();
|
|
2636
|
+
if (hasError) return;
|
|
2637
|
+
else {
|
|
2638
|
+
setLoading2(true);
|
|
2639
|
+
let dataForm = {
|
|
2640
|
+
fractalpayPublicKey: fractalpayClientKey,
|
|
2641
|
+
label: (achData == null ? void 0 : achData.name) || "John Doe",
|
|
2642
|
+
account_number: achData == null ? void 0 : achData.accountNumber,
|
|
2643
|
+
routing_number: achData == null ? void 0 : achData.routingNumber,
|
|
2644
|
+
bank_name: achData == null ? void 0 : achData.bankName,
|
|
2645
|
+
account_type: achData == null ? void 0 : achData.accountType,
|
|
2646
|
+
amount: String(props.amount || 0),
|
|
2647
|
+
isSaveAch: saveACHinfo,
|
|
2648
|
+
customer_id: props == null ? void 0 : props.customerId,
|
|
2649
|
+
order_id: props == null ? void 0 : props.orderID,
|
|
2650
|
+
tax: props == null ? void 0 : props.tax,
|
|
2651
|
+
discount: props == null ? void 0 : props.discount,
|
|
2652
|
+
surcharge: props == null ? void 0 : props.surcharge,
|
|
2653
|
+
isChargeACH: true
|
|
2654
|
+
};
|
|
2655
|
+
socketClient_default.emit("sendMessage", dataForm);
|
|
2656
|
+
socketClient_default.on("ach-incoming", (data) => {
|
|
2657
|
+
var _a3;
|
|
2658
|
+
console.log(data, "sfhdwhf");
|
|
2659
|
+
if ((data == null ? void 0 : data.status) == "Failed") {
|
|
2660
|
+
if (typeof (data == null ? void 0 : data.message) == "object") {
|
|
2661
|
+
Object.values(data == null ? void 0 : data.message).forEach((message) => {
|
|
2662
|
+
setError(message || "Something went wrong");
|
|
2663
|
+
});
|
|
2664
|
+
} else {
|
|
2665
|
+
setError((data == null ? void 0 : data.message) || "Something went wrong");
|
|
2666
|
+
}
|
|
2667
|
+
} else {
|
|
2668
|
+
setTranId((_a3 = data == null ? void 0 : data.data) == null ? void 0 : _a3.transaction_id);
|
|
2669
|
+
setSuccess(true);
|
|
2670
|
+
setLoading2(false);
|
|
2671
|
+
}
|
|
2672
|
+
});
|
|
2673
|
+
}
|
|
2674
|
+
}
|
|
2675
|
+
};
|
|
2676
|
+
const getPaymentDetails = async () => {
|
|
2677
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2, _q, _r, _s;
|
|
2678
|
+
showLoader();
|
|
2679
|
+
try {
|
|
2680
|
+
const data = {
|
|
2681
|
+
fractalpayPublicKey: fractalpayClientKey,
|
|
2682
|
+
"customer_id": props == null ? void 0 : props.customerId
|
|
2683
|
+
};
|
|
2684
|
+
let paymentData2 = await axios3.post(`${baseUrl}get-payment-details`, data);
|
|
2685
|
+
setPaymentData((_a2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _a2.data);
|
|
2686
|
+
if (!((_c2 = (_b2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _b2.data) == null ? void 0 : _c2.paymentGateway)) {
|
|
2687
|
+
handleClose();
|
|
2688
|
+
setError("Something went wrong.");
|
|
2689
|
+
}
|
|
2690
|
+
if (((_e2 = (_d2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _d2.data) == null ? void 0 : _e2.card_list) && ((_h2 = (_g2 = (_f2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _f2.data) == null ? void 0 : _g2.card_list) == null ? void 0 : _h2.length) > 0) {
|
|
2691
|
+
setCardList((_j2 = (_i2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _i2.data) == null ? void 0 : _j2.card_list);
|
|
2692
|
+
setActive("cardList");
|
|
2693
|
+
let primary_card = (_m2 = (_l2 = (_k2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _k2.data) == null ? void 0 : _l2.card_list) == null ? void 0 : _m2.filter((card) => (card == null ? void 0 : card.primary_card) == 1);
|
|
2694
|
+
if ((primary_card == null ? void 0 : primary_card[0]) && ((_n2 = primary_card == null ? void 0 : primary_card[0]) == null ? void 0 : _n2.payment_method_type) == ((_p2 = (_o2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _o2.data) == null ? void 0 : _p2.paymentGateway)) {
|
|
2695
|
+
setSelectedCard(primary_card[0]);
|
|
2696
|
+
} else if (((_q = primary_card == null ? void 0 : primary_card[0]) == null ? void 0 : _q.card_type) === "Bank") {
|
|
2697
|
+
setSelectedCard(primary_card[0]);
|
|
2698
|
+
}
|
|
2699
|
+
} else {
|
|
2700
|
+
setActive("card");
|
|
2701
|
+
}
|
|
2702
|
+
hideLoader();
|
|
2703
|
+
} catch (err) {
|
|
2704
|
+
console.log(err);
|
|
2705
|
+
hideLoader();
|
|
2706
|
+
setError(((_s = (_r = err == null ? void 0 : err.response) == null ? void 0 : _r.data) == null ? void 0 : _s.message) || (err == null ? void 0 : err.message) || "Something went wrong");
|
|
2707
|
+
}
|
|
2708
|
+
};
|
|
2709
|
+
const handlechargeCustomer = async () => {
|
|
2710
|
+
let customer_id = props == null ? void 0 : props.customerId;
|
|
2711
|
+
let discount = String(props == null ? void 0 : props.discount);
|
|
2712
|
+
let surcharge = String(props == null ? void 0 : props.surcharge);
|
|
2713
|
+
let tax = String(props == null ? void 0 : props.tax);
|
|
2714
|
+
let fractalpayPublicKey = props == null ? void 0 : props.fractalpayClientKey;
|
|
2715
|
+
let order_id = props == null ? void 0 : props.orderID;
|
|
2716
|
+
let amount = String(props == null ? void 0 : props.amount);
|
|
2717
|
+
let card_id = selectedCard == null ? void 0 : selectedCard.id;
|
|
2718
|
+
let card_type = selectedCard == null ? void 0 : selectedCard.card_type;
|
|
2719
|
+
if (fractalpayPublicKey && order_id && amount) {
|
|
2720
|
+
if (customer_id) {
|
|
2721
|
+
if (card_id) {
|
|
2722
|
+
let chargeobj = {
|
|
2723
|
+
amount,
|
|
2724
|
+
order_id,
|
|
2725
|
+
customer_id,
|
|
2726
|
+
card_id,
|
|
2727
|
+
fractalpayPublicKey,
|
|
2728
|
+
isCardSave: saveCardInfo,
|
|
2729
|
+
discount,
|
|
2730
|
+
surcharge,
|
|
2731
|
+
tax
|
|
2732
|
+
};
|
|
2733
|
+
let _a2 = chargeobj, { isCardSave } = _a2, rest = __objRest(_a2, ["isCardSave"]);
|
|
2734
|
+
let endpoint = card_type === "Bank" ? "charge-ach" : "charge-by-card";
|
|
2735
|
+
let chargeurl = baseUrl + endpoint;
|
|
2736
|
+
const headers = {
|
|
2737
|
+
"Content-Type": "application/json"
|
|
2738
|
+
};
|
|
2739
|
+
setLoading2(true);
|
|
2740
|
+
socketClient_default.emit("sendMessage", { url: chargeurl, body: card_type == "Bank" ? rest : chargeobj, isChargebycard: true });
|
|
2741
|
+
socketClient_default.on("charge-by-card", (response) => {
|
|
2742
|
+
var _a3;
|
|
2743
|
+
console.log(response, "response");
|
|
2744
|
+
if ((response == null ? void 0 : response.result) == true || (response == null ? void 0 : response.status) == true) {
|
|
2745
|
+
setTranId((_a3 = response.data) == null ? void 0 : _a3.transaction_id);
|
|
2746
|
+
setSuccess(true);
|
|
2747
|
+
setLoading2(false);
|
|
2748
|
+
} else {
|
|
2749
|
+
setError((response == null ? void 0 : response.message) || "Something went wrong.");
|
|
2750
|
+
}
|
|
2751
|
+
});
|
|
2752
|
+
} else {
|
|
2753
|
+
setError("Please Select A Card/ACH");
|
|
2754
|
+
}
|
|
2755
|
+
} else {
|
|
2756
|
+
setError("Please Select Customer");
|
|
2757
|
+
}
|
|
2758
|
+
} else {
|
|
2759
|
+
setError("Something went wrong.");
|
|
2760
|
+
}
|
|
2761
|
+
};
|
|
2762
|
+
useEffect4(() => {
|
|
2763
|
+
if (show && fractalpayClientKey) {
|
|
2764
|
+
getPaymentDetails();
|
|
2765
|
+
}
|
|
2766
|
+
}, [fractalpayClientKey, show]);
|
|
2767
|
+
const handleDeleteCard = async (cardId) => {
|
|
2768
|
+
Swal.fire({
|
|
2769
|
+
icon: "warning",
|
|
2770
|
+
text: "Do you want to delete the card?",
|
|
2771
|
+
showCancelButton: true,
|
|
2772
|
+
confirmButtonText: "Yes",
|
|
2773
|
+
cancelButtonText: "No",
|
|
2774
|
+
reverseButtons: true,
|
|
2775
|
+
buttonsStyling: false,
|
|
2776
|
+
customClass: {
|
|
2777
|
+
confirmButton: "swal2-confirm btn btn-dark",
|
|
2778
|
+
cancelButton: "swal2-cancel btn btn-dark",
|
|
2779
|
+
popup: "custom-swal-popup",
|
|
2780
|
+
icon: "custom-swal-icon"
|
|
2781
|
+
}
|
|
2782
|
+
}).then(async (result) => {
|
|
2783
|
+
if (result.isConfirmed) {
|
|
2784
|
+
setLoading2(true);
|
|
2785
|
+
try {
|
|
2786
|
+
let obj = {
|
|
2787
|
+
card_id: cardId,
|
|
2788
|
+
customer_id: props == null ? void 0 : props.customerId,
|
|
2789
|
+
fractalpayPublicKey: props == null ? void 0 : props.fractalpayClientKey
|
|
2790
|
+
};
|
|
2791
|
+
const res = await axios3.post(`${baseUrl}delete-customer-card`, obj);
|
|
2792
|
+
setLoading2(false);
|
|
2793
|
+
getPaymentDetails();
|
|
2794
|
+
Swal.fire({
|
|
2795
|
+
icon: "success",
|
|
2796
|
+
title: "Deleted!",
|
|
2797
|
+
text: "Card deleted.",
|
|
2798
|
+
confirmButtonText: "OK",
|
|
2799
|
+
showConfirmButton: true,
|
|
2800
|
+
timer: 1e3,
|
|
2801
|
+
// auto-close after 1 second
|
|
2802
|
+
timerProgressBar: true,
|
|
2803
|
+
customClass: {
|
|
2804
|
+
confirmButton: "btn btn-dark"
|
|
2805
|
+
}
|
|
2806
|
+
});
|
|
2807
|
+
} catch (err) {
|
|
2808
|
+
setLoading2(false);
|
|
2809
|
+
Swal.fire({
|
|
2810
|
+
icon: "error",
|
|
2811
|
+
title: "Error!",
|
|
2812
|
+
text: "Failed to delete the card.",
|
|
2813
|
+
confirmButtonText: "OK",
|
|
2814
|
+
customClass: {
|
|
2815
|
+
confirmButton: "btn btn-dark"
|
|
2816
|
+
}
|
|
2817
|
+
});
|
|
2818
|
+
}
|
|
2819
|
+
} else if (result.dismiss === Swal.DismissReason.cancel) {
|
|
2820
|
+
Swal.fire({
|
|
2821
|
+
icon: "info",
|
|
2822
|
+
text: "Card not deleted",
|
|
2823
|
+
confirmButtonText: "OK",
|
|
2824
|
+
buttonsStyling: false,
|
|
2825
|
+
customClass: {
|
|
2826
|
+
confirmButton: "btn btn-dark float-end",
|
|
2827
|
+
actions: "swal2-actions-end"
|
|
2828
|
+
}
|
|
2829
|
+
});
|
|
2830
|
+
}
|
|
2831
|
+
});
|
|
2832
|
+
};
|
|
2833
|
+
return /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(DataScript, null), /* @__PURE__ */ React13.createElement(Chargewidgetstyles, null), /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(
|
|
2834
|
+
"button",
|
|
2835
|
+
{
|
|
2836
|
+
className: "paymentBtn",
|
|
2837
|
+
onClick: handleShow
|
|
2838
|
+
},
|
|
2839
|
+
"Pay"
|
|
2840
|
+
), /* @__PURE__ */ React13.createElement(
|
|
2841
|
+
CustomModal2_default,
|
|
2842
|
+
{
|
|
2843
|
+
open: show,
|
|
2844
|
+
onClose: handleClose
|
|
2845
|
+
},
|
|
2846
|
+
error && /* @__PURE__ */ React13.createElement("div", { style: { maxHeight: "606px", minHeight: "60vh", padding: "40px" } }, /* @__PURE__ */ React13.createElement(ErrorCardMessage_default, { error, onClose: handleClose })),
|
|
2847
|
+
success && /* @__PURE__ */ React13.createElement(SuccessMsz, { onClose: handleClose, tranId }),
|
|
2848
|
+
!error && !success && /* @__PURE__ */ React13.createElement(React13.Fragment, null, (loading || loading2) && /* @__PURE__ */ React13.createElement(Loader_default, { loading: loading || loading2 }), /* @__PURE__ */ React13.createElement("div", { className: "frac-card-payment-page frac-form" }, /* @__PURE__ */ React13.createElement("div", { className: "parent-pay-container" }, /* @__PURE__ */ React13.createElement("span", { className: "request-payment-close-popup", onClick: handleClose }, /* @__PURE__ */ React13.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, /* @__PURE__ */ React13.createElement("g", { clipPath: "url(#clip0_12425_52336)" }, /* @__PURE__ */ React13.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__ */ React13.createElement("defs", null, /* @__PURE__ */ React13.createElement("clipPath", { id: "clip0_12425_52336" }, /* @__PURE__ */ React13.createElement("rect", { width: "16", height: "16", fill: "white" }))))), /* @__PURE__ */ React13.createElement("div", { className: "pay-main-logo-res" }, /* @__PURE__ */ React13.createElement("img", { src: "https://fractal-userdata-upload.s3.us-east-1.amazonaws.com/uploaded/merchant_logo/20250311131124_merchant_logo.png", id: "pay-logos" })), /* @__PURE__ */ React13.createElement("div", { className: "pay-container" }, /* @__PURE__ */ React13.createElement("div", { className: "pay-header pay-conatiner-one" }, /* @__PURE__ */ React13.createElement("div", { className: "pay-conatiner-one-first" }, /* @__PURE__ */ React13.createElement("div", { className: "pay-logo-container" }, /* @__PURE__ */ React13.createElement("div", { className: "pay-main-logo" }, /* @__PURE__ */ React13.createElement("img", { src: "https://fractal-userdata-upload.s3.us-east-1.amazonaws.com/uploaded/merchant_logo/20250311131124_merchant_logo.png", id: "pay-logos" })), /* @__PURE__ */ React13.createElement("h1", { className: "pay-heading" }, "Pay"), (cardList == null ? void 0 : cardList.length) > 0 && activetab !== "cardList" && /* @__PURE__ */ React13.createElement("button", { className: "res-charge-payment-back-btn ", onClick: () => setActive("cardList") }, " ", /* @__PURE__ */ React13.createElement(IoArrowBack, null), " Back")), /* @__PURE__ */ React13.createElement("div", { className: "amt-pay-con" }, /* @__PURE__ */ React13.createElement("div", { className: "pay-amount-conatiner" }, /* @__PURE__ */ React13.createElement("small", { className: "pay-payment-amount" }, "Payment Amount"), /* @__PURE__ */ React13.createElement("strong", { className: "pay-amount" }, "$", (_a = Number(props == null ? void 0 : props.amount)) == null ? void 0 : _a.toFixed(2))), activetab != "ach" && /* @__PURE__ */ React13.createElement("div", { style: { display: "flex", gap: "8px", margin: "8px 0" } }, /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/visa-img.svg", alt: "", width: 33 }), /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/mc-img.svg", width: 33, alt: "" }), /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/ae-img.svg", alt: "", width: 33 }), /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/discover-img.svg", width: 33, alt: "" })))), /* @__PURE__ */ React13.createElement("div", { className: "pay-conatiner-one-last" }, /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/secure-img.png", alt: "" }), /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/pov-by.png", alt: "" }), "Secure payments powered by Fractal"), /* @__PURE__ */ React13.createElement("div", null)), /* @__PURE__ */ React13.createElement("div", { className: "pay-tab pay-conatiner-two" }, !loading && /* @__PURE__ */ React13.createElement("div", { className: "col-md-12" }, /* @__PURE__ */ React13.createElement("div", { id: "payment-form-div" }, activetab !== "cardList" ? /* @__PURE__ */ React13.createElement("div", null, (cardList == null ? void 0 : cardList.length) > 0 && /* @__PURE__ */ React13.createElement("button", { className: "charge-payment-back-btn ", onClick: () => setActive("cardList") }, " ", /* @__PURE__ */ React13.createElement(IoArrowBack, null), " Back"), (paymentData == null ? void 0 : paymentData.isSkyFiAccount) && /* @__PURE__ */ React13.createElement("div", { className: "tab" }, /* @__PURE__ */ React13.createElement("button", { className: "tablinks", onClick: (e) => {
|
|
2849
|
+
handletabchange("card");
|
|
2850
|
+
}, style: { border: activetab === "card" ? "1px solid" : "" } }, /* @__PURE__ */ React13.createElement("i", { className: "fas fa-credit-card me-2", style: { marginRight: "8px", fontSize: "15px" } }), "Card"), /* @__PURE__ */ React13.createElement("button", { className: "tablinks", onClick: (e) => {
|
|
2851
|
+
handletabchange("ach");
|
|
2852
|
+
}, style: { border: activetab === "ach" ? "1px solid" : "" } }, /* @__PURE__ */ React13.createElement("i", { className: "fas fa-university me-2", style: { marginRight: "8px", fontSize: "15px" } }), "Bank")), /* @__PURE__ */ React13.createElement("div", { className: "res-pay-con" }, /* @__PURE__ */ React13.createElement("div", { className: "pay-amount-conatiner", style: { margin: 0 } }, /* @__PURE__ */ React13.createElement("small", { className: "pay-payment-amount" }, "Payment Amount"), /* @__PURE__ */ React13.createElement("strong", { className: "pay-amount" }, "$", (_b = Number(props == null ? void 0 : props.amount)) == null ? void 0 : _b.toFixed(2))), activetab != "ach" && /* @__PURE__ */ React13.createElement("div", null, /* @__PURE__ */ React13.createElement("div", null, /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/visa-img.svg", alt: "", width: 35, style: { paddingRight: "5px" } }), /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/mc-img.svg", width: 35, alt: "" })), /* @__PURE__ */ React13.createElement("div", null, /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/ae-img.svg", alt: "", width: 35, style: { paddingRight: "5px" } }), /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/discover-img.svg", width: 35, alt: "" }))))) : /* @__PURE__ */ React13.createElement("div", null, /* @__PURE__ */ React13.createElement("h6", { className: "charge-customer-name", style: { marginBottom: "16px !important" } }, " Charge ", paymentData == null ? void 0 : paymentData.customer_name), /* @__PURE__ */ React13.createElement("h6", { className: "card-ach-heading", style: { marginBottom: "10px !important" } }, " Cards/ACH"), /* @__PURE__ */ React13.createElement("div", { className: "res-pay-con" }, /* @__PURE__ */ React13.createElement("div", { className: "pay-amount-conatiner", style: { margin: 0 } }, /* @__PURE__ */ React13.createElement("small", { className: "pay-payment-amount" }, "Payment Amount"), /* @__PURE__ */ React13.createElement("strong", { className: "pay-amount" }, "$", (_c = Number(props == null ? void 0 : props.amount)) == null ? void 0 : _c.toFixed(2))), /* @__PURE__ */ React13.createElement("div", null, /* @__PURE__ */ React13.createElement("div", null, /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/visa-img.svg", alt: "", width: 35, style: { paddingRight: "5px" } }), /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/mc-img.svg", width: 35, alt: "" })), /* @__PURE__ */ React13.createElement("div", null, /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/ae-img.svg", alt: "", width: 35, style: { paddingRight: "5px" } }), /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/discover-img.svg", width: 35, alt: "" }))))), /* @__PURE__ */ React13.createElement("div", { id: "ach", style: { display: activetab === "cardList" ? "block" : "none" }, className: "tabcontent" }, /* @__PURE__ */ React13.createElement("div", { className: "card-lint-div-in" }, /* @__PURE__ */ React13.createElement("div", { className: "card-list-div" }, (paymentData == null ? void 0 : paymentData.card_list) && ((_d = paymentData == null ? void 0 : paymentData.card_list) == null ? void 0 : _d.length) > 0 && ((_e = paymentData == null ? void 0 : paymentData.card_list) == null ? void 0 : _e.map((card, index) => /* @__PURE__ */ React13.createElement("div", { className: "card-list-single-div", key: index }, /* @__PURE__ */ React13.createElement("div", { className: "card-number-radio" }, /* @__PURE__ */ React13.createElement(
|
|
2853
|
+
"input",
|
|
2854
|
+
{
|
|
2855
|
+
disabled: (paymentData == null ? void 0 : paymentData.paymentGateway) != (card == null ? void 0 : card.payment_method_type) && (card == null ? void 0 : card.card_type) != "Bank",
|
|
2856
|
+
type: "radio",
|
|
2857
|
+
className: "cardRadio",
|
|
2858
|
+
name: "selected_card",
|
|
2859
|
+
id: "",
|
|
2860
|
+
checked: selectedCard === card,
|
|
2861
|
+
onChange: (e) => setSelectedCard(card)
|
|
2862
|
+
}
|
|
2863
|
+
), /* @__PURE__ */ React13.createElement("label", { htmlFor: "", className: "card-number-last-four" }, "**** ", card == null ? void 0 : card.cardlastfourdigit), (card == null ? void 0 : card.card_type) != "Bank" && /* @__PURE__ */ React13.createElement("h6", { className: "card-expiry-date" }, card == null ? void 0 : card.expmonth, "/", card == null ? void 0 : card.expyear)), /* @__PURE__ */ React13.createElement("div", { className: "card-number-radio" }, /* @__PURE__ */ React13.createElement("span", { className: "visa-card" }, /* @__PURE__ */ React13.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__ */ React13.createElement("span", { className: "visa-card", style: { cursor: "pointer" }, onClick: () => handleDeleteCard(card == null ? void 0 : card.id) }, /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/Trash.svg", alt: "" }))))))), /* @__PURE__ */ React13.createElement("div", { className: "pay-with-other-card ", onClick: () => setActive("card") }, "Pay With Other Card", /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/card.svg", alt: "" }))), /* @__PURE__ */ React13.createElement("div", { className: "form-group", style: { padding: "0" } }, /* @__PURE__ */ React13.createElement("button", { className: "pay-button", style: { margin: "0px" }, type: "submit", onClick: handlechargeCustomer }, "$", (_f = Number(props == null ? void 0 : props.amount)) == null ? void 0 : _f.toFixed(2)))), /* @__PURE__ */ React13.createElement("div", { id: "card", style: { display: activetab === "card" ? "block" : "none" }, className: "tabcontent" }, /* @__PURE__ */ React13.createElement("form", { id: "PaymentForm", style: { textAlign: "start" }, onSubmit: submitFunc }, /* @__PURE__ */ React13.createElement("div", { className: "ach-scrl", style: { minHeight: (paymentData == null ? void 0 : paymentData.isSkyFiAccount) && (cardList == null ? void 0 : cardList.length) > 0 ? "398px" : (paymentData == null ? void 0 : paymentData.isSkyFiAccount) && (cardList == null ? void 0 : cardList.length) == 0 ? "456px" : (cardList == null ? void 0 : cardList.length) > 0 ? "462px" : "520px", overflow: "auto", marginRight: "5px" } }, /* @__PURE__ */ React13.createElement("div", { className: "form-group" }, /* @__PURE__ */ React13.createElement("label", { htmlFor: "cardHolderName" }, "NAME ON CARD "), /* @__PURE__ */ React13.createElement("input", { type: "text", className: "form-control", maxLength: 100, placeholder: "John Doe", value: (cardData == null ? void 0 : cardData.cardName) || "", onChange: (e) => {
|
|
2864
|
+
const value = e.target.value;
|
|
2865
|
+
if (/^[a-zA-Z\s]*$/.test(value)) {
|
|
2866
|
+
handleCardChange("cardName", value);
|
|
2867
|
+
}
|
|
2868
|
+
} }), (cardError == null ? void 0 : cardError.cardName) && /* @__PURE__ */ React13.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cardName)), /* @__PURE__ */ React13.createElement("div", { className: "form-group" }, /* @__PURE__ */ React13.createElement("label", { htmlFor: "cardNumber" }, "CARD NUMBER"), /* @__PURE__ */ React13.createElement("div", { className: "toggle-num-wrapper" }, /* @__PURE__ */ React13.createElement(
|
|
2869
|
+
"input",
|
|
2870
|
+
{
|
|
2871
|
+
className: "form-control card-number-new",
|
|
2872
|
+
type: "text",
|
|
2873
|
+
maxLength: 19,
|
|
2874
|
+
inputMode: "numeric",
|
|
2875
|
+
placeholder: "0000 0000 0000 0000",
|
|
2876
|
+
value: (cardData == null ? void 0 : cardData.cardNumber) || "",
|
|
2877
|
+
onChange: (e) => handleCardNumberChange(e),
|
|
2878
|
+
"data-token": "card_number"
|
|
2879
|
+
}
|
|
2880
|
+
), /* @__PURE__ */ React13.createElement("div", { className: "card-crdi card-expiry-new" }, /* @__PURE__ */ React13.createElement("div", { className: "exp-date-year-container" }, /* @__PURE__ */ React13.createElement("div", { className: "exp-date form-group" }, /* @__PURE__ */ React13.createElement(
|
|
2881
|
+
"input",
|
|
2882
|
+
{
|
|
2883
|
+
"data-token": "exp_month",
|
|
2884
|
+
className: "form-control required card-cvv-in",
|
|
2885
|
+
type: "text",
|
|
2886
|
+
style: { maxHeight: "36px" },
|
|
2887
|
+
placeholder: "MM",
|
|
2888
|
+
maxLength: 2,
|
|
2889
|
+
value: (cardData == null ? void 0 : cardData.expiryMonth) || "",
|
|
2890
|
+
onChange: (e) => handleCardChange("expiryMonth", e.target.value)
|
|
2891
|
+
}
|
|
2892
|
+
)), /* @__PURE__ */ React13.createElement("div", { className: "exp-year form-group" }, /* @__PURE__ */ React13.createElement(
|
|
2893
|
+
"input",
|
|
2894
|
+
{
|
|
2895
|
+
"data-token": "exp_year",
|
|
2896
|
+
className: "form-control required card-cvv-in",
|
|
2897
|
+
type: "text",
|
|
2898
|
+
style: { maxHeight: "36px" },
|
|
2899
|
+
placeholder: "YYYY",
|
|
2900
|
+
maxLength: 4,
|
|
2901
|
+
value: (cardData == null ? void 0 : cardData.expiryYear) || "",
|
|
2902
|
+
onChange: (e) => handleCardChange("expiryYear", e.target.value)
|
|
2903
|
+
}
|
|
2904
|
+
)), /* @__PURE__ */ React13.createElement("div", { className: "security-digit form-group" }, /* @__PURE__ */ React13.createElement(
|
|
2905
|
+
"input",
|
|
2906
|
+
{
|
|
2907
|
+
"data-token": "cvv",
|
|
2908
|
+
className: "form-control card-cvv-in required",
|
|
2909
|
+
type: "text",
|
|
2910
|
+
style: { maxHeight: "36px" },
|
|
2911
|
+
maxLength: 4,
|
|
2912
|
+
placeholder: "CVC",
|
|
2913
|
+
value: (cardData == null ? void 0 : cardData.cvv) || "",
|
|
2914
|
+
onChange: (e) => handleCardChange("cvv", e.target.value)
|
|
2915
|
+
}
|
|
2916
|
+
)))), (cardError == null ? void 0 : cardError.cardNumber) && /* @__PURE__ */ React13.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cardNumber), /* @__PURE__ */ React13.createElement("p", { style: { margin: "0" } }, (cardError == null ? void 0 : cardError.expiryMonth) || (cardError == null ? void 0 : cardError.expiryYear) ? /* @__PURE__ */ React13.createElement("span", { className: "error-span", style: { paddingRight: "4px" } }, cardError == null ? void 0 : cardError.expiryMonth) : "", (cardError == null ? void 0 : cardError.cvv) && /* @__PURE__ */ React13.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cvv)))), /* @__PURE__ */ React13.createElement("div", { className: "form-group" }, /* @__PURE__ */ React13.createElement("label", { htmlFor: "OrderId" }, "Order ID / Description"), /* @__PURE__ */ React13.createElement(
|
|
2917
|
+
"input",
|
|
2918
|
+
{
|
|
2919
|
+
type: "text",
|
|
2920
|
+
className: "form-control",
|
|
2921
|
+
maxLength: 100,
|
|
2922
|
+
placeholder: "OID123456",
|
|
2923
|
+
disabled: true,
|
|
2924
|
+
value: (_g = props == null ? void 0 : props.orderID) != null ? _g : "",
|
|
2925
|
+
style: { background: "#F6F6F7", color: "#727272" }
|
|
2926
|
+
}
|
|
2927
|
+
)), /* @__PURE__ */ React13.createElement("div", { className: "form-group" }, /* @__PURE__ */ React13.createElement("label", { htmlFor: "zip" }, "ZIP"), /* @__PURE__ */ React13.createElement("input", { type: "text", className: "form-control", maxLength: 100, placeholder: "000000", value: (_h = cardData == null ? void 0 : cardData.zipCode) != null ? _h : "", onChange: (e) => handleCardChange("zipCode", e.target.value) }), (cardError == null ? void 0 : cardError.zipCode) && /* @__PURE__ */ React13.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.zipCode)), (props == null ? void 0 : props.customerId) && /* @__PURE__ */ React13.createElement("div", { className: "form-group" }, /* @__PURE__ */ React13.createElement("div", { style: { display: "flex", alignItems: "center", gap: "10px", paddingTop: "10px" } }, /* @__PURE__ */ React13.createElement(
|
|
2928
|
+
"input",
|
|
2929
|
+
{
|
|
2930
|
+
type: "checkbox",
|
|
2931
|
+
id: "save_card",
|
|
2932
|
+
className: "toggle-checkbox",
|
|
2933
|
+
checked: saveCardInfo,
|
|
2934
|
+
onChange: (e) => setSaveCardInfo(e.target.checked)
|
|
2935
|
+
}
|
|
2936
|
+
), /* @__PURE__ */ React13.createElement("label", { htmlFor: "save_card", className: "toggle-label" }), /* @__PURE__ */ React13.createElement("label", { htmlFor: "save_card" }, "Save card for future payments "), /* @__PURE__ */ React13.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none" }, /* @__PURE__ */ React13.createElement("g", { clipPath: "url(#clip0_12420_50192)" }, /* @__PURE__ */ React13.createElement("rect", { width: "20", height: "20", fill: "white" }), /* @__PURE__ */ React13.createElement("circle", { cx: "10", cy: "10", r: "10", fill: "#E0DFE2" }), /* @__PURE__ */ React13.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__ */ React13.createElement("defs", null, /* @__PURE__ */ React13.createElement("clipPath", { id: "clip0_12420_50192" }, /* @__PURE__ */ React13.createElement("rect", { width: "20", height: "20", fill: "white" }))))))), /* @__PURE__ */ React13.createElement("div", { className: "form-group", style: { marginTop: "20px", padding: "0" } }, /* @__PURE__ */ React13.createElement("button", { type: "submit", style: { margin: 0 }, className: "pay-button" }, "$", (_i = Number(props == null ? void 0 : props.amount)) == null ? void 0 : _i.toFixed(2))))), /* @__PURE__ */ React13.createElement("div", { id: "ach", style: { display: activetab === "ach" ? "block" : "none" }, className: "tabcontent" }, /* @__PURE__ */ React13.createElement("form", { id: "ACHPaymentForm", style: { textAlign: "start" }, onSubmit: submitFunc }, /* @__PURE__ */ React13.createElement("div", { className: "ach-scrl", style: {
|
|
2937
|
+
minHeight: (paymentData == null ? void 0 : paymentData.isSkyFiAccount) && (cardList == null ? void 0 : cardList.length) > 0 ? "378px" : (paymentData == null ? void 0 : paymentData.isSkyFiAccount) && (cardList == null ? void 0 : cardList.length) == 0 ? "436px" : (cardList == null ? void 0 : cardList.length) > 0 ? "462px" : "520px",
|
|
2938
|
+
maxHeight: (paymentData == null ? void 0 : paymentData.isSkyFiAccount) && (cardList == null ? void 0 : cardList.length) > 0 ? "358px" : (cardList == null ? void 0 : cardList.length) > 0 ? "380px" : "380px"
|
|
2939
|
+
} }, /* @__PURE__ */ React13.createElement("div", { className: "form-group mb-4" }, /* @__PURE__ */ React13.createElement("label", { htmlFor: "nameonaccount" }, "Name on account"), /* @__PURE__ */ React13.createElement("input", { type: "text", id: "nameonaccount", className: "form-control", maxLength: 100, placeholder: "John Doe", name: "name", value: (_j = achData == null ? void 0 : achData.name) != null ? _j : "", onChange: handleChangeAch }), (achError == null ? void 0 : achError.name) && /* @__PURE__ */ React13.createElement("span", { className: "error-span" }, achError == null ? void 0 : achError.name)), /* @__PURE__ */ React13.createElement("div", { className: "form-group mb-4" }, /* @__PURE__ */ React13.createElement("label", { htmlFor: "routingnumber" }, "Routing number"), /* @__PURE__ */ React13.createElement(
|
|
2940
|
+
"input",
|
|
2941
|
+
{
|
|
2942
|
+
type: "text",
|
|
2943
|
+
id: "routingnumber",
|
|
2944
|
+
className: "form-control",
|
|
2945
|
+
maxLength: 9,
|
|
2946
|
+
placeholder: "000000000",
|
|
2947
|
+
name: "routingNumber",
|
|
2948
|
+
value: (_k = achData == null ? void 0 : achData.routingNumber) != null ? _k : "",
|
|
2949
|
+
onChange: handleChangeAch
|
|
2950
|
+
}
|
|
2951
|
+
), (achError == null ? void 0 : achError.routingNumber) && /* @__PURE__ */ React13.createElement("span", { className: "error-span" }, achError == null ? void 0 : achError.routingNumber)), /* @__PURE__ */ React13.createElement("div", { className: "form-group mb-4" }, /* @__PURE__ */ React13.createElement("label", { htmlFor: "accountnumber" }, "Account number"), /* @__PURE__ */ React13.createElement(
|
|
2952
|
+
"input",
|
|
2953
|
+
{
|
|
2954
|
+
type: "text",
|
|
2955
|
+
id: "accountnumber",
|
|
2956
|
+
className: "form-control",
|
|
2957
|
+
maxLength: 16,
|
|
2958
|
+
placeholder: "0000000000",
|
|
2959
|
+
name: "accountNumber",
|
|
2960
|
+
value: (_l = achData == null ? void 0 : achData.accountNumber) != null ? _l : "",
|
|
2961
|
+
onChange: handleChangeAch
|
|
2962
|
+
}
|
|
2963
|
+
), (achError == null ? void 0 : achError.accountNumber) && /* @__PURE__ */ React13.createElement("span", { className: "error-span" }, achError == null ? void 0 : achError.accountNumber)), /* @__PURE__ */ React13.createElement("div", { className: "form-group mb-4" }, /* @__PURE__ */ React13.createElement("label", { htmlFor: "confirmaccountnumber" }, "Confirm account number"), /* @__PURE__ */ React13.createElement(
|
|
2964
|
+
"input",
|
|
2965
|
+
{
|
|
2966
|
+
type: "text",
|
|
2967
|
+
id: "confirmaccountnumber",
|
|
2968
|
+
className: "form-control",
|
|
2969
|
+
maxLength: 16,
|
|
2970
|
+
placeholder: "0000000000",
|
|
2971
|
+
name: "confirmAccountNumber",
|
|
2972
|
+
value: (_m = achData == null ? void 0 : achData.confirmAccountNumber) != null ? _m : "",
|
|
2973
|
+
onChange: handleChangeAch
|
|
2974
|
+
}
|
|
2975
|
+
), (achError == null ? void 0 : achError.confirmAccountNumber) && /* @__PURE__ */ React13.createElement("span", { className: "error-span" }, achError == null ? void 0 : achError.confirmAccountNumber)), /* @__PURE__ */ React13.createElement("div", { className: "form-group mb-4" }, /* @__PURE__ */ React13.createElement("label", { htmlFor: "bankname" }, "Bank name"), /* @__PURE__ */ React13.createElement(
|
|
2976
|
+
"input",
|
|
2977
|
+
{
|
|
2978
|
+
type: "text",
|
|
2979
|
+
id: "bankname",
|
|
2980
|
+
className: "form-control",
|
|
2981
|
+
maxLength: 100,
|
|
2982
|
+
placeholder: "My Bank",
|
|
2983
|
+
name: "bankName",
|
|
2984
|
+
value: (_n = achData == null ? void 0 : achData.bankName) != null ? _n : "",
|
|
2985
|
+
onChange: handleChangeAch
|
|
2986
|
+
}
|
|
2987
|
+
), (achError == null ? void 0 : achError.bankName) && /* @__PURE__ */ React13.createElement("span", { className: "error-span" }, achError == null ? void 0 : achError.bankName)), /* @__PURE__ */ React13.createElement("div", { className: "form-group mb-4" }, /* @__PURE__ */ React13.createElement("label", { htmlFor: "accounttype" }, "Select account type"), /* @__PURE__ */ React13.createElement("select", { name: "accountType", id: "accounttype", className: "form-control", value: (_o = achData == null ? void 0 : achData.accountType) != null ? _o : "", onChange: handleChangeAch }, /* @__PURE__ */ React13.createElement("option", { value: "" }, "Select account"), /* @__PURE__ */ React13.createElement("option", { value: "Personal Saving" }, "Personal Saving"), /* @__PURE__ */ React13.createElement("option", { value: "Business Saving" }, "Business Saving"), /* @__PURE__ */ React13.createElement("option", { value: "Personal Checking" }, "Personal Checking"), /* @__PURE__ */ React13.createElement("option", { value: "Business Checking" }, "Business Checking"))), (props == null ? void 0 : props.customerId) && /* @__PURE__ */ React13.createElement("div", { className: "form-group mb-4 save-ach-div", style: { paddingTop: "5px" } }, /* @__PURE__ */ React13.createElement("input", { type: "checkbox", id: "saveACH", className: "", maxLength: 100, placeholder: "My Bank", checked: saveACHinfo, onChange: (e) => setSaveACHinfo(e.target.checked) }), /* @__PURE__ */ React13.createElement("label", { htmlFor: "saveACH" }, "Save ACH")), saveACHinfo && /* @__PURE__ */ React13.createElement("div", { className: "form-group mb-4", style: { fontSize: "12px", color: "#727272" } }, /* @__PURE__ */ React13.createElement("p", null, "If checked, I agree for ", /* @__PURE__ */ React13.createElement("b", null, "ecommerce"), " to have my permission to charge this credit card for agreed upon purchases in the future."))), /* @__PURE__ */ React13.createElement("div", { className: "form-group " }, /* @__PURE__ */ React13.createElement("button", { className: "pay-button", style: { margin: "20px 0 0" }, type: "submit" }, "$", (_p = Number(props == null ? void 0 : props.amount)) == null ? void 0 : _p.toFixed(2))))))))))))
|
|
2988
|
+
)));
|
|
2989
|
+
}
|
|
2990
|
+
|
|
2991
|
+
// src/app/components/PreAuthCharge/PreAuthPaymentPage.tsx
|
|
2992
|
+
import React14, { useEffect as useEffect5, useState as useState4 } from "react";
|
|
2993
|
+
import axios4 from "axios";
|
|
2994
|
+
import Swal2 from "sweetalert2";
|
|
2995
|
+
import { IoArrowBack as IoArrowBack2 } from "react-icons/io5";
|
|
2996
|
+
function PreAuthPayment(props) {
|
|
2997
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
2998
|
+
const [loading, setLoading] = useState4(false);
|
|
2999
|
+
const [loading2, setLoading2] = useState4(false);
|
|
3000
|
+
const [error, setError] = useState4("");
|
|
3001
|
+
const [success, setSuccess] = useState4(false);
|
|
3002
|
+
const [show, setShow] = useState4(false);
|
|
3003
|
+
const [activetab, setActive] = useState4("card");
|
|
3004
|
+
const [saveCardInfo, setSaveCardInfo] = useState4(false);
|
|
3005
|
+
const fractalpayClientKey = props.fractalpayClientKey;
|
|
3006
|
+
const [cardData, setCardData] = useState4();
|
|
3007
|
+
const [cardError, setCardError] = useState4({});
|
|
3008
|
+
const [cardList, setCardList] = useState4([]);
|
|
3009
|
+
const [selectedCard, setSelectedCard] = useState4();
|
|
3010
|
+
const [paymentData, setPaymentData] = useState4();
|
|
3011
|
+
let [tranId, setTranId] = useState4("");
|
|
3012
|
+
const showLoader = () => setLoading(true);
|
|
3013
|
+
const hideLoader = () => setLoading(false);
|
|
3014
|
+
const handleClose = () => {
|
|
3015
|
+
setShow(false);
|
|
3016
|
+
setActive("card");
|
|
3017
|
+
setLoading2(false);
|
|
3018
|
+
setError("");
|
|
3019
|
+
setSuccess(false);
|
|
3020
|
+
setTranId("");
|
|
3021
|
+
setCardData({
|
|
3022
|
+
cardName: "",
|
|
3023
|
+
cardNumber: "",
|
|
3024
|
+
expiryMonth: "",
|
|
3025
|
+
expiryYear: "",
|
|
3026
|
+
cvv: "",
|
|
3027
|
+
orderId: "",
|
|
3028
|
+
zipCode: ""
|
|
3029
|
+
});
|
|
3030
|
+
setCardError({
|
|
3031
|
+
cardName: "",
|
|
3032
|
+
cardNumber: "",
|
|
3033
|
+
expiryMonth: "",
|
|
3034
|
+
expiryYear: "",
|
|
3035
|
+
cvv: "",
|
|
3036
|
+
orderId: "",
|
|
3037
|
+
zipCode: ""
|
|
3038
|
+
});
|
|
3039
|
+
setSaveCardInfo(false);
|
|
3040
|
+
setSelectedCard({
|
|
3041
|
+
card_type: "",
|
|
3042
|
+
cardlastfourdigit: "",
|
|
3043
|
+
expmonth: 1,
|
|
3044
|
+
expyear: 2025,
|
|
3045
|
+
primary_card: 0,
|
|
3046
|
+
firstname: "",
|
|
3047
|
+
id: "",
|
|
3048
|
+
lastname: ""
|
|
3049
|
+
});
|
|
3050
|
+
};
|
|
3051
|
+
const handleShow = () => setShow(true);
|
|
3052
|
+
const handleCardChange = (field, value) => {
|
|
3053
|
+
const name = field;
|
|
3054
|
+
const numericFields = ["expiryMonth", "expiryYear", "zipCode", "cvv"];
|
|
3055
|
+
if (numericFields.includes(name)) {
|
|
3056
|
+
if (value === "" || /^[0-9]+$/.test(value)) {
|
|
3057
|
+
setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
3058
|
+
[name]: ""
|
|
3059
|
+
}));
|
|
3060
|
+
setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
3061
|
+
[name]: value
|
|
3062
|
+
}));
|
|
3063
|
+
}
|
|
3064
|
+
return;
|
|
3065
|
+
}
|
|
3066
|
+
setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
3067
|
+
[name]: ""
|
|
3068
|
+
}));
|
|
3069
|
+
setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
3070
|
+
[name]: value
|
|
3071
|
+
}));
|
|
3072
|
+
};
|
|
3073
|
+
const handleCardNumberChange = (e) => {
|
|
3074
|
+
const input = e.target;
|
|
3075
|
+
const rawValue = input.value.replace(/\D/g, "");
|
|
3076
|
+
let formatted = "";
|
|
3077
|
+
if (/^3[47]/.test(rawValue)) {
|
|
3078
|
+
const trimmed = rawValue.slice(0, 15);
|
|
3079
|
+
formatted = trimmed.replace(
|
|
3080
|
+
/^(\d{1,4})(\d{1,6})?(\d{1,5})?$/,
|
|
3081
|
+
(_, g1, g2, g3) => [g1, g2, g3].filter(Boolean).join(" ")
|
|
3082
|
+
);
|
|
3083
|
+
} else {
|
|
3084
|
+
const trimmed = rawValue.slice(0, 16);
|
|
3085
|
+
formatted = trimmed.replace(
|
|
3086
|
+
/^(\d{1,4})(\d{1,4})?(\d{1,4})?(\d{1,4})?$/,
|
|
3087
|
+
(_, g1, g2, g3, g4) => [g1, g2, g3, g4].filter(Boolean).join(" ")
|
|
3088
|
+
);
|
|
3089
|
+
}
|
|
3090
|
+
setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
3091
|
+
cardNumber: ""
|
|
3092
|
+
}));
|
|
3093
|
+
setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
3094
|
+
cardNumber: formatted
|
|
3095
|
+
}));
|
|
3096
|
+
};
|
|
3097
|
+
const validateCardData = () => {
|
|
3098
|
+
var _a2, _b2, _c2, _d2, _e2, _f2;
|
|
3099
|
+
const errors = {};
|
|
3100
|
+
const data = cardData;
|
|
3101
|
+
const month = parseInt((data == null ? void 0 : data.expiryMonth) || "", 10);
|
|
3102
|
+
const year = (data == null ? void 0 : data.expiryYear) || "";
|
|
3103
|
+
if (!((_a2 = data == null ? void 0 : data.cardName) == null ? void 0 : _a2.trim())) errors.cardName = "Card name is required";
|
|
3104
|
+
if (!((_b2 = data == null ? void 0 : data.cardNumber) == null ? void 0 : _b2.trim())) errors.cardNumber = "Card number is required";
|
|
3105
|
+
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())) {
|
|
3106
|
+
errors.expiryMonth = "Invalid Expiration Date.";
|
|
3107
|
+
} else if (isNaN(month) || month < 1 || month > 12 || year.length !== 4) {
|
|
3108
|
+
errors.expiryMonth = "Invalid Expiration Date.";
|
|
3109
|
+
}
|
|
3110
|
+
if (!((_e2 = data == null ? void 0 : data.cvv) == null ? void 0 : _e2.trim())) errors.cvv = "CVV is required";
|
|
3111
|
+
if (!((_f2 = data == null ? void 0 : data.zipCode) == null ? void 0 : _f2.trim())) errors.zipCode = "ZIP code is required";
|
|
3112
|
+
if ((data == null ? void 0 : data.expiryMonth) && (data == null ? void 0 : data.expiryYear) && data.expiryMonth.length <= 2 && data.expiryYear.length === 4) {
|
|
3113
|
+
const month2 = parseInt(data.expiryMonth, 10);
|
|
3114
|
+
const year2 = parseInt(data.expiryYear, 10);
|
|
3115
|
+
const now = /* @__PURE__ */ new Date();
|
|
3116
|
+
const currentMonth = now.getMonth() + 1;
|
|
3117
|
+
const currentYear = now.getFullYear();
|
|
3118
|
+
if (year2 < currentYear || year2 === currentYear && month2 < currentMonth) {
|
|
3119
|
+
errors.expiryMonth = "Card is expired";
|
|
3120
|
+
}
|
|
3121
|
+
}
|
|
3122
|
+
setCardError(errors);
|
|
3123
|
+
return Object.keys(errors).length > 0;
|
|
3124
|
+
};
|
|
3125
|
+
const submitFunc = async (e) => {
|
|
3126
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
|
|
3127
|
+
e.preventDefault();
|
|
3128
|
+
if (activetab == "card") {
|
|
3129
|
+
const hasError = validateCardData();
|
|
3130
|
+
if (hasError) return;
|
|
3131
|
+
else {
|
|
3132
|
+
let validCard = DatacapWebToken.validateCardNumber(cardData == null ? void 0 : cardData.cardNumber.replaceAll(" ", ""));
|
|
3133
|
+
let validExpirationDate = DatacapWebToken.validateExpirationDate(cardData == null ? void 0 : cardData.expiryMonth, cardData == null ? void 0 : cardData.expiryYear);
|
|
3134
|
+
let validCVV = DatacapWebToken.validateCVV(cardData == null ? void 0 : cardData.cvv);
|
|
3135
|
+
let errors = {};
|
|
3136
|
+
if (!validCard) errors.cardNumber = "Invalid card Number";
|
|
3137
|
+
if (!validExpirationDate) errors.expiryMonth = "Invalid Expiration Date.";
|
|
3138
|
+
if (!validCVV) errors.cvv = "Invalid CVV";
|
|
3139
|
+
setCardError(errors);
|
|
3140
|
+
if (validCard && validCVV && validExpirationDate) {
|
|
3141
|
+
setLoading2(true);
|
|
3142
|
+
try {
|
|
3143
|
+
let tokenCallback = async function(response) {
|
|
3144
|
+
if (response.Error) {
|
|
3145
|
+
setError(response.Error);
|
|
3146
|
+
setLoading2(false);
|
|
3147
|
+
} else {
|
|
3148
|
+
let name = cardData == null ? void 0 : cardData.cardName;
|
|
3149
|
+
let postal_code = cardData == null ? void 0 : cardData.zipCode;
|
|
3150
|
+
response.name = name;
|
|
3151
|
+
response.postal_code = postal_code;
|
|
3152
|
+
response.fractalpayPublicKey = props == null ? void 0 : props.fractalpayClientKey;
|
|
3153
|
+
response.amount = props == null ? void 0 : props.amount;
|
|
3154
|
+
response.order_id = props == null ? void 0 : props.orderID;
|
|
3155
|
+
response.preAuth_id = "";
|
|
3156
|
+
response.isCardSave = saveCardInfo;
|
|
3157
|
+
response.customer_id = props == null ? void 0 : props.customerId;
|
|
3158
|
+
response.link_token = "";
|
|
3159
|
+
response.gateway_id = paymentData == null ? void 0 : paymentData.paymentGateway;
|
|
3160
|
+
response.discount = props == null ? void 0 : props.discount;
|
|
3161
|
+
response.tax = props == null ? void 0 : props.tax;
|
|
3162
|
+
response.surcharge = props == null ? void 0 : props.surcharge;
|
|
3163
|
+
const myHeaders = new Headers();
|
|
3164
|
+
myHeaders.append("Content-Type", "application/json");
|
|
3165
|
+
const requestOptions = {
|
|
3166
|
+
method: "POST",
|
|
3167
|
+
body: JSON.stringify(response),
|
|
3168
|
+
redirect: "follow"
|
|
3169
|
+
};
|
|
3170
|
+
socketClient_default.emit("sendMessage", __spreadProps(__spreadValues({}, requestOptions), { "isChargePreauth": true }));
|
|
3171
|
+
socketClient_default.on("charge-preauth", (data) => {
|
|
3172
|
+
var _a3;
|
|
3173
|
+
console.log(data, "datdata");
|
|
3174
|
+
if ((data == null ? void 0 : data.status) == "Failed") {
|
|
3175
|
+
setLoading2(false);
|
|
3176
|
+
setError((data == null ? void 0 : data.message) || "Something went wrong. Please try again later.");
|
|
3177
|
+
} else {
|
|
3178
|
+
setSuccess(true);
|
|
3179
|
+
setTranId((_a3 = data == null ? void 0 : data.data) == null ? void 0 : _a3.transaction_id);
|
|
3180
|
+
setLoading2(false);
|
|
3181
|
+
setCardData({
|
|
3182
|
+
cardName: "",
|
|
3183
|
+
cardNumber: "",
|
|
3184
|
+
expiryMonth: "",
|
|
3185
|
+
expiryYear: "",
|
|
3186
|
+
cvv: "",
|
|
3187
|
+
orderId: "",
|
|
3188
|
+
zipCode: ""
|
|
3189
|
+
});
|
|
3190
|
+
}
|
|
3191
|
+
});
|
|
3192
|
+
}
|
|
3193
|
+
};
|
|
3194
|
+
if ((paymentData == null ? void 0 : paymentData.paymentGateway) === 32) {
|
|
3195
|
+
const requestOptions = {
|
|
3196
|
+
method: "POST",
|
|
3197
|
+
redirect: "follow"
|
|
3198
|
+
};
|
|
3199
|
+
try {
|
|
3200
|
+
let sesionResult = await axios4.post(`${masterBaseUrl}api/v1/widget/generate-session`, requestOptions);
|
|
3201
|
+
let expYear = Number(cardData == null ? void 0 : cardData.expiryYear) % 100;
|
|
3202
|
+
let cardNumber = cardData == null ? void 0 : cardData.cardNumber;
|
|
3203
|
+
cardNumber = cardNumber == null ? void 0 : cardNumber.replace(/\s+/g, "");
|
|
3204
|
+
let track2_data = `${cardNumber}=${expYear}${cardData == null ? void 0 : cardData.expiryMonth} ${cardData == null ? void 0 : cardData.cvv}`;
|
|
3205
|
+
const publicKey = forge.pki.publicKeyFromPem((_b2 = (_a2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _a2.data) == null ? void 0 : _b2.publicKeyPem);
|
|
3206
|
+
const encrypted = publicKey.encrypt(track2_data, "RSA-OAEP", {
|
|
3207
|
+
md: forge.md.sha1.create(),
|
|
3208
|
+
mgf1: {
|
|
3209
|
+
md: forge.md.sha1.create()
|
|
3210
|
+
}
|
|
3211
|
+
});
|
|
3212
|
+
const encryptedBase64 = forge.util.encode64(encrypted);
|
|
3213
|
+
const myHeaders = {
|
|
3214
|
+
"Content-Type": "application/json",
|
|
3215
|
+
"x-app-session-key": (_d2 = (_c2 = sesionResult.data) == null ? void 0 : _c2.data) == null ? void 0 : _d2.session_key
|
|
3216
|
+
};
|
|
3217
|
+
const raw = JSON.stringify({
|
|
3218
|
+
"enc_track2_data": `${encryptedBase64}`,
|
|
3219
|
+
"algorithm": "RSAES_OAEP_SHA_1",
|
|
3220
|
+
session_key: `${(_f2 = (_e2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _e2.data) == null ? void 0 : _f2.session_key}`
|
|
3221
|
+
});
|
|
3222
|
+
try {
|
|
3223
|
+
const tokenizeData = await axios4.post(`${fractalGatewayUrl}tokenizer/tokenize`, raw, { headers: myHeaders });
|
|
3224
|
+
const reqData = JSON.stringify(__spreadProps(__spreadValues({}, (_g2 = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _g2.data), {
|
|
3225
|
+
// isSaveCardChecked: saveCardInfo,
|
|
3226
|
+
name: cardData == null ? void 0 : cardData.cardName,
|
|
3227
|
+
postal_code: cardData == null ? void 0 : cardData.zipCode,
|
|
3228
|
+
customer_id: props == null ? void 0 : props.customerId,
|
|
3229
|
+
"amount": props == null ? void 0 : props.amount,
|
|
3230
|
+
"Token": `${(_i2 = (_h2 = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _h2.data) == null ? void 0 : _i2.token}`,
|
|
3231
|
+
"fractalpayPublicKey": fractalpayClientKey,
|
|
3232
|
+
"order_id": props == null ? void 0 : props.orderID,
|
|
3233
|
+
"preAuth_id": "",
|
|
3234
|
+
"isCardSave": saveCardInfo,
|
|
3235
|
+
"discount": props == null ? void 0 : props.discount,
|
|
3236
|
+
"surcharge": props == null ? void 0 : props.surcharge,
|
|
3237
|
+
"tax": props == null ? void 0 : props.tax,
|
|
3238
|
+
"link_token": "",
|
|
3239
|
+
"ExpirationYear": cardData == null ? void 0 : cardData.expiryYear,
|
|
3240
|
+
"ExpirationMonth": cardData == null ? void 0 : cardData.expiryMonth,
|
|
3241
|
+
"CVV": cardData == null ? void 0 : cardData.cvv,
|
|
3242
|
+
"Last4": (_k = (_j = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _j.data) == null ? void 0 : _k.last4,
|
|
3243
|
+
"Brand": (_m = (_l = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _l.data) == null ? void 0 : _m.brand,
|
|
3244
|
+
"gateway_id": paymentData == null ? void 0 : paymentData.paymentGateway
|
|
3245
|
+
}));
|
|
3246
|
+
let myHeaders2 = {
|
|
3247
|
+
"Content-Type": "application/json"
|
|
3248
|
+
};
|
|
3249
|
+
const requestOptions2 = {
|
|
3250
|
+
method: "POST",
|
|
3251
|
+
headers: myHeaders2,
|
|
3252
|
+
body: reqData,
|
|
3253
|
+
redirect: "follow"
|
|
3254
|
+
};
|
|
3255
|
+
socketClient_default.emit("sendMessage", __spreadProps(__spreadValues({}, requestOptions2), { "isFractalPreauth": true }));
|
|
3256
|
+
socketClient_default.on("fractal-charge-preauth", (data) => {
|
|
3257
|
+
var _a3;
|
|
3258
|
+
if ((data == null ? void 0 : data.status) == "Failed") {
|
|
3259
|
+
setLoading2(false);
|
|
3260
|
+
setError((data == null ? void 0 : data.message) || "Something went wrong , Try again later");
|
|
3261
|
+
} else {
|
|
3262
|
+
setTranId((_a3 = data == null ? void 0 : data.data) == null ? void 0 : _a3.transaction_id);
|
|
3263
|
+
setSuccess(true);
|
|
3264
|
+
setLoading2(false);
|
|
3265
|
+
}
|
|
3266
|
+
});
|
|
3267
|
+
} catch (err) {
|
|
3268
|
+
console.log(err);
|
|
3269
|
+
setLoading2(false);
|
|
3270
|
+
setError(((_o = (_n = err == null ? void 0 : err.response) == null ? void 0 : _n.data) == null ? void 0 : _o.message) || (err == null ? void 0 : err.message) || "Something went wrong , Try again later");
|
|
3271
|
+
}
|
|
3272
|
+
} catch (err) {
|
|
3273
|
+
setLoading2(false);
|
|
3274
|
+
setError(((_q = (_p = err == null ? void 0 : err.response) == null ? void 0 : _p.data) == null ? void 0 : _q.message) || (err == null ? void 0 : err.message) || "Something went wrong , Try again later");
|
|
3275
|
+
}
|
|
3276
|
+
} else {
|
|
3277
|
+
DatacapWebToken.requestToken(paymentData == null ? void 0 : paymentData.dctoken, "PaymentForm", tokenCallback);
|
|
3278
|
+
}
|
|
3279
|
+
} catch (err) {
|
|
3280
|
+
setLoading2(false);
|
|
3281
|
+
setError(((_s = (_r = err == null ? void 0 : err.response) == null ? void 0 : _r.data) == null ? void 0 : _s.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
|
|
3282
|
+
}
|
|
3283
|
+
}
|
|
3284
|
+
}
|
|
3285
|
+
}
|
|
3286
|
+
};
|
|
3287
|
+
const getPaymentDetails = async () => {
|
|
3288
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j, _k, _l, _m, _n, _o, _p, _q, _r;
|
|
3289
|
+
showLoader();
|
|
3290
|
+
try {
|
|
3291
|
+
const data = {
|
|
3292
|
+
fractalpayPublicKey: fractalpayClientKey,
|
|
3293
|
+
"customer_id": props == null ? void 0 : props.customerId,
|
|
3294
|
+
preauth: true
|
|
3295
|
+
};
|
|
3296
|
+
let paymentData2 = await axios4.post(`${baseUrl}get-payment-details`, data);
|
|
3297
|
+
setPaymentData((_a2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _a2.data);
|
|
3298
|
+
if (!((_c2 = (_b2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _b2.data) == null ? void 0 : _c2.paymentGateway)) {
|
|
3299
|
+
handleClose();
|
|
3300
|
+
setError("Something went wrong.");
|
|
3301
|
+
}
|
|
3302
|
+
if (((_e2 = (_d2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _d2.data) == null ? void 0 : _e2.card_list) && ((_h2 = (_g2 = (_f2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _f2.data) == null ? void 0 : _g2.card_list) == null ? void 0 : _h2.length) > 0) {
|
|
3303
|
+
setCardList((_j = (_i2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _i2.data) == null ? void 0 : _j.card_list);
|
|
3304
|
+
setActive("cardList");
|
|
3305
|
+
let primary_card = (_m = (_l = (_k = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _k.data) == null ? void 0 : _l.card_list) == null ? void 0 : _m.filter((card) => (card == null ? void 0 : card.primary_card) == 1);
|
|
3306
|
+
if ((primary_card == null ? void 0 : primary_card[0]) && ((_n = primary_card == null ? void 0 : primary_card[0]) == null ? void 0 : _n.payment_method_type) == ((_p = (_o = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _o.data) == null ? void 0 : _p.paymentGateway)) {
|
|
3307
|
+
setSelectedCard(primary_card[0]);
|
|
3308
|
+
}
|
|
3309
|
+
} else {
|
|
3310
|
+
setActive("card");
|
|
3311
|
+
}
|
|
3312
|
+
hideLoader();
|
|
3313
|
+
} catch (err) {
|
|
3314
|
+
console.log(err);
|
|
3315
|
+
hideLoader();
|
|
3316
|
+
setError(((_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 went wrong");
|
|
3317
|
+
}
|
|
3318
|
+
};
|
|
3319
|
+
const handlechargeCustomer = async () => {
|
|
3320
|
+
var _b2, _c2, _d2, _e2, _f2, _g2, _h2;
|
|
3321
|
+
let customer_id = props == null ? void 0 : props.customerId;
|
|
3322
|
+
let discount = props == null ? void 0 : props.discount;
|
|
3323
|
+
let surcharge = props == null ? void 0 : props.surcharge;
|
|
3324
|
+
let tax = props == null ? void 0 : props.tax;
|
|
3325
|
+
let fractalpayPublicKey = props == null ? void 0 : props.fractalpayClientKey;
|
|
3326
|
+
let order_id = props == null ? void 0 : props.orderID;
|
|
3327
|
+
let amount = props == null ? void 0 : props.amount;
|
|
3328
|
+
let card_id = selectedCard == null ? void 0 : selectedCard.id;
|
|
3329
|
+
let card_type = selectedCard == null ? void 0 : selectedCard.card_type;
|
|
3330
|
+
if (fractalpayPublicKey && order_id && amount) {
|
|
3331
|
+
if (customer_id) {
|
|
3332
|
+
if (card_id) {
|
|
3333
|
+
let chargeobj = {
|
|
3334
|
+
amount,
|
|
3335
|
+
order_id,
|
|
3336
|
+
customer_id,
|
|
3337
|
+
card_id,
|
|
3338
|
+
fractalpayPublicKey,
|
|
3339
|
+
isCardSave: card_type != "Bank",
|
|
3340
|
+
discount,
|
|
3341
|
+
surcharge,
|
|
3342
|
+
tax
|
|
3343
|
+
};
|
|
3344
|
+
let _a2 = chargeobj, { isCardSave } = _a2, rest = __objRest(_a2, ["isCardSave"]);
|
|
3345
|
+
let endpoint = card_type === "Bank" ? "charge-ach" : "charge-by-card";
|
|
3346
|
+
let chargeurl = baseUrl + endpoint;
|
|
3347
|
+
const headers = {
|
|
3348
|
+
"Content-Type": "application/json"
|
|
3349
|
+
};
|
|
3350
|
+
setLoading2(true);
|
|
3351
|
+
try {
|
|
3352
|
+
let result = await axios4.post(chargeurl, card_type == "Bank" ? rest : chargeobj, { headers });
|
|
3353
|
+
if ((_b2 = result == null ? void 0 : result.data) == null ? void 0 : _b2.result) {
|
|
3354
|
+
setTranId((_d2 = (_c2 = result == null ? void 0 : result.data) == null ? void 0 : _c2.data) == null ? void 0 : _d2.transaction_id);
|
|
3355
|
+
setSuccess(true);
|
|
3356
|
+
setLoading2(false);
|
|
3357
|
+
}
|
|
3358
|
+
} catch (err) {
|
|
3359
|
+
setLoading2(false);
|
|
3360
|
+
console.log(err);
|
|
3361
|
+
setError(((_f2 = (_e2 = err == null ? void 0 : err.response) == null ? void 0 : _e2.data) == null ? void 0 : _f2.message) || ((_h2 = (_g2 = err == null ? void 0 : err.response) == null ? void 0 : _g2.data) == null ? void 0 : _h2.status) || "Something went erong");
|
|
3362
|
+
}
|
|
3363
|
+
} else {
|
|
3364
|
+
setError("Please Select A Card/ACH");
|
|
3365
|
+
}
|
|
3366
|
+
} else {
|
|
3367
|
+
setError("Please Select Customer");
|
|
3368
|
+
}
|
|
3369
|
+
} else {
|
|
3370
|
+
setError("Something went wrong.");
|
|
3371
|
+
}
|
|
3372
|
+
};
|
|
3373
|
+
useEffect5(() => {
|
|
3374
|
+
if (show && fractalpayClientKey) {
|
|
3375
|
+
getPaymentDetails();
|
|
3376
|
+
}
|
|
3377
|
+
}, [fractalpayClientKey, show]);
|
|
3378
|
+
const handleDeleteCard = async (cardId) => {
|
|
3379
|
+
Swal2.fire({
|
|
3380
|
+
icon: "warning",
|
|
3381
|
+
text: "Do you want to delete the card?",
|
|
3382
|
+
showCancelButton: true,
|
|
3383
|
+
confirmButtonText: "Yes",
|
|
3384
|
+
cancelButtonText: "No",
|
|
3385
|
+
reverseButtons: true,
|
|
3386
|
+
buttonsStyling: false,
|
|
3387
|
+
customClass: {
|
|
3388
|
+
confirmButton: "swal2-confirm btn btn-dark",
|
|
3389
|
+
cancelButton: "swal2-cancel btn btn-dark",
|
|
3390
|
+
popup: "custom-swal-popup",
|
|
3391
|
+
icon: "custom-swal-icon"
|
|
3392
|
+
}
|
|
3393
|
+
}).then(async (result) => {
|
|
3394
|
+
if (result.isConfirmed) {
|
|
3395
|
+
setLoading2(true);
|
|
3396
|
+
try {
|
|
3397
|
+
let obj = {
|
|
3398
|
+
card_id: cardId,
|
|
3399
|
+
customer_id: props == null ? void 0 : props.customerId,
|
|
3400
|
+
fractalpayPublicKey: props == null ? void 0 : props.fractalpayClientKey
|
|
3401
|
+
};
|
|
3402
|
+
const res = await axios4.post(`${baseUrl}delete-customer-card`, obj);
|
|
3403
|
+
setLoading2(false);
|
|
3404
|
+
getPaymentDetails();
|
|
3405
|
+
Swal2.fire({
|
|
3406
|
+
icon: "success",
|
|
3407
|
+
title: "Deleted!",
|
|
3408
|
+
text: "The card has been deleted.",
|
|
3409
|
+
confirmButtonText: "OK",
|
|
3410
|
+
customClass: {
|
|
3411
|
+
confirmButton: "btn btn-dark"
|
|
3412
|
+
}
|
|
3413
|
+
});
|
|
3414
|
+
} catch (err) {
|
|
3415
|
+
setLoading2(false);
|
|
3416
|
+
Swal2.fire({
|
|
3417
|
+
icon: "error",
|
|
3418
|
+
title: "Error!",
|
|
3419
|
+
text: "Failed to delete the card.",
|
|
3420
|
+
confirmButtonText: "OK",
|
|
3421
|
+
customClass: {
|
|
3422
|
+
confirmButton: "btn btn-dark"
|
|
3423
|
+
}
|
|
3424
|
+
});
|
|
3425
|
+
}
|
|
3426
|
+
}
|
|
3427
|
+
});
|
|
3428
|
+
};
|
|
3429
|
+
return /* @__PURE__ */ React14.createElement(React14.Fragment, null, /* @__PURE__ */ React14.createElement(DataScript, null), /* @__PURE__ */ React14.createElement(Chargewidgetstyles, null), /* @__PURE__ */ React14.createElement(React14.Fragment, null, /* @__PURE__ */ React14.createElement(
|
|
3430
|
+
"button",
|
|
3431
|
+
{
|
|
3432
|
+
className: "paymentBtn",
|
|
3433
|
+
onClick: handleShow
|
|
3434
|
+
},
|
|
3435
|
+
"Pre Auth Pay"
|
|
3436
|
+
), /* @__PURE__ */ React14.createElement(
|
|
3437
|
+
CustomModal2_default,
|
|
3438
|
+
{
|
|
3439
|
+
open: show,
|
|
3440
|
+
onClose: handleClose
|
|
3441
|
+
},
|
|
3442
|
+
error && /* @__PURE__ */ React14.createElement("div", { style: { maxHeight: "606px", minHeight: "60vh", padding: "40px" } }, /* @__PURE__ */ React14.createElement(ErrorCardMessage_default, { error, onClose: handleClose })),
|
|
3443
|
+
success && /* @__PURE__ */ React14.createElement(SuccessMsz, { onClose: handleClose, tranId }),
|
|
3444
|
+
!error && !success && /* @__PURE__ */ React14.createElement(React14.Fragment, null, (loading || loading2) && /* @__PURE__ */ React14.createElement(Loader_default, { loading: loading || loading2 }), /* @__PURE__ */ React14.createElement("div", null, /* @__PURE__ */ React14.createElement("div", { className: "frac-card-payment-page frac-form" }, /* @__PURE__ */ React14.createElement("div", { className: "parent-pay-container" }, /* @__PURE__ */ React14.createElement("span", { className: "request-payment-close-popup", onClick: handleClose }, /* @__PURE__ */ React14.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, /* @__PURE__ */ React14.createElement("g", { clipPath: "url(#clip0_12425_52336)" }, /* @__PURE__ */ React14.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__ */ React14.createElement("defs", null, /* @__PURE__ */ React14.createElement("clipPath", { id: "clip0_12425_52336" }, /* @__PURE__ */ React14.createElement("rect", { width: "16", height: "16", fill: "white" }))))), /* @__PURE__ */ React14.createElement("div", { className: "pay-container" }, /* @__PURE__ */ React14.createElement("div", { className: "pay-header pay-conatiner-one" }, /* @__PURE__ */ React14.createElement("div", { className: "pay-conatiner-one-first" }, /* @__PURE__ */ React14.createElement("div", { className: "pay-logo-container" }, /* @__PURE__ */ React14.createElement("div", { className: "pay-main-logo" }, /* @__PURE__ */ React14.createElement("img", { src: "https://fractal-userdata-upload.s3.us-east-1.amazonaws.com/uploaded/merchant_logo/20250311131124_merchant_logo.png", id: "pay-logos" })), /* @__PURE__ */ React14.createElement("h1", { className: "pay-heading" }, "Pay"), (cardList == null ? void 0 : cardList.length) > 0 && activetab !== "cardList" && /* @__PURE__ */ React14.createElement("button", { className: "res-charge-payment-back-btn ", onClick: () => setActive("cardList") }, " ", /* @__PURE__ */ React14.createElement(IoArrowBack2, null), " Back")), /* @__PURE__ */ React14.createElement("div", { className: "amt-pay-con" }, /* @__PURE__ */ React14.createElement("div", { className: "pay-amount-conatiner" }, /* @__PURE__ */ React14.createElement("small", { className: "pay-payment-amount" }, "Payment Amount"), /* @__PURE__ */ React14.createElement("strong", { className: "pay-amount" }, "$", (_a = Number(props == null ? void 0 : props.amount)) == null ? void 0 : _a.toFixed(2))), activetab != "ach" && /* @__PURE__ */ React14.createElement("div", { style: { display: "flex", gap: "8px", margin: "8px 0" } }, /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/visa-img.svg", alt: "", width: 33 }), /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/mc-img.svg", width: 33, alt: "" }), /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/ae-img.svg", alt: "", width: 33 }), /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/discover-img.svg", width: 33, alt: "" })))), /* @__PURE__ */ React14.createElement("div", { className: "pay-conatiner-one-last" }, /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/secure-img.png", alt: "" }), /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/pov-by.png", alt: "" }), "Secure payments powered by Fractal"), /* @__PURE__ */ React14.createElement("div", null)), !loading && /* @__PURE__ */ React14.createElement("div", { className: "pay-tab pay-conatiner-two" }, /* @__PURE__ */ React14.createElement("div", { className: "col-md-12" }, /* @__PURE__ */ React14.createElement("div", { id: "payment-form-div" }, activetab !== "cardList" ? /* @__PURE__ */ React14.createElement("div", null, (cardList == null ? void 0 : cardList.length) > 0 && /* @__PURE__ */ React14.createElement("button", { className: "charge-payment-back-btn ", onClick: () => setActive("cardList") }, " ", /* @__PURE__ */ React14.createElement(IoArrowBack2, null), " Back"), /* @__PURE__ */ React14.createElement("div", { className: "" }, /* @__PURE__ */ React14.createElement("div", { className: "res-pay-con" }, /* @__PURE__ */ React14.createElement("div", { className: "pay-amount-conatiner", style: { margin: 0 } }, /* @__PURE__ */ React14.createElement("small", { className: "pay-payment-amount" }, "Payment Amount"), /* @__PURE__ */ React14.createElement("strong", { className: "pay-amount" }, "$", (_b = Number(props == null ? void 0 : props.amount)) == null ? void 0 : _b.toFixed(2))), /* @__PURE__ */ React14.createElement("div", null, /* @__PURE__ */ React14.createElement("div", null, /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/visa-img.svg", alt: "", width: 35, style: { paddingRight: "5px" } }), /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/mc-img.svg", width: 35, alt: "" })), /* @__PURE__ */ React14.createElement("div", null, /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/ae-img.svg", alt: "", width: 35, style: { paddingRight: "5px" } }), /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/discover-img.svg", width: 35, alt: "" })))))) : /* @__PURE__ */ React14.createElement("div", null, /* @__PURE__ */ React14.createElement("h6", { className: "charge-customer-name", style: { marginBottom: "16px !important" } }, " Charge ", paymentData == null ? void 0 : paymentData.customer_name), /* @__PURE__ */ React14.createElement("div", { className: "res-pay-con" }, /* @__PURE__ */ React14.createElement("div", { className: "pay-amount-conatiner", style: { margin: 0 } }, /* @__PURE__ */ React14.createElement("small", { className: "pay-payment-amount" }, "Payment Amount"), /* @__PURE__ */ React14.createElement("strong", { className: "pay-amount" }, "$", (_c = Number(props == null ? void 0 : props.amount)) == null ? void 0 : _c.toFixed(2))), /* @__PURE__ */ React14.createElement("div", null, /* @__PURE__ */ React14.createElement("div", null, /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/visa-img.svg", alt: "", width: 35, style: { paddingRight: "5px" } }), /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/mc-img.svg", width: 35, alt: "" })), /* @__PURE__ */ React14.createElement("div", null, /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/ae-img.svg", alt: "", width: 35, style: { paddingRight: "5px" } }), /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/discover-img.svg", width: 35, alt: "" })))), /* @__PURE__ */ React14.createElement("h6", { className: "card-ach-heading", style: { marginBottom: "10px !important" } }, " Cards")), /* @__PURE__ */ React14.createElement("div", { style: { display: activetab === "cardList" ? "block" : "none" }, className: "tabcontent" }, /* @__PURE__ */ React14.createElement("div", { className: "card-lint-div-in" }, /* @__PURE__ */ React14.createElement("div", { className: "card-list-div" }, (paymentData == null ? void 0 : paymentData.card_list) && ((_d = paymentData == null ? void 0 : paymentData.card_list) == null ? void 0 : _d.length) > 0 && ((_e = paymentData == null ? void 0 : paymentData.card_list) == null ? void 0 : _e.map((card, index) => /* @__PURE__ */ React14.createElement("div", { className: "card-list-single-div", key: index }, /* @__PURE__ */ React14.createElement("div", { className: "card-number-radio" }, /* @__PURE__ */ React14.createElement(
|
|
3445
|
+
"input",
|
|
3446
|
+
{
|
|
3447
|
+
disabled: (paymentData == null ? void 0 : paymentData.paymentGateway) != (card == null ? void 0 : card.payment_method_type),
|
|
3448
|
+
type: "radio",
|
|
3449
|
+
className: "cardRadio",
|
|
3450
|
+
name: "selected_card",
|
|
3451
|
+
id: "",
|
|
3452
|
+
checked: selectedCard === card,
|
|
3453
|
+
onChange: (e) => setSelectedCard(card)
|
|
3454
|
+
}
|
|
3455
|
+
), /* @__PURE__ */ React14.createElement("label", { htmlFor: "", className: "card-number-last-four" }, "**** ", card == null ? void 0 : card.cardlastfourdigit), /* @__PURE__ */ React14.createElement("h6", { className: "card-expiry-date" }, card == null ? void 0 : card.expmonth, "/", card == null ? void 0 : card.expyear)), /* @__PURE__ */ React14.createElement("div", { className: "card-number-radio" }, /* @__PURE__ */ React14.createElement("span", { className: "visa-card" }, /* @__PURE__ */ React14.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__ */ React14.createElement("span", { className: "visa-card", style: { cursor: "pointer" }, onClick: () => handleDeleteCard(card == null ? void 0 : card.id) }, /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/Trash.svg", alt: "" }))))))), /* @__PURE__ */ React14.createElement("div", { className: "pay-with-other-card ", onClick: () => setActive("card") }, "Authorize With Other Card", /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/card.svg", alt: "" }))), /* @__PURE__ */ React14.createElement("div", { className: "form-group" }, /* @__PURE__ */ React14.createElement("button", { className: "pay-button", style: { margin: "0px" }, type: "submit", onClick: handlechargeCustomer }, "$", (_f = Number(props == null ? void 0 : props.amount)) == null ? void 0 : _f.toFixed(2)))), /* @__PURE__ */ React14.createElement("div", { id: "card", style: { display: activetab === "card" ? "block" : "none" }, className: "tabcontent" }, /* @__PURE__ */ React14.createElement("form", { id: "PaymentForm", onSubmit: submitFunc }, /* @__PURE__ */ React14.createElement("div", { className: "ach-scrl", style: { minHeight: (cardList == null ? void 0 : cardList.length) > 0 ? "462px" : "520px", overflow: "auto", marginRight: "5px" } }, /* @__PURE__ */ React14.createElement("div", { className: "form-group" }, /* @__PURE__ */ React14.createElement("label", { htmlFor: "cardHolderName" }, "Name on Card"), /* @__PURE__ */ React14.createElement(
|
|
3456
|
+
"input",
|
|
3457
|
+
{
|
|
3458
|
+
type: "text",
|
|
3459
|
+
className: "form-control",
|
|
3460
|
+
placeholder: "John Doe",
|
|
3461
|
+
value: (cardData == null ? void 0 : cardData.cardName) || "",
|
|
3462
|
+
onChange: (e) => {
|
|
3463
|
+
const value = e.target.value;
|
|
3464
|
+
if (/^[a-zA-Z\s]*$/.test(value)) {
|
|
3465
|
+
handleCardChange("cardName", value);
|
|
3466
|
+
}
|
|
3467
|
+
}
|
|
3468
|
+
}
|
|
3469
|
+
), (cardError == null ? void 0 : cardError.cardName) && /* @__PURE__ */ React14.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cardName)), /* @__PURE__ */ React14.createElement("div", { className: "form-group" }, /* @__PURE__ */ React14.createElement("label", { htmlFor: "cardNumber" }, "Card Number"), /* @__PURE__ */ React14.createElement("div", { className: "toggle-num-wrapper" }, /* @__PURE__ */ React14.createElement(
|
|
3470
|
+
"input",
|
|
3471
|
+
{
|
|
3472
|
+
className: "form-control card-number-new",
|
|
3473
|
+
type: "text",
|
|
3474
|
+
maxLength: 19,
|
|
3475
|
+
inputMode: "numeric",
|
|
3476
|
+
placeholder: "0000 0000 0000 0000",
|
|
3477
|
+
value: (cardData == null ? void 0 : cardData.cardNumber) || "",
|
|
3478
|
+
onChange: (e) => handleCardNumberChange(e),
|
|
3479
|
+
"data-token": "card_number"
|
|
3480
|
+
}
|
|
3481
|
+
), /* @__PURE__ */ React14.createElement("div", { className: "card-crdi card-expiry-new" }, /* @__PURE__ */ React14.createElement("div", { className: "exp-date-year-container" }, /* @__PURE__ */ React14.createElement("div", { className: "exp-date form-group" }, /* @__PURE__ */ React14.createElement(
|
|
3482
|
+
"input",
|
|
3483
|
+
{
|
|
3484
|
+
"data-token": "exp_month",
|
|
3485
|
+
className: "form-control required card-cvv-in",
|
|
3486
|
+
type: "text",
|
|
3487
|
+
style: { maxHeight: "36px" },
|
|
3488
|
+
placeholder: "MM",
|
|
3489
|
+
maxLength: 2,
|
|
3490
|
+
value: (cardData == null ? void 0 : cardData.expiryMonth) || "",
|
|
3491
|
+
onChange: (e) => handleCardChange("expiryMonth", e.target.value)
|
|
3492
|
+
}
|
|
3493
|
+
)), /* @__PURE__ */ React14.createElement("div", { className: "exp-year form-group" }, /* @__PURE__ */ React14.createElement(
|
|
3494
|
+
"input",
|
|
3495
|
+
{
|
|
3496
|
+
"data-token": "exp_year",
|
|
3497
|
+
className: "form-control required card-cvv-in",
|
|
3498
|
+
type: "text",
|
|
3499
|
+
style: { maxHeight: "36px" },
|
|
3500
|
+
placeholder: "YYYY",
|
|
3501
|
+
maxLength: 4,
|
|
3502
|
+
value: (cardData == null ? void 0 : cardData.expiryYear) || "",
|
|
3503
|
+
onChange: (e) => handleCardChange("expiryYear", e.target.value)
|
|
3504
|
+
}
|
|
3505
|
+
)), /* @__PURE__ */ React14.createElement("div", { className: "security-digit form-group" }, /* @__PURE__ */ React14.createElement(
|
|
3506
|
+
"input",
|
|
3507
|
+
{
|
|
3508
|
+
"data-token": "cvv",
|
|
3509
|
+
className: "form-control required card-cvv-in",
|
|
3510
|
+
type: "text",
|
|
3511
|
+
style: { maxHeight: "36px" },
|
|
3512
|
+
maxLength: 4,
|
|
3513
|
+
placeholder: "CVC",
|
|
3514
|
+
value: (cardData == null ? void 0 : cardData.cvv) || "",
|
|
3515
|
+
onChange: (e) => handleCardChange("cvv", e.target.value)
|
|
3516
|
+
}
|
|
3517
|
+
)))), (cardError == null ? void 0 : cardError.cardNumber) && /* @__PURE__ */ React14.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cardNumber), /* @__PURE__ */ React14.createElement("p", { style: { margin: "0" } }, (cardError == null ? void 0 : cardError.expiryMonth) || (cardError == null ? void 0 : cardError.expiryYear) ? /* @__PURE__ */ React14.createElement("span", { className: "error-span", style: { paddingRight: "4px" } }, cardError == null ? void 0 : cardError.expiryMonth) : "", (cardError == null ? void 0 : cardError.cvv) && /* @__PURE__ */ React14.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cvv)))), /* @__PURE__ */ React14.createElement("div", { className: "form-group" }, /* @__PURE__ */ React14.createElement("label", { htmlFor: "OrderId" }, "Order ID / Description"), /* @__PURE__ */ React14.createElement(
|
|
3518
|
+
"input",
|
|
3519
|
+
{
|
|
3520
|
+
type: "text",
|
|
3521
|
+
className: "form-control",
|
|
3522
|
+
maxLength: 100,
|
|
3523
|
+
placeholder: "OID123456",
|
|
3524
|
+
disabled: true,
|
|
3525
|
+
value: (_g = cardData == null ? void 0 : cardData.orderId) != null ? _g : "OID123456",
|
|
3526
|
+
onChange: (e) => handleCardChange("orderId", e.target.value),
|
|
3527
|
+
style: { background: "#F6F6F7", color: "#727272" }
|
|
3528
|
+
}
|
|
3529
|
+
)), /* @__PURE__ */ React14.createElement("div", { className: "form-group" }, /* @__PURE__ */ React14.createElement("label", { htmlFor: "zip" }, "ZIP"), /* @__PURE__ */ React14.createElement("input", { type: "text", className: "form-control", maxLength: 100, placeholder: "000000", value: (_h = cardData == null ? void 0 : cardData.zipCode) != null ? _h : "", onChange: (e) => handleCardChange("zipCode", e.target.value) }), (cardError == null ? void 0 : cardError.zipCode) && /* @__PURE__ */ React14.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.zipCode)), (props == null ? void 0 : props.customerId) && /* @__PURE__ */ React14.createElement("div", { className: "form-group" }, /* @__PURE__ */ React14.createElement("div", { style: { display: "flex", alignItems: "center", gap: "10px", paddingTop: "10px" } }, /* @__PURE__ */ React14.createElement(
|
|
3530
|
+
"input",
|
|
3531
|
+
{
|
|
3532
|
+
type: "checkbox",
|
|
3533
|
+
id: "save_card",
|
|
3534
|
+
className: "toggle-checkbox",
|
|
3535
|
+
checked: saveCardInfo,
|
|
3536
|
+
onChange: (e) => setSaveCardInfo(e.target.checked)
|
|
3537
|
+
}
|
|
3538
|
+
), /* @__PURE__ */ React14.createElement("label", { htmlFor: "save_card", className: "toggle-label" }), /* @__PURE__ */ React14.createElement("label", { htmlFor: "save_card" }, "Save card for future payments "), /* @__PURE__ */ React14.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none" }, /* @__PURE__ */ React14.createElement("g", { clipPath: "url(#clip0_12420_50192)" }, /* @__PURE__ */ React14.createElement("rect", { width: "20", height: "20", fill: "white" }), /* @__PURE__ */ React14.createElement("circle", { cx: "10", cy: "10", r: "10", fill: "#E0DFE2" }), /* @__PURE__ */ React14.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__ */ React14.createElement("defs", null, /* @__PURE__ */ React14.createElement("clipPath", { id: "clip0_12420_50192" }, /* @__PURE__ */ React14.createElement("rect", { width: "20", height: "20", fill: "white" }))))))), /* @__PURE__ */ React14.createElement("div", { className: "form-group", style: { marginTop: "20px", padding: 0 } }, /* @__PURE__ */ React14.createElement("button", { type: "submit", style: { margin: 0 }, className: "pay-button" }, "$", (_i = Number(props == null ? void 0 : props.amount)) == null ? void 0 : _i.toFixed(2)))))))))))))
|
|
3539
|
+
)));
|
|
3540
|
+
}
|
|
3541
|
+
|
|
3542
|
+
// src/app/components/AddCard/AddCard.tsx
|
|
3543
|
+
import React19, { useEffect as useEffect6, useState as useState5 } from "react";
|
|
3544
|
+
import Swal3 from "sweetalert2";
|
|
3545
|
+
import axios5 from "axios";
|
|
3546
|
+
|
|
3547
|
+
// src/app/components/AddCard/AddCardStyles.tsx
|
|
3548
|
+
import React15 from "react";
|
|
3549
|
+
function AddCardStyle() {
|
|
3550
|
+
const primarycolor = "#000";
|
|
3551
|
+
const primarybgcolor = "#fff";
|
|
3552
|
+
const primarybodycolor = "#212529";
|
|
3553
|
+
const primarybordercolor = "#dee2e6";
|
|
3554
|
+
return /* @__PURE__ */ React15.createElement("style", null, `
|
|
3555
|
+
.add-card {
|
|
3556
|
+
max-width:380px;
|
|
3557
|
+
padding: 0 20px
|
|
3558
|
+
}
|
|
3559
|
+
.add-card .form-group {
|
|
3560
|
+
margin-bottom: 5px;
|
|
3561
|
+
}
|
|
3562
|
+
|
|
3563
|
+
.add-card .idle-green-btn {
|
|
3564
|
+
color: white;
|
|
3565
|
+
background-color: rgba(97, 198, 153, 1);
|
|
3566
|
+
border-radius: 100px;
|
|
3567
|
+
border: none !important;
|
|
3568
|
+
padding: 12px 24px 12px 24px;
|
|
3569
|
+
width: 100%;
|
|
3570
|
+
cursor:pointer
|
|
3571
|
+
}
|
|
3572
|
+
|
|
3573
|
+
.add-card .idle-green-btn:hover {
|
|
3574
|
+
background-color: rgba(65, 164, 120, 1) !important;
|
|
3575
|
+
}
|
|
3576
|
+
|
|
3577
|
+
.add-card .idle-green-btn:focus {
|
|
3578
|
+
border: 2px solid rgba(90, 172, 136, 1) !important;
|
|
3579
|
+
background-color: rgba(97, 198, 153, 1) !important;
|
|
3580
|
+
padding: 10px 24px 10px 24px;
|
|
3581
|
+
}
|
|
3582
|
+
|
|
3583
|
+
.add-card .container-creditcard {
|
|
3584
|
+
width: 426px;
|
|
3585
|
+
padding: 24px;
|
|
3586
|
+
background-color: #FFFFFF;
|
|
3587
|
+
border-radius: 24px;
|
|
3588
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
3589
|
+
}
|
|
3590
|
+
.add-card .container-creditcard .request-payment-close-popup{
|
|
3591
|
+
position:absolute;
|
|
3592
|
+
// background:red
|
|
3593
|
+
}
|
|
3594
|
+
|
|
3595
|
+
.add-card h2 {
|
|
3596
|
+
font-size: 24px;
|
|
3597
|
+
line-height: 32px;
|
|
3598
|
+
font-weight: 500;
|
|
3599
|
+
color: #35254D;
|
|
3600
|
+
margin-bottom: 24px;
|
|
3601
|
+
text-align: center;
|
|
3602
|
+
}
|
|
3603
|
+
.add-card .form-group {
|
|
3604
|
+
margin-top: 20px;
|
|
3605
|
+
margin-bottom : 10px
|
|
3606
|
+
}
|
|
3607
|
+
|
|
3608
|
+
.add-card .credit-card {
|
|
3609
|
+
display: flex;
|
|
3610
|
+
flex-direction: column;
|
|
3611
|
+
justify-content: space-between;
|
|
3612
|
+
align-items: flex-start;
|
|
3613
|
+
padding: 20px;
|
|
3614
|
+
background-color: #35254D;
|
|
3615
|
+
color: #FFFFFF;
|
|
3616
|
+
border-radius: 15px;
|
|
3617
|
+
margin-bottom: 20px;
|
|
3618
|
+
}
|
|
3619
|
+
|
|
3620
|
+
.add-card .credit-card .chip {
|
|
3621
|
+
width: 50px;
|
|
3622
|
+
height: 30px;
|
|
3623
|
+
background-image: url('https://raw.githubusercontent.com/danieldasilvaa/creditcard-html-css/main/chip.png');
|
|
3624
|
+
background-size: cover;
|
|
3625
|
+
margin-bottom: 10px;
|
|
3626
|
+
}
|
|
3627
|
+
|
|
3628
|
+
.add-card .credit-card .card-number {
|
|
3629
|
+
font-size: 18px;
|
|
3630
|
+
letter-spacing: 2px;
|
|
3631
|
+
margin-bottom: 10px;
|
|
3632
|
+
}
|
|
3633
|
+
|
|
3634
|
+
.add-card .credit-card .card-info {
|
|
3635
|
+
font-size: 14px;
|
|
3636
|
+
margin-bottom: 5px;
|
|
3637
|
+
}
|
|
3638
|
+
|
|
3639
|
+
.add-card label {
|
|
3640
|
+
font-size: 12px;
|
|
3641
|
+
font-family: 'IBM Plex Mono', monospace;
|
|
3642
|
+
font-weight: 400;
|
|
3643
|
+
text-transform: uppercase;
|
|
3644
|
+
color: #35254D;
|
|
3645
|
+
margin-bottom: 6px;
|
|
3646
|
+
}
|
|
3647
|
+
|
|
3648
|
+
.add-card input[type="text"],
|
|
3649
|
+
.add-card input[type="number"],
|
|
3650
|
+
.add-card input[type="date"],
|
|
3651
|
+
.add-card input[type="email"],
|
|
3652
|
+
.add-card select {
|
|
3653
|
+
width: 100%;
|
|
3654
|
+
padding: 12px;
|
|
3655
|
+
font-size: 14px;
|
|
3656
|
+
font-weight: 500;
|
|
3657
|
+
color: #35254D;
|
|
3658
|
+
border: 1px solid #D4CDDF;
|
|
3659
|
+
border-radius: 6px;
|
|
3660
|
+
background-color: #FFFFFF;
|
|
3661
|
+
box-sizing: border-box;
|
|
3662
|
+
// margin-bottom: 20px;
|
|
3663
|
+
}
|
|
3664
|
+
|
|
3665
|
+
.add-card input[type="text"]::placeholder {
|
|
3666
|
+
color: #867C94;
|
|
3667
|
+
}
|
|
3668
|
+
|
|
3669
|
+
// .add-card input[type="submit"] {
|
|
3670
|
+
// width: 100%;
|
|
3671
|
+
// padding: 12px;
|
|
3672
|
+
// background-color: #161616;
|
|
3673
|
+
// color: #FFFFFF;
|
|
3674
|
+
// font-size: 14px;
|
|
3675
|
+
// font-weight: 500;
|
|
3676
|
+
// border: none;
|
|
3677
|
+
// border-radius: 1000px;
|
|
3678
|
+
// cursor: pointer;
|
|
3679
|
+
// text-align: center;
|
|
3680
|
+
// }
|
|
3681
|
+
|
|
3682
|
+
.add-card input[type="submit"]:hover {
|
|
3683
|
+
background-color: #000000;
|
|
3684
|
+
}
|
|
3685
|
+
|
|
3686
|
+
.add-card .error {
|
|
3687
|
+
font-size: 12px;
|
|
3688
|
+
color: red;
|
|
3689
|
+
margin-top: -15px;
|
|
3690
|
+
margin-bottom: 15px;
|
|
3691
|
+
}
|
|
3692
|
+
|
|
3693
|
+
/* Tab Styling */
|
|
3694
|
+
.add-card .tabs {
|
|
3695
|
+
display: flex;
|
|
3696
|
+
gap: 4px;
|
|
3697
|
+
margin-bottom: 24px;
|
|
3698
|
+
justify-content: center;
|
|
3699
|
+
}
|
|
3700
|
+
|
|
3701
|
+
.add-card .tab {
|
|
3702
|
+
display: flex;
|
|
3703
|
+
justify-content: center;
|
|
3704
|
+
align-items: center;
|
|
3705
|
+
padding: 6px 16px;
|
|
3706
|
+
font-size: 14px;
|
|
3707
|
+
font-weight: 500;
|
|
3708
|
+
border: 1px solid #D4CDDF;
|
|
3709
|
+
border-radius: 1000px;
|
|
3710
|
+
cursor: pointer;
|
|
3711
|
+
}
|
|
3712
|
+
|
|
3713
|
+
.add-card .tab.active {
|
|
3714
|
+
border-color: #35254D;
|
|
3715
|
+
color: #35254D;
|
|
3716
|
+
}
|
|
3717
|
+
|
|
3718
|
+
.add-card .tab:hover {
|
|
3719
|
+
border-color: #867C94;
|
|
3720
|
+
}
|
|
3721
|
+
|
|
3722
|
+
/* Buttons */
|
|
3723
|
+
.add-card .button-close {
|
|
3724
|
+
display: inline-block;
|
|
3725
|
+
background-color: #161616;
|
|
3726
|
+
color: #FFFFFF;
|
|
3727
|
+
font-size: 14px;
|
|
3728
|
+
font-weight: 500;
|
|
3729
|
+
padding: 12px 32px;
|
|
3730
|
+
border-radius: 1000px;
|
|
3731
|
+
text-align: center;
|
|
3732
|
+
cursor: pointer;
|
|
3733
|
+
width: 48%;
|
|
3734
|
+
box-sizing: border-box;
|
|
3735
|
+
}
|
|
3736
|
+
|
|
3737
|
+
.add-card .button-close:hover {
|
|
3738
|
+
background-color: #000000;
|
|
3739
|
+
}
|
|
3740
|
+
|
|
3741
|
+
.add-card .btn-add1 {
|
|
3742
|
+
display: inline-block;
|
|
3743
|
+
background-color: #61c699;
|
|
3744
|
+
color: #FFFFFF;
|
|
3745
|
+
font-size: 14px;
|
|
3746
|
+
font-weight: 500;
|
|
3747
|
+
padding: 12px 32px;
|
|
3748
|
+
border-radius: 1000px;
|
|
3749
|
+
text-align: center;
|
|
3750
|
+
cursor: pointer;
|
|
3751
|
+
width: 48%;
|
|
3752
|
+
box-sizing: border-box;
|
|
3753
|
+
}
|
|
3754
|
+
|
|
3755
|
+
.add-card .btn-add1:hover {
|
|
3756
|
+
background-color: #B5E1CB;
|
|
3757
|
+
}
|
|
3758
|
+
|
|
3759
|
+
/* Combined Expiration Date and CVC Row */
|
|
3760
|
+
.add-card .exp-cvc-container {
|
|
3761
|
+
display: flex;
|
|
3762
|
+
justify-content: space-between;
|
|
3763
|
+
gap: 16px;
|
|
3764
|
+
margin-bottom: 5px;
|
|
3765
|
+
}
|
|
3766
|
+
|
|
3767
|
+
.add-card .exp-cvc-container input {
|
|
3768
|
+
flex: 1;
|
|
3769
|
+
padding: 12px;
|
|
3770
|
+
font-size: 14px;
|
|
3771
|
+
font-weight: 500;
|
|
3772
|
+
color: #35254D;
|
|
3773
|
+
border: 1px solid #D4CDDF;
|
|
3774
|
+
border-radius: 6px;
|
|
3775
|
+
background-color: #FFFFFF;
|
|
3776
|
+
box-sizing: border-box;
|
|
3777
|
+
}
|
|
3778
|
+
|
|
3779
|
+
.add-card .exp-cvc-container input::placeholder {
|
|
3780
|
+
color: #867C94;
|
|
3781
|
+
}
|
|
3782
|
+
|
|
3783
|
+
.card-scrl {
|
|
3784
|
+
overflow-y: auto;
|
|
3785
|
+
padding-right: 6px !important;
|
|
3786
|
+
}
|
|
3787
|
+
.card-scrl::-webkit-scrollbar {
|
|
3788
|
+
width: 3px;
|
|
3789
|
+
background-color: #F5F5F5;
|
|
3790
|
+
}
|
|
3791
|
+
.card-scrl::-webkit-scrollbar-thumb {
|
|
3792
|
+
background-color: #35254D;
|
|
3793
|
+
}
|
|
3794
|
+
|
|
3795
|
+
.custom-z-index {
|
|
3796
|
+
z-index: 9999 !important;
|
|
3797
|
+
}
|
|
3798
|
+
#add-credit-card-panel{
|
|
3799
|
+
padding: auto 10px !important}
|
|
3800
|
+
/* Responsive Design */
|
|
3801
|
+
@media screen and (max-width: 768px) {
|
|
3802
|
+
.add-card .container-creditcard {
|
|
3803
|
+
width: 90%;
|
|
3804
|
+
padding: 20px;
|
|
3805
|
+
}
|
|
3806
|
+
|
|
3807
|
+
.add-card input[type="submit"] {
|
|
3808
|
+
font-size: 12px;
|
|
3809
|
+
padding: 10px;
|
|
3810
|
+
}
|
|
3811
|
+
}
|
|
3812
|
+
|
|
3813
|
+
`);
|
|
3814
|
+
}
|
|
3815
|
+
|
|
3816
|
+
// src/app/components/CustomModal/CustomModal.tsx
|
|
3817
|
+
import React16 from "react";
|
|
3818
|
+
var CustomModal = ({
|
|
3819
|
+
open,
|
|
3820
|
+
onClose,
|
|
3821
|
+
children
|
|
3822
|
+
}) => {
|
|
3823
|
+
if (!open) return null;
|
|
3824
|
+
return /* @__PURE__ */ React16.createElement("div", { style: {
|
|
3825
|
+
position: "fixed",
|
|
3826
|
+
top: 0,
|
|
3827
|
+
left: 0,
|
|
3828
|
+
width: "100%",
|
|
3829
|
+
height: "100%",
|
|
3830
|
+
zIndex: 5,
|
|
3831
|
+
backgroundColor: "rgba(0,0,0,0.5)",
|
|
3832
|
+
display: "flex",
|
|
3833
|
+
justifyContent: "center",
|
|
3834
|
+
alignItems: "center"
|
|
3835
|
+
} }, /* @__PURE__ */ React16.createElement("div", { style: { background: "white", padding: "20px", borderRadius: "8px", minWidth: "300px" } }, /* @__PURE__ */ React16.createElement("div", { className: "", style: { display: "flex", justifyContent: "end" } }, /* @__PURE__ */ React16.createElement("button", { onClick: onClose, style: { border: "none", background: "transparent", color: "black" } }, "X")), /* @__PURE__ */ React16.createElement("div", null, children)));
|
|
3836
|
+
};
|
|
3837
|
+
var CustomModal_default = CustomModal;
|
|
3838
|
+
|
|
3839
|
+
// src/app/components/SuccessCardMessage/SuccessCardMsz.tsx
|
|
3840
|
+
import React18 from "react";
|
|
3841
|
+
|
|
3842
|
+
// src/app/components/SuccessCardMessage/SuccessCardMszStyle.tsx
|
|
3843
|
+
import React17 from "react";
|
|
3844
|
+
function SuccessCardMszStyle() {
|
|
3845
|
+
return /* @__PURE__ */ React17.createElement("style", null, `
|
|
3846
|
+
.card-success .logo-container {
|
|
3847
|
+
display: flex;
|
|
3848
|
+
justify-content: center;
|
|
3849
|
+
align-items: center;
|
|
3850
|
+
margin-bottom: -50px; /* Adjust this to overlap the content */
|
|
3851
|
+
z-index: 10;
|
|
3852
|
+
}
|
|
3853
|
+
|
|
3854
|
+
.card-success .client-logo {
|
|
3855
|
+
max-width: 100px;
|
|
3856
|
+
height: auto;
|
|
3857
|
+
object-fit: contain;
|
|
3858
|
+
display: block;
|
|
3859
|
+
}
|
|
3860
|
+
|
|
3861
|
+
.card-success .payment-success-container {
|
|
3862
|
+
display: flex;
|
|
3863
|
+
flex-direction: column;
|
|
3864
|
+
align-items: center;
|
|
3865
|
+
padding: 18px 20px 24px;
|
|
3866
|
+
width: 335px;
|
|
3867
|
+
height: 400px; /* Fixed height */
|
|
3868
|
+
background: #FFFFFF;
|
|
3869
|
+
border-radius: 12px;
|
|
3870
|
+
position: relative;
|
|
3871
|
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
|
3872
|
+
border: 1px solid #e3e3e3;
|
|
3873
|
+
justify-content: center;
|
|
3874
|
+
text-align: center;
|
|
3875
|
+
// margin-top: 50px; /* Adjust this to move the content down */
|
|
3876
|
+
margin: 50px auto 0 auto !important;
|
|
3877
|
+
}
|
|
3878
|
+
|
|
3879
|
+
.card-success .success-icon {
|
|
3880
|
+
display: flex;
|
|
3881
|
+
flex-direction: column;
|
|
3882
|
+
align-items: center;
|
|
3883
|
+
gap: 12px;
|
|
3884
|
+
width: 227px;
|
|
3885
|
+
height: 116px;
|
|
3886
|
+
z-index: 2;
|
|
3887
|
+
}
|
|
3888
|
+
|
|
3889
|
+
.card-success .circle {
|
|
3890
|
+
width: 40px;
|
|
3891
|
+
height: 40px;
|
|
3892
|
+
border: 1px solid #49B182;
|
|
3893
|
+
border-radius: 50%;
|
|
3894
|
+
display: flex;
|
|
3895
|
+
justify-content: center;
|
|
3896
|
+
align-items: center;
|
|
3897
|
+
}
|
|
3898
|
+
|
|
3899
|
+
.card-success .circle .fa-check-circle {
|
|
3900
|
+
font-size: 20px;
|
|
3901
|
+
color: #49B182;
|
|
3902
|
+
}
|
|
3903
|
+
|
|
3904
|
+
.card-success .success-text {
|
|
3905
|
+
display: flex;
|
|
3906
|
+
flex-direction: column;
|
|
3907
|
+
justify-content: center;
|
|
3908
|
+
align-items: center;
|
|
3909
|
+
gap: 4px;
|
|
3910
|
+
width: 227px;
|
|
3911
|
+
}
|
|
3912
|
+
|
|
3913
|
+
.card-success .payment-success-text {
|
|
3914
|
+
font-family: 'Inter', sans-serif;
|
|
3915
|
+
font-weight: 500;
|
|
3916
|
+
font-size: 18px;
|
|
3917
|
+
line-height: 21px;
|
|
3918
|
+
text-align: center;
|
|
3919
|
+
letter-spacing: -0.02em;
|
|
3920
|
+
color: #161616;
|
|
3921
|
+
}
|
|
3922
|
+
|
|
3923
|
+
.card-success .thank-you-text {
|
|
3924
|
+
font-family: 'Inter', sans-serif;
|
|
3925
|
+
font-weight: 500;
|
|
3926
|
+
font-size: 14px;
|
|
3927
|
+
line-height: 18px;
|
|
3928
|
+
text-align: center;
|
|
3929
|
+
letter-spacing: -0.02em;
|
|
3930
|
+
color: #161616;
|
|
3931
|
+
opacity: 0.5;
|
|
3932
|
+
}
|
|
3933
|
+
`);
|
|
3934
|
+
}
|
|
3935
|
+
|
|
3936
|
+
// src/app/components/SuccessCardMessage/SuccessCardMsz.tsx
|
|
3937
|
+
var SuccessCardMsz = ({ onClose }) => {
|
|
3938
|
+
return /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(SuccessCardMszStyle, null), /* @__PURE__ */ React18.createElement("div", { className: "card-success" }, /* @__PURE__ */ React18.createElement("div", { className: "payment-success-container" }, /* @__PURE__ */ React18.createElement("div", { className: "success-icon" }, /* @__PURE__ */ React18.createElement("div", { className: "circle" }, /* @__PURE__ */ React18.createElement("i", { className: "fa fa-check-circle", "aria-hidden": "true" })), /* @__PURE__ */ React18.createElement("div", { className: "success-text" }, /* @__PURE__ */ React18.createElement("div", { className: "payment-success-text" }, "Your card was added successfully."), /* @__PURE__ */ React18.createElement("div", { className: "thank-you-text" }, "Thank you "))))));
|
|
3939
|
+
};
|
|
3940
|
+
var SuccessCardMsz_default = SuccessCardMsz;
|
|
3941
|
+
|
|
3942
|
+
// src/app/components/AddCard/AddCard.tsx
|
|
3943
|
+
function AddCard(props) {
|
|
3944
|
+
var _a;
|
|
3945
|
+
const [loading, setLoading] = useState5(false);
|
|
3946
|
+
const [success, setSuccess] = useState5(false);
|
|
3947
|
+
const [show, setShow] = useState5(false);
|
|
3948
|
+
const [cardData, setCardData] = useState5();
|
|
3949
|
+
const [cardError, setCardError] = useState5({});
|
|
3950
|
+
const [paymentData, setPaymentData] = useState5();
|
|
3951
|
+
const showLoader = () => setLoading(true);
|
|
3952
|
+
const hideLoader = () => setLoading(false);
|
|
3953
|
+
const showError = (msz) => {
|
|
3954
|
+
Swal3.fire({
|
|
3955
|
+
icon: "error",
|
|
3956
|
+
text: msz
|
|
3957
|
+
});
|
|
3958
|
+
};
|
|
3959
|
+
const handleClose = () => {
|
|
3960
|
+
setShow(false);
|
|
3961
|
+
setSuccess(false);
|
|
3962
|
+
setCardData({
|
|
3963
|
+
cardName: "",
|
|
3964
|
+
cardNumber: "",
|
|
3965
|
+
expiryMonth: "",
|
|
3966
|
+
expiryYear: "",
|
|
3967
|
+
cvv: "",
|
|
3968
|
+
orderId: "",
|
|
3969
|
+
zipCode: ""
|
|
3970
|
+
});
|
|
3971
|
+
setCardError({
|
|
3972
|
+
cardName: "",
|
|
3973
|
+
cardNumber: "",
|
|
3974
|
+
expiryMonth: "",
|
|
3975
|
+
expiryYear: "",
|
|
3976
|
+
cvv: "",
|
|
3977
|
+
orderId: "",
|
|
3978
|
+
zipCode: ""
|
|
3979
|
+
});
|
|
3980
|
+
};
|
|
3981
|
+
const handleShow = () => setShow(true);
|
|
3982
|
+
const handleCardChange = (field, value) => {
|
|
3983
|
+
const name = field;
|
|
3984
|
+
const numericFields = ["expiryMonth", "expiryYear", "zipCode", "cvv"];
|
|
3985
|
+
if (numericFields.includes(name)) {
|
|
3986
|
+
if (value === "" || /^[0-9]+$/.test(value)) {
|
|
3987
|
+
setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
3988
|
+
[name]: ""
|
|
3989
|
+
}));
|
|
3990
|
+
setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
3991
|
+
[name]: value
|
|
3992
|
+
}));
|
|
3993
|
+
}
|
|
3994
|
+
return;
|
|
3995
|
+
}
|
|
3996
|
+
setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
3997
|
+
[name]: ""
|
|
3998
|
+
}));
|
|
3999
|
+
setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
4000
|
+
[name]: value
|
|
4001
|
+
}));
|
|
4002
|
+
};
|
|
4003
|
+
const handleCardNumberChange = (e) => {
|
|
4004
|
+
const input = e.target;
|
|
4005
|
+
const rawValue = input.value.replace(/\D/g, "");
|
|
4006
|
+
let formatted = "";
|
|
4007
|
+
if (/^3[47]/.test(rawValue)) {
|
|
4008
|
+
const trimmed = rawValue.slice(0, 15);
|
|
4009
|
+
formatted = trimmed.replace(
|
|
4010
|
+
/^(\d{1,4})(\d{1,6})?(\d{1,5})?$/,
|
|
4011
|
+
(_, g1, g2, g3) => [g1, g2, g3].filter(Boolean).join(" ")
|
|
4012
|
+
);
|
|
4013
|
+
} else {
|
|
4014
|
+
const trimmed = rawValue.slice(0, 16);
|
|
4015
|
+
formatted = trimmed.replace(
|
|
4016
|
+
/^(\d{1,4})(\d{1,4})?(\d{1,4})?(\d{1,4})?$/,
|
|
4017
|
+
(_, g1, g2, g3, g4) => [g1, g2, g3, g4].filter(Boolean).join(" ")
|
|
4018
|
+
);
|
|
4019
|
+
}
|
|
4020
|
+
setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
4021
|
+
cardNumber: ""
|
|
4022
|
+
}));
|
|
4023
|
+
setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
4024
|
+
cardNumber: formatted
|
|
4025
|
+
}));
|
|
4026
|
+
};
|
|
4027
|
+
const validateCardData = () => {
|
|
4028
|
+
var _a2, _b, _c, _d, _e, _f;
|
|
4029
|
+
const errors = {};
|
|
4030
|
+
const data = cardData;
|
|
4031
|
+
const month = parseInt((data == null ? void 0 : data.expiryMonth) || "", 10);
|
|
4032
|
+
const year = (data == null ? void 0 : data.expiryYear) || "";
|
|
4033
|
+
if (!((_a2 = data == null ? void 0 : data.cardName) == null ? void 0 : _a2.trim())) errors.cardName = "Card name is required";
|
|
4034
|
+
if (!((_b = data == null ? void 0 : data.cardNumber) == null ? void 0 : _b.trim())) errors.cardNumber = "Card number is required";
|
|
4035
|
+
if (!((_c = data == null ? void 0 : data.expiryMonth) == null ? void 0 : _c.trim())) {
|
|
4036
|
+
errors.expiryMonth = "Expiration month is required";
|
|
4037
|
+
} else if (Number(data == null ? void 0 : data.expiryMonth) > 12 || Number(data == null ? void 0 : data.expiryMonth) < 1) {
|
|
4038
|
+
errors.expiryMonth = "Invalid Expiration Month.";
|
|
4039
|
+
}
|
|
4040
|
+
if (!((_d = data == null ? void 0 : data.expiryYear) == null ? void 0 : _d.trim())) {
|
|
4041
|
+
errors.expiryYear = "Expiration year is required";
|
|
4042
|
+
} else if (((_e = data == null ? void 0 : data.expiryYear) == null ? void 0 : _e.trim().length) !== 4 || Number(data == null ? void 0 : data.expiryYear) < 2025) {
|
|
4043
|
+
errors.expiryYear = "Invalid Expiration Year.";
|
|
4044
|
+
} else if (isNaN(month) || month < 1 || month > 12 || year.length !== 4) {
|
|
4045
|
+
errors.expiryMonth = "Invalid Expiration Date.";
|
|
4046
|
+
}
|
|
4047
|
+
if (!((_f = data == null ? void 0 : data.cvv) == null ? void 0 : _f.trim())) errors.cvv = "CVC is required";
|
|
4048
|
+
if ((data == null ? void 0 : data.expiryMonth) && (data == null ? void 0 : data.expiryYear) && data.expiryMonth.length <= 2 && data.expiryYear.length === 4) {
|
|
4049
|
+
const month2 = parseInt(data.expiryMonth, 10);
|
|
4050
|
+
const year2 = parseInt(data.expiryYear, 10);
|
|
4051
|
+
const now = /* @__PURE__ */ new Date();
|
|
4052
|
+
const currentMonth = now.getMonth() + 1;
|
|
4053
|
+
const currentYear = now.getFullYear();
|
|
4054
|
+
if (year2 < currentYear || year2 === currentYear && month2 < currentMonth) {
|
|
4055
|
+
errors.expiryMonth = "Card is expired";
|
|
4056
|
+
}
|
|
4057
|
+
}
|
|
4058
|
+
setCardError(errors);
|
|
4059
|
+
return Object.keys(errors).length > 0;
|
|
4060
|
+
};
|
|
4061
|
+
const getPaymentDetails = async () => {
|
|
4062
|
+
var _a2;
|
|
4063
|
+
showLoader();
|
|
4064
|
+
try {
|
|
4065
|
+
const data = {
|
|
4066
|
+
fractalpayPublicKey: props == null ? void 0 : props.fractalpayClientKey,
|
|
4067
|
+
"customer_id": props == null ? void 0 : props.customerId,
|
|
4068
|
+
addcard: true
|
|
4069
|
+
};
|
|
4070
|
+
let paymentData2 = await axios5.post(`${baseUrl}get-payment-details`, data);
|
|
4071
|
+
setPaymentData((_a2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _a2.data);
|
|
4072
|
+
hideLoader();
|
|
4073
|
+
} catch (err) {
|
|
4074
|
+
hideLoader();
|
|
4075
|
+
handleClose();
|
|
4076
|
+
showError("Something went wrong , Try again later");
|
|
4077
|
+
}
|
|
4078
|
+
};
|
|
4079
|
+
useEffect6(() => {
|
|
4080
|
+
if (show && props.fractalpayClientKey) {
|
|
4081
|
+
getPaymentDetails();
|
|
4082
|
+
}
|
|
4083
|
+
}, [props == null ? void 0 : props.fractalpayClientKey, show]);
|
|
4084
|
+
const addCardFunc = async (e) => {
|
|
4085
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
4086
|
+
console.log("called");
|
|
4087
|
+
e.preventDefault();
|
|
4088
|
+
const hasError = validateCardData();
|
|
4089
|
+
if (hasError) return;
|
|
4090
|
+
else {
|
|
4091
|
+
let validCard = DatacapWebToken.validateCardNumber(cardData == null ? void 0 : cardData.cardNumber.replaceAll(" ", ""));
|
|
4092
|
+
let validExpirationDate = DatacapWebToken.validateExpirationDate(cardData == null ? void 0 : cardData.expiryMonth, cardData == null ? void 0 : cardData.expiryYear);
|
|
4093
|
+
let validCVV = DatacapWebToken.validateCVV(cardData == null ? void 0 : cardData.cvv);
|
|
4094
|
+
let errors = {};
|
|
4095
|
+
if (!validCard) errors.cardNumber = "Invalid card Number";
|
|
4096
|
+
if (!validExpirationDate) errors.expiryMonth = "Invalid Expiration Date.";
|
|
4097
|
+
if (!validCVV) errors.cvv = "Invalid CVV";
|
|
4098
|
+
setCardError(errors);
|
|
4099
|
+
if (validCard && validCVV && validExpirationDate) {
|
|
4100
|
+
showLoader();
|
|
4101
|
+
try {
|
|
4102
|
+
let getTokenCallback = async function(token) {
|
|
4103
|
+
var _a3, _b2, _c2, _d2, _e2;
|
|
4104
|
+
if (token.Error) {
|
|
4105
|
+
showError(token.Error);
|
|
4106
|
+
hideLoader();
|
|
4107
|
+
} else {
|
|
4108
|
+
const reqData = {
|
|
4109
|
+
userId: props == null ? void 0 : props.customerId,
|
|
4110
|
+
cardName: cardData == null ? void 0 : cardData.cardName,
|
|
4111
|
+
zip: cardData == null ? void 0 : cardData.zipCode,
|
|
4112
|
+
fractalpayPublicKey: props == null ? void 0 : props.fractalpayClientKey,
|
|
4113
|
+
token
|
|
4114
|
+
};
|
|
4115
|
+
try {
|
|
4116
|
+
let apiResponse = await axios5.post(`${baseUrl}add-card`, reqData);
|
|
4117
|
+
let formData = {
|
|
4118
|
+
fractalpayPublicKey: props == null ? void 0 : props.fractalpayClientKey,
|
|
4119
|
+
wallet_id: "",
|
|
4120
|
+
card_number: cardData == null ? void 0 : cardData.cardNumber.replaceAll(" ", ""),
|
|
4121
|
+
exp_month: cardData == null ? void 0 : cardData.expiryMonth,
|
|
4122
|
+
exp_year: (_a3 = cardData == null ? void 0 : cardData.expiryYear) == null ? void 0 : _a3.slice(-2),
|
|
4123
|
+
cvv: cardData == null ? void 0 : cardData.cvv
|
|
4124
|
+
};
|
|
4125
|
+
try {
|
|
4126
|
+
const result = await axios5.post(`${baseUrl}link-wallet`, formData);
|
|
4127
|
+
setSuccess(true);
|
|
4128
|
+
hideLoader();
|
|
4129
|
+
setCardData({
|
|
4130
|
+
cardName: "",
|
|
4131
|
+
cardNumber: "",
|
|
4132
|
+
expiryMonth: "",
|
|
4133
|
+
expiryYear: "",
|
|
4134
|
+
cvv: "",
|
|
4135
|
+
orderId: "",
|
|
4136
|
+
zipCode: ""
|
|
4137
|
+
});
|
|
4138
|
+
} catch (err) {
|
|
4139
|
+
hideLoader();
|
|
4140
|
+
showError(((_c2 = (_b2 = err == null ? void 0 : err.response) == null ? void 0 : _b2.data) == null ? void 0 : _c2.message) || (err == null ? void 0 : err.message) || "Something went wrong..");
|
|
4141
|
+
}
|
|
4142
|
+
} catch (err) {
|
|
4143
|
+
hideLoader();
|
|
4144
|
+
showError(((_e2 = (_d2 = err == null ? void 0 : err.response) == null ? void 0 : _d2.data) == null ? void 0 : _e2.message) || (err == null ? void 0 : err.message) || "Something went wrong..");
|
|
4145
|
+
}
|
|
4146
|
+
}
|
|
4147
|
+
};
|
|
4148
|
+
if ((paymentData == null ? void 0 : paymentData.paymentGateway) === 32) {
|
|
4149
|
+
const requestOptions = {
|
|
4150
|
+
method: "POST",
|
|
4151
|
+
redirect: "follow"
|
|
4152
|
+
};
|
|
4153
|
+
try {
|
|
4154
|
+
let sesionResult = await axios5.post(`${masterBaseUrl}api/v1/widget/generate-session`, requestOptions);
|
|
4155
|
+
let expYear = Number(cardData == null ? void 0 : cardData.expiryYear) % 100;
|
|
4156
|
+
let cardNumber = cardData == null ? void 0 : cardData.cardNumber;
|
|
4157
|
+
cardNumber = cardNumber == null ? void 0 : cardNumber.replace(/\s+/g, "");
|
|
4158
|
+
let track2_data = `${cardNumber}=${expYear}${cardData == null ? void 0 : cardData.expiryMonth} ${cardData == null ? void 0 : cardData.cvv}`;
|
|
4159
|
+
const publicKey = forge.pki.publicKeyFromPem((_b = (_a2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _a2.data) == null ? void 0 : _b.publicKeyPem);
|
|
4160
|
+
const encrypted = publicKey.encrypt(track2_data, "RSA-OAEP", {
|
|
4161
|
+
md: forge.md.sha1.create(),
|
|
4162
|
+
mgf1: {
|
|
4163
|
+
md: forge.md.sha1.create()
|
|
4164
|
+
}
|
|
4165
|
+
});
|
|
4166
|
+
const encryptedBase64 = forge.util.encode64(encrypted);
|
|
4167
|
+
const myHeaders = {
|
|
4168
|
+
"Content-Type": "application/json",
|
|
4169
|
+
"x-app-session-key": (_d = (_c = sesionResult.data) == null ? void 0 : _c.data) == null ? void 0 : _d.session_key
|
|
4170
|
+
};
|
|
4171
|
+
const raw = JSON.stringify({
|
|
4172
|
+
"enc_track2_data": `${encryptedBase64}`,
|
|
4173
|
+
"algorithm": "RSAES_OAEP_SHA_1",
|
|
4174
|
+
session_key: `${(_f = (_e = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _e.data) == null ? void 0 : _f.session_key}`
|
|
4175
|
+
});
|
|
4176
|
+
try {
|
|
4177
|
+
const tokenizeData = await axios5.post(`${fractalGatewayUrl}tokenizer/tokenize`, raw, { headers: myHeaders });
|
|
4178
|
+
const reqData = JSON.stringify(__spreadProps(__spreadValues({}, (_g = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _g.data), {
|
|
4179
|
+
cvv: cardData == null ? void 0 : cardData.cvv,
|
|
4180
|
+
cardName: cardData == null ? void 0 : cardData.cardName,
|
|
4181
|
+
zip: cardData == null ? void 0 : cardData.zipCode,
|
|
4182
|
+
userId: props == null ? void 0 : props.customerId,
|
|
4183
|
+
fractalpayPublicKey: props == null ? void 0 : props.fractalpayClientKey
|
|
4184
|
+
}));
|
|
4185
|
+
let myHeaders2 = {
|
|
4186
|
+
"Content-Type": "application/json"
|
|
4187
|
+
};
|
|
4188
|
+
try {
|
|
4189
|
+
let addCardRes = await axios5.post(
|
|
4190
|
+
`${baseUrl}add-card`,
|
|
4191
|
+
reqData,
|
|
4192
|
+
{
|
|
4193
|
+
headers: myHeaders2
|
|
4194
|
+
}
|
|
4195
|
+
);
|
|
4196
|
+
if ((_h = addCardRes == null ? void 0 : addCardRes.data) == null ? void 0 : _h.result) {
|
|
4197
|
+
setSuccess(true);
|
|
4198
|
+
hideLoader();
|
|
4199
|
+
}
|
|
4200
|
+
} catch (err) {
|
|
4201
|
+
hideLoader();
|
|
4202
|
+
showError(((_j = (_i = err == null ? void 0 : err.response) == null ? void 0 : _i.data) == null ? void 0 : _j.message) || (err == null ? void 0 : err.message) || "Something went wrong , Try again later");
|
|
4203
|
+
}
|
|
4204
|
+
} catch (err) {
|
|
4205
|
+
hideLoader();
|
|
4206
|
+
showError(((_l = (_k = err == null ? void 0 : err.response) == null ? void 0 : _k.data) == null ? void 0 : _l.message) || (err == null ? void 0 : err.message) || "Something went wrong , Try again later");
|
|
4207
|
+
}
|
|
4208
|
+
} catch (err) {
|
|
4209
|
+
hideLoader();
|
|
4210
|
+
showError(((_n = (_m = err == null ? void 0 : err.response) == null ? void 0 : _m.data) == null ? void 0 : _n.message) || (err == null ? void 0 : err.message) || "Something went wrong , Try again later");
|
|
4211
|
+
}
|
|
4212
|
+
} else {
|
|
4213
|
+
if (typeof DatacapWebToken !== "undefined") {
|
|
4214
|
+
DatacapWebToken.requestToken(paymentData == null ? void 0 : paymentData.dctoken, "creditCardForm", getTokenCallback);
|
|
4215
|
+
}
|
|
4216
|
+
}
|
|
4217
|
+
} catch (err) {
|
|
4218
|
+
hideLoader();
|
|
4219
|
+
showError(((_p = (_o = err == null ? void 0 : err.response) == null ? void 0 : _o.data) == null ? void 0 : _p.message) || (err == null ? void 0 : err.message) || "Something went wrong , Try again later");
|
|
4220
|
+
}
|
|
4221
|
+
}
|
|
4222
|
+
}
|
|
4223
|
+
};
|
|
4224
|
+
return /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(DataScript, null), /* @__PURE__ */ React19.createElement(AddCardStyle, null), /* @__PURE__ */ React19.createElement(
|
|
4225
|
+
"button",
|
|
4226
|
+
{
|
|
4227
|
+
className: "paymentBtn",
|
|
4228
|
+
onClick: handleShow
|
|
4229
|
+
},
|
|
4230
|
+
"Add Card"
|
|
4231
|
+
), /* @__PURE__ */ React19.createElement(
|
|
4232
|
+
CustomModal_default,
|
|
4233
|
+
{
|
|
4234
|
+
open: show,
|
|
4235
|
+
onClose: handleClose
|
|
4236
|
+
},
|
|
4237
|
+
/* @__PURE__ */ React19.createElement(Loader_default, { loading }),
|
|
4238
|
+
success ? /* @__PURE__ */ React19.createElement(SuccessCardMsz_default, { onClose: handleClose }) : /* @__PURE__ */ React19.createElement(
|
|
4239
|
+
"div",
|
|
4240
|
+
{
|
|
4241
|
+
className: "container-creditcard add-card modal-content frac-form",
|
|
4242
|
+
id: "add-credit-card-panel"
|
|
4243
|
+
},
|
|
4244
|
+
/* @__PURE__ */ React19.createElement("form", { id: "creditCardForm", onSubmit: addCardFunc }, /* @__PURE__ */ React19.createElement("div", { className: "form-group", style: { marginTop: "0", marginBottom: "10px" } }, /* @__PURE__ */ React19.createElement("label", { htmlFor: "cardNumber" }, "Card Number"), /* @__PURE__ */ React19.createElement(
|
|
4245
|
+
"input",
|
|
4246
|
+
{
|
|
4247
|
+
type: "text",
|
|
4248
|
+
"data-token": "card_number",
|
|
4249
|
+
placeholder: "Enter card number",
|
|
4250
|
+
maxLength: 19,
|
|
4251
|
+
inputMode: "numeric",
|
|
4252
|
+
value: (cardData == null ? void 0 : cardData.cardNumber) || "",
|
|
4253
|
+
onChange: (e) => handleCardNumberChange(e)
|
|
4254
|
+
}
|
|
4255
|
+
), (cardError == null ? void 0 : cardError.cardNumber) && /* @__PURE__ */ React19.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cardNumber)), /* @__PURE__ */ React19.createElement("div", { className: "card-dtl" }, /* @__PURE__ */ React19.createElement("div", { className: "exp-cvc-container" }, /* @__PURE__ */ React19.createElement("div", { className: "form-group", style: { marginTop: "0", marginBottom: "10px" } }, /* @__PURE__ */ React19.createElement("label", { htmlFor: "expMonth" }, "MM"), /* @__PURE__ */ React19.createElement(
|
|
4256
|
+
"input",
|
|
4257
|
+
{
|
|
4258
|
+
"data-token": "exp_month",
|
|
4259
|
+
className: "form-control required",
|
|
4260
|
+
type: "text",
|
|
4261
|
+
placeholder: "MM",
|
|
4262
|
+
maxLength: 2,
|
|
4263
|
+
value: (cardData == null ? void 0 : cardData.expiryMonth) || "",
|
|
4264
|
+
onChange: (e) => handleCardChange("expiryMonth", e.target.value)
|
|
4265
|
+
}
|
|
4266
|
+
), (cardError == null ? void 0 : cardError.expiryMonth) && /* @__PURE__ */ React19.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.expiryMonth)), /* @__PURE__ */ React19.createElement("div", { className: "form-group", style: { marginTop: "0", marginBottom: "10px" } }, /* @__PURE__ */ React19.createElement("label", { htmlFor: "expYear" }, "YYYY"), /* @__PURE__ */ React19.createElement(
|
|
4267
|
+
"input",
|
|
4268
|
+
{
|
|
4269
|
+
"data-token": "exp_year",
|
|
4270
|
+
className: "form-control required",
|
|
4271
|
+
type: "text",
|
|
4272
|
+
placeholder: "YYYY",
|
|
4273
|
+
maxLength: 4,
|
|
4274
|
+
value: (cardData == null ? void 0 : cardData.expiryYear) || "",
|
|
4275
|
+
onChange: (e) => handleCardChange("expiryYear", e.target.value)
|
|
4276
|
+
}
|
|
4277
|
+
), (cardError == null ? void 0 : cardError.expiryYear) && /* @__PURE__ */ React19.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.expiryYear)), /* @__PURE__ */ React19.createElement("div", { className: "form-group", style: { marginTop: "0", marginBottom: "10px" } }, /* @__PURE__ */ React19.createElement("label", { htmlFor: "cvc" }, "CVC"), /* @__PURE__ */ React19.createElement(
|
|
4278
|
+
"input",
|
|
4279
|
+
{
|
|
4280
|
+
"data-token": "cvv",
|
|
4281
|
+
className: "form-control required",
|
|
4282
|
+
type: "text",
|
|
4283
|
+
placeholder: "CVC",
|
|
4284
|
+
maxLength: 4,
|
|
4285
|
+
value: (cardData == null ? void 0 : cardData.cvv) || "",
|
|
4286
|
+
onChange: (e) => handleCardChange("cvv", e.target.value)
|
|
4287
|
+
}
|
|
4288
|
+
), (cardError == null ? void 0 : cardError.cvv) && /* @__PURE__ */ React19.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cvv)))), /* @__PURE__ */ React19.createElement("div", { className: "form-group", style: { marginTop: "0", marginBottom: "10px" } }, /* @__PURE__ */ React19.createElement("label", { htmlFor: "cardholderName" }, "Name on card"), /* @__PURE__ */ React19.createElement(
|
|
4289
|
+
"input",
|
|
4290
|
+
{
|
|
4291
|
+
type: "text",
|
|
4292
|
+
id: "cardholderName",
|
|
4293
|
+
name: "cardholderName",
|
|
4294
|
+
placeholder: "Name on card required",
|
|
4295
|
+
value: (cardData == null ? void 0 : cardData.cardName) || "",
|
|
4296
|
+
onChange: (e) => {
|
|
4297
|
+
const value = e.target.value;
|
|
4298
|
+
if (/^[a-zA-Z\s]*$/.test(value)) {
|
|
4299
|
+
handleCardChange("cardName", value);
|
|
4300
|
+
}
|
|
4301
|
+
}
|
|
4302
|
+
}
|
|
4303
|
+
), (cardError == null ? void 0 : cardError.cardName) && /* @__PURE__ */ React19.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cardName)), /* @__PURE__ */ React19.createElement("div", { className: "form-group", style: { marginBottom: "20px" } }, /* @__PURE__ */ React19.createElement("label", { htmlFor: "zipcode" }, "Zip"), /* @__PURE__ */ React19.createElement(
|
|
4304
|
+
"input",
|
|
4305
|
+
{
|
|
4306
|
+
type: "text",
|
|
4307
|
+
id: "zipcode",
|
|
4308
|
+
name: "zipcode",
|
|
4309
|
+
placeholder: "Zip",
|
|
4310
|
+
value: (_a = cardData == null ? void 0 : cardData.zipCode) != null ? _a : "",
|
|
4311
|
+
onChange: (e) => handleCardChange("zipCode", e.target.value)
|
|
4312
|
+
}
|
|
4313
|
+
), (cardError == null ? void 0 : cardError.zipCode) && /* @__PURE__ */ React19.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.zipCode)), /* @__PURE__ */ React19.createElement(
|
|
4314
|
+
"input",
|
|
4315
|
+
{
|
|
4316
|
+
type: "submit",
|
|
4317
|
+
className: "idle-green-btn w-100",
|
|
4318
|
+
defaultValue: "Submit"
|
|
4319
|
+
}
|
|
4320
|
+
))
|
|
4321
|
+
)
|
|
4322
|
+
));
|
|
4323
|
+
}
|
|
4324
|
+
|
|
4325
|
+
// src/app/components/AddCard/AddCardEasyPay.tsx
|
|
4326
|
+
import React20, { useEffect as useEffect7, useState as useState6 } from "react";
|
|
4327
|
+
import Swal4 from "sweetalert2";
|
|
4328
|
+
import axios6 from "axios";
|
|
4329
|
+
function AddCardEasyPay(props) {
|
|
4330
|
+
var _a;
|
|
4331
|
+
const [loading, setLoading] = useState6(false);
|
|
4332
|
+
const [success, setSuccess] = useState6(false);
|
|
4333
|
+
const [error, setError] = useState6("");
|
|
4334
|
+
const [show, setShow] = useState6(false);
|
|
4335
|
+
const [cardData, setCardData] = useState6();
|
|
4336
|
+
const [cardError, setCardError] = useState6({});
|
|
4337
|
+
const [paymentData, setPaymentData] = useState6();
|
|
4338
|
+
const showLoader = () => setLoading(true);
|
|
4339
|
+
const hideLoader = () => setLoading(false);
|
|
4340
|
+
const showError = (msz) => {
|
|
4341
|
+
Swal4.fire({
|
|
4342
|
+
icon: "error",
|
|
4343
|
+
text: msz,
|
|
4344
|
+
customClass: {
|
|
4345
|
+
popup: "custom-z-index"
|
|
4346
|
+
}
|
|
4347
|
+
});
|
|
4348
|
+
};
|
|
4349
|
+
const handleClose = () => {
|
|
4350
|
+
setShow(false);
|
|
4351
|
+
setSuccess(false);
|
|
4352
|
+
setError("");
|
|
4353
|
+
setCardData({
|
|
4354
|
+
cardName: "",
|
|
4355
|
+
cardNumber: "",
|
|
4356
|
+
expiryMonth: "",
|
|
4357
|
+
expiryYear: "",
|
|
4358
|
+
cvv: "",
|
|
4359
|
+
orderId: "",
|
|
4360
|
+
zipCode: ""
|
|
4361
|
+
});
|
|
4362
|
+
};
|
|
4363
|
+
const handleShow = () => setShow(true);
|
|
4364
|
+
const handleCloseSeccess = () => {
|
|
4365
|
+
handleClose();
|
|
4366
|
+
};
|
|
4367
|
+
const handleCardChange = (field, value) => {
|
|
4368
|
+
const name = field;
|
|
4369
|
+
const numericFields = ["expiryMonth", "expiryYear", "zipCode", "cvv"];
|
|
4370
|
+
if (numericFields.includes(name)) {
|
|
4371
|
+
if (value === "" || /^[0-9]+$/.test(value)) {
|
|
4372
|
+
setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
4373
|
+
[name]: ""
|
|
4374
|
+
}));
|
|
4375
|
+
setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
4376
|
+
[name]: value
|
|
4377
|
+
}));
|
|
4378
|
+
}
|
|
4379
|
+
return;
|
|
4380
|
+
}
|
|
4381
|
+
setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
4382
|
+
[name]: ""
|
|
4383
|
+
}));
|
|
4384
|
+
console.log(value, name);
|
|
4385
|
+
setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
4386
|
+
[name]: value
|
|
4387
|
+
}));
|
|
4388
|
+
};
|
|
4389
|
+
const handleCardNumberChange = (e) => {
|
|
4390
|
+
const input = e.target;
|
|
4391
|
+
const rawValue = input.value.replace(/\D/g, "");
|
|
4392
|
+
let formatted = "";
|
|
4393
|
+
if (/^3[47]/.test(rawValue)) {
|
|
4394
|
+
const trimmed = rawValue.slice(0, 15);
|
|
4395
|
+
formatted = trimmed.replace(
|
|
4396
|
+
/^(\d{1,4})(\d{1,6})?(\d{1,5})?$/,
|
|
4397
|
+
(_, g1, g2, g3) => [g1, g2, g3].filter(Boolean).join(" ")
|
|
4398
|
+
);
|
|
4399
|
+
} else {
|
|
4400
|
+
const trimmed = rawValue.slice(0, 16);
|
|
4401
|
+
formatted = trimmed.replace(
|
|
4402
|
+
/^(\d{1,4})(\d{1,4})?(\d{1,4})?(\d{1,4})?$/,
|
|
4403
|
+
(_, g1, g2, g3, g4) => [g1, g2, g3, g4].filter(Boolean).join(" ")
|
|
4404
|
+
);
|
|
4405
|
+
}
|
|
4406
|
+
setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
4407
|
+
cardNumber: ""
|
|
4408
|
+
}));
|
|
4409
|
+
setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
4410
|
+
cardNumber: formatted
|
|
4411
|
+
}));
|
|
4412
|
+
};
|
|
4413
|
+
const validateCardData = () => {
|
|
4414
|
+
var _a2, _b, _c, _d, _e, _f;
|
|
4415
|
+
const errors = {};
|
|
4416
|
+
const data = cardData;
|
|
4417
|
+
const month = parseInt((data == null ? void 0 : data.expiryMonth) || "", 10);
|
|
4418
|
+
const year = (data == null ? void 0 : data.expiryYear) || "";
|
|
4419
|
+
if (!((_a2 = data == null ? void 0 : data.cardName) == null ? void 0 : _a2.trim())) errors.cardName = "Card name is required";
|
|
4420
|
+
if (!((_b = data == null ? void 0 : data.cardNumber) == null ? void 0 : _b.trim())) errors.cardNumber = "Card number is required";
|
|
4421
|
+
if (!((_c = data == null ? void 0 : data.expiryMonth) == null ? void 0 : _c.trim())) {
|
|
4422
|
+
errors.expiryMonth = "Expiration month is required";
|
|
4423
|
+
} else if (Number(data == null ? void 0 : data.expiryMonth) > 12 || Number(data == null ? void 0 : data.expiryMonth) < 1) {
|
|
4424
|
+
errors.expiryMonth = "Invalid Expiration Month.";
|
|
4425
|
+
}
|
|
4426
|
+
if (!((_d = data == null ? void 0 : data.expiryYear) == null ? void 0 : _d.trim())) {
|
|
4427
|
+
errors.expiryYear = "Expiration year is required";
|
|
4428
|
+
} else if (((_e = data == null ? void 0 : data.expiryYear) == null ? void 0 : _e.trim().length) !== 4 || Number(data == null ? void 0 : data.expiryYear) < 2025) {
|
|
4429
|
+
errors.expiryYear = "Invalid Expiration Year.";
|
|
4430
|
+
} else if (isNaN(month) || month < 1 || month > 12 || year.length !== 4) {
|
|
4431
|
+
errors.expiryMonth = "Invalid Expiration Date.";
|
|
4432
|
+
}
|
|
4433
|
+
if (!((_f = data == null ? void 0 : data.cvv) == null ? void 0 : _f.trim())) errors.cvv = "CVC is required";
|
|
4434
|
+
if ((data == null ? void 0 : data.expiryMonth) && (data == null ? void 0 : data.expiryYear) && data.expiryMonth.length <= 2 && data.expiryYear.length === 4) {
|
|
4435
|
+
const month2 = parseInt(data.expiryMonth, 10);
|
|
4436
|
+
const year2 = parseInt(data.expiryYear, 10);
|
|
4437
|
+
const now = /* @__PURE__ */ new Date();
|
|
4438
|
+
const currentMonth = now.getMonth() + 1;
|
|
4439
|
+
const currentYear = now.getFullYear();
|
|
4440
|
+
if (year2 < currentYear || year2 === currentYear && month2 < currentMonth) {
|
|
4441
|
+
errors.expiryMonth = "Card is expired";
|
|
4442
|
+
}
|
|
4443
|
+
}
|
|
4444
|
+
setCardError(errors);
|
|
4445
|
+
return Object.keys(errors).length > 0;
|
|
4446
|
+
};
|
|
4447
|
+
const getPaymentDetails = async () => {
|
|
4448
|
+
var _a2, _b, _c;
|
|
4449
|
+
showLoader();
|
|
4450
|
+
try {
|
|
4451
|
+
const data = {
|
|
4452
|
+
fractalpayPublicKey: props == null ? void 0 : props.fractalpayClientKey,
|
|
4453
|
+
"customer_id": props == null ? void 0 : props.customerId,
|
|
4454
|
+
addcard: true
|
|
4455
|
+
};
|
|
4456
|
+
let paymentData2 = await axios6.post(`${baseUrl}get-payment-details`, data);
|
|
4457
|
+
console.log(paymentData2);
|
|
4458
|
+
setPaymentData((_a2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _a2.data);
|
|
4459
|
+
if (!((_c = (_b = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _b.data) == null ? void 0 : _c.paymentGateway)) {
|
|
4460
|
+
handleClose();
|
|
4461
|
+
setError("Something went wrong.");
|
|
4462
|
+
}
|
|
4463
|
+
hideLoader();
|
|
4464
|
+
} catch (err) {
|
|
4465
|
+
console.log(err);
|
|
4466
|
+
hideLoader();
|
|
4467
|
+
handleClose();
|
|
4468
|
+
setError("Something went wrong.");
|
|
4469
|
+
}
|
|
4470
|
+
};
|
|
4471
|
+
useEffect7(() => {
|
|
4472
|
+
if (props.fractalpayClientKey) {
|
|
4473
|
+
getPaymentDetails();
|
|
4474
|
+
}
|
|
4475
|
+
}, [props == null ? void 0 : props.fractalpayClientKey]);
|
|
4476
|
+
const addCardFunc = async (e) => {
|
|
4477
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
4478
|
+
e.preventDefault();
|
|
4479
|
+
const hasError = validateCardData();
|
|
4480
|
+
console.log(cardData);
|
|
4481
|
+
if (hasError) return;
|
|
4482
|
+
else {
|
|
4483
|
+
let validCard = DatacapWebToken.validateCardNumber(cardData == null ? void 0 : cardData.cardNumber.replaceAll(" ", ""));
|
|
4484
|
+
let validExpirationDate = DatacapWebToken.validateExpirationDate(cardData == null ? void 0 : cardData.expiryMonth, cardData == null ? void 0 : cardData.expiryYear);
|
|
4485
|
+
let validCVV = DatacapWebToken.validateCVV(cardData == null ? void 0 : cardData.cvv);
|
|
4486
|
+
let errors = {};
|
|
4487
|
+
if (!validCard) errors.cardNumber = "Invalid card Number";
|
|
4488
|
+
if (!validExpirationDate) errors.expiryMonth = "Invalid Expiration Date.";
|
|
4489
|
+
if (!validCVV) errors.cvv = "Invalid CVV";
|
|
4490
|
+
setCardError(errors);
|
|
4491
|
+
if (validCard && validCVV && validExpirationDate) {
|
|
4492
|
+
showLoader();
|
|
4493
|
+
try {
|
|
4494
|
+
let getTokenCallback = async function(token) {
|
|
4495
|
+
var _a3, _b2, _c2, _d2, _e2;
|
|
4496
|
+
console.log(token);
|
|
4497
|
+
if (token.Error) {
|
|
4498
|
+
console.log(token == null ? void 0 : token.Error);
|
|
4499
|
+
setError(token.Error);
|
|
4500
|
+
hideLoader();
|
|
4501
|
+
} else {
|
|
4502
|
+
const reqData = {
|
|
4503
|
+
userId: props == null ? void 0 : props.customerId,
|
|
4504
|
+
cardName: cardData == null ? void 0 : cardData.cardName,
|
|
4505
|
+
zip: cardData == null ? void 0 : cardData.zipCode,
|
|
4506
|
+
fractalpayPublicKey: props == null ? void 0 : props.fractalpayClientKey,
|
|
4507
|
+
token
|
|
4508
|
+
};
|
|
4509
|
+
try {
|
|
4510
|
+
let apiResponse = await axios6.post(`${baseUrl}add-card`, reqData);
|
|
4511
|
+
console.log(apiResponse);
|
|
4512
|
+
let formData = {
|
|
4513
|
+
fractalpayPublicKey: props == null ? void 0 : props.fractalpayClientKey,
|
|
4514
|
+
wallet_id: "",
|
|
4515
|
+
card_number: cardData == null ? void 0 : cardData.cardNumber.replaceAll(" ", ""),
|
|
4516
|
+
exp_month: cardData == null ? void 0 : cardData.expiryMonth,
|
|
4517
|
+
exp_year: (_a3 = cardData == null ? void 0 : cardData.expiryYear) == null ? void 0 : _a3.slice(-2),
|
|
4518
|
+
cvv: cardData == null ? void 0 : cardData.cvv
|
|
4519
|
+
};
|
|
4520
|
+
try {
|
|
4521
|
+
const result = await axios6.post(`${baseUrl}link-wallet`, formData);
|
|
4522
|
+
console.log(result);
|
|
4523
|
+
setSuccess(true);
|
|
4524
|
+
hideLoader();
|
|
4525
|
+
setCardData({
|
|
4526
|
+
cardName: "",
|
|
4527
|
+
cardNumber: "",
|
|
4528
|
+
expiryMonth: "",
|
|
4529
|
+
expiryYear: "",
|
|
4530
|
+
cvv: "",
|
|
4531
|
+
orderId: "",
|
|
4532
|
+
zipCode: ""
|
|
4533
|
+
});
|
|
4534
|
+
HandleSubmit(e, "close", "");
|
|
4535
|
+
} catch (err) {
|
|
4536
|
+
console.log(err);
|
|
4537
|
+
hideLoader();
|
|
4538
|
+
setError(((_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.");
|
|
4539
|
+
}
|
|
4540
|
+
} catch (err) {
|
|
4541
|
+
console.log(err);
|
|
4542
|
+
hideLoader();
|
|
4543
|
+
setError(((_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.");
|
|
4544
|
+
}
|
|
4545
|
+
}
|
|
4546
|
+
};
|
|
4547
|
+
if ((paymentData == null ? void 0 : paymentData.paymentGateway) === 32) {
|
|
4548
|
+
const requestOptions = {
|
|
4549
|
+
method: "POST",
|
|
4550
|
+
redirect: "follow"
|
|
4551
|
+
};
|
|
4552
|
+
try {
|
|
4553
|
+
let sesionResult = await axios6.post(`${masterBaseUrl}api/v1/widget/generate-session`, requestOptions);
|
|
4554
|
+
let expYear = Number(cardData == null ? void 0 : cardData.expiryYear) % 100;
|
|
4555
|
+
let cardNumber = cardData == null ? void 0 : cardData.cardNumber;
|
|
4556
|
+
cardNumber = cardNumber == null ? void 0 : cardNumber.replace(/\s+/g, "");
|
|
4557
|
+
let track2_data = `${cardNumber}=${expYear}${cardData == null ? void 0 : cardData.expiryMonth} ${cardData == null ? void 0 : cardData.cvv}`;
|
|
4558
|
+
const publicKey = forge.pki.publicKeyFromPem((_b = (_a2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _a2.data) == null ? void 0 : _b.publicKeyPem);
|
|
4559
|
+
const encrypted = publicKey.encrypt(track2_data, "RSA-OAEP", {
|
|
4560
|
+
md: forge.md.sha1.create(),
|
|
4561
|
+
mgf1: {
|
|
4562
|
+
md: forge.md.sha1.create()
|
|
4563
|
+
}
|
|
4564
|
+
});
|
|
4565
|
+
const encryptedBase64 = forge.util.encode64(encrypted);
|
|
4566
|
+
const myHeaders = {
|
|
4567
|
+
"Content-Type": "application/json",
|
|
4568
|
+
"x-app-session-key": (_d = (_c = sesionResult.data) == null ? void 0 : _c.data) == null ? void 0 : _d.session_key
|
|
4569
|
+
};
|
|
4570
|
+
const raw = JSON.stringify({
|
|
4571
|
+
"enc_track2_data": `${encryptedBase64}`,
|
|
4572
|
+
"algorithm": "RSAES_OAEP_SHA_1",
|
|
4573
|
+
session_key: `${(_f = (_e = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _e.data) == null ? void 0 : _f.session_key}`
|
|
4574
|
+
});
|
|
4575
|
+
try {
|
|
4576
|
+
const tokenizeData = await axios6.post(`${fractalGatewayUrl}tokenizer/tokenize`, raw, { headers: myHeaders });
|
|
4577
|
+
const reqData = JSON.stringify(__spreadProps(__spreadValues({}, (_g = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _g.data), {
|
|
4578
|
+
cvv: cardData == null ? void 0 : cardData.cvv,
|
|
4579
|
+
cardName: cardData == null ? void 0 : cardData.cardName,
|
|
4580
|
+
zip: cardData == null ? void 0 : cardData.zipCode,
|
|
4581
|
+
userId: props == null ? void 0 : props.customerId,
|
|
4582
|
+
fractalpayPublicKey: props == null ? void 0 : props.fractalpayClientKey
|
|
4583
|
+
}));
|
|
4584
|
+
let myHeaders2 = {
|
|
4585
|
+
"Content-Type": "application/json"
|
|
4586
|
+
};
|
|
4587
|
+
try {
|
|
4588
|
+
let addCardRes = await axios6.post(
|
|
4589
|
+
`${baseUrl}add-card`,
|
|
4590
|
+
reqData,
|
|
4591
|
+
{
|
|
4592
|
+
headers: myHeaders2
|
|
4593
|
+
}
|
|
4594
|
+
);
|
|
4595
|
+
console.log(addCardRes);
|
|
4596
|
+
if ((_h = addCardRes == null ? void 0 : addCardRes.data) == null ? void 0 : _h.result) {
|
|
4597
|
+
setSuccess(true);
|
|
4598
|
+
hideLoader();
|
|
4599
|
+
HandleSubmit(e, "close", "");
|
|
4600
|
+
}
|
|
4601
|
+
} catch (err) {
|
|
4602
|
+
hideLoader();
|
|
4603
|
+
setError(((_j = (_i = err == null ? void 0 : err.response) == null ? void 0 : _i.data) == null ? void 0 : _j.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
|
|
4604
|
+
}
|
|
4605
|
+
} catch (err) {
|
|
4606
|
+
hideLoader();
|
|
4607
|
+
setError(((_l = (_k = err == null ? void 0 : err.response) == null ? void 0 : _k.data) == null ? void 0 : _l.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
|
|
4608
|
+
}
|
|
4609
|
+
} catch (err) {
|
|
4610
|
+
hideLoader();
|
|
4611
|
+
setError(((_n = (_m = err == null ? void 0 : err.response) == null ? void 0 : _m.data) == null ? void 0 : _n.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
|
|
4612
|
+
}
|
|
4613
|
+
} else {
|
|
4614
|
+
if (typeof DatacapWebToken !== "undefined") {
|
|
4615
|
+
DatacapWebToken.requestToken(paymentData == null ? void 0 : paymentData.dctoken, "creditCardForm", getTokenCallback);
|
|
4616
|
+
}
|
|
4617
|
+
}
|
|
4618
|
+
} catch (err) {
|
|
4619
|
+
hideLoader();
|
|
4620
|
+
setError(((_p = (_o = err == null ? void 0 : err.response) == null ? void 0 : _o.data) == null ? void 0 : _p.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
|
|
4621
|
+
}
|
|
4622
|
+
}
|
|
4623
|
+
}
|
|
4624
|
+
};
|
|
4625
|
+
return /* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement(DataScript, null), /* @__PURE__ */ React20.createElement(AddCardStyle, null), /* @__PURE__ */ React20.createElement(Loader_default, { loading }), error && /* @__PURE__ */ React20.createElement("div", { style: { maxHeight: "606px", minHeight: "60vh", padding: "40px" } }, /* @__PURE__ */ React20.createElement(ErrorCardMessage_default, { error, onClose: handleClose })), success && /* @__PURE__ */ React20.createElement(SuccessCardMsz_default, { onClose: handleCloseSeccess }), !error && !success && /* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement(
|
|
4626
|
+
"div",
|
|
4627
|
+
{
|
|
4628
|
+
className: "container-creditcard add-card modal-content",
|
|
4629
|
+
id: "add-credit-card-panel",
|
|
4630
|
+
style: { margin: "auto" }
|
|
4631
|
+
},
|
|
4632
|
+
/* @__PURE__ */ React20.createElement("form", { id: "creditCardForm", onSubmit: addCardFunc, style: { padding: "0 10px" } }, /* @__PURE__ */ React20.createElement("div", { style: { maxHeight: "350px", minHeight: "0" }, className: "card-scrl" }, /* @__PURE__ */ React20.createElement("div", { className: "form-group", style: { marginTop: "0", marginBottom: "10px" } }, /* @__PURE__ */ React20.createElement("label", { htmlFor: "cardNumber" }, "Card Number"), /* @__PURE__ */ React20.createElement(
|
|
4633
|
+
"input",
|
|
4634
|
+
{
|
|
4635
|
+
type: "text",
|
|
4636
|
+
"data-token": "card_number",
|
|
4637
|
+
placeholder: "Enter card number",
|
|
4638
|
+
maxLength: 19,
|
|
4639
|
+
inputMode: "numeric",
|
|
4640
|
+
value: (cardData == null ? void 0 : cardData.cardNumber) || "",
|
|
4641
|
+
onChange: (e) => handleCardNumberChange(e)
|
|
4642
|
+
}
|
|
4643
|
+
), (cardError == null ? void 0 : cardError.cardNumber) && /* @__PURE__ */ React20.createElement("span", { className: "error-span", style: { color: "red", fontSize: "12px" } }, cardError == null ? void 0 : cardError.cardNumber), /* @__PURE__ */ React20.createElement("br", null)), /* @__PURE__ */ React20.createElement("div", { className: "card-dtl" }, /* @__PURE__ */ React20.createElement("div", { className: "exp-cvc-container", style: { margin: "0" } }, /* @__PURE__ */ React20.createElement("div", { className: "form-group", style: { marginTop: "0" } }, /* @__PURE__ */ React20.createElement("label", { htmlFor: "expMonth" }, "MM"), /* @__PURE__ */ React20.createElement(
|
|
4644
|
+
"input",
|
|
4645
|
+
{
|
|
4646
|
+
"data-token": "exp_month",
|
|
4647
|
+
className: "form-control required",
|
|
4648
|
+
type: "text",
|
|
4649
|
+
placeholder: "MM",
|
|
4650
|
+
maxLength: 2,
|
|
4651
|
+
value: (cardData == null ? void 0 : cardData.expiryMonth) || "",
|
|
4652
|
+
onChange: (e) => handleCardChange("expiryMonth", e.target.value)
|
|
4653
|
+
}
|
|
4654
|
+
), (cardError == null ? void 0 : cardError.expiryMonth) && /* @__PURE__ */ React20.createElement("span", { className: "error-span", style: { color: "red", fontSize: "12px" } }, cardError == null ? void 0 : cardError.expiryMonth)), /* @__PURE__ */ React20.createElement("div", { className: "form-group", style: { marginTop: "0" } }, /* @__PURE__ */ React20.createElement("label", { htmlFor: "expYear" }, "YYYY"), /* @__PURE__ */ React20.createElement(
|
|
4655
|
+
"input",
|
|
4656
|
+
{
|
|
4657
|
+
"data-token": "exp_year",
|
|
4658
|
+
className: "form-control required",
|
|
4659
|
+
type: "text",
|
|
4660
|
+
placeholder: "YYYY",
|
|
4661
|
+
maxLength: 4,
|
|
4662
|
+
value: (cardData == null ? void 0 : cardData.expiryYear) || "",
|
|
4663
|
+
onChange: (e) => handleCardChange("expiryYear", e.target.value)
|
|
4664
|
+
}
|
|
4665
|
+
), (cardError == null ? void 0 : cardError.expiryYear) && /* @__PURE__ */ React20.createElement("span", { className: "error-span", style: { color: "red", fontSize: "12px" } }, cardError == null ? void 0 : cardError.expiryYear)), /* @__PURE__ */ React20.createElement("div", { className: "form-group", style: { marginTop: "0" } }, /* @__PURE__ */ React20.createElement("label", { htmlFor: "cvc" }, "CVC"), /* @__PURE__ */ React20.createElement(
|
|
4666
|
+
"input",
|
|
4667
|
+
{
|
|
4668
|
+
"data-token": "cvv",
|
|
4669
|
+
className: "form-control required",
|
|
4670
|
+
type: "text",
|
|
4671
|
+
placeholder: "CVC",
|
|
4672
|
+
maxLength: 4,
|
|
4673
|
+
value: (cardData == null ? void 0 : cardData.cvv) || "",
|
|
4674
|
+
onChange: (e) => handleCardChange("cvv", e.target.value)
|
|
4675
|
+
}
|
|
4676
|
+
), (cardError == null ? void 0 : cardError.cvv) && /* @__PURE__ */ React20.createElement("span", { className: "error-span", style: { color: "red", fontSize: "12px" } }, cardError == null ? void 0 : cardError.cvv)))), /* @__PURE__ */ React20.createElement("div", { className: "form-group", style: { marginTop: "0" } }, /* @__PURE__ */ React20.createElement("label", { htmlFor: "cardholderName" }, "Name on card"), /* @__PURE__ */ React20.createElement(
|
|
4677
|
+
"input",
|
|
4678
|
+
{
|
|
4679
|
+
type: "text",
|
|
4680
|
+
id: "cardholderName",
|
|
4681
|
+
name: "cardholderName",
|
|
4682
|
+
placeholder: "Name on card required",
|
|
4683
|
+
value: (cardData == null ? void 0 : cardData.cardName) || "",
|
|
4684
|
+
onChange: (e) => {
|
|
4685
|
+
const value = e.target.value;
|
|
4686
|
+
if (/^[a-zA-Z\s]*$/.test(value)) {
|
|
4687
|
+
handleCardChange("cardName", value);
|
|
4688
|
+
}
|
|
4689
|
+
}
|
|
4690
|
+
}
|
|
4691
|
+
), (cardError == null ? void 0 : cardError.cardName) && /* @__PURE__ */ React20.createElement("span", { className: "error-span", style: { color: "red", fontSize: "12px" } }, cardError == null ? void 0 : cardError.cardName)), /* @__PURE__ */ React20.createElement("div", { className: "form-group", style: { marginTop: "0" } }, /* @__PURE__ */ React20.createElement("label", { htmlFor: "zipcode" }, "Zip"), /* @__PURE__ */ React20.createElement(
|
|
4692
|
+
"input",
|
|
4693
|
+
{
|
|
4694
|
+
type: "text",
|
|
4695
|
+
id: "",
|
|
4696
|
+
name: "zipcode",
|
|
4697
|
+
placeholder: "Zip",
|
|
4698
|
+
value: (_a = cardData == null ? void 0 : cardData.zipCode) != null ? _a : "",
|
|
4699
|
+
onChange: (e) => handleCardChange("zipCode", e.target.value)
|
|
4700
|
+
}
|
|
4701
|
+
), (cardError == null ? void 0 : cardError.zipCode) && /* @__PURE__ */ React20.createElement("span", { className: "error-span", style: { color: "red", fontSize: "12px" } }, cardError == null ? void 0 : cardError.zipCode))), /* @__PURE__ */ React20.createElement(
|
|
4702
|
+
"input",
|
|
4703
|
+
{
|
|
4704
|
+
type: "submit",
|
|
4705
|
+
className: "idle-green-btn w-100",
|
|
4706
|
+
defaultValue: "Submit"
|
|
4707
|
+
}
|
|
4708
|
+
))
|
|
4709
|
+
)));
|
|
4710
|
+
}
|
|
4711
|
+
export {
|
|
4712
|
+
AddCard,
|
|
4713
|
+
AddCardEasyPay,
|
|
4714
|
+
GetPaymentPage,
|
|
4715
|
+
PreAuthPayment,
|
|
4716
|
+
RequestPayment,
|
|
4717
|
+
RequestPreAuthPayment
|
|
4718
|
+
};
|