@superlogic/spree-pay 0.1.14 → 0.1.15
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/build/index.cjs +12 -5
- package/build/index.d.cts +1 -0
- package/build/index.d.ts +1 -0
- package/build/index.js +12 -5
- package/package.json +1 -1
package/build/index.cjs
CHANGED
|
@@ -562,7 +562,7 @@ var SlapiPaymentService = {
|
|
|
562
562
|
|
|
563
563
|
// src/services/cardPayment.ts
|
|
564
564
|
var cardPayment = async (params) => {
|
|
565
|
-
const { card, redirect3dsURI, hash, capture, metadata } = params;
|
|
565
|
+
const { card, redirect3dsURI, hash, capture, metadata, transactionFee } = params;
|
|
566
566
|
let cardId = card.id;
|
|
567
567
|
if ("token" in card) {
|
|
568
568
|
const { data: cardResData } = await SlapiPaymentService.addCard({ hash, source: card.token });
|
|
@@ -570,10 +570,14 @@ var cardPayment = async (params) => {
|
|
|
570
570
|
}
|
|
571
571
|
const { data: paymentResData } = await SlapiPaymentService.createPayment({
|
|
572
572
|
hash,
|
|
573
|
-
type: "CREDIT_CARD" /* CREDIT_CARD */,
|
|
574
|
-
metadata,
|
|
575
573
|
capture,
|
|
576
|
-
|
|
574
|
+
metadata,
|
|
575
|
+
type: "CREDIT_CARD" /* CREDIT_CARD */,
|
|
576
|
+
card: {
|
|
577
|
+
cardId,
|
|
578
|
+
transactionFee,
|
|
579
|
+
returnUrl: `${window.location.origin}${redirect3dsURI}`
|
|
580
|
+
}
|
|
577
581
|
});
|
|
578
582
|
if (paymentResData.redirectUrl) {
|
|
579
583
|
const paymentIntent = await import_nice_modal_react2.default.show(Iframe3ds, { url: paymentResData.redirectUrl });
|
|
@@ -1197,6 +1201,7 @@ var useCryptoPayment = () => {
|
|
|
1197
1201
|
if (selectedPaymentMethod.type !== "CRYPTO" /* CRYPTO */ || !selectedPaymentMethod.method?.symbol) {
|
|
1198
1202
|
throw new Error("Unsupported payment method");
|
|
1199
1203
|
}
|
|
1204
|
+
const { capture, hash, metadata } = params;
|
|
1200
1205
|
const TOKEN = selectedPaymentMethod.method.symbol;
|
|
1201
1206
|
if (["MOCA" /* MOCA */, "WETH" /* WETH */, "USDC" /* USDC */, "USDT" /* USDT */].includes(TOKEN)) {
|
|
1202
1207
|
const tokenAddress = selectedPaymentMethod.method.address;
|
|
@@ -1224,7 +1229,9 @@ var useCryptoPayment = () => {
|
|
|
1224
1229
|
}
|
|
1225
1230
|
}
|
|
1226
1231
|
const paymentRes = await SlapiPaymentService.createPayment({
|
|
1227
|
-
|
|
1232
|
+
hash,
|
|
1233
|
+
capture,
|
|
1234
|
+
metadata,
|
|
1228
1235
|
type: "CRYPTO" /* CRYPTO */,
|
|
1229
1236
|
crypto: {
|
|
1230
1237
|
token: TOKEN,
|
package/build/index.d.cts
CHANGED
package/build/index.d.ts
CHANGED
package/build/index.js
CHANGED
|
@@ -523,7 +523,7 @@ var SlapiPaymentService = {
|
|
|
523
523
|
|
|
524
524
|
// src/services/cardPayment.ts
|
|
525
525
|
var cardPayment = async (params) => {
|
|
526
|
-
const { card, redirect3dsURI, hash, capture, metadata } = params;
|
|
526
|
+
const { card, redirect3dsURI, hash, capture, metadata, transactionFee } = params;
|
|
527
527
|
let cardId = card.id;
|
|
528
528
|
if ("token" in card) {
|
|
529
529
|
const { data: cardResData } = await SlapiPaymentService.addCard({ hash, source: card.token });
|
|
@@ -531,10 +531,14 @@ var cardPayment = async (params) => {
|
|
|
531
531
|
}
|
|
532
532
|
const { data: paymentResData } = await SlapiPaymentService.createPayment({
|
|
533
533
|
hash,
|
|
534
|
-
type: "CREDIT_CARD" /* CREDIT_CARD */,
|
|
535
|
-
metadata,
|
|
536
534
|
capture,
|
|
537
|
-
|
|
535
|
+
metadata,
|
|
536
|
+
type: "CREDIT_CARD" /* CREDIT_CARD */,
|
|
537
|
+
card: {
|
|
538
|
+
cardId,
|
|
539
|
+
transactionFee,
|
|
540
|
+
returnUrl: `${window.location.origin}${redirect3dsURI}`
|
|
541
|
+
}
|
|
538
542
|
});
|
|
539
543
|
if (paymentResData.redirectUrl) {
|
|
540
544
|
const paymentIntent = await NiceModal2.show(Iframe3ds, { url: paymentResData.redirectUrl });
|
|
@@ -1158,6 +1162,7 @@ var useCryptoPayment = () => {
|
|
|
1158
1162
|
if (selectedPaymentMethod.type !== "CRYPTO" /* CRYPTO */ || !selectedPaymentMethod.method?.symbol) {
|
|
1159
1163
|
throw new Error("Unsupported payment method");
|
|
1160
1164
|
}
|
|
1165
|
+
const { capture, hash, metadata } = params;
|
|
1161
1166
|
const TOKEN = selectedPaymentMethod.method.symbol;
|
|
1162
1167
|
if (["MOCA" /* MOCA */, "WETH" /* WETH */, "USDC" /* USDC */, "USDT" /* USDT */].includes(TOKEN)) {
|
|
1163
1168
|
const tokenAddress = selectedPaymentMethod.method.address;
|
|
@@ -1185,7 +1190,9 @@ var useCryptoPayment = () => {
|
|
|
1185
1190
|
}
|
|
1186
1191
|
}
|
|
1187
1192
|
const paymentRes = await SlapiPaymentService.createPayment({
|
|
1188
|
-
|
|
1193
|
+
hash,
|
|
1194
|
+
capture,
|
|
1195
|
+
metadata,
|
|
1189
1196
|
type: "CRYPTO" /* CRYPTO */,
|
|
1190
1197
|
crypto: {
|
|
1191
1198
|
token: TOKEN,
|