@pinerohit11/testwidget 0.2.124 → 0.2.126
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +163 -123
- package/dist/index.mjs +163 -123
- package/package.json +2 -1
package/dist/index.js
CHANGED
@@ -173,6 +173,7 @@ var Loader_default = Loader;
|
|
173
173
|
// src/app/components/baseurl.ts
|
174
174
|
var masterBaseUrl = "https://dev-sky-node.fractalpay.com/";
|
175
175
|
var baseUrl = "https://dev-widget.fractalpay.com/";
|
176
|
+
var fractalGatewayUrl = "https://api-dev.merchant-trends.com/";
|
176
177
|
|
177
178
|
// src/app/components/Errortext.ts
|
178
179
|
var ErrorText = {
|
@@ -471,7 +472,6 @@ var CustomModal2 = ({
|
|
471
472
|
maxWidth
|
472
473
|
}) => {
|
473
474
|
if (!open) return null;
|
474
|
-
console.log(maxWidth);
|
475
475
|
return /* @__PURE__ */ import_react4.default.createElement(import_react4.default.Fragment, null, /* @__PURE__ */ import_react4.default.createElement(CustomModal2styles_default, null), /* @__PURE__ */ import_react4.default.createElement("div", { className: "fractal-popup" }, /* @__PURE__ */ import_react4.default.createElement("div", { className: "fractal-popup-content request-payment-popup-container", style: { maxWidth: `${maxWidth != null ? maxWidth : "auto"}` } }, children)));
|
476
476
|
};
|
477
477
|
var CustomModal2_default = CustomModal2;
|
@@ -780,7 +780,6 @@ function RequestPayment(props) {
|
|
780
780
|
window.parent.postMessage(message, "*");
|
781
781
|
}
|
782
782
|
const sendRequestPayment = async () => {
|
783
|
-
debugger;
|
784
783
|
if (Object.keys(errors).length > 0) {
|
785
784
|
return;
|
786
785
|
}
|
@@ -2282,6 +2281,25 @@ var ErrorCardMessage = ({ onClose, error }) => {
|
|
2282
2281
|
};
|
2283
2282
|
var ErrorCardMessage_default = ErrorCardMessage;
|
2284
2283
|
|
2284
|
+
// src/app/components/socketClient.js
|
2285
|
+
var import_socket = require("socket.io-client");
|
2286
|
+
var socket = (0, import_socket.io)(baseUrl, {
|
2287
|
+
transports: ["websocket"],
|
2288
|
+
// Optional: force WebSocket
|
2289
|
+
withCredentials: false
|
2290
|
+
});
|
2291
|
+
var socketClient_default = socket;
|
2292
|
+
|
2293
|
+
// src/app/utils/Common.js
|
2294
|
+
var isValidJson = (jsonString) => {
|
2295
|
+
try {
|
2296
|
+
const parsed = JSON.parse(jsonString);
|
2297
|
+
return typeof parsed === "object" && parsed !== null;
|
2298
|
+
} catch (e) {
|
2299
|
+
return false;
|
2300
|
+
}
|
2301
|
+
};
|
2302
|
+
|
2285
2303
|
// src/app/components/Charge/GetPaymentPage.tsx
|
2286
2304
|
function GetPaymentPage(props) {
|
2287
2305
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
@@ -2491,7 +2509,7 @@ function GetPaymentPage(props) {
|
|
2491
2509
|
return Object.keys(errors).length > 0;
|
2492
2510
|
};
|
2493
2511
|
const submitFunc = async (e) => {
|
2494
|
-
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2
|
2512
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2;
|
2495
2513
|
e.preventDefault();
|
2496
2514
|
if (activetab !== "ach") {
|
2497
2515
|
const hasError = validateCardData();
|
@@ -2519,7 +2537,6 @@ function GetPaymentPage(props) {
|
|
2519
2537
|
});
|
2520
2538
|
const result = await import_axios3.default.post(`${baseUrl}create-widget-order`, formData);
|
2521
2539
|
let tokenCallback = async function(response) {
|
2522
|
-
var _a3, _b3, _c3;
|
2523
2540
|
if (response.Error) {
|
2524
2541
|
setError(response.Error);
|
2525
2542
|
setLoading2(false);
|
@@ -2529,25 +2546,38 @@ function GetPaymentPage(props) {
|
|
2529
2546
|
response.name = name;
|
2530
2547
|
response.postal_code = postal_code;
|
2531
2548
|
response.isCardSave = `${saveCardInfo}`;
|
2532
|
-
|
2533
|
-
|
2534
|
-
|
2535
|
-
|
2536
|
-
|
2537
|
-
|
2538
|
-
|
2539
|
-
|
2540
|
-
|
2541
|
-
|
2542
|
-
|
2543
|
-
|
2544
|
-
|
2545
|
-
|
2546
|
-
|
2547
|
-
|
2548
|
-
|
2549
|
-
|
2550
|
-
|
2549
|
+
response.isCharge = true;
|
2550
|
+
response.posSalesIdEncode = result == null ? void 0 : result.data.data.posSalesIdEncode;
|
2551
|
+
console.log(response, "resppp");
|
2552
|
+
console.log(result == null ? void 0 : result.data.data.posSalesIdEncode, "fkjdashgfuh");
|
2553
|
+
socketClient_default.emit("sendMessage", response);
|
2554
|
+
socketClient_default.on(result == null ? void 0 : result.data.data.posSalesIdEncode, (data) => {
|
2555
|
+
console.log(data, "socket data");
|
2556
|
+
if (isValidJson(data == null ? void 0 : data.data)) {
|
2557
|
+
let apiResponse = JSON.parse(data.data);
|
2558
|
+
console.log("return data : ", apiResponse);
|
2559
|
+
if (apiResponse == null ? void 0 : apiResponse.result) {
|
2560
|
+
setCardData({
|
2561
|
+
cardName: "",
|
2562
|
+
cardNumber: "",
|
2563
|
+
expiryMonth: "",
|
2564
|
+
expiryYear: "",
|
2565
|
+
cvv: "",
|
2566
|
+
orderId: "",
|
2567
|
+
zipCode: ""
|
2568
|
+
});
|
2569
|
+
setSaveCardInfo(false);
|
2570
|
+
setTranId(apiResponse == null ? void 0 : apiResponse.transactionId);
|
2571
|
+
setSuccess(true);
|
2572
|
+
setLoading2(false);
|
2573
|
+
} else {
|
2574
|
+
setLoading2(false);
|
2575
|
+
setError((apiResponse == null ? void 0 : apiResponse.message) || "Something went wrong.");
|
2576
|
+
}
|
2577
|
+
} else {
|
2578
|
+
setError("Something went wrong.");
|
2579
|
+
}
|
2580
|
+
});
|
2551
2581
|
}
|
2552
2582
|
};
|
2553
2583
|
if ((paymentData == null ? void 0 : paymentData.paymentGateway) === 32) {
|
@@ -2579,48 +2609,54 @@ function GetPaymentPage(props) {
|
|
2579
2609
|
session_key: `${(_f2 = (_e2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _e2.data) == null ? void 0 : _f2.session_key}`
|
2580
2610
|
});
|
2581
2611
|
try {
|
2582
|
-
const tokenizeData = await import_axios3.default.post(
|
2612
|
+
const tokenizeData = await import_axios3.default.post(`${fractalGatewayUrl}tokenizer/tokenize`, raw, { headers: myHeaders });
|
2583
2613
|
const reqData = JSON.stringify(__spreadProps(__spreadValues({}, (_g2 = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _g2.data), {
|
2584
2614
|
isSaveCardChecked: saveCardInfo,
|
2585
2615
|
name: cardData == null ? void 0 : cardData.cardName,
|
2586
2616
|
postal_code: cardData == null ? void 0 : cardData.zipCode,
|
2587
2617
|
customer_id: props == null ? void 0 : props.customerId
|
2588
2618
|
}));
|
2589
|
-
const reqData2 = {
|
2619
|
+
const reqData2 = JSON.stringify({
|
2590
2620
|
"pre_sales_id": `${(_i2 = (_h2 = result == null ? void 0 : result.data) == null ? void 0 : _h2.data) == null ? void 0 : _i2.posSalesIdEncode}`,
|
2591
2621
|
"token": `${(_j2 = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _j2.data.token}`,
|
2592
2622
|
"json_response": `${reqData}`
|
2593
|
-
};
|
2594
|
-
let myHeaders2 = {
|
2623
|
+
});
|
2624
|
+
let myHeaders2 = JSON.stringify({
|
2595
2625
|
"Content-Type": "application/json"
|
2596
|
-
};
|
2597
|
-
const requestOptions2 = __spreadProps(__spreadValues({}, reqData2), {
|
2598
|
-
isChargeviafractal: true
|
2599
2626
|
});
|
2600
|
-
|
2601
|
-
|
2602
|
-
|
2603
|
-
|
2604
|
-
|
2605
|
-
|
2627
|
+
const requestOptions2 = {
|
2628
|
+
method: "POST",
|
2629
|
+
headers: myHeaders2,
|
2630
|
+
body: reqData2,
|
2631
|
+
redirect: "follow",
|
2632
|
+
isChargeviafractal: true
|
2633
|
+
};
|
2634
|
+
socketClient_default.emit("sendMessage", requestOptions2);
|
2635
|
+
socketClient_default.on("chargeviafractalgateway", (data) => {
|
2636
|
+
var _a3;
|
2637
|
+
console.log(data, "socket data");
|
2638
|
+
if (isValidJson(data == null ? void 0 : data.data)) {
|
2639
|
+
let paymentRes = JSON.parse(data == null ? void 0 : data.data);
|
2640
|
+
console.log(paymentRes, "dfuigdasuf");
|
2641
|
+
if (paymentRes == null ? void 0 : paymentRes.result) {
|
2642
|
+
setTranId((_a3 = paymentRes == null ? void 0 : paymentRes.data) == null ? void 0 : _a3.transactionId);
|
2643
|
+
setSuccess(true);
|
2644
|
+
setLoading2(false);
|
2645
|
+
} else {
|
2646
|
+
setLoading2(false);
|
2647
|
+
setError((paymentRes == null ? void 0 : paymentRes.message) || "Something went wrong.");
|
2606
2648
|
}
|
2607
|
-
|
2608
|
-
|
2609
|
-
setTranId((_m2 = (_l2 = paymentRes == null ? void 0 : paymentRes.data) == null ? void 0 : _l2.data) == null ? void 0 : _m2.transactionId);
|
2610
|
-
setSuccess(true);
|
2611
|
-
setLoading2(false);
|
2649
|
+
} else {
|
2650
|
+
setError("Something went wrong.");
|
2612
2651
|
}
|
2613
|
-
}
|
2614
|
-
setLoading2(false);
|
2615
|
-
setError(((_o2 = (_n2 = err == null ? void 0 : err.response) == null ? void 0 : _n2.data) == null ? void 0 : _o2.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
|
2616
|
-
}
|
2652
|
+
});
|
2617
2653
|
} catch (err) {
|
2618
2654
|
setLoading2(false);
|
2619
|
-
setError(((
|
2655
|
+
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.");
|
2620
2656
|
}
|
2621
2657
|
} catch (err) {
|
2622
2658
|
setLoading2(false);
|
2623
|
-
setError(((
|
2659
|
+
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.");
|
2624
2660
|
}
|
2625
2661
|
} else {
|
2626
2662
|
if (typeof DatacapWebToken !== "undefined") {
|
@@ -2629,7 +2665,7 @@ function GetPaymentPage(props) {
|
|
2629
2665
|
}
|
2630
2666
|
} catch (err) {
|
2631
2667
|
setLoading2(false);
|
2632
|
-
setError(((
|
2668
|
+
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.");
|
2633
2669
|
}
|
2634
2670
|
}
|
2635
2671
|
}
|
@@ -2651,28 +2687,27 @@ function GetPaymentPage(props) {
|
|
2651
2687
|
order_id: props == null ? void 0 : props.orderID,
|
2652
2688
|
tax: props == null ? void 0 : props.tax,
|
2653
2689
|
discount: props == null ? void 0 : props.discount,
|
2654
|
-
surcharge: props == null ? void 0 : props.surcharge
|
2690
|
+
surcharge: props == null ? void 0 : props.surcharge,
|
2691
|
+
isChargeACH: true
|
2655
2692
|
};
|
2656
|
-
|
2657
|
-
|
2658
|
-
|
2659
|
-
|
2660
|
-
|
2661
|
-
|
2662
|
-
|
2663
|
-
|
2664
|
-
|
2665
|
-
|
2693
|
+
socketClient_default.emit("sendMessage", dataForm);
|
2694
|
+
socketClient_default.on("ach-incoming", (data) => {
|
2695
|
+
var _a3;
|
2696
|
+
console.log(data, "sfhdwhf");
|
2697
|
+
if ((data == null ? void 0 : data.status) == "Failed") {
|
2698
|
+
if (typeof (data == null ? void 0 : data.message) == "object") {
|
2699
|
+
Object.values(data == null ? void 0 : data.message).forEach((message) => {
|
2700
|
+
setError(message || "Something went wrong");
|
2701
|
+
});
|
2702
|
+
} else {
|
2703
|
+
setError((data == null ? void 0 : data.message) || "Something went wrong");
|
2666
2704
|
}
|
2667
|
-
});
|
2668
|
-
} catch (error2) {
|
2669
|
-
if (import_axios3.default.isAxiosError(error2)) {
|
2670
|
-
setLoading2(false);
|
2671
|
-
setError((_D = (_C = (_y = (_x = (_w = error2.response) == null ? void 0 : _w.data) == null ? void 0 : _x.message) == null ? void 0 : _y.error) != null ? _C : (_B = (_A = (_z = error2.response) == null ? void 0 : _z.data) == null ? void 0 : _A.message) == null ? void 0 : _B.amount) != null ? _D : "Something went wrong");
|
2672
2705
|
} else {
|
2673
|
-
|
2706
|
+
setTranId((_a3 = data == null ? void 0 : data.data) == null ? void 0 : _a3.transaction_id);
|
2707
|
+
setSuccess(true);
|
2708
|
+
setLoading2(false);
|
2674
2709
|
}
|
2675
|
-
}
|
2710
|
+
});
|
2676
2711
|
}
|
2677
2712
|
}
|
2678
2713
|
};
|
@@ -2708,7 +2743,6 @@ function GetPaymentPage(props) {
|
|
2708
2743
|
}
|
2709
2744
|
};
|
2710
2745
|
const handlechargeCustomer = async () => {
|
2711
|
-
var _b2, _c2, _d2, _e2, _f2, _g2, _h2;
|
2712
2746
|
let customer_id = props == null ? void 0 : props.customerId;
|
2713
2747
|
let discount = String(props == null ? void 0 : props.discount);
|
2714
2748
|
let surcharge = String(props == null ? void 0 : props.surcharge);
|
@@ -2739,17 +2773,18 @@ function GetPaymentPage(props) {
|
|
2739
2773
|
"Content-Type": "application/json"
|
2740
2774
|
};
|
2741
2775
|
setLoading2(true);
|
2742
|
-
|
2743
|
-
|
2744
|
-
|
2745
|
-
|
2776
|
+
socketClient_default.emit("sendMessage", { url: chargeurl, body: chargeobj, isChargebycard: true });
|
2777
|
+
socketClient_default.on("charge-by-card", (response) => {
|
2778
|
+
var _a3;
|
2779
|
+
console.log(response, "response");
|
2780
|
+
if ((response == null ? void 0 : response.result) == true || (response == null ? void 0 : response.status) == true) {
|
2781
|
+
setTranId((_a3 = response.data) == null ? void 0 : _a3.transaction_id);
|
2746
2782
|
setSuccess(true);
|
2747
2783
|
setLoading2(false);
|
2784
|
+
} else {
|
2785
|
+
setError((response == null ? void 0 : response.message) || "Something went wrong.");
|
2748
2786
|
}
|
2749
|
-
}
|
2750
|
-
setLoading2(false);
|
2751
|
-
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");
|
2752
|
-
}
|
2787
|
+
});
|
2753
2788
|
} else {
|
2754
2789
|
setError("Please Select A Card/ACH");
|
2755
2790
|
}
|
@@ -3123,7 +3158,7 @@ function PreAuthPayment(props) {
|
|
3123
3158
|
return Object.keys(errors).length > 0;
|
3124
3159
|
};
|
3125
3160
|
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
|
3161
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
|
3127
3162
|
e.preventDefault();
|
3128
3163
|
if (activetab == "card") {
|
3129
3164
|
const hasError = validateCardData();
|
@@ -3141,7 +3176,6 @@ function PreAuthPayment(props) {
|
|
3141
3176
|
setLoading2(true);
|
3142
3177
|
try {
|
3143
3178
|
let tokenCallback = async function(response) {
|
3144
|
-
var _a3, _b3, _c3, _d3;
|
3145
3179
|
if (response.Error) {
|
3146
3180
|
setError(response.Error);
|
3147
3181
|
setLoading2(false);
|
@@ -3161,26 +3195,35 @@ function PreAuthPayment(props) {
|
|
3161
3195
|
response.discount = props == null ? void 0 : props.discount;
|
3162
3196
|
response.tax = props == null ? void 0 : props.tax;
|
3163
3197
|
response.surcharge = props == null ? void 0 : props.surcharge;
|
3164
|
-
|
3165
|
-
|
3166
|
-
|
3167
|
-
|
3168
|
-
|
3169
|
-
|
3170
|
-
|
3171
|
-
|
3172
|
-
|
3173
|
-
|
3174
|
-
|
3175
|
-
|
3176
|
-
|
3177
|
-
|
3178
|
-
|
3179
|
-
|
3180
|
-
|
3181
|
-
|
3182
|
-
|
3183
|
-
|
3198
|
+
const myHeaders = new Headers();
|
3199
|
+
myHeaders.append("Content-Type", "application/json");
|
3200
|
+
const requestOptions = {
|
3201
|
+
method: "POST",
|
3202
|
+
body: JSON.stringify(response),
|
3203
|
+
redirect: "follow"
|
3204
|
+
};
|
3205
|
+
socketClient_default.emit("sendMessage", __spreadProps(__spreadValues({}, requestOptions), { "isChargePreauth": true }));
|
3206
|
+
socketClient_default.on("charge-preauth", (data) => {
|
3207
|
+
var _a3;
|
3208
|
+
console.log(data, "datdata");
|
3209
|
+
if ((data == null ? void 0 : data.status) == "Failed") {
|
3210
|
+
setLoading2(false);
|
3211
|
+
setError((data == null ? void 0 : data.message) || "Something went wrong. Please try again later.");
|
3212
|
+
} else {
|
3213
|
+
setSuccess(true);
|
3214
|
+
setTranId((_a3 = data == null ? void 0 : data.data) == null ? void 0 : _a3.transaction_id);
|
3215
|
+
setLoading2(false);
|
3216
|
+
setCardData({
|
3217
|
+
cardName: "",
|
3218
|
+
cardNumber: "",
|
3219
|
+
expiryMonth: "",
|
3220
|
+
expiryYear: "",
|
3221
|
+
cvv: "",
|
3222
|
+
orderId: "",
|
3223
|
+
zipCode: ""
|
3224
|
+
});
|
3225
|
+
}
|
3226
|
+
});
|
3184
3227
|
}
|
3185
3228
|
};
|
3186
3229
|
if ((paymentData == null ? void 0 : paymentData.paymentGateway) === 32) {
|
@@ -3212,7 +3255,7 @@ function PreAuthPayment(props) {
|
|
3212
3255
|
session_key: `${(_f2 = (_e2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _e2.data) == null ? void 0 : _f2.session_key}`
|
3213
3256
|
});
|
3214
3257
|
try {
|
3215
|
-
const tokenizeData = await import_axios4.default.post(
|
3258
|
+
const tokenizeData = await import_axios4.default.post(`${fractalGatewayUrl}tokenizer/tokenize`, raw, { headers: myHeaders });
|
3216
3259
|
const reqData = JSON.stringify(__spreadProps(__spreadValues({}, (_g2 = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _g2.data), {
|
3217
3260
|
// isSaveCardChecked: saveCardInfo,
|
3218
3261
|
name: cardData == null ? void 0 : cardData.cardName,
|
@@ -3238,39 +3281,39 @@ function PreAuthPayment(props) {
|
|
3238
3281
|
let myHeaders2 = {
|
3239
3282
|
"Content-Type": "application/json"
|
3240
3283
|
};
|
3241
|
-
|
3242
|
-
|
3243
|
-
|
3244
|
-
|
3245
|
-
|
3246
|
-
|
3247
|
-
|
3248
|
-
|
3249
|
-
|
3250
|
-
if ((
|
3251
|
-
|
3284
|
+
const requestOptions2 = {
|
3285
|
+
method: "POST",
|
3286
|
+
headers: myHeaders2,
|
3287
|
+
body: reqData,
|
3288
|
+
redirect: "follow"
|
3289
|
+
};
|
3290
|
+
socketClient_default.emit("sendMessage", __spreadProps(__spreadValues({}, requestOptions2), { "isFractalPreauth": true }));
|
3291
|
+
socketClient_default.on("fractal-charge-preauth", (data) => {
|
3292
|
+
var _a3;
|
3293
|
+
if ((data == null ? void 0 : data.status) == "Failed") {
|
3294
|
+
setLoading2(false);
|
3295
|
+
setError((data == null ? void 0 : data.message) || "Something went wrong , Try again later");
|
3296
|
+
} else {
|
3297
|
+
setTranId((_a3 = data == null ? void 0 : data.data) == null ? void 0 : _a3.transaction_id);
|
3252
3298
|
setSuccess(true);
|
3253
3299
|
setLoading2(false);
|
3254
3300
|
}
|
3255
|
-
}
|
3256
|
-
setLoading2(false);
|
3257
|
-
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 , Try again later");
|
3258
|
-
}
|
3301
|
+
});
|
3259
3302
|
} catch (err) {
|
3260
3303
|
console.log(err);
|
3261
3304
|
setLoading2(false);
|
3262
|
-
setError(((
|
3305
|
+
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");
|
3263
3306
|
}
|
3264
3307
|
} catch (err) {
|
3265
3308
|
setLoading2(false);
|
3266
|
-
setError(((
|
3309
|
+
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");
|
3267
3310
|
}
|
3268
3311
|
} else {
|
3269
3312
|
DatacapWebToken.requestToken(paymentData == null ? void 0 : paymentData.dctoken, "PaymentForm", tokenCallback);
|
3270
3313
|
}
|
3271
3314
|
} catch (err) {
|
3272
3315
|
setLoading2(false);
|
3273
|
-
setError(((
|
3316
|
+
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.");
|
3274
3317
|
}
|
3275
3318
|
}
|
3276
3319
|
}
|
@@ -4016,7 +4059,7 @@ function AddCard(props) {
|
|
4016
4059
|
}));
|
4017
4060
|
};
|
4018
4061
|
const validateCardData = () => {
|
4019
|
-
var _a2, _b, _c, _d, _e, _f
|
4062
|
+
var _a2, _b, _c, _d, _e, _f;
|
4020
4063
|
const errors = {};
|
4021
4064
|
const data = cardData;
|
4022
4065
|
const month = parseInt((data == null ? void 0 : data.expiryMonth) || "", 10);
|
@@ -4036,7 +4079,6 @@ function AddCard(props) {
|
|
4036
4079
|
errors.expiryMonth = "Invalid Expiration Date.";
|
4037
4080
|
}
|
4038
4081
|
if (!((_f = data == null ? void 0 : data.cvv) == null ? void 0 : _f.trim())) errors.cvv = "CVC is required";
|
4039
|
-
if (!((_g = data == null ? void 0 : data.zipCode) == null ? void 0 : _g.trim())) errors.zipCode = "ZIP code is required";
|
4040
4082
|
if ((data == null ? void 0 : data.expiryMonth) && (data == null ? void 0 : data.expiryYear) && data.expiryMonth.length <= 2 && data.expiryYear.length === 4) {
|
4041
4083
|
const month2 = parseInt(data.expiryMonth, 10);
|
4042
4084
|
const year2 = parseInt(data.expiryYear, 10);
|
@@ -4166,7 +4208,7 @@ function AddCard(props) {
|
|
4166
4208
|
session_key: `${(_f = (_e = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _e.data) == null ? void 0 : _f.session_key}`
|
4167
4209
|
});
|
4168
4210
|
try {
|
4169
|
-
const tokenizeData = await import_axios5.default.post(
|
4211
|
+
const tokenizeData = await import_axios5.default.post(`${fractalGatewayUrl}tokenizer/tokenize`, raw, { headers: myHeaders });
|
4170
4212
|
const reqData = JSON.stringify(__spreadProps(__spreadValues({}, (_g = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _g.data), {
|
4171
4213
|
cvv: cardData == null ? void 0 : cardData.cvv,
|
4172
4214
|
cardName: cardData == null ? void 0 : cardData.cardName,
|
@@ -4403,7 +4445,7 @@ function AddCardEasyPay(props) {
|
|
4403
4445
|
}));
|
4404
4446
|
};
|
4405
4447
|
const validateCardData = () => {
|
4406
|
-
var _a2, _b, _c, _d, _e, _f
|
4448
|
+
var _a2, _b, _c, _d, _e, _f;
|
4407
4449
|
const errors = {};
|
4408
4450
|
const data = cardData;
|
4409
4451
|
const month = parseInt((data == null ? void 0 : data.expiryMonth) || "", 10);
|
@@ -4423,7 +4465,6 @@ function AddCardEasyPay(props) {
|
|
4423
4465
|
errors.expiryMonth = "Invalid Expiration Date.";
|
4424
4466
|
}
|
4425
4467
|
if (!((_f = data == null ? void 0 : data.cvv) == null ? void 0 : _f.trim())) errors.cvv = "CVC is required";
|
4426
|
-
if (!((_g = data == null ? void 0 : data.zipCode) == null ? void 0 : _g.trim())) errors.zipCode = "ZIP code is required";
|
4427
4468
|
if ((data == null ? void 0 : data.expiryMonth) && (data == null ? void 0 : data.expiryYear) && data.expiryMonth.length <= 2 && data.expiryYear.length === 4) {
|
4428
4469
|
const month2 = parseInt(data.expiryMonth, 10);
|
4429
4470
|
const year2 = parseInt(data.expiryYear, 10);
|
@@ -4471,7 +4512,6 @@ function AddCardEasyPay(props) {
|
|
4471
4512
|
e.preventDefault();
|
4472
4513
|
const hasError = validateCardData();
|
4473
4514
|
console.log(cardData);
|
4474
|
-
debugger;
|
4475
4515
|
if (hasError) return;
|
4476
4516
|
else {
|
4477
4517
|
let validCard = DatacapWebToken.validateCardNumber(cardData == null ? void 0 : cardData.cardNumber.replaceAll(" ", ""));
|
@@ -4567,7 +4607,7 @@ function AddCardEasyPay(props) {
|
|
4567
4607
|
session_key: `${(_f = (_e = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _e.data) == null ? void 0 : _f.session_key}`
|
4568
4608
|
});
|
4569
4609
|
try {
|
4570
|
-
const tokenizeData = await import_axios6.default.post(
|
4610
|
+
const tokenizeData = await import_axios6.default.post(`${fractalGatewayUrl}tokenizer/tokenize`, raw, { headers: myHeaders });
|
4571
4611
|
const reqData = JSON.stringify(__spreadProps(__spreadValues({}, (_g = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _g.data), {
|
4572
4612
|
cvv: cardData == null ? void 0 : cardData.cvv,
|
4573
4613
|
cardName: cardData == null ? void 0 : cardData.cardName,
|
package/dist/index.mjs
CHANGED
@@ -135,6 +135,7 @@ var Loader_default = Loader;
|
|
135
135
|
// src/app/components/baseurl.ts
|
136
136
|
var masterBaseUrl = "https://dev-sky-node.fractalpay.com/";
|
137
137
|
var baseUrl = "https://dev-widget.fractalpay.com/";
|
138
|
+
var fractalGatewayUrl = "https://api-dev.merchant-trends.com/";
|
138
139
|
|
139
140
|
// src/app/components/Errortext.ts
|
140
141
|
var ErrorText = {
|
@@ -433,7 +434,6 @@ var CustomModal2 = ({
|
|
433
434
|
maxWidth
|
434
435
|
}) => {
|
435
436
|
if (!open) return null;
|
436
|
-
console.log(maxWidth);
|
437
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
438
|
};
|
439
439
|
var CustomModal2_default = CustomModal2;
|
@@ -742,7 +742,6 @@ function RequestPayment(props) {
|
|
742
742
|
window.parent.postMessage(message, "*");
|
743
743
|
}
|
744
744
|
const sendRequestPayment = async () => {
|
745
|
-
debugger;
|
746
745
|
if (Object.keys(errors).length > 0) {
|
747
746
|
return;
|
748
747
|
}
|
@@ -2244,6 +2243,25 @@ var ErrorCardMessage = ({ onClose, error }) => {
|
|
2244
2243
|
};
|
2245
2244
|
var ErrorCardMessage_default = ErrorCardMessage;
|
2246
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
|
+
|
2247
2265
|
// src/app/components/Charge/GetPaymentPage.tsx
|
2248
2266
|
function GetPaymentPage(props) {
|
2249
2267
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
@@ -2453,7 +2471,7 @@ function GetPaymentPage(props) {
|
|
2453
2471
|
return Object.keys(errors).length > 0;
|
2454
2472
|
};
|
2455
2473
|
const submitFunc = async (e) => {
|
2456
|
-
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2
|
2474
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2;
|
2457
2475
|
e.preventDefault();
|
2458
2476
|
if (activetab !== "ach") {
|
2459
2477
|
const hasError = validateCardData();
|
@@ -2481,7 +2499,6 @@ function GetPaymentPage(props) {
|
|
2481
2499
|
});
|
2482
2500
|
const result = await axios3.post(`${baseUrl}create-widget-order`, formData);
|
2483
2501
|
let tokenCallback = async function(response) {
|
2484
|
-
var _a3, _b3, _c3;
|
2485
2502
|
if (response.Error) {
|
2486
2503
|
setError(response.Error);
|
2487
2504
|
setLoading2(false);
|
@@ -2491,25 +2508,38 @@ function GetPaymentPage(props) {
|
|
2491
2508
|
response.name = name;
|
2492
2509
|
response.postal_code = postal_code;
|
2493
2510
|
response.isCardSave = `${saveCardInfo}`;
|
2494
|
-
|
2495
|
-
|
2496
|
-
|
2497
|
-
|
2498
|
-
|
2499
|
-
|
2500
|
-
|
2501
|
-
|
2502
|
-
|
2503
|
-
|
2504
|
-
|
2505
|
-
|
2506
|
-
|
2507
|
-
|
2508
|
-
|
2509
|
-
|
2510
|
-
|
2511
|
-
|
2512
|
-
|
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
|
+
});
|
2513
2543
|
}
|
2514
2544
|
};
|
2515
2545
|
if ((paymentData == null ? void 0 : paymentData.paymentGateway) === 32) {
|
@@ -2541,48 +2571,54 @@ function GetPaymentPage(props) {
|
|
2541
2571
|
session_key: `${(_f2 = (_e2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _e2.data) == null ? void 0 : _f2.session_key}`
|
2542
2572
|
});
|
2543
2573
|
try {
|
2544
|
-
const tokenizeData = await axios3.post(
|
2574
|
+
const tokenizeData = await axios3.post(`${fractalGatewayUrl}tokenizer/tokenize`, raw, { headers: myHeaders });
|
2545
2575
|
const reqData = JSON.stringify(__spreadProps(__spreadValues({}, (_g2 = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _g2.data), {
|
2546
2576
|
isSaveCardChecked: saveCardInfo,
|
2547
2577
|
name: cardData == null ? void 0 : cardData.cardName,
|
2548
2578
|
postal_code: cardData == null ? void 0 : cardData.zipCode,
|
2549
2579
|
customer_id: props == null ? void 0 : props.customerId
|
2550
2580
|
}));
|
2551
|
-
const reqData2 = {
|
2581
|
+
const reqData2 = JSON.stringify({
|
2552
2582
|
"pre_sales_id": `${(_i2 = (_h2 = result == null ? void 0 : result.data) == null ? void 0 : _h2.data) == null ? void 0 : _i2.posSalesIdEncode}`,
|
2553
2583
|
"token": `${(_j2 = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _j2.data.token}`,
|
2554
2584
|
"json_response": `${reqData}`
|
2555
|
-
};
|
2556
|
-
let myHeaders2 = {
|
2585
|
+
});
|
2586
|
+
let myHeaders2 = JSON.stringify({
|
2557
2587
|
"Content-Type": "application/json"
|
2558
|
-
};
|
2559
|
-
const requestOptions2 = __spreadProps(__spreadValues({}, reqData2), {
|
2560
|
-
isChargeviafractal: true
|
2561
2588
|
});
|
2562
|
-
|
2563
|
-
|
2564
|
-
|
2565
|
-
|
2566
|
-
|
2567
|
-
|
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.");
|
2568
2610
|
}
|
2569
|
-
|
2570
|
-
|
2571
|
-
setTranId((_m2 = (_l2 = paymentRes == null ? void 0 : paymentRes.data) == null ? void 0 : _l2.data) == null ? void 0 : _m2.transactionId);
|
2572
|
-
setSuccess(true);
|
2573
|
-
setLoading2(false);
|
2611
|
+
} else {
|
2612
|
+
setError("Something went wrong.");
|
2574
2613
|
}
|
2575
|
-
}
|
2576
|
-
setLoading2(false);
|
2577
|
-
setError(((_o2 = (_n2 = err == null ? void 0 : err.response) == null ? void 0 : _n2.data) == null ? void 0 : _o2.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
|
2578
|
-
}
|
2614
|
+
});
|
2579
2615
|
} catch (err) {
|
2580
2616
|
setLoading2(false);
|
2581
|
-
setError(((
|
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.");
|
2582
2618
|
}
|
2583
2619
|
} catch (err) {
|
2584
2620
|
setLoading2(false);
|
2585
|
-
setError(((
|
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.");
|
2586
2622
|
}
|
2587
2623
|
} else {
|
2588
2624
|
if (typeof DatacapWebToken !== "undefined") {
|
@@ -2591,7 +2627,7 @@ function GetPaymentPage(props) {
|
|
2591
2627
|
}
|
2592
2628
|
} catch (err) {
|
2593
2629
|
setLoading2(false);
|
2594
|
-
setError(((
|
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.");
|
2595
2631
|
}
|
2596
2632
|
}
|
2597
2633
|
}
|
@@ -2613,28 +2649,27 @@ function GetPaymentPage(props) {
|
|
2613
2649
|
order_id: props == null ? void 0 : props.orderID,
|
2614
2650
|
tax: props == null ? void 0 : props.tax,
|
2615
2651
|
discount: props == null ? void 0 : props.discount,
|
2616
|
-
surcharge: props == null ? void 0 : props.surcharge
|
2652
|
+
surcharge: props == null ? void 0 : props.surcharge,
|
2653
|
+
isChargeACH: true
|
2617
2654
|
};
|
2618
|
-
|
2619
|
-
|
2620
|
-
|
2621
|
-
|
2622
|
-
|
2623
|
-
|
2624
|
-
|
2625
|
-
|
2626
|
-
|
2627
|
-
|
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");
|
2628
2666
|
}
|
2629
|
-
});
|
2630
|
-
} catch (error2) {
|
2631
|
-
if (axios3.isAxiosError(error2)) {
|
2632
|
-
setLoading2(false);
|
2633
|
-
setError((_D = (_C = (_y = (_x = (_w = error2.response) == null ? void 0 : _w.data) == null ? void 0 : _x.message) == null ? void 0 : _y.error) != null ? _C : (_B = (_A = (_z = error2.response) == null ? void 0 : _z.data) == null ? void 0 : _A.message) == null ? void 0 : _B.amount) != null ? _D : "Something went wrong");
|
2634
2667
|
} else {
|
2635
|
-
|
2668
|
+
setTranId((_a3 = data == null ? void 0 : data.data) == null ? void 0 : _a3.transaction_id);
|
2669
|
+
setSuccess(true);
|
2670
|
+
setLoading2(false);
|
2636
2671
|
}
|
2637
|
-
}
|
2672
|
+
});
|
2638
2673
|
}
|
2639
2674
|
}
|
2640
2675
|
};
|
@@ -2670,7 +2705,6 @@ function GetPaymentPage(props) {
|
|
2670
2705
|
}
|
2671
2706
|
};
|
2672
2707
|
const handlechargeCustomer = async () => {
|
2673
|
-
var _b2, _c2, _d2, _e2, _f2, _g2, _h2;
|
2674
2708
|
let customer_id = props == null ? void 0 : props.customerId;
|
2675
2709
|
let discount = String(props == null ? void 0 : props.discount);
|
2676
2710
|
let surcharge = String(props == null ? void 0 : props.surcharge);
|
@@ -2701,17 +2735,18 @@ function GetPaymentPage(props) {
|
|
2701
2735
|
"Content-Type": "application/json"
|
2702
2736
|
};
|
2703
2737
|
setLoading2(true);
|
2704
|
-
|
2705
|
-
|
2706
|
-
|
2707
|
-
|
2738
|
+
socketClient_default.emit("sendMessage", { url: chargeurl, body: chargeobj, isChargebycard: true });
|
2739
|
+
socketClient_default.on("charge-by-card", (response) => {
|
2740
|
+
var _a3;
|
2741
|
+
console.log(response, "response");
|
2742
|
+
if ((response == null ? void 0 : response.result) == true || (response == null ? void 0 : response.status) == true) {
|
2743
|
+
setTranId((_a3 = response.data) == null ? void 0 : _a3.transaction_id);
|
2708
2744
|
setSuccess(true);
|
2709
2745
|
setLoading2(false);
|
2746
|
+
} else {
|
2747
|
+
setError((response == null ? void 0 : response.message) || "Something went wrong.");
|
2710
2748
|
}
|
2711
|
-
}
|
2712
|
-
setLoading2(false);
|
2713
|
-
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");
|
2714
|
-
}
|
2749
|
+
});
|
2715
2750
|
} else {
|
2716
2751
|
setError("Please Select A Card/ACH");
|
2717
2752
|
}
|
@@ -3085,7 +3120,7 @@ function PreAuthPayment(props) {
|
|
3085
3120
|
return Object.keys(errors).length > 0;
|
3086
3121
|
};
|
3087
3122
|
const submitFunc = async (e) => {
|
3088
|
-
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s
|
3123
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
|
3089
3124
|
e.preventDefault();
|
3090
3125
|
if (activetab == "card") {
|
3091
3126
|
const hasError = validateCardData();
|
@@ -3103,7 +3138,6 @@ function PreAuthPayment(props) {
|
|
3103
3138
|
setLoading2(true);
|
3104
3139
|
try {
|
3105
3140
|
let tokenCallback = async function(response) {
|
3106
|
-
var _a3, _b3, _c3, _d3;
|
3107
3141
|
if (response.Error) {
|
3108
3142
|
setError(response.Error);
|
3109
3143
|
setLoading2(false);
|
@@ -3123,26 +3157,35 @@ function PreAuthPayment(props) {
|
|
3123
3157
|
response.discount = props == null ? void 0 : props.discount;
|
3124
3158
|
response.tax = props == null ? void 0 : props.tax;
|
3125
3159
|
response.surcharge = props == null ? void 0 : props.surcharge;
|
3126
|
-
|
3127
|
-
|
3128
|
-
|
3129
|
-
|
3130
|
-
|
3131
|
-
|
3132
|
-
|
3133
|
-
|
3134
|
-
|
3135
|
-
|
3136
|
-
|
3137
|
-
|
3138
|
-
|
3139
|
-
|
3140
|
-
|
3141
|
-
|
3142
|
-
|
3143
|
-
|
3144
|
-
|
3145
|
-
|
3160
|
+
const myHeaders = new Headers();
|
3161
|
+
myHeaders.append("Content-Type", "application/json");
|
3162
|
+
const requestOptions = {
|
3163
|
+
method: "POST",
|
3164
|
+
body: JSON.stringify(response),
|
3165
|
+
redirect: "follow"
|
3166
|
+
};
|
3167
|
+
socketClient_default.emit("sendMessage", __spreadProps(__spreadValues({}, requestOptions), { "isChargePreauth": true }));
|
3168
|
+
socketClient_default.on("charge-preauth", (data) => {
|
3169
|
+
var _a3;
|
3170
|
+
console.log(data, "datdata");
|
3171
|
+
if ((data == null ? void 0 : data.status) == "Failed") {
|
3172
|
+
setLoading2(false);
|
3173
|
+
setError((data == null ? void 0 : data.message) || "Something went wrong. Please try again later.");
|
3174
|
+
} else {
|
3175
|
+
setSuccess(true);
|
3176
|
+
setTranId((_a3 = data == null ? void 0 : data.data) == null ? void 0 : _a3.transaction_id);
|
3177
|
+
setLoading2(false);
|
3178
|
+
setCardData({
|
3179
|
+
cardName: "",
|
3180
|
+
cardNumber: "",
|
3181
|
+
expiryMonth: "",
|
3182
|
+
expiryYear: "",
|
3183
|
+
cvv: "",
|
3184
|
+
orderId: "",
|
3185
|
+
zipCode: ""
|
3186
|
+
});
|
3187
|
+
}
|
3188
|
+
});
|
3146
3189
|
}
|
3147
3190
|
};
|
3148
3191
|
if ((paymentData == null ? void 0 : paymentData.paymentGateway) === 32) {
|
@@ -3174,7 +3217,7 @@ function PreAuthPayment(props) {
|
|
3174
3217
|
session_key: `${(_f2 = (_e2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _e2.data) == null ? void 0 : _f2.session_key}`
|
3175
3218
|
});
|
3176
3219
|
try {
|
3177
|
-
const tokenizeData = await axios4.post(
|
3220
|
+
const tokenizeData = await axios4.post(`${fractalGatewayUrl}tokenizer/tokenize`, raw, { headers: myHeaders });
|
3178
3221
|
const reqData = JSON.stringify(__spreadProps(__spreadValues({}, (_g2 = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _g2.data), {
|
3179
3222
|
// isSaveCardChecked: saveCardInfo,
|
3180
3223
|
name: cardData == null ? void 0 : cardData.cardName,
|
@@ -3200,39 +3243,39 @@ function PreAuthPayment(props) {
|
|
3200
3243
|
let myHeaders2 = {
|
3201
3244
|
"Content-Type": "application/json"
|
3202
3245
|
};
|
3203
|
-
|
3204
|
-
|
3205
|
-
|
3206
|
-
|
3207
|
-
|
3208
|
-
|
3209
|
-
|
3210
|
-
|
3211
|
-
|
3212
|
-
if ((
|
3213
|
-
|
3246
|
+
const requestOptions2 = {
|
3247
|
+
method: "POST",
|
3248
|
+
headers: myHeaders2,
|
3249
|
+
body: reqData,
|
3250
|
+
redirect: "follow"
|
3251
|
+
};
|
3252
|
+
socketClient_default.emit("sendMessage", __spreadProps(__spreadValues({}, requestOptions2), { "isFractalPreauth": true }));
|
3253
|
+
socketClient_default.on("fractal-charge-preauth", (data) => {
|
3254
|
+
var _a3;
|
3255
|
+
if ((data == null ? void 0 : data.status) == "Failed") {
|
3256
|
+
setLoading2(false);
|
3257
|
+
setError((data == null ? void 0 : data.message) || "Something went wrong , Try again later");
|
3258
|
+
} else {
|
3259
|
+
setTranId((_a3 = data == null ? void 0 : data.data) == null ? void 0 : _a3.transaction_id);
|
3214
3260
|
setSuccess(true);
|
3215
3261
|
setLoading2(false);
|
3216
3262
|
}
|
3217
|
-
}
|
3218
|
-
setLoading2(false);
|
3219
|
-
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 , Try again later");
|
3220
|
-
}
|
3263
|
+
});
|
3221
3264
|
} catch (err) {
|
3222
3265
|
console.log(err);
|
3223
3266
|
setLoading2(false);
|
3224
|
-
setError(((
|
3267
|
+
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");
|
3225
3268
|
}
|
3226
3269
|
} catch (err) {
|
3227
3270
|
setLoading2(false);
|
3228
|
-
setError(((
|
3271
|
+
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");
|
3229
3272
|
}
|
3230
3273
|
} else {
|
3231
3274
|
DatacapWebToken.requestToken(paymentData == null ? void 0 : paymentData.dctoken, "PaymentForm", tokenCallback);
|
3232
3275
|
}
|
3233
3276
|
} catch (err) {
|
3234
3277
|
setLoading2(false);
|
3235
|
-
setError(((
|
3278
|
+
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.");
|
3236
3279
|
}
|
3237
3280
|
}
|
3238
3281
|
}
|
@@ -3978,7 +4021,7 @@ function AddCard(props) {
|
|
3978
4021
|
}));
|
3979
4022
|
};
|
3980
4023
|
const validateCardData = () => {
|
3981
|
-
var _a2, _b, _c, _d, _e, _f
|
4024
|
+
var _a2, _b, _c, _d, _e, _f;
|
3982
4025
|
const errors = {};
|
3983
4026
|
const data = cardData;
|
3984
4027
|
const month = parseInt((data == null ? void 0 : data.expiryMonth) || "", 10);
|
@@ -3998,7 +4041,6 @@ function AddCard(props) {
|
|
3998
4041
|
errors.expiryMonth = "Invalid Expiration Date.";
|
3999
4042
|
}
|
4000
4043
|
if (!((_f = data == null ? void 0 : data.cvv) == null ? void 0 : _f.trim())) errors.cvv = "CVC is required";
|
4001
|
-
if (!((_g = data == null ? void 0 : data.zipCode) == null ? void 0 : _g.trim())) errors.zipCode = "ZIP code is required";
|
4002
4044
|
if ((data == null ? void 0 : data.expiryMonth) && (data == null ? void 0 : data.expiryYear) && data.expiryMonth.length <= 2 && data.expiryYear.length === 4) {
|
4003
4045
|
const month2 = parseInt(data.expiryMonth, 10);
|
4004
4046
|
const year2 = parseInt(data.expiryYear, 10);
|
@@ -4128,7 +4170,7 @@ function AddCard(props) {
|
|
4128
4170
|
session_key: `${(_f = (_e = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _e.data) == null ? void 0 : _f.session_key}`
|
4129
4171
|
});
|
4130
4172
|
try {
|
4131
|
-
const tokenizeData = await axios5.post(
|
4173
|
+
const tokenizeData = await axios5.post(`${fractalGatewayUrl}tokenizer/tokenize`, raw, { headers: myHeaders });
|
4132
4174
|
const reqData = JSON.stringify(__spreadProps(__spreadValues({}, (_g = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _g.data), {
|
4133
4175
|
cvv: cardData == null ? void 0 : cardData.cvv,
|
4134
4176
|
cardName: cardData == null ? void 0 : cardData.cardName,
|
@@ -4365,7 +4407,7 @@ function AddCardEasyPay(props) {
|
|
4365
4407
|
}));
|
4366
4408
|
};
|
4367
4409
|
const validateCardData = () => {
|
4368
|
-
var _a2, _b, _c, _d, _e, _f
|
4410
|
+
var _a2, _b, _c, _d, _e, _f;
|
4369
4411
|
const errors = {};
|
4370
4412
|
const data = cardData;
|
4371
4413
|
const month = parseInt((data == null ? void 0 : data.expiryMonth) || "", 10);
|
@@ -4385,7 +4427,6 @@ function AddCardEasyPay(props) {
|
|
4385
4427
|
errors.expiryMonth = "Invalid Expiration Date.";
|
4386
4428
|
}
|
4387
4429
|
if (!((_f = data == null ? void 0 : data.cvv) == null ? void 0 : _f.trim())) errors.cvv = "CVC is required";
|
4388
|
-
if (!((_g = data == null ? void 0 : data.zipCode) == null ? void 0 : _g.trim())) errors.zipCode = "ZIP code is required";
|
4389
4430
|
if ((data == null ? void 0 : data.expiryMonth) && (data == null ? void 0 : data.expiryYear) && data.expiryMonth.length <= 2 && data.expiryYear.length === 4) {
|
4390
4431
|
const month2 = parseInt(data.expiryMonth, 10);
|
4391
4432
|
const year2 = parseInt(data.expiryYear, 10);
|
@@ -4433,7 +4474,6 @@ function AddCardEasyPay(props) {
|
|
4433
4474
|
e.preventDefault();
|
4434
4475
|
const hasError = validateCardData();
|
4435
4476
|
console.log(cardData);
|
4436
|
-
debugger;
|
4437
4477
|
if (hasError) return;
|
4438
4478
|
else {
|
4439
4479
|
let validCard = DatacapWebToken.validateCardNumber(cardData == null ? void 0 : cardData.cardNumber.replaceAll(" ", ""));
|
@@ -4529,7 +4569,7 @@ function AddCardEasyPay(props) {
|
|
4529
4569
|
session_key: `${(_f = (_e = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _e.data) == null ? void 0 : _f.session_key}`
|
4530
4570
|
});
|
4531
4571
|
try {
|
4532
|
-
const tokenizeData = await axios6.post(
|
4572
|
+
const tokenizeData = await axios6.post(`${fractalGatewayUrl}tokenizer/tokenize`, raw, { headers: myHeaders });
|
4533
4573
|
const reqData = JSON.stringify(__spreadProps(__spreadValues({}, (_g = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _g.data), {
|
4534
4574
|
cvv: cardData == null ? void 0 : cardData.cvv,
|
4535
4575
|
cardName: cardData == null ? void 0 : cardData.cardName,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@pinerohit11/testwidget",
|
3
|
-
"version": "0.2.
|
3
|
+
"version": "0.2.126",
|
4
4
|
"private": false,
|
5
5
|
"scripts": {
|
6
6
|
"dev": "next dev -p 4001",
|
@@ -25,6 +25,7 @@
|
|
25
25
|
"react-icons": "^5.5.0",
|
26
26
|
"react-number-format": "^5.4.3",
|
27
27
|
"react-toastify": "^10.0.6",
|
28
|
+
"socket.io-client": "^4.8.1",
|
28
29
|
"styled-components": "^6.1.15",
|
29
30
|
"sweetalert2": "^11.22.0",
|
30
31
|
"yup": "^1.6.1"
|