@miden-npm/react 0.0.7 → 0.0.9
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.cjs +20 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +20 -14
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -82,7 +82,7 @@ var getQueryParams = (url) => {
|
|
|
82
82
|
|
|
83
83
|
// src/utils/api.util.ts
|
|
84
84
|
var getBaseUrl = (mode) => {
|
|
85
|
-
return mode === "sandbox" ? "https://sandbox-api.midencards.io/payment-gateway-api" : "";
|
|
85
|
+
return mode === "sandbox" ? "https://sandbox-api.midencards.io/payment-gateway-core-api" : "";
|
|
86
86
|
};
|
|
87
87
|
|
|
88
88
|
// src/utils/string.util.ts
|
|
@@ -474,10 +474,12 @@ async function generateStableCoinAddress(environment, { merchantId, ...rest }) {
|
|
|
474
474
|
|
|
475
475
|
// src/apis/encrypt.api.ts
|
|
476
476
|
import CryptoJS from "crypto-js";
|
|
477
|
-
function encryptPayload(
|
|
478
|
-
const
|
|
479
|
-
const
|
|
480
|
-
const
|
|
477
|
+
function encryptPayload(merchantId, formData = {}) {
|
|
478
|
+
const merchId = merchantId.replace("-", "");
|
|
479
|
+
const first16Key = merchId.slice(0, 16);
|
|
480
|
+
const last16Iv = merchId.slice(-16);
|
|
481
|
+
const key = CryptoJS.enc.Utf8.parse(first16Key);
|
|
482
|
+
const iv = CryptoJS.enc.Utf8.parse(last16Iv);
|
|
481
483
|
const postDataObj = JSON.stringify(formData);
|
|
482
484
|
const encryptedData = CryptoJS.AES.encrypt(
|
|
483
485
|
CryptoJS.enc.Utf8.parse(postDataObj),
|
|
@@ -493,10 +495,12 @@ function encryptPayload(environment, formData = {}) {
|
|
|
493
495
|
requestParam: encryptedData.toString()
|
|
494
496
|
};
|
|
495
497
|
}
|
|
496
|
-
function decryptPayload(
|
|
497
|
-
const
|
|
498
|
-
const
|
|
499
|
-
const
|
|
498
|
+
function decryptPayload(merchantId, payload) {
|
|
499
|
+
const merchId = merchantId.replace("-", "");
|
|
500
|
+
const first16Key = merchId.slice(0, 16);
|
|
501
|
+
const last16Iv = merchId.slice(-16);
|
|
502
|
+
const key = CryptoJS.enc.Utf8.parse(first16Key);
|
|
503
|
+
const iv = CryptoJS.enc.Utf8.parse(last16Iv);
|
|
500
504
|
const decryptedData = CryptoJS.AES.decrypt(payload, key, {
|
|
501
505
|
keySize: 128 / 8,
|
|
502
506
|
iv,
|
|
@@ -1994,7 +1998,7 @@ function PayByCard({
|
|
|
1994
1998
|
emailAddress: billingForm.emailAddress ?? "",
|
|
1995
1999
|
phoneNumber: billingForm.phoneNumber ?? ""
|
|
1996
2000
|
};
|
|
1997
|
-
const encryptedCardDetails = encryptPayload(
|
|
2001
|
+
const encryptedCardDetails = encryptPayload(secretKey, cardDetails);
|
|
1998
2002
|
const payload = {
|
|
1999
2003
|
customerId: paymentObject?.email || payForm.customerName || "",
|
|
2000
2004
|
amount: String(paymentObject?.amount ?? ""),
|
|
@@ -2170,7 +2174,7 @@ function PayByCard({
|
|
|
2170
2174
|
};
|
|
2171
2175
|
const cardNumberInputHandler = (event) => {
|
|
2172
2176
|
setCardType(cardTypeHandler(event));
|
|
2173
|
-
payRules.cardPin = "required|numeric";
|
|
2177
|
+
payRules.cardPin = cardType === "Verve" ? "required|numeric" : "";
|
|
2174
2178
|
};
|
|
2175
2179
|
useEffect3(() => {
|
|
2176
2180
|
(async () => {
|
|
@@ -3058,12 +3062,14 @@ function BzpCheckoutCard({
|
|
|
3058
3062
|
};
|
|
3059
3063
|
const setSuccess = (event) => {
|
|
3060
3064
|
setSuccessObject({ ...event });
|
|
3061
|
-
if (
|
|
3065
|
+
if (event.paymentStatus === "Authorized") {
|
|
3066
|
+
setCheckoutState("SUCCESS");
|
|
3067
|
+
} else if (event.paymentStatus === "Payment failed") {
|
|
3062
3068
|
setCheckoutState("PENDING");
|
|
3063
|
-
} else if (
|
|
3069
|
+
} else if (event.paymentStatus === "used") {
|
|
3064
3070
|
setCheckoutState("USED");
|
|
3065
3071
|
} else {
|
|
3066
|
-
setCheckoutState("
|
|
3072
|
+
setCheckoutState("PENDING");
|
|
3067
3073
|
}
|
|
3068
3074
|
};
|
|
3069
3075
|
useEffect6(() => {
|