@pinerohit11/testwidget 0.1.51 → 0.1.52
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 +68 -36
- package/dist/index.mjs +68 -36
- package/package.json +1 -2
package/dist/index.js
CHANGED
@@ -61,7 +61,6 @@ module.exports = __toCommonJS(app_exports);
|
|
61
61
|
|
62
62
|
// src/app/components/RequestPayment/RequestPayment.tsx
|
63
63
|
var import_react4 = __toESM(require("react"));
|
64
|
-
var import_axios = __toESM(require("axios"));
|
65
64
|
|
66
65
|
// src/app/components/Loader/Loader.tsx
|
67
66
|
var import_react2 = __toESM(require("react"));
|
@@ -1116,14 +1115,24 @@ function RequestPayment(props) {
|
|
1116
1115
|
name: requestDetails.name,
|
1117
1116
|
email: requestDetails.email
|
1118
1117
|
};
|
1119
|
-
|
1120
|
-
|
1118
|
+
const response = await fetch(`${baseUrl}create-widget-order`, {
|
1119
|
+
method: "POST",
|
1120
|
+
headers: {
|
1121
|
+
"Content-Type": "application/json"
|
1122
|
+
},
|
1123
|
+
body: JSON.stringify(formData)
|
1124
|
+
});
|
1125
|
+
if (!response.ok) {
|
1126
|
+
throw new Error("Failed to create widget order");
|
1127
|
+
}
|
1128
|
+
const data = await response.json();
|
1129
|
+
if (data) {
|
1121
1130
|
setShowConfirmationModal(true);
|
1122
1131
|
setShow(false);
|
1123
1132
|
emptyFields();
|
1124
|
-
handleSubmit(
|
1133
|
+
handleSubmit(data);
|
1125
1134
|
}
|
1126
|
-
console.log(
|
1135
|
+
console.log(data);
|
1127
1136
|
setLoading(false);
|
1128
1137
|
} catch (error) {
|
1129
1138
|
console.log(error);
|
@@ -1858,7 +1867,6 @@ function RqstPaymntInputField({ fractalpayClientKey, amount, orderID }) {
|
|
1858
1867
|
|
1859
1868
|
// src/app/components/Payment/Payment.tsx
|
1860
1869
|
var import_react10 = __toESM(require("react"));
|
1861
|
-
var import_axios2 = __toESM(require("axios"));
|
1862
1870
|
var import_node_forge = __toESM(require("node-forge"));
|
1863
1871
|
var import_react_toastify3 = require("react-toastify");
|
1864
1872
|
var import_react_bootstrap6 = require("react-bootstrap");
|
@@ -2808,9 +2816,18 @@ function Payment() {
|
|
2808
2816
|
const [data, setData] = (0, import_react10.useState)(null);
|
2809
2817
|
const handlePaymentClick = async () => {
|
2810
2818
|
try {
|
2811
|
-
const response = await
|
2812
|
-
|
2813
|
-
|
2819
|
+
const response = await fetch(`${baseUrl}generate-session`, {
|
2820
|
+
method: "POST",
|
2821
|
+
headers: {
|
2822
|
+
"Content-Type": "application/json"
|
2823
|
+
},
|
2824
|
+
body: JSON.stringify({})
|
2825
|
+
});
|
2826
|
+
if (!response.ok) {
|
2827
|
+
throw new Error("Network response was not ok");
|
2828
|
+
}
|
2829
|
+
const data2 = await response.json();
|
2830
|
+
if (data2 && data2.result === true) {
|
2814
2831
|
setState((prev) => {
|
2815
2832
|
var _a2, _b;
|
2816
2833
|
return __spreadProps(__spreadValues({}, prev), {
|
@@ -2840,13 +2857,15 @@ function Payment() {
|
|
2840
2857
|
};
|
2841
2858
|
const apiUrl = "https://m1ao5pku8b.execute-api.us-east-2.amazonaws.com/prod/tokenizer/tokenize";
|
2842
2859
|
try {
|
2843
|
-
const response = await
|
2860
|
+
const response = await fetch(apiUrl, {
|
2861
|
+
method: "POST",
|
2844
2862
|
headers: {
|
2845
2863
|
"x-app-session-key": state == null ? void 0 : state.sessionKey,
|
2846
2864
|
"Content-Type": "application/json"
|
2847
|
-
}
|
2865
|
+
},
|
2866
|
+
body: JSON.stringify(requestBody)
|
2848
2867
|
});
|
2849
|
-
if (
|
2868
|
+
if (response.ok) {
|
2850
2869
|
import_react_toastify3.toast.success("Payment Successful");
|
2851
2870
|
setState((prev) => __spreadProps(__spreadValues({}, prev), {
|
2852
2871
|
show: false,
|
@@ -2860,7 +2879,8 @@ function Payment() {
|
|
2860
2879
|
amount: ""
|
2861
2880
|
}));
|
2862
2881
|
}
|
2863
|
-
|
2882
|
+
const responseData = await response.json();
|
2883
|
+
console.log("response", responseData);
|
2864
2884
|
} catch (error) {
|
2865
2885
|
console.error("Error:", error);
|
2866
2886
|
}
|
@@ -3422,7 +3442,6 @@ function CompletedTransactions(props) {
|
|
3422
3442
|
var import_react13 = __toESM(require("react"));
|
3423
3443
|
var import_react_bootstrap8 = require("react-bootstrap");
|
3424
3444
|
var import_react_toastify5 = require("react-toastify");
|
3425
|
-
var import_axios3 = __toESM(require("axios"));
|
3426
3445
|
var import_node_forge2 = __toESM(require("node-forge"));
|
3427
3446
|
var import_credit_card_type = __toESM(require("credit-card-type"));
|
3428
3447
|
function TockenizPay() {
|
@@ -3443,9 +3462,18 @@ function TockenizPay() {
|
|
3443
3462
|
const [data, setData] = (0, import_react13.useState)(null);
|
3444
3463
|
const handlePaymentClick = async () => {
|
3445
3464
|
try {
|
3446
|
-
const response = await
|
3447
|
-
|
3448
|
-
|
3465
|
+
const response = await fetch(`${baseUrl}/generate-session`, {
|
3466
|
+
method: "POST",
|
3467
|
+
headers: {
|
3468
|
+
"Content-Type": "application/json"
|
3469
|
+
},
|
3470
|
+
body: JSON.stringify({})
|
3471
|
+
});
|
3472
|
+
if (!response.ok) {
|
3473
|
+
throw new Error("Network response was not ok");
|
3474
|
+
}
|
3475
|
+
const data2 = await response.json();
|
3476
|
+
if (data2 && data2.result === true) {
|
3449
3477
|
setState((prev) => {
|
3450
3478
|
var _a, _b;
|
3451
3479
|
return __spreadProps(__spreadValues({}, prev), {
|
@@ -3460,7 +3488,7 @@ function TockenizPay() {
|
|
3460
3488
|
}
|
3461
3489
|
};
|
3462
3490
|
const handleSubmitPay = async () => {
|
3463
|
-
var _a, _b, _c
|
3491
|
+
var _a, _b, _c;
|
3464
3492
|
let track2_data = `${(_a = state == null ? void 0 : state.cardNumber) == null ? void 0 : _a.replaceAll(" ", "")}=${state.year}${((_b = state == null ? void 0 : state.month) == null ? void 0 : _b.length) > 1 ? state == null ? void 0 : state.month : "0" + (state == null ? void 0 : state.month)} ${state.cvv}`;
|
3465
3493
|
const publicKey = import_node_forge2.default.pki.publicKeyFromPem(state.publicKey);
|
3466
3494
|
const encrypted = publicKey.encrypt(track2_data, "RSA-OAEP", {
|
@@ -3477,33 +3505,37 @@ function TockenizPay() {
|
|
3477
3505
|
algorithm: "RSAES_OAEP_SHA_1"
|
3478
3506
|
};
|
3479
3507
|
try {
|
3480
|
-
const response = await
|
3508
|
+
const response = await fetch(
|
3481
3509
|
"https://m1ao5pku8b.execute-api.us-east-2.amazonaws.com/prod/tokenizer/tokenize",
|
3482
|
-
requestBody,
|
3483
3510
|
{
|
3511
|
+
method: "POST",
|
3484
3512
|
headers: {
|
3485
3513
|
"x-app-session-key": state == null ? void 0 : state.sessionKey,
|
3486
3514
|
"Content-Type": "application/json"
|
3487
|
-
}
|
3515
|
+
},
|
3516
|
+
body: JSON.stringify(requestBody)
|
3488
3517
|
}
|
3489
3518
|
);
|
3490
|
-
if (
|
3491
|
-
|
3492
|
-
|
3493
|
-
show: false,
|
3494
|
-
publicKey: "",
|
3495
|
-
sessionKey: "",
|
3496
|
-
cardNumber: "",
|
3497
|
-
year: "",
|
3498
|
-
month: "",
|
3499
|
-
cvv: "",
|
3500
|
-
zip: "",
|
3501
|
-
amount: ""
|
3502
|
-
}));
|
3519
|
+
if (!response.ok) {
|
3520
|
+
const errorData = await response.json();
|
3521
|
+
throw new Error(((_c = errorData == null ? void 0 : errorData.data) == null ? void 0 : _c.message) || "Request failed");
|
3503
3522
|
}
|
3504
|
-
|
3523
|
+
const responseData = await response.json();
|
3524
|
+
import_react_toastify5.toast.success("Payment Successful");
|
3525
|
+
setState((prev) => __spreadProps(__spreadValues({}, prev), {
|
3526
|
+
show: false,
|
3527
|
+
publicKey: "",
|
3528
|
+
sessionKey: "",
|
3529
|
+
cardNumber: "",
|
3530
|
+
year: "",
|
3531
|
+
month: "",
|
3532
|
+
cvv: "",
|
3533
|
+
zip: "",
|
3534
|
+
amount: ""
|
3535
|
+
}));
|
3536
|
+
console.log("response", responseData);
|
3505
3537
|
} catch (error) {
|
3506
|
-
import_react_toastify5.toast.error((
|
3538
|
+
import_react_toastify5.toast.error((error == null ? void 0 : error.message) || "An error occurred");
|
3507
3539
|
console.error("Error:", error);
|
3508
3540
|
}
|
3509
3541
|
};
|
package/dist/index.mjs
CHANGED
@@ -20,7 +20,6 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
20
|
|
21
21
|
// src/app/components/RequestPayment/RequestPayment.tsx
|
22
22
|
import React4, { useState, useEffect } from "react";
|
23
|
-
import axios from "axios";
|
24
23
|
|
25
24
|
// src/app/components/Loader/Loader.tsx
|
26
25
|
import React2 from "react";
|
@@ -1075,14 +1074,24 @@ function RequestPayment(props) {
|
|
1075
1074
|
name: requestDetails.name,
|
1076
1075
|
email: requestDetails.email
|
1077
1076
|
};
|
1078
|
-
|
1079
|
-
|
1077
|
+
const response = await fetch(`${baseUrl}create-widget-order`, {
|
1078
|
+
method: "POST",
|
1079
|
+
headers: {
|
1080
|
+
"Content-Type": "application/json"
|
1081
|
+
},
|
1082
|
+
body: JSON.stringify(formData)
|
1083
|
+
});
|
1084
|
+
if (!response.ok) {
|
1085
|
+
throw new Error("Failed to create widget order");
|
1086
|
+
}
|
1087
|
+
const data = await response.json();
|
1088
|
+
if (data) {
|
1080
1089
|
setShowConfirmationModal(true);
|
1081
1090
|
setShow(false);
|
1082
1091
|
emptyFields();
|
1083
|
-
handleSubmit(
|
1092
|
+
handleSubmit(data);
|
1084
1093
|
}
|
1085
|
-
console.log(
|
1094
|
+
console.log(data);
|
1086
1095
|
setLoading(false);
|
1087
1096
|
} catch (error) {
|
1088
1097
|
console.log(error);
|
@@ -1817,7 +1826,6 @@ function RqstPaymntInputField({ fractalpayClientKey, amount, orderID }) {
|
|
1817
1826
|
|
1818
1827
|
// src/app/components/Payment/Payment.tsx
|
1819
1828
|
import React10, { useState as useState6 } from "react";
|
1820
|
-
import axios2 from "axios";
|
1821
1829
|
import forge from "node-forge";
|
1822
1830
|
import { toast as toast3 } from "react-toastify";
|
1823
1831
|
import { Modal as Modal6 } from "react-bootstrap";
|
@@ -2767,9 +2775,18 @@ function Payment() {
|
|
2767
2775
|
const [data, setData] = useState6(null);
|
2768
2776
|
const handlePaymentClick = async () => {
|
2769
2777
|
try {
|
2770
|
-
const response = await
|
2771
|
-
|
2772
|
-
|
2778
|
+
const response = await fetch(`${baseUrl}generate-session`, {
|
2779
|
+
method: "POST",
|
2780
|
+
headers: {
|
2781
|
+
"Content-Type": "application/json"
|
2782
|
+
},
|
2783
|
+
body: JSON.stringify({})
|
2784
|
+
});
|
2785
|
+
if (!response.ok) {
|
2786
|
+
throw new Error("Network response was not ok");
|
2787
|
+
}
|
2788
|
+
const data2 = await response.json();
|
2789
|
+
if (data2 && data2.result === true) {
|
2773
2790
|
setState((prev) => {
|
2774
2791
|
var _a2, _b;
|
2775
2792
|
return __spreadProps(__spreadValues({}, prev), {
|
@@ -2799,13 +2816,15 @@ function Payment() {
|
|
2799
2816
|
};
|
2800
2817
|
const apiUrl = "https://m1ao5pku8b.execute-api.us-east-2.amazonaws.com/prod/tokenizer/tokenize";
|
2801
2818
|
try {
|
2802
|
-
const response = await
|
2819
|
+
const response = await fetch(apiUrl, {
|
2820
|
+
method: "POST",
|
2803
2821
|
headers: {
|
2804
2822
|
"x-app-session-key": state == null ? void 0 : state.sessionKey,
|
2805
2823
|
"Content-Type": "application/json"
|
2806
|
-
}
|
2824
|
+
},
|
2825
|
+
body: JSON.stringify(requestBody)
|
2807
2826
|
});
|
2808
|
-
if (
|
2827
|
+
if (response.ok) {
|
2809
2828
|
toast3.success("Payment Successful");
|
2810
2829
|
setState((prev) => __spreadProps(__spreadValues({}, prev), {
|
2811
2830
|
show: false,
|
@@ -2819,7 +2838,8 @@ function Payment() {
|
|
2819
2838
|
amount: ""
|
2820
2839
|
}));
|
2821
2840
|
}
|
2822
|
-
|
2841
|
+
const responseData = await response.json();
|
2842
|
+
console.log("response", responseData);
|
2823
2843
|
} catch (error) {
|
2824
2844
|
console.error("Error:", error);
|
2825
2845
|
}
|
@@ -3387,7 +3407,6 @@ function CompletedTransactions(props) {
|
|
3387
3407
|
import React13, { useState as useState9 } from "react";
|
3388
3408
|
import { Modal as Modal7 } from "react-bootstrap";
|
3389
3409
|
import { toast as toast5, ToastContainer as ToastContainer3 } from "react-toastify";
|
3390
|
-
import axios3 from "axios";
|
3391
3410
|
import forge2 from "node-forge";
|
3392
3411
|
import creditCardType from "credit-card-type";
|
3393
3412
|
function TockenizPay() {
|
@@ -3408,9 +3427,18 @@ function TockenizPay() {
|
|
3408
3427
|
const [data, setData] = useState9(null);
|
3409
3428
|
const handlePaymentClick = async () => {
|
3410
3429
|
try {
|
3411
|
-
const response = await
|
3412
|
-
|
3413
|
-
|
3430
|
+
const response = await fetch(`${baseUrl}/generate-session`, {
|
3431
|
+
method: "POST",
|
3432
|
+
headers: {
|
3433
|
+
"Content-Type": "application/json"
|
3434
|
+
},
|
3435
|
+
body: JSON.stringify({})
|
3436
|
+
});
|
3437
|
+
if (!response.ok) {
|
3438
|
+
throw new Error("Network response was not ok");
|
3439
|
+
}
|
3440
|
+
const data2 = await response.json();
|
3441
|
+
if (data2 && data2.result === true) {
|
3414
3442
|
setState((prev) => {
|
3415
3443
|
var _a, _b;
|
3416
3444
|
return __spreadProps(__spreadValues({}, prev), {
|
@@ -3425,7 +3453,7 @@ function TockenizPay() {
|
|
3425
3453
|
}
|
3426
3454
|
};
|
3427
3455
|
const handleSubmitPay = async () => {
|
3428
|
-
var _a, _b, _c
|
3456
|
+
var _a, _b, _c;
|
3429
3457
|
let track2_data = `${(_a = state == null ? void 0 : state.cardNumber) == null ? void 0 : _a.replaceAll(" ", "")}=${state.year}${((_b = state == null ? void 0 : state.month) == null ? void 0 : _b.length) > 1 ? state == null ? void 0 : state.month : "0" + (state == null ? void 0 : state.month)} ${state.cvv}`;
|
3430
3458
|
const publicKey = forge2.pki.publicKeyFromPem(state.publicKey);
|
3431
3459
|
const encrypted = publicKey.encrypt(track2_data, "RSA-OAEP", {
|
@@ -3442,33 +3470,37 @@ function TockenizPay() {
|
|
3442
3470
|
algorithm: "RSAES_OAEP_SHA_1"
|
3443
3471
|
};
|
3444
3472
|
try {
|
3445
|
-
const response = await
|
3473
|
+
const response = await fetch(
|
3446
3474
|
"https://m1ao5pku8b.execute-api.us-east-2.amazonaws.com/prod/tokenizer/tokenize",
|
3447
|
-
requestBody,
|
3448
3475
|
{
|
3476
|
+
method: "POST",
|
3449
3477
|
headers: {
|
3450
3478
|
"x-app-session-key": state == null ? void 0 : state.sessionKey,
|
3451
3479
|
"Content-Type": "application/json"
|
3452
|
-
}
|
3480
|
+
},
|
3481
|
+
body: JSON.stringify(requestBody)
|
3453
3482
|
}
|
3454
3483
|
);
|
3455
|
-
if (
|
3456
|
-
|
3457
|
-
|
3458
|
-
show: false,
|
3459
|
-
publicKey: "",
|
3460
|
-
sessionKey: "",
|
3461
|
-
cardNumber: "",
|
3462
|
-
year: "",
|
3463
|
-
month: "",
|
3464
|
-
cvv: "",
|
3465
|
-
zip: "",
|
3466
|
-
amount: ""
|
3467
|
-
}));
|
3484
|
+
if (!response.ok) {
|
3485
|
+
const errorData = await response.json();
|
3486
|
+
throw new Error(((_c = errorData == null ? void 0 : errorData.data) == null ? void 0 : _c.message) || "Request failed");
|
3468
3487
|
}
|
3469
|
-
|
3488
|
+
const responseData = await response.json();
|
3489
|
+
toast5.success("Payment Successful");
|
3490
|
+
setState((prev) => __spreadProps(__spreadValues({}, prev), {
|
3491
|
+
show: false,
|
3492
|
+
publicKey: "",
|
3493
|
+
sessionKey: "",
|
3494
|
+
cardNumber: "",
|
3495
|
+
year: "",
|
3496
|
+
month: "",
|
3497
|
+
cvv: "",
|
3498
|
+
zip: "",
|
3499
|
+
amount: ""
|
3500
|
+
}));
|
3501
|
+
console.log("response", responseData);
|
3470
3502
|
} catch (error) {
|
3471
|
-
toast5.error((
|
3503
|
+
toast5.error((error == null ? void 0 : error.message) || "An error occurred");
|
3472
3504
|
console.error("Error:", error);
|
3473
3505
|
}
|
3474
3506
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@pinerohit11/testwidget",
|
3
|
-
"version": "0.1.
|
3
|
+
"version": "0.1.52",
|
4
4
|
"private": false,
|
5
5
|
"scripts": {
|
6
6
|
"dev": "next dev",
|
@@ -10,7 +10,6 @@
|
|
10
10
|
"bundle": "tsup src/app/index.ts"
|
11
11
|
},
|
12
12
|
"dependencies": {
|
13
|
-
"axios": "^1.7.7",
|
14
13
|
"bootstrap": "^5.3.3",
|
15
14
|
"next": "15.0.3",
|
16
15
|
"node-forge": "^1.3.1",
|