payment-kit 1.20.2 → 1.20.3
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/api/src/libs/notification/template/subscription-trial-will-end.ts +1 -1
- package/api/src/libs/notification/template/subscription-will-renew.ts +1 -1
- package/api/src/libs/subscription.ts +0 -1
- package/api/src/queues/usage-record.ts +1 -1
- package/api/src/routes/checkout-sessions.ts +0 -1
- package/api/src/routes/payment-intents.ts +1 -1
- package/api/src/routes/products.ts +0 -1
- package/blocklet.yml +1 -1
- package/package.json +4 -4
- package/src/components/invoice/table.tsx +1 -2
- package/src/libs/util.ts +1 -1
- package/src/pages/customer/subscription/detail.tsx +1 -1
|
@@ -91,7 +91,7 @@ export class SubscriptionTrialWillEndEmailTemplate extends BaseSubscriptionEmail
|
|
|
91
91
|
// @ts-ignore
|
|
92
92
|
const paymentAddress = subscription.payment_details?.[paymentMethod.type]?.payer ?? undefined;
|
|
93
93
|
const balance = await getTokenByAddress(paymentAddress, paymentMethod, paymentCurrency);
|
|
94
|
-
|
|
94
|
+
|
|
95
95
|
paymentDetail.balance = +fromUnitToToken(balance, paymentCurrency.decimal);
|
|
96
96
|
}
|
|
97
97
|
|
|
@@ -98,7 +98,7 @@ export class SubscriptionWillRenewEmailTemplate extends BaseSubscriptionEmailTem
|
|
|
98
98
|
if (!isStripe && !isCreditSubscription) {
|
|
99
99
|
const paymentAddress = getSubscriptionPaymentAddress(subscription, paymentInfoResult.paymentMethod!.type);
|
|
100
100
|
const balance = await getTokenByAddress(paymentAddress, paymentInfoResult.paymentMethod!, paymentCurrency);
|
|
101
|
-
|
|
101
|
+
|
|
102
102
|
paymentDetail.balanceFormatted = fromUnitToToken(balance, paymentCurrency.decimal);
|
|
103
103
|
paymentDetail.balance = +paymentDetail.balanceFormatted;
|
|
104
104
|
}
|
|
@@ -1061,7 +1061,6 @@ export async function getSubscriptionStakeAmountSetup(
|
|
|
1061
1061
|
});
|
|
1062
1062
|
});
|
|
1063
1063
|
Object.keys(amountRes).forEach((address) => {
|
|
1064
|
-
// @ts-expect-error 这里有问题
|
|
1065
1064
|
amountRes[address] = amountRes[address].toString();
|
|
1066
1065
|
});
|
|
1067
1066
|
logger.info('get subscription stake amount setup success', { txHash, amountRes });
|
|
@@ -107,7 +107,7 @@ export const doHandleUsageRecord = async (job: UsageRecordJob) => {
|
|
|
107
107
|
usageEnd: dayjs.unix(usageEnd).toISOString(),
|
|
108
108
|
rawQuantity,
|
|
109
109
|
quantity,
|
|
110
|
-
|
|
110
|
+
|
|
111
111
|
unitAmount: fromUnitToToken(unitAmount, currency.decimal),
|
|
112
112
|
totalAmount: fromUnitToToken(totalAmount.toString(), currency.decimal),
|
|
113
113
|
threshold: fromUnitToToken(threshold.toString(), currency.decimal),
|
|
@@ -364,7 +364,7 @@ router.get('/:id/refundable-amount', authPortal, async (req, res) => {
|
|
|
364
364
|
payouts.forEach((payout) => {
|
|
365
365
|
totalPayoutAmount = totalPayoutAmount.add(new BN(payout.amount));
|
|
366
366
|
});
|
|
367
|
-
|
|
367
|
+
|
|
368
368
|
result.amount = result.amount.sub(totalPayoutAmount);
|
|
369
369
|
}
|
|
370
370
|
res.json(result);
|
|
@@ -121,7 +121,6 @@ export async function createProductAndPrices(payload: any) {
|
|
|
121
121
|
// @ts-ignore
|
|
122
122
|
['preset', 'maximum', 'minimum'].forEach((key: keyof CustomUnitAmount) => {
|
|
123
123
|
if (newPrice.custom_unit_amount?.[key]) {
|
|
124
|
-
// @ts-expect-error 这里有问题
|
|
125
124
|
newPrice.custom_unit_amount[key] = fromTokenToUnit(
|
|
126
125
|
newPrice.custom_unit_amount[key] as string,
|
|
127
126
|
currency.decimal
|
package/blocklet.yml
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "payment-kit",
|
|
3
|
-
"version": "1.20.
|
|
3
|
+
"version": "1.20.3",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "blocklet dev --open",
|
|
6
6
|
"lint": "tsc --noEmit && eslint src api/src --ext .mjs,.js,.jsx,.ts,.tsx",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@blocklet/error": "^0.2.5",
|
|
56
56
|
"@blocklet/js-sdk": "^1.16.50",
|
|
57
57
|
"@blocklet/logger": "^1.16.50",
|
|
58
|
-
"@blocklet/payment-react": "1.20.
|
|
58
|
+
"@blocklet/payment-react": "1.20.3",
|
|
59
59
|
"@blocklet/sdk": "^1.16.50",
|
|
60
60
|
"@blocklet/ui-react": "^3.1.33",
|
|
61
61
|
"@blocklet/uploader": "^0.2.7",
|
|
@@ -124,7 +124,7 @@
|
|
|
124
124
|
"devDependencies": {
|
|
125
125
|
"@abtnode/types": "^1.16.50",
|
|
126
126
|
"@arcblock/eslint-config-ts": "^0.3.3",
|
|
127
|
-
"@blocklet/payment-types": "1.20.
|
|
127
|
+
"@blocklet/payment-types": "1.20.3",
|
|
128
128
|
"@types/cookie-parser": "^1.4.9",
|
|
129
129
|
"@types/cors": "^2.8.19",
|
|
130
130
|
"@types/debug": "^4.1.12",
|
|
@@ -171,5 +171,5 @@
|
|
|
171
171
|
"parser": "typescript"
|
|
172
172
|
}
|
|
173
173
|
},
|
|
174
|
-
"gitHead": "
|
|
174
|
+
"gitHead": "984217214ef0b3c3dcfbfcbeb68d7cbab69b750b"
|
|
175
175
|
}
|
|
@@ -54,9 +54,8 @@ export function getAppliedBalance(invoice: TInvoiceExpanded) {
|
|
|
54
54
|
invoice.ending_token_balance &&
|
|
55
55
|
invoice.ending_token_balance[invoice.paymentCurrency.id]
|
|
56
56
|
) {
|
|
57
|
-
// @ts-expect-error 这里有问题
|
|
58
57
|
const starting = toBN(invoice.starting_token_balance[invoice.paymentCurrency.id]);
|
|
59
|
-
|
|
58
|
+
|
|
60
59
|
const ending = toBN(invoice.ending_token_balance[invoice.paymentCurrency.id]);
|
|
61
60
|
return ending.sub(starting).toString();
|
|
62
61
|
}
|
package/src/libs/util.ts
CHANGED
|
@@ -141,7 +141,7 @@ export default function CustomerSubscriptionDetail() {
|
|
|
141
141
|
new BN(overdraftProtection.upcoming?.amount).add(new BN(overdraftProtection.gas))
|
|
142
142
|
);
|
|
143
143
|
const estimateAmount = +fromUnitToToken(cycleAmount.amount, data.paymentCurrency?.decimal);
|
|
144
|
-
|
|
144
|
+
|
|
145
145
|
const remainingStake = +fromUnitToToken(overdraftProtection?.unused, data.paymentCurrency?.decimal);
|
|
146
146
|
const formatEstimatedDuration = (cycles: number) => {
|
|
147
147
|
if (!data?.pending_invoice_item_interval) return '';
|