payment-kit 1.13.58 → 1.13.60
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/jobs/payment.ts +11 -0
- package/api/src/routes/checkout-sessions.ts +1 -0
- package/blocklet.yml +1 -1
- package/package.json +24 -24
package/api/src/jobs/payment.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { ensureStakedForGas } from '../integrations/blockchain/stake';
|
|
1
2
|
import { wallet } from '../libs/auth';
|
|
2
3
|
import dayjs from '../libs/dayjs';
|
|
3
4
|
import CustomError from '../libs/error';
|
|
5
|
+
import { events } from '../libs/event';
|
|
4
6
|
import logger from '../libs/logger';
|
|
5
7
|
import { getGasPayerExtra, isDelegationSufficientForPayment } from '../libs/payment';
|
|
6
8
|
import createQueue from '../libs/queue';
|
|
@@ -246,6 +248,15 @@ export const paymentQueue = createQueue<PaymentJob>({
|
|
|
246
248
|
});
|
|
247
249
|
|
|
248
250
|
export const startPaymentQueue = async () => {
|
|
251
|
+
// Do gas stake as soon as possible after payment succeed
|
|
252
|
+
events.on('payment_intent.succeeded', async (paymentIntent: PaymentIntent) => {
|
|
253
|
+
const paymentMethod = await PaymentMethod.findByPk(paymentIntent.payment_method_id);
|
|
254
|
+
if (paymentMethod && paymentMethod.type === 'arcblock') {
|
|
255
|
+
ensureStakedForGas();
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
// Restore previous payments
|
|
249
260
|
const payments = await PaymentIntent.findAll({
|
|
250
261
|
where: {
|
|
251
262
|
status: ['requires_capture', 'processing'],
|
|
@@ -721,6 +721,7 @@ router.put('/:id/submit', user, ensureCheckoutSessionOpen, async (req, res) => {
|
|
|
721
721
|
await invoice.update({ auto_advance: true, payment_settings: paymentSettings });
|
|
722
722
|
invoiceQueue.push({ id: invoice.id, job: { invoiceId: invoice.id, retryOnError: false } });
|
|
723
723
|
} else {
|
|
724
|
+
await paymentIntent.update({ status: 'requires_capture' });
|
|
724
725
|
paymentQueue.push({
|
|
725
726
|
id: paymentIntent.id,
|
|
726
727
|
job: { paymentIntentId: paymentIntent.id, paymentSettings, retryOnError: false },
|
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.60",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "blocklet dev",
|
|
6
6
|
"eject": "vite eject",
|
|
@@ -40,28 +40,28 @@
|
|
|
40
40
|
]
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@arcblock/did": "^1.18.
|
|
43
|
+
"@arcblock/did": "^1.18.101",
|
|
44
44
|
"@arcblock/did-auth-storage-nedb": "^1.7.1",
|
|
45
|
-
"@arcblock/did-connect": "^2.8.
|
|
46
|
-
"@arcblock/did-util": "^1.18.
|
|
47
|
-
"@arcblock/jwt": "^1.18.
|
|
48
|
-
"@arcblock/ux": "^2.8.
|
|
45
|
+
"@arcblock/did-connect": "^2.8.17",
|
|
46
|
+
"@arcblock/did-util": "^1.18.101",
|
|
47
|
+
"@arcblock/jwt": "^1.18.101",
|
|
48
|
+
"@arcblock/ux": "^2.8.17",
|
|
49
49
|
"@blocklet/logger": "1.16.18",
|
|
50
50
|
"@blocklet/sdk": "1.16.18",
|
|
51
|
-
"@blocklet/ui-react": "^2.8.
|
|
51
|
+
"@blocklet/ui-react": "^2.8.17",
|
|
52
52
|
"@blocklet/uploader": "^0.0.38",
|
|
53
53
|
"@mui/icons-material": "^5.14.18",
|
|
54
54
|
"@mui/lab": "^5.0.0-alpha.153",
|
|
55
55
|
"@mui/material": "^5.14.18",
|
|
56
56
|
"@mui/styles": "^5.14.18",
|
|
57
57
|
"@mui/system": "^5.14.18",
|
|
58
|
-
"@ocap/asset": "^1.18.
|
|
59
|
-
"@ocap/client": "^1.18.
|
|
60
|
-
"@ocap/mcrypto": "^1.18.
|
|
61
|
-
"@ocap/util": "^1.18.
|
|
62
|
-
"@ocap/wallet": "^1.18.
|
|
63
|
-
"@stripe/react-stripe-js": "^2.
|
|
64
|
-
"@stripe/stripe-js": "^2.
|
|
58
|
+
"@ocap/asset": "^1.18.101",
|
|
59
|
+
"@ocap/client": "^1.18.101",
|
|
60
|
+
"@ocap/mcrypto": "^1.18.101",
|
|
61
|
+
"@ocap/util": "^1.18.101",
|
|
62
|
+
"@ocap/wallet": "^1.18.101",
|
|
63
|
+
"@stripe/react-stripe-js": "^2.4.0",
|
|
64
|
+
"@stripe/stripe-js": "^2.2.0",
|
|
65
65
|
"ahooks": "^3.7.8",
|
|
66
66
|
"axios": "^0.27.2",
|
|
67
67
|
"body-parser": "^1.20.2",
|
|
@@ -89,9 +89,9 @@
|
|
|
89
89
|
"react-error-boundary": "^4.0.11",
|
|
90
90
|
"react-hook-form": "^7.48.2",
|
|
91
91
|
"react-international-phone": "^3.1.2",
|
|
92
|
-
"react-router-dom": "^6.
|
|
92
|
+
"react-router-dom": "^6.20.0",
|
|
93
93
|
"rimraf": "^3.0.2",
|
|
94
|
-
"sequelize": "^6.35.
|
|
94
|
+
"sequelize": "^6.35.1",
|
|
95
95
|
"sqlite3": "^5.1.6",
|
|
96
96
|
"stripe": "^13.11.0",
|
|
97
97
|
"typewriter-effect": "^2.21.0",
|
|
@@ -104,18 +104,18 @@
|
|
|
104
104
|
"@abtnode/types": "1.16.18",
|
|
105
105
|
"@arcblock/eslint-config": "^0.2.4",
|
|
106
106
|
"@arcblock/eslint-config-ts": "^0.2.4",
|
|
107
|
-
"@did-pay/types": "1.13.
|
|
107
|
+
"@did-pay/types": "1.13.60",
|
|
108
108
|
"@types/cookie-parser": "^1.4.6",
|
|
109
|
-
"@types/cors": "^2.8.
|
|
109
|
+
"@types/cors": "^2.8.17",
|
|
110
110
|
"@types/dotenv-flow": "^3.3.3",
|
|
111
111
|
"@types/express": "^4.17.21",
|
|
112
|
-
"@types/node": "^18.18.
|
|
113
|
-
"@types/react": "^18.2.
|
|
114
|
-
"@types/react-dom": "^18.2.
|
|
112
|
+
"@types/node": "^18.18.13",
|
|
113
|
+
"@types/react": "^18.2.39",
|
|
114
|
+
"@types/react-dom": "^18.2.17",
|
|
115
115
|
"@vitejs/plugin-react": "^2.2.0",
|
|
116
116
|
"bumpp": "^8.2.1",
|
|
117
117
|
"cross-env": "^7.0.3",
|
|
118
|
-
"eslint": "^8.
|
|
118
|
+
"eslint": "^8.54.0",
|
|
119
119
|
"import-sort-style-module": "^6.0.0",
|
|
120
120
|
"lint-staged": "^12.5.0",
|
|
121
121
|
"nodemon": "^2.0.22",
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
"prettier": "^2.8.8",
|
|
124
124
|
"prettier-plugin-import-sort": "^0.0.7",
|
|
125
125
|
"ts-node": "^10.9.1",
|
|
126
|
-
"type-fest": "^4.
|
|
126
|
+
"type-fest": "^4.8.2",
|
|
127
127
|
"typescript": "^4.9.5",
|
|
128
128
|
"vite": "^4.5.0",
|
|
129
129
|
"vite-plugin-blocklet": "^0.6.15",
|
|
@@ -141,5 +141,5 @@
|
|
|
141
141
|
"parser": "typescript"
|
|
142
142
|
}
|
|
143
143
|
},
|
|
144
|
-
"gitHead": "
|
|
144
|
+
"gitHead": "8e15e9d178ebb2c038066ae2b17f95415b6919cb"
|
|
145
145
|
}
|