payment-kit 1.13.290 → 1.13.291
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/queues/subscription.ts +1 -1
- package/api/src/routes/invoices.ts +10 -2
- package/blocklet.yml +1 -1
- package/package.json +4 -4
|
@@ -327,7 +327,7 @@ const handleStakeSlashAfterCancel = async (subscription: Subscription) => {
|
|
|
327
327
|
|
|
328
328
|
// check for staking for this subscription
|
|
329
329
|
const data = JSON.parse(state.data.value || '{}');
|
|
330
|
-
if (!data[subscription.id]) {
|
|
330
|
+
if (!data[subscription.id] && !state.nonce) {
|
|
331
331
|
logger.warn('Stake slashing aborted because no staking for subscription', {
|
|
332
332
|
subscription: subscription.id,
|
|
333
333
|
address,
|
|
@@ -132,14 +132,22 @@ router.get('/', authMine, async (req, res) => {
|
|
|
132
132
|
|
|
133
133
|
if (state && last) {
|
|
134
134
|
const data = JSON.parse(state.data?.value || '{}');
|
|
135
|
+
let stakeAmount = data[subscription.id];
|
|
136
|
+
if (state.nonce) {
|
|
137
|
+
const currency = await PaymentCurrency.findByPk(subscription.currency_id);
|
|
138
|
+
if (!currency) {
|
|
139
|
+
throw new Error('Invalid currency');
|
|
140
|
+
}
|
|
141
|
+
stakeAmount = state.tokens.find((x: any) => x.address === currency?.contract)?.value;
|
|
142
|
+
}
|
|
135
143
|
list.push({
|
|
136
144
|
id: address as string,
|
|
137
145
|
status: 'paid',
|
|
138
146
|
description: 'Subscription staking',
|
|
139
147
|
billing_reason: 'subscription_create',
|
|
140
|
-
total:
|
|
148
|
+
total: stakeAmount,
|
|
141
149
|
amount_due: '0',
|
|
142
|
-
amount_paid:
|
|
150
|
+
amount_paid: stakeAmount,
|
|
143
151
|
amount_remaining: '0',
|
|
144
152
|
...pick(last, [
|
|
145
153
|
'number',
|
package/blocklet.yml
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "payment-kit",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.291",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "blocklet dev --open",
|
|
6
6
|
"eject": "vite eject",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@arcblock/validator": "^1.18.124",
|
|
53
53
|
"@blocklet/js-sdk": "1.16.28",
|
|
54
54
|
"@blocklet/logger": "1.16.28",
|
|
55
|
-
"@blocklet/payment-react": "1.13.
|
|
55
|
+
"@blocklet/payment-react": "1.13.291",
|
|
56
56
|
"@blocklet/sdk": "1.16.28",
|
|
57
57
|
"@blocklet/ui-react": "^2.10.3",
|
|
58
58
|
"@blocklet/uploader": "^0.1.18",
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
"devDependencies": {
|
|
119
119
|
"@abtnode/types": "1.16.28",
|
|
120
120
|
"@arcblock/eslint-config-ts": "^0.3.2",
|
|
121
|
-
"@blocklet/payment-types": "1.13.
|
|
121
|
+
"@blocklet/payment-types": "1.13.291",
|
|
122
122
|
"@types/cookie-parser": "^1.4.7",
|
|
123
123
|
"@types/cors": "^2.8.17",
|
|
124
124
|
"@types/debug": "^4.1.12",
|
|
@@ -158,5 +158,5 @@
|
|
|
158
158
|
"parser": "typescript"
|
|
159
159
|
}
|
|
160
160
|
},
|
|
161
|
-
"gitHead": "
|
|
161
|
+
"gitHead": "6e2ff4e102d46a29b5808e9c198e30ad3d3e9e04"
|
|
162
162
|
}
|