@pinerohit11/testwidget 0.2.124 → 0.2.125
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 -117
- package/dist/index.mjs +163 -117
- 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;
|
@@ -2282,6 +2282,25 @@ var ErrorCardMessage = ({ onClose, error }) => {
|
|
2282
2282
|
};
|
2283
2283
|
var ErrorCardMessage_default = ErrorCardMessage;
|
2284
2284
|
|
2285
|
+
// src/app/components/socketClient.js
|
2286
|
+
var import_socket = require("socket.io-client");
|
2287
|
+
var socket = (0, import_socket.io)(baseUrl, {
|
2288
|
+
transports: ["websocket"],
|
2289
|
+
// Optional: force WebSocket
|
2290
|
+
withCredentials: false
|
2291
|
+
});
|
2292
|
+
var socketClient_default = socket;
|
2293
|
+
|
2294
|
+
// src/app/utils/Common.js
|
2295
|
+
var isValidJson = (jsonString) => {
|
2296
|
+
try {
|
2297
|
+
const parsed = JSON.parse(jsonString);
|
2298
|
+
return typeof parsed === "object" && parsed !== null;
|
2299
|
+
} catch (e) {
|
2300
|
+
return false;
|
2301
|
+
}
|
2302
|
+
};
|
2303
|
+
|
2285
2304
|
// src/app/components/Charge/GetPaymentPage.tsx
|
2286
2305
|
function GetPaymentPage(props) {
|
2287
2306
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
@@ -2491,7 +2510,7 @@ function GetPaymentPage(props) {
|
|
2491
2510
|
return Object.keys(errors).length > 0;
|
2492
2511
|
};
|
2493
2512
|
const submitFunc = async (e) => {
|
2494
|
-
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2
|
2513
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2;
|
2495
2514
|
e.preventDefault();
|
2496
2515
|
if (activetab !== "ach") {
|
2497
2516
|
const hasError = validateCardData();
|
@@ -2519,7 +2538,6 @@ function GetPaymentPage(props) {
|
|
2519
2538
|
});
|
2520
2539
|
const result = await import_axios3.default.post(`${baseUrl}create-widget-order`, formData);
|
2521
2540
|
let tokenCallback = async function(response) {
|
2522
|
-
var _a3, _b3, _c3;
|
2523
2541
|
if (response.Error) {
|
2524
2542
|
setError(response.Error);
|
2525
2543
|
setLoading2(false);
|
@@ -2529,25 +2547,38 @@ function GetPaymentPage(props) {
|
|
2529
2547
|
response.name = name;
|
2530
2548
|
response.postal_code = postal_code;
|
2531
2549
|
response.isCardSave = `${saveCardInfo}`;
|
2532
|
-
|
2533
|
-
|
2534
|
-
|
2535
|
-
|
2536
|
-
|
2537
|
-
|
2538
|
-
|
2539
|
-
|
2540
|
-
|
2541
|
-
|
2542
|
-
|
2543
|
-
|
2544
|
-
|
2545
|
-
|
2546
|
-
|
2547
|
-
|
2548
|
-
|
2549
|
-
|
2550
|
-
|
2550
|
+
response.isCharge = true;
|
2551
|
+
response.posSalesIdEncode = result == null ? void 0 : result.data.data.posSalesIdEncode;
|
2552
|
+
console.log(response, "resppp");
|
2553
|
+
console.log(result == null ? void 0 : result.data.data.posSalesIdEncode, "fkjdashgfuh");
|
2554
|
+
socketClient_default.emit("sendMessage", response);
|
2555
|
+
socketClient_default.on(result == null ? void 0 : result.data.data.posSalesIdEncode, (data) => {
|
2556
|
+
console.log(data, "socket data");
|
2557
|
+
if (isValidJson(data == null ? void 0 : data.data)) {
|
2558
|
+
let apiResponse = JSON.parse(data.data);
|
2559
|
+
console.log("return data : ", apiResponse);
|
2560
|
+
if (apiResponse == null ? void 0 : apiResponse.result) {
|
2561
|
+
setCardData({
|
2562
|
+
cardName: "",
|
2563
|
+
cardNumber: "",
|
2564
|
+
expiryMonth: "",
|
2565
|
+
expiryYear: "",
|
2566
|
+
cvv: "",
|
2567
|
+
orderId: "",
|
2568
|
+
zipCode: ""
|
2569
|
+
});
|
2570
|
+
setSaveCardInfo(false);
|
2571
|
+
setTranId(apiResponse == null ? void 0 : apiResponse.transactionId);
|
2572
|
+
setSuccess(true);
|
2573
|
+
setLoading2(false);
|
2574
|
+
} else {
|
2575
|
+
setLoading2(false);
|
2576
|
+
setError((apiResponse == null ? void 0 : apiResponse.message) || "Something went wrong.");
|
2577
|
+
}
|
2578
|
+
} else {
|
2579
|
+
setError("Something went wrong.");
|
2580
|
+
}
|
2581
|
+
});
|
2551
2582
|
}
|
2552
2583
|
};
|
2553
2584
|
if ((paymentData == null ? void 0 : paymentData.paymentGateway) === 32) {
|
@@ -2579,48 +2610,54 @@ function GetPaymentPage(props) {
|
|
2579
2610
|
session_key: `${(_f2 = (_e2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _e2.data) == null ? void 0 : _f2.session_key}`
|
2580
2611
|
});
|
2581
2612
|
try {
|
2582
|
-
const tokenizeData = await import_axios3.default.post(
|
2613
|
+
const tokenizeData = await import_axios3.default.post(`${fractalGatewayUrl}tokenizer/tokenize`, raw, { headers: myHeaders });
|
2583
2614
|
const reqData = JSON.stringify(__spreadProps(__spreadValues({}, (_g2 = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _g2.data), {
|
2584
2615
|
isSaveCardChecked: saveCardInfo,
|
2585
2616
|
name: cardData == null ? void 0 : cardData.cardName,
|
2586
2617
|
postal_code: cardData == null ? void 0 : cardData.zipCode,
|
2587
2618
|
customer_id: props == null ? void 0 : props.customerId
|
2588
2619
|
}));
|
2589
|
-
const reqData2 = {
|
2620
|
+
const reqData2 = JSON.stringify({
|
2590
2621
|
"pre_sales_id": `${(_i2 = (_h2 = result == null ? void 0 : result.data) == null ? void 0 : _h2.data) == null ? void 0 : _i2.posSalesIdEncode}`,
|
2591
2622
|
"token": `${(_j2 = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _j2.data.token}`,
|
2592
2623
|
"json_response": `${reqData}`
|
2593
|
-
};
|
2594
|
-
let myHeaders2 = {
|
2624
|
+
});
|
2625
|
+
let myHeaders2 = JSON.stringify({
|
2595
2626
|
"Content-Type": "application/json"
|
2596
|
-
};
|
2597
|
-
const requestOptions2 = __spreadProps(__spreadValues({}, reqData2), {
|
2598
|
-
isChargeviafractal: true
|
2599
2627
|
});
|
2600
|
-
|
2601
|
-
|
2602
|
-
|
2603
|
-
|
2604
|
-
|
2605
|
-
|
2628
|
+
const requestOptions2 = {
|
2629
|
+
method: "POST",
|
2630
|
+
headers: myHeaders2,
|
2631
|
+
body: reqData2,
|
2632
|
+
redirect: "follow",
|
2633
|
+
isChargeviafractal: true
|
2634
|
+
};
|
2635
|
+
socketClient_default.emit("sendMessage", requestOptions2);
|
2636
|
+
socketClient_default.on("chargeviafractalgateway", (data) => {
|
2637
|
+
var _a3;
|
2638
|
+
console.log(data, "socket data");
|
2639
|
+
if (isValidJson(data == null ? void 0 : data.data)) {
|
2640
|
+
let paymentRes = JSON.parse(data == null ? void 0 : data.data);
|
2641
|
+
console.log(paymentRes, "dfuigdasuf");
|
2642
|
+
if (paymentRes == null ? void 0 : paymentRes.result) {
|
2643
|
+
setTranId((_a3 = paymentRes == null ? void 0 : paymentRes.data) == null ? void 0 : _a3.transactionId);
|
2644
|
+
setSuccess(true);
|
2645
|
+
setLoading2(false);
|
2646
|
+
} else {
|
2647
|
+
setLoading2(false);
|
2648
|
+
setError((paymentRes == null ? void 0 : paymentRes.message) || "Something went wrong.");
|
2606
2649
|
}
|
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);
|
2650
|
+
} else {
|
2651
|
+
setError("Something went wrong.");
|
2612
2652
|
}
|
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
|
-
}
|
2653
|
+
});
|
2617
2654
|
} catch (err) {
|
2618
2655
|
setLoading2(false);
|
2619
|
-
setError(((
|
2656
|
+
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
2657
|
}
|
2621
2658
|
} catch (err) {
|
2622
2659
|
setLoading2(false);
|
2623
|
-
setError(((
|
2660
|
+
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
2661
|
}
|
2625
2662
|
} else {
|
2626
2663
|
if (typeof DatacapWebToken !== "undefined") {
|
@@ -2629,7 +2666,7 @@ function GetPaymentPage(props) {
|
|
2629
2666
|
}
|
2630
2667
|
} catch (err) {
|
2631
2668
|
setLoading2(false);
|
2632
|
-
setError(((
|
2669
|
+
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
2670
|
}
|
2634
2671
|
}
|
2635
2672
|
}
|
@@ -2651,28 +2688,28 @@ function GetPaymentPage(props) {
|
|
2651
2688
|
order_id: props == null ? void 0 : props.orderID,
|
2652
2689
|
tax: props == null ? void 0 : props.tax,
|
2653
2690
|
discount: props == null ? void 0 : props.discount,
|
2654
|
-
surcharge: props == null ? void 0 : props.surcharge
|
2691
|
+
surcharge: props == null ? void 0 : props.surcharge,
|
2692
|
+
isChargeACH: true
|
2655
2693
|
};
|
2656
|
-
|
2657
|
-
|
2658
|
-
|
2659
|
-
|
2660
|
-
|
2661
|
-
|
2662
|
-
|
2663
|
-
|
2664
|
-
|
2665
|
-
|
2694
|
+
socketClient_default.emit("sendMessage", dataForm);
|
2695
|
+
socketClient_default.on("ach-incoming", (data) => {
|
2696
|
+
var _a3;
|
2697
|
+
debugger;
|
2698
|
+
console.log(data, "sfhdwhf");
|
2699
|
+
if ((data == null ? void 0 : data.status) == "Failed") {
|
2700
|
+
if (typeof (data == null ? void 0 : data.message) == "object") {
|
2701
|
+
Object.values(data == null ? void 0 : data.message).forEach((message) => {
|
2702
|
+
setError(message || "Something went wrong");
|
2703
|
+
});
|
2704
|
+
} else {
|
2705
|
+
setError((data == null ? void 0 : data.message) || "Something went wrong");
|
2666
2706
|
}
|
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
2707
|
} else {
|
2673
|
-
|
2708
|
+
setTranId((_a3 = data == null ? void 0 : data.data) == null ? void 0 : _a3.transaction_id);
|
2709
|
+
setSuccess(true);
|
2710
|
+
setLoading2(false);
|
2674
2711
|
}
|
2675
|
-
}
|
2712
|
+
});
|
2676
2713
|
}
|
2677
2714
|
}
|
2678
2715
|
};
|
@@ -2708,7 +2745,6 @@ function GetPaymentPage(props) {
|
|
2708
2745
|
}
|
2709
2746
|
};
|
2710
2747
|
const handlechargeCustomer = async () => {
|
2711
|
-
var _b2, _c2, _d2, _e2, _f2, _g2, _h2;
|
2712
2748
|
let customer_id = props == null ? void 0 : props.customerId;
|
2713
2749
|
let discount = String(props == null ? void 0 : props.discount);
|
2714
2750
|
let surcharge = String(props == null ? void 0 : props.surcharge);
|
@@ -2739,17 +2775,19 @@ function GetPaymentPage(props) {
|
|
2739
2775
|
"Content-Type": "application/json"
|
2740
2776
|
};
|
2741
2777
|
setLoading2(true);
|
2742
|
-
|
2743
|
-
|
2744
|
-
|
2745
|
-
|
2778
|
+
socketClient_default.emit("sendMessage", { url: chargeurl, body: chargeobj, isChargebycard: true });
|
2779
|
+
socketClient_default.on("charge-by-card", (response) => {
|
2780
|
+
var _a3;
|
2781
|
+
debugger;
|
2782
|
+
console.log(response, "response");
|
2783
|
+
if ((response == null ? void 0 : response.result) == true || (response == null ? void 0 : response.status) == true) {
|
2784
|
+
setTranId((_a3 = response.data) == null ? void 0 : _a3.transaction_id);
|
2746
2785
|
setSuccess(true);
|
2747
2786
|
setLoading2(false);
|
2787
|
+
} else {
|
2788
|
+
setError((response == null ? void 0 : response.message) || "Something went wrong.");
|
2748
2789
|
}
|
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
|
-
}
|
2790
|
+
});
|
2753
2791
|
} else {
|
2754
2792
|
setError("Please Select A Card/ACH");
|
2755
2793
|
}
|
@@ -3123,7 +3161,7 @@ function PreAuthPayment(props) {
|
|
3123
3161
|
return Object.keys(errors).length > 0;
|
3124
3162
|
};
|
3125
3163
|
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
|
3164
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
|
3127
3165
|
e.preventDefault();
|
3128
3166
|
if (activetab == "card") {
|
3129
3167
|
const hasError = validateCardData();
|
@@ -3141,7 +3179,6 @@ function PreAuthPayment(props) {
|
|
3141
3179
|
setLoading2(true);
|
3142
3180
|
try {
|
3143
3181
|
let tokenCallback = async function(response) {
|
3144
|
-
var _a3, _b3, _c3, _d3;
|
3145
3182
|
if (response.Error) {
|
3146
3183
|
setError(response.Error);
|
3147
3184
|
setLoading2(false);
|
@@ -3161,26 +3198,35 @@ function PreAuthPayment(props) {
|
|
3161
3198
|
response.discount = props == null ? void 0 : props.discount;
|
3162
3199
|
response.tax = props == null ? void 0 : props.tax;
|
3163
3200
|
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
|
-
|
3201
|
+
const myHeaders = new Headers();
|
3202
|
+
myHeaders.append("Content-Type", "application/json");
|
3203
|
+
const requestOptions = {
|
3204
|
+
method: "POST",
|
3205
|
+
body: JSON.stringify(response),
|
3206
|
+
redirect: "follow"
|
3207
|
+
};
|
3208
|
+
socketClient_default.emit("sendMessage", __spreadProps(__spreadValues({}, requestOptions), { "isChargePreauth": true }));
|
3209
|
+
socketClient_default.on("charge-preauth", (data) => {
|
3210
|
+
var _a3;
|
3211
|
+
console.log(data, "datdata");
|
3212
|
+
if ((data == null ? void 0 : data.status) == "Failed") {
|
3213
|
+
setLoading2(false);
|
3214
|
+
setError((data == null ? void 0 : data.message) || "Something went wrong. Please try again later.");
|
3215
|
+
} else {
|
3216
|
+
setSuccess(true);
|
3217
|
+
setTranId((_a3 = data == null ? void 0 : data.data) == null ? void 0 : _a3.transaction_id);
|
3218
|
+
setLoading2(false);
|
3219
|
+
setCardData({
|
3220
|
+
cardName: "",
|
3221
|
+
cardNumber: "",
|
3222
|
+
expiryMonth: "",
|
3223
|
+
expiryYear: "",
|
3224
|
+
cvv: "",
|
3225
|
+
orderId: "",
|
3226
|
+
zipCode: ""
|
3227
|
+
});
|
3228
|
+
}
|
3229
|
+
});
|
3184
3230
|
}
|
3185
3231
|
};
|
3186
3232
|
if ((paymentData == null ? void 0 : paymentData.paymentGateway) === 32) {
|
@@ -3212,7 +3258,7 @@ function PreAuthPayment(props) {
|
|
3212
3258
|
session_key: `${(_f2 = (_e2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _e2.data) == null ? void 0 : _f2.session_key}`
|
3213
3259
|
});
|
3214
3260
|
try {
|
3215
|
-
const tokenizeData = await import_axios4.default.post(
|
3261
|
+
const tokenizeData = await import_axios4.default.post(`${fractalGatewayUrl}tokenizer/tokenize`, raw, { headers: myHeaders });
|
3216
3262
|
const reqData = JSON.stringify(__spreadProps(__spreadValues({}, (_g2 = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _g2.data), {
|
3217
3263
|
// isSaveCardChecked: saveCardInfo,
|
3218
3264
|
name: cardData == null ? void 0 : cardData.cardName,
|
@@ -3238,39 +3284,39 @@ function PreAuthPayment(props) {
|
|
3238
3284
|
let myHeaders2 = {
|
3239
3285
|
"Content-Type": "application/json"
|
3240
3286
|
};
|
3241
|
-
|
3242
|
-
|
3243
|
-
|
3244
|
-
|
3245
|
-
|
3246
|
-
|
3247
|
-
|
3248
|
-
|
3249
|
-
|
3250
|
-
if ((
|
3251
|
-
|
3287
|
+
const requestOptions2 = {
|
3288
|
+
method: "POST",
|
3289
|
+
headers: myHeaders2,
|
3290
|
+
body: reqData,
|
3291
|
+
redirect: "follow"
|
3292
|
+
};
|
3293
|
+
socketClient_default.emit("sendMessage", __spreadProps(__spreadValues({}, requestOptions2), { "isFractalPreauth": true }));
|
3294
|
+
socketClient_default.on("fractal-charge-preauth", (data) => {
|
3295
|
+
var _a3;
|
3296
|
+
if ((data == null ? void 0 : data.status) == "Failed") {
|
3297
|
+
setLoading2(false);
|
3298
|
+
setError((data == null ? void 0 : data.message) || "Something went wrong , Try again later");
|
3299
|
+
} else {
|
3300
|
+
setTranId((_a3 = data == null ? void 0 : data.data) == null ? void 0 : _a3.transaction_id);
|
3252
3301
|
setSuccess(true);
|
3253
3302
|
setLoading2(false);
|
3254
3303
|
}
|
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
|
-
}
|
3304
|
+
});
|
3259
3305
|
} catch (err) {
|
3260
3306
|
console.log(err);
|
3261
3307
|
setLoading2(false);
|
3262
|
-
setError(((
|
3308
|
+
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
3309
|
}
|
3264
3310
|
} catch (err) {
|
3265
3311
|
setLoading2(false);
|
3266
|
-
setError(((
|
3312
|
+
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
3313
|
}
|
3268
3314
|
} else {
|
3269
3315
|
DatacapWebToken.requestToken(paymentData == null ? void 0 : paymentData.dctoken, "PaymentForm", tokenCallback);
|
3270
3316
|
}
|
3271
3317
|
} catch (err) {
|
3272
3318
|
setLoading2(false);
|
3273
|
-
setError(((
|
3319
|
+
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
3320
|
}
|
3275
3321
|
}
|
3276
3322
|
}
|
@@ -4166,7 +4212,7 @@ function AddCard(props) {
|
|
4166
4212
|
session_key: `${(_f = (_e = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _e.data) == null ? void 0 : _f.session_key}`
|
4167
4213
|
});
|
4168
4214
|
try {
|
4169
|
-
const tokenizeData = await import_axios5.default.post(
|
4215
|
+
const tokenizeData = await import_axios5.default.post(`${fractalGatewayUrl}tokenizer/tokenize`, raw, { headers: myHeaders });
|
4170
4216
|
const reqData = JSON.stringify(__spreadProps(__spreadValues({}, (_g = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _g.data), {
|
4171
4217
|
cvv: cardData == null ? void 0 : cardData.cvv,
|
4172
4218
|
cardName: cardData == null ? void 0 : cardData.cardName,
|
@@ -4567,7 +4613,7 @@ function AddCardEasyPay(props) {
|
|
4567
4613
|
session_key: `${(_f = (_e = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _e.data) == null ? void 0 : _f.session_key}`
|
4568
4614
|
});
|
4569
4615
|
try {
|
4570
|
-
const tokenizeData = await import_axios6.default.post(
|
4616
|
+
const tokenizeData = await import_axios6.default.post(`${fractalGatewayUrl}tokenizer/tokenize`, raw, { headers: myHeaders });
|
4571
4617
|
const reqData = JSON.stringify(__spreadProps(__spreadValues({}, (_g = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _g.data), {
|
4572
4618
|
cvv: cardData == null ? void 0 : cardData.cvv,
|
4573
4619
|
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;
|
@@ -2244,6 +2244,25 @@ var ErrorCardMessage = ({ onClose, error }) => {
|
|
2244
2244
|
};
|
2245
2245
|
var ErrorCardMessage_default = ErrorCardMessage;
|
2246
2246
|
|
2247
|
+
// src/app/components/socketClient.js
|
2248
|
+
import { io } from "socket.io-client";
|
2249
|
+
var socket = io(baseUrl, {
|
2250
|
+
transports: ["websocket"],
|
2251
|
+
// Optional: force WebSocket
|
2252
|
+
withCredentials: false
|
2253
|
+
});
|
2254
|
+
var socketClient_default = socket;
|
2255
|
+
|
2256
|
+
// src/app/utils/Common.js
|
2257
|
+
var isValidJson = (jsonString) => {
|
2258
|
+
try {
|
2259
|
+
const parsed = JSON.parse(jsonString);
|
2260
|
+
return typeof parsed === "object" && parsed !== null;
|
2261
|
+
} catch (e) {
|
2262
|
+
return false;
|
2263
|
+
}
|
2264
|
+
};
|
2265
|
+
|
2247
2266
|
// src/app/components/Charge/GetPaymentPage.tsx
|
2248
2267
|
function GetPaymentPage(props) {
|
2249
2268
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
@@ -2453,7 +2472,7 @@ function GetPaymentPage(props) {
|
|
2453
2472
|
return Object.keys(errors).length > 0;
|
2454
2473
|
};
|
2455
2474
|
const submitFunc = async (e) => {
|
2456
|
-
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2
|
2475
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2;
|
2457
2476
|
e.preventDefault();
|
2458
2477
|
if (activetab !== "ach") {
|
2459
2478
|
const hasError = validateCardData();
|
@@ -2481,7 +2500,6 @@ function GetPaymentPage(props) {
|
|
2481
2500
|
});
|
2482
2501
|
const result = await axios3.post(`${baseUrl}create-widget-order`, formData);
|
2483
2502
|
let tokenCallback = async function(response) {
|
2484
|
-
var _a3, _b3, _c3;
|
2485
2503
|
if (response.Error) {
|
2486
2504
|
setError(response.Error);
|
2487
2505
|
setLoading2(false);
|
@@ -2491,25 +2509,38 @@ function GetPaymentPage(props) {
|
|
2491
2509
|
response.name = name;
|
2492
2510
|
response.postal_code = postal_code;
|
2493
2511
|
response.isCardSave = `${saveCardInfo}`;
|
2494
|
-
|
2495
|
-
|
2496
|
-
|
2497
|
-
|
2498
|
-
|
2499
|
-
|
2500
|
-
|
2501
|
-
|
2502
|
-
|
2503
|
-
|
2504
|
-
|
2505
|
-
|
2506
|
-
|
2507
|
-
|
2508
|
-
|
2509
|
-
|
2510
|
-
|
2511
|
-
|
2512
|
-
|
2512
|
+
response.isCharge = true;
|
2513
|
+
response.posSalesIdEncode = result == null ? void 0 : result.data.data.posSalesIdEncode;
|
2514
|
+
console.log(response, "resppp");
|
2515
|
+
console.log(result == null ? void 0 : result.data.data.posSalesIdEncode, "fkjdashgfuh");
|
2516
|
+
socketClient_default.emit("sendMessage", response);
|
2517
|
+
socketClient_default.on(result == null ? void 0 : result.data.data.posSalesIdEncode, (data) => {
|
2518
|
+
console.log(data, "socket data");
|
2519
|
+
if (isValidJson(data == null ? void 0 : data.data)) {
|
2520
|
+
let apiResponse = JSON.parse(data.data);
|
2521
|
+
console.log("return data : ", apiResponse);
|
2522
|
+
if (apiResponse == null ? void 0 : apiResponse.result) {
|
2523
|
+
setCardData({
|
2524
|
+
cardName: "",
|
2525
|
+
cardNumber: "",
|
2526
|
+
expiryMonth: "",
|
2527
|
+
expiryYear: "",
|
2528
|
+
cvv: "",
|
2529
|
+
orderId: "",
|
2530
|
+
zipCode: ""
|
2531
|
+
});
|
2532
|
+
setSaveCardInfo(false);
|
2533
|
+
setTranId(apiResponse == null ? void 0 : apiResponse.transactionId);
|
2534
|
+
setSuccess(true);
|
2535
|
+
setLoading2(false);
|
2536
|
+
} else {
|
2537
|
+
setLoading2(false);
|
2538
|
+
setError((apiResponse == null ? void 0 : apiResponse.message) || "Something went wrong.");
|
2539
|
+
}
|
2540
|
+
} else {
|
2541
|
+
setError("Something went wrong.");
|
2542
|
+
}
|
2543
|
+
});
|
2513
2544
|
}
|
2514
2545
|
};
|
2515
2546
|
if ((paymentData == null ? void 0 : paymentData.paymentGateway) === 32) {
|
@@ -2541,48 +2572,54 @@ function GetPaymentPage(props) {
|
|
2541
2572
|
session_key: `${(_f2 = (_e2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _e2.data) == null ? void 0 : _f2.session_key}`
|
2542
2573
|
});
|
2543
2574
|
try {
|
2544
|
-
const tokenizeData = await axios3.post(
|
2575
|
+
const tokenizeData = await axios3.post(`${fractalGatewayUrl}tokenizer/tokenize`, raw, { headers: myHeaders });
|
2545
2576
|
const reqData = JSON.stringify(__spreadProps(__spreadValues({}, (_g2 = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _g2.data), {
|
2546
2577
|
isSaveCardChecked: saveCardInfo,
|
2547
2578
|
name: cardData == null ? void 0 : cardData.cardName,
|
2548
2579
|
postal_code: cardData == null ? void 0 : cardData.zipCode,
|
2549
2580
|
customer_id: props == null ? void 0 : props.customerId
|
2550
2581
|
}));
|
2551
|
-
const reqData2 = {
|
2582
|
+
const reqData2 = JSON.stringify({
|
2552
2583
|
"pre_sales_id": `${(_i2 = (_h2 = result == null ? void 0 : result.data) == null ? void 0 : _h2.data) == null ? void 0 : _i2.posSalesIdEncode}`,
|
2553
2584
|
"token": `${(_j2 = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _j2.data.token}`,
|
2554
2585
|
"json_response": `${reqData}`
|
2555
|
-
};
|
2556
|
-
let myHeaders2 = {
|
2586
|
+
});
|
2587
|
+
let myHeaders2 = JSON.stringify({
|
2557
2588
|
"Content-Type": "application/json"
|
2558
|
-
};
|
2559
|
-
const requestOptions2 = __spreadProps(__spreadValues({}, reqData2), {
|
2560
|
-
isChargeviafractal: true
|
2561
2589
|
});
|
2562
|
-
|
2563
|
-
|
2564
|
-
|
2565
|
-
|
2566
|
-
|
2567
|
-
|
2590
|
+
const requestOptions2 = {
|
2591
|
+
method: "POST",
|
2592
|
+
headers: myHeaders2,
|
2593
|
+
body: reqData2,
|
2594
|
+
redirect: "follow",
|
2595
|
+
isChargeviafractal: true
|
2596
|
+
};
|
2597
|
+
socketClient_default.emit("sendMessage", requestOptions2);
|
2598
|
+
socketClient_default.on("chargeviafractalgateway", (data) => {
|
2599
|
+
var _a3;
|
2600
|
+
console.log(data, "socket data");
|
2601
|
+
if (isValidJson(data == null ? void 0 : data.data)) {
|
2602
|
+
let paymentRes = JSON.parse(data == null ? void 0 : data.data);
|
2603
|
+
console.log(paymentRes, "dfuigdasuf");
|
2604
|
+
if (paymentRes == null ? void 0 : paymentRes.result) {
|
2605
|
+
setTranId((_a3 = paymentRes == null ? void 0 : paymentRes.data) == null ? void 0 : _a3.transactionId);
|
2606
|
+
setSuccess(true);
|
2607
|
+
setLoading2(false);
|
2608
|
+
} else {
|
2609
|
+
setLoading2(false);
|
2610
|
+
setError((paymentRes == null ? void 0 : paymentRes.message) || "Something went wrong.");
|
2568
2611
|
}
|
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);
|
2612
|
+
} else {
|
2613
|
+
setError("Something went wrong.");
|
2574
2614
|
}
|
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
|
-
}
|
2615
|
+
});
|
2579
2616
|
} catch (err) {
|
2580
2617
|
setLoading2(false);
|
2581
|
-
setError(((
|
2618
|
+
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
2619
|
}
|
2583
2620
|
} catch (err) {
|
2584
2621
|
setLoading2(false);
|
2585
|
-
setError(((
|
2622
|
+
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
2623
|
}
|
2587
2624
|
} else {
|
2588
2625
|
if (typeof DatacapWebToken !== "undefined") {
|
@@ -2591,7 +2628,7 @@ function GetPaymentPage(props) {
|
|
2591
2628
|
}
|
2592
2629
|
} catch (err) {
|
2593
2630
|
setLoading2(false);
|
2594
|
-
setError(((
|
2631
|
+
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
2632
|
}
|
2596
2633
|
}
|
2597
2634
|
}
|
@@ -2613,28 +2650,28 @@ function GetPaymentPage(props) {
|
|
2613
2650
|
order_id: props == null ? void 0 : props.orderID,
|
2614
2651
|
tax: props == null ? void 0 : props.tax,
|
2615
2652
|
discount: props == null ? void 0 : props.discount,
|
2616
|
-
surcharge: props == null ? void 0 : props.surcharge
|
2653
|
+
surcharge: props == null ? void 0 : props.surcharge,
|
2654
|
+
isChargeACH: true
|
2617
2655
|
};
|
2618
|
-
|
2619
|
-
|
2620
|
-
|
2621
|
-
|
2622
|
-
|
2623
|
-
|
2624
|
-
|
2625
|
-
|
2626
|
-
|
2627
|
-
|
2656
|
+
socketClient_default.emit("sendMessage", dataForm);
|
2657
|
+
socketClient_default.on("ach-incoming", (data) => {
|
2658
|
+
var _a3;
|
2659
|
+
debugger;
|
2660
|
+
console.log(data, "sfhdwhf");
|
2661
|
+
if ((data == null ? void 0 : data.status) == "Failed") {
|
2662
|
+
if (typeof (data == null ? void 0 : data.message) == "object") {
|
2663
|
+
Object.values(data == null ? void 0 : data.message).forEach((message) => {
|
2664
|
+
setError(message || "Something went wrong");
|
2665
|
+
});
|
2666
|
+
} else {
|
2667
|
+
setError((data == null ? void 0 : data.message) || "Something went wrong");
|
2628
2668
|
}
|
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
2669
|
} else {
|
2635
|
-
|
2670
|
+
setTranId((_a3 = data == null ? void 0 : data.data) == null ? void 0 : _a3.transaction_id);
|
2671
|
+
setSuccess(true);
|
2672
|
+
setLoading2(false);
|
2636
2673
|
}
|
2637
|
-
}
|
2674
|
+
});
|
2638
2675
|
}
|
2639
2676
|
}
|
2640
2677
|
};
|
@@ -2670,7 +2707,6 @@ function GetPaymentPage(props) {
|
|
2670
2707
|
}
|
2671
2708
|
};
|
2672
2709
|
const handlechargeCustomer = async () => {
|
2673
|
-
var _b2, _c2, _d2, _e2, _f2, _g2, _h2;
|
2674
2710
|
let customer_id = props == null ? void 0 : props.customerId;
|
2675
2711
|
let discount = String(props == null ? void 0 : props.discount);
|
2676
2712
|
let surcharge = String(props == null ? void 0 : props.surcharge);
|
@@ -2701,17 +2737,19 @@ function GetPaymentPage(props) {
|
|
2701
2737
|
"Content-Type": "application/json"
|
2702
2738
|
};
|
2703
2739
|
setLoading2(true);
|
2704
|
-
|
2705
|
-
|
2706
|
-
|
2707
|
-
|
2740
|
+
socketClient_default.emit("sendMessage", { url: chargeurl, body: chargeobj, isChargebycard: true });
|
2741
|
+
socketClient_default.on("charge-by-card", (response) => {
|
2742
|
+
var _a3;
|
2743
|
+
debugger;
|
2744
|
+
console.log(response, "response");
|
2745
|
+
if ((response == null ? void 0 : response.result) == true || (response == null ? void 0 : response.status) == true) {
|
2746
|
+
setTranId((_a3 = response.data) == null ? void 0 : _a3.transaction_id);
|
2708
2747
|
setSuccess(true);
|
2709
2748
|
setLoading2(false);
|
2749
|
+
} else {
|
2750
|
+
setError((response == null ? void 0 : response.message) || "Something went wrong.");
|
2710
2751
|
}
|
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
|
-
}
|
2752
|
+
});
|
2715
2753
|
} else {
|
2716
2754
|
setError("Please Select A Card/ACH");
|
2717
2755
|
}
|
@@ -3085,7 +3123,7 @@ function PreAuthPayment(props) {
|
|
3085
3123
|
return Object.keys(errors).length > 0;
|
3086
3124
|
};
|
3087
3125
|
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
|
3126
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
|
3089
3127
|
e.preventDefault();
|
3090
3128
|
if (activetab == "card") {
|
3091
3129
|
const hasError = validateCardData();
|
@@ -3103,7 +3141,6 @@ function PreAuthPayment(props) {
|
|
3103
3141
|
setLoading2(true);
|
3104
3142
|
try {
|
3105
3143
|
let tokenCallback = async function(response) {
|
3106
|
-
var _a3, _b3, _c3, _d3;
|
3107
3144
|
if (response.Error) {
|
3108
3145
|
setError(response.Error);
|
3109
3146
|
setLoading2(false);
|
@@ -3123,26 +3160,35 @@ function PreAuthPayment(props) {
|
|
3123
3160
|
response.discount = props == null ? void 0 : props.discount;
|
3124
3161
|
response.tax = props == null ? void 0 : props.tax;
|
3125
3162
|
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
|
-
|
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
|
+
});
|
3146
3192
|
}
|
3147
3193
|
};
|
3148
3194
|
if ((paymentData == null ? void 0 : paymentData.paymentGateway) === 32) {
|
@@ -3174,7 +3220,7 @@ function PreAuthPayment(props) {
|
|
3174
3220
|
session_key: `${(_f2 = (_e2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _e2.data) == null ? void 0 : _f2.session_key}`
|
3175
3221
|
});
|
3176
3222
|
try {
|
3177
|
-
const tokenizeData = await axios4.post(
|
3223
|
+
const tokenizeData = await axios4.post(`${fractalGatewayUrl}tokenizer/tokenize`, raw, { headers: myHeaders });
|
3178
3224
|
const reqData = JSON.stringify(__spreadProps(__spreadValues({}, (_g2 = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _g2.data), {
|
3179
3225
|
// isSaveCardChecked: saveCardInfo,
|
3180
3226
|
name: cardData == null ? void 0 : cardData.cardName,
|
@@ -3200,39 +3246,39 @@ function PreAuthPayment(props) {
|
|
3200
3246
|
let myHeaders2 = {
|
3201
3247
|
"Content-Type": "application/json"
|
3202
3248
|
};
|
3203
|
-
|
3204
|
-
|
3205
|
-
|
3206
|
-
|
3207
|
-
|
3208
|
-
|
3209
|
-
|
3210
|
-
|
3211
|
-
|
3212
|
-
if ((
|
3213
|
-
|
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);
|
3214
3263
|
setSuccess(true);
|
3215
3264
|
setLoading2(false);
|
3216
3265
|
}
|
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
|
-
}
|
3266
|
+
});
|
3221
3267
|
} catch (err) {
|
3222
3268
|
console.log(err);
|
3223
3269
|
setLoading2(false);
|
3224
|
-
setError(((
|
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");
|
3225
3271
|
}
|
3226
3272
|
} catch (err) {
|
3227
3273
|
setLoading2(false);
|
3228
|
-
setError(((
|
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");
|
3229
3275
|
}
|
3230
3276
|
} else {
|
3231
3277
|
DatacapWebToken.requestToken(paymentData == null ? void 0 : paymentData.dctoken, "PaymentForm", tokenCallback);
|
3232
3278
|
}
|
3233
3279
|
} catch (err) {
|
3234
3280
|
setLoading2(false);
|
3235
|
-
setError(((
|
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.");
|
3236
3282
|
}
|
3237
3283
|
}
|
3238
3284
|
}
|
@@ -4128,7 +4174,7 @@ function AddCard(props) {
|
|
4128
4174
|
session_key: `${(_f = (_e = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _e.data) == null ? void 0 : _f.session_key}`
|
4129
4175
|
});
|
4130
4176
|
try {
|
4131
|
-
const tokenizeData = await axios5.post(
|
4177
|
+
const tokenizeData = await axios5.post(`${fractalGatewayUrl}tokenizer/tokenize`, raw, { headers: myHeaders });
|
4132
4178
|
const reqData = JSON.stringify(__spreadProps(__spreadValues({}, (_g = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _g.data), {
|
4133
4179
|
cvv: cardData == null ? void 0 : cardData.cvv,
|
4134
4180
|
cardName: cardData == null ? void 0 : cardData.cardName,
|
@@ -4529,7 +4575,7 @@ function AddCardEasyPay(props) {
|
|
4529
4575
|
session_key: `${(_f = (_e = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _e.data) == null ? void 0 : _f.session_key}`
|
4530
4576
|
});
|
4531
4577
|
try {
|
4532
|
-
const tokenizeData = await axios6.post(
|
4578
|
+
const tokenizeData = await axios6.post(`${fractalGatewayUrl}tokenizer/tokenize`, raw, { headers: myHeaders });
|
4533
4579
|
const reqData = JSON.stringify(__spreadProps(__spreadValues({}, (_g = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _g.data), {
|
4534
4580
|
cvv: cardData == null ? void 0 : cardData.cvv,
|
4535
4581
|
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.125",
|
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"
|