@arcblock/payment-service 1.29.13 → 1.29.14
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/cf.js +38 -38
- package/dist/index.js +14 -7
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -6474,9 +6474,9 @@ var init_customer = __esm({
|
|
|
6474
6474
|
]);
|
|
6475
6475
|
return { paid, due, refunded };
|
|
6476
6476
|
}
|
|
6477
|
-
async canMakeNewPurchase(excludedInvoiceId = "") {
|
|
6477
|
+
async canMakeNewPurchase(excludedInvoiceId = "", livemode2) {
|
|
6478
6478
|
const { Invoice: Invoice5 } = this.sequelize.models;
|
|
6479
|
-
const [summary] = await Invoice5.getUncollectibleAmount({ customerId: this.id, excludedInvoiceId });
|
|
6479
|
+
const [summary] = await Invoice5.getUncollectibleAmount({ customerId: this.id, excludedInvoiceId, livemode: livemode2 });
|
|
6480
6480
|
return Object.entries(summary).every(([, amount]) => new import_util6.BN(amount).lte(new import_util6.BN(0)));
|
|
6481
6481
|
}
|
|
6482
6482
|
getBalanceToApply(currencyId, amount) {
|
|
@@ -10008,12 +10008,13 @@ var init_sequelize = __esm({
|
|
|
10008
10008
|
});
|
|
10009
10009
|
|
|
10010
10010
|
// ../../blocklets/core/api/src/libs/constants.ts
|
|
10011
|
-
var EVM_CHAIN_TYPES, CHARGE_SUPPORTED_CHAIN_TYPES;
|
|
10011
|
+
var EVM_CHAIN_TYPES, CHARGE_SUPPORTED_CHAIN_TYPES, MAX_BATCH_COLLECT_INVOICES;
|
|
10012
10012
|
var init_constants = __esm({
|
|
10013
10013
|
"../../blocklets/core/api/src/libs/constants.ts"() {
|
|
10014
10014
|
"use strict";
|
|
10015
10015
|
EVM_CHAIN_TYPES = ["ethereum", "base"];
|
|
10016
10016
|
CHARGE_SUPPORTED_CHAIN_TYPES = ["arcblock", "ethereum", "base"];
|
|
10017
|
+
MAX_BATCH_COLLECT_INVOICES = 200;
|
|
10017
10018
|
}
|
|
10018
10019
|
});
|
|
10019
10020
|
|
|
@@ -33716,7 +33717,7 @@ var init_notification3 = __esm({
|
|
|
33716
33717
|
}
|
|
33717
33718
|
},
|
|
33718
33719
|
60 * 60 * 1e3
|
|
33719
|
-
);
|
|
33720
|
+
).unref();
|
|
33720
33721
|
notificationQueue = createQueue({
|
|
33721
33722
|
name: "notification",
|
|
33722
33723
|
onJob: handleNotificationJob,
|
|
@@ -40065,12 +40066,18 @@ async function ensureSubscriptionForCollectBatch(subscriptionId, currencyId, cus
|
|
|
40065
40066
|
if (!paymentMethod) {
|
|
40066
40067
|
throw new Error(`Payment method not found for currency ${currencyId}`);
|
|
40067
40068
|
}
|
|
40069
|
+
const invoices = detail[currencyId] || [];
|
|
40070
|
+
if (paymentMethod.type === "arcblock" && invoices.length > MAX_BATCH_COLLECT_INVOICES) {
|
|
40071
|
+
throw new Error(
|
|
40072
|
+
`Too many past due invoices to batch collect in a single on-chain transaction (${invoices.length} invoices, limit is ${MAX_BATCH_COLLECT_INVOICES}). Please pay a smaller subset of invoices, or contact support to collect the remainder separately.`
|
|
40073
|
+
);
|
|
40074
|
+
}
|
|
40068
40075
|
return {
|
|
40069
40076
|
subscription,
|
|
40070
40077
|
paymentCurrency,
|
|
40071
40078
|
paymentMethod,
|
|
40072
40079
|
amount: summary[currencyId],
|
|
40073
|
-
invoices
|
|
40080
|
+
invoices
|
|
40074
40081
|
};
|
|
40075
40082
|
}
|
|
40076
40083
|
async function ensureSubscriptionForOverdraftProtection(subscriptionId, amount) {
|
|
@@ -44977,7 +44984,7 @@ var init_checkout_sessions = __esm({
|
|
|
44977
44984
|
}
|
|
44978
44985
|
}
|
|
44979
44986
|
}
|
|
44980
|
-
const canMakeNewPurchase = await customer.canMakeNewPurchase(checkoutSession.invoice_id);
|
|
44987
|
+
const canMakeNewPurchase = await customer.canMakeNewPurchase(checkoutSession.invoice_id, checkoutSession.livemode);
|
|
44981
44988
|
if (!canMakeNewPurchase) {
|
|
44982
44989
|
return c.json(
|
|
44983
44990
|
{
|
|
@@ -45610,7 +45617,7 @@ var init_checkout_sessions = __esm({
|
|
|
45610
45617
|
);
|
|
45611
45618
|
}
|
|
45612
45619
|
}
|
|
45613
|
-
const canMakeNewPurchase = await customer.canMakeNewPurchase(checkoutSession.invoice_id);
|
|
45620
|
+
const canMakeNewPurchase = await customer.canMakeNewPurchase(checkoutSession.invoice_id, checkoutSession.livemode);
|
|
45614
45621
|
if (!canMakeNewPurchase) {
|
|
45615
45622
|
return c.json(
|
|
45616
45623
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcblock/payment-service",
|
|
3
|
-
"version": "1.29.
|
|
3
|
+
"version": "1.29.14",
|
|
4
4
|
"description": "Embedded payment service factory (W2) — side-effect-free core for arc / blocklet server / standalone worker hosts",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@blocklet/constant": "^1.17.13-beta-20260613-094425-b81920c8",
|
|
45
45
|
"@blocklet/error": "^0.3.5",
|
|
46
46
|
"@blocklet/logger": "^1.17.13-beta-20260613-094425-b81920c8",
|
|
47
|
-
"@blocklet/payment-vendor": "1.29.
|
|
47
|
+
"@blocklet/payment-vendor": "1.29.14",
|
|
48
48
|
"@blocklet/sdk": "^1.17.13-beta-20260613-094425-b81920c8",
|
|
49
49
|
"@blocklet/xss": "^0.15.4",
|
|
50
50
|
"@hono/node-server": "^2.0.4",
|
|
@@ -90,5 +90,5 @@
|
|
|
90
90
|
"ts-jest": "^29.1.2",
|
|
91
91
|
"typescript": "^5.4.3"
|
|
92
92
|
},
|
|
93
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "ac4de50daf46f5ef2b4d58d1060610564929a10c"
|
|
94
94
|
}
|