@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.cjs
CHANGED
|
@@ -124,7 +124,7 @@ var getQueryParams = (url) => {
|
|
|
124
124
|
|
|
125
125
|
// src/utils/api.util.ts
|
|
126
126
|
var getBaseUrl = (mode) => {
|
|
127
|
-
return mode === "sandbox" ? "https://sandbox-api.midencards.io/payment-gateway-api" : "";
|
|
127
|
+
return mode === "sandbox" ? "https://sandbox-api.midencards.io/payment-gateway-core-api" : "";
|
|
128
128
|
};
|
|
129
129
|
|
|
130
130
|
// src/utils/string.util.ts
|
|
@@ -516,10 +516,12 @@ async function generateStableCoinAddress(environment, { merchantId, ...rest }) {
|
|
|
516
516
|
|
|
517
517
|
// src/apis/encrypt.api.ts
|
|
518
518
|
var import_crypto_js = __toESM(require("crypto-js"), 1);
|
|
519
|
-
function encryptPayload(
|
|
520
|
-
const
|
|
521
|
-
const
|
|
522
|
-
const
|
|
519
|
+
function encryptPayload(merchantId, formData = {}) {
|
|
520
|
+
const merchId = merchantId.replace("-", "");
|
|
521
|
+
const first16Key = merchId.slice(0, 16);
|
|
522
|
+
const last16Iv = merchId.slice(-16);
|
|
523
|
+
const key = import_crypto_js.default.enc.Utf8.parse(first16Key);
|
|
524
|
+
const iv = import_crypto_js.default.enc.Utf8.parse(last16Iv);
|
|
523
525
|
const postDataObj = JSON.stringify(formData);
|
|
524
526
|
const encryptedData = import_crypto_js.default.AES.encrypt(
|
|
525
527
|
import_crypto_js.default.enc.Utf8.parse(postDataObj),
|
|
@@ -535,10 +537,12 @@ function encryptPayload(environment, formData = {}) {
|
|
|
535
537
|
requestParam: encryptedData.toString()
|
|
536
538
|
};
|
|
537
539
|
}
|
|
538
|
-
function decryptPayload(
|
|
539
|
-
const
|
|
540
|
-
const
|
|
541
|
-
const
|
|
540
|
+
function decryptPayload(merchantId, payload) {
|
|
541
|
+
const merchId = merchantId.replace("-", "");
|
|
542
|
+
const first16Key = merchId.slice(0, 16);
|
|
543
|
+
const last16Iv = merchId.slice(-16);
|
|
544
|
+
const key = import_crypto_js.default.enc.Utf8.parse(first16Key);
|
|
545
|
+
const iv = import_crypto_js.default.enc.Utf8.parse(last16Iv);
|
|
542
546
|
const decryptedData = import_crypto_js.default.AES.decrypt(payload, key, {
|
|
543
547
|
keySize: 128 / 8,
|
|
544
548
|
iv,
|
|
@@ -2036,7 +2040,7 @@ function PayByCard({
|
|
|
2036
2040
|
emailAddress: billingForm.emailAddress ?? "",
|
|
2037
2041
|
phoneNumber: billingForm.phoneNumber ?? ""
|
|
2038
2042
|
};
|
|
2039
|
-
const encryptedCardDetails = encryptPayload(
|
|
2043
|
+
const encryptedCardDetails = encryptPayload(secretKey, cardDetails);
|
|
2040
2044
|
const payload = {
|
|
2041
2045
|
customerId: paymentObject?.email || payForm.customerName || "",
|
|
2042
2046
|
amount: String(paymentObject?.amount ?? ""),
|
|
@@ -2212,7 +2216,7 @@ function PayByCard({
|
|
|
2212
2216
|
};
|
|
2213
2217
|
const cardNumberInputHandler = (event) => {
|
|
2214
2218
|
setCardType(cardTypeHandler(event));
|
|
2215
|
-
payRules.cardPin = "required|numeric";
|
|
2219
|
+
payRules.cardPin = cardType === "Verve" ? "required|numeric" : "";
|
|
2216
2220
|
};
|
|
2217
2221
|
(0, import_react8.useEffect)(() => {
|
|
2218
2222
|
(async () => {
|
|
@@ -3095,12 +3099,14 @@ function BzpCheckoutCard({
|
|
|
3095
3099
|
};
|
|
3096
3100
|
const setSuccess = (event) => {
|
|
3097
3101
|
setSuccessObject({ ...event });
|
|
3098
|
-
if (
|
|
3102
|
+
if (event.paymentStatus === "Authorized") {
|
|
3103
|
+
setCheckoutState("SUCCESS");
|
|
3104
|
+
} else if (event.paymentStatus === "Payment failed") {
|
|
3099
3105
|
setCheckoutState("PENDING");
|
|
3100
|
-
} else if (
|
|
3106
|
+
} else if (event.paymentStatus === "used") {
|
|
3101
3107
|
setCheckoutState("USED");
|
|
3102
3108
|
} else {
|
|
3103
|
-
setCheckoutState("
|
|
3109
|
+
setCheckoutState("PENDING");
|
|
3104
3110
|
}
|
|
3105
3111
|
};
|
|
3106
3112
|
(0, import_react11.useEffect)(() => {
|