payment-kit 1.13.28 → 1.13.30

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.
@@ -60,6 +60,7 @@ export async function mintNftForCheckoutSession(id: string) {
60
60
  await checkoutSession.update({
61
61
  nft_mint_status: 'error',
62
62
  nft_mint_details: {
63
+ type: 'arcblock',
63
64
  arcblock: {
64
65
  address: preMint.address,
65
66
  owner: nftOwner as string,
@@ -88,6 +89,7 @@ export async function mintNftForCheckoutSession(id: string) {
88
89
  await checkoutSession.update({
89
90
  nft_mint_status: 'minted',
90
91
  nft_mint_details: {
92
+ type: 'arcblock',
91
93
  arcblock: {
92
94
  tx_hash: hash,
93
95
  address: preMint.address,
@@ -182,14 +182,12 @@ router.put('/:id', auth, async (req, res) => {
182
182
  if (!product) {
183
183
  return res.status(404).json({ error: 'product not found' });
184
184
  }
185
- if (product.active === false) {
186
- return res.status(403).json({ error: 'product archived' });
187
- }
188
185
  if (product.locked) {
189
186
  return res.status(403).json({ error: 'product locked' });
190
187
  }
191
188
 
192
189
  const updates: Partial<Product> = pick(req.body, [
190
+ 'status',
193
191
  'name',
194
192
  'description',
195
193
  'images',
@@ -216,7 +214,6 @@ router.put('/:id/archive', auth, async (req, res) => {
216
214
  if (!product) {
217
215
  return res.status(404).json({ error: 'product not found' });
218
216
  }
219
-
220
217
  if (product.locked) {
221
218
  return res.status(403).json({ error: 'product locked' });
222
219
  }
@@ -235,11 +232,6 @@ router.delete('/:id', auth, async (req, res) => {
235
232
  if (!product) {
236
233
  return res.status(404).json({ error: 'product not found' });
237
234
  }
238
-
239
- if (product.active === false) {
240
- return res.status(403).json({ error: 'product archived' });
241
- }
242
-
243
235
  if (product.locked) {
244
236
  return res.status(403).json({ error: 'product locked' });
245
237
  }
@@ -31,19 +31,33 @@ router.post('/', auth, async (req, res) => {
31
31
  const schema = Joi.object<{
32
32
  page: number;
33
33
  pageSize: number;
34
+ status?: string;
34
35
  livemode?: boolean;
35
36
  }>({
36
37
  page: Joi.number().integer().min(1).default(1),
37
38
  pageSize: Joi.number().integer().min(1).max(100).default(20),
39
+ status: Joi.string().empty(''),
38
40
  livemode: Joi.boolean().empty(''),
39
41
  });
40
42
  router.get('/', auth, async (req, res) => {
41
- const { page, pageSize, ...query } = await schema.validateAsync(req.query, { stripUnknown: true });
43
+ const { page, pageSize, status, ...query } = await schema.validateAsync(req.query, { stripUnknown: true });
42
44
  const where: WhereOptions<WebhookEndpoint> = {};
43
45
 
44
46
  if (typeof query.livemode === 'boolean') {
45
47
  where.livemode = query.livemode;
46
48
  }
49
+ if (status) {
50
+ where.status = status
51
+ .split(',')
52
+ .map((x) => x.trim())
53
+ .filter(Boolean);
54
+ }
55
+ Object.keys(query)
56
+ .filter((x) => x.startsWith('metadata.'))
57
+ .forEach((key: string) => {
58
+ // @ts-ignore
59
+ where[key] = query[key];
60
+ });
47
61
 
48
62
  try {
49
63
  const { rows: list, count } = await WebhookEndpoint.findAndCountAll({
@@ -81,7 +95,13 @@ router.put('/:id', auth, async (req, res) => {
81
95
  return res.status(404).json({ error: 'webhook endpoint not found' });
82
96
  }
83
97
 
84
- const updates: Partial<WebhookEndpoint> = pick(req.body, ['description', 'metadata', 'status', 'enabled_events']);
98
+ const updates: Partial<WebhookEndpoint> = pick(req.body, [
99
+ 'url',
100
+ 'description',
101
+ 'metadata',
102
+ 'status',
103
+ 'enabled_events',
104
+ ]);
85
105
  if (updates.metadata) {
86
106
  updates.metadata = formatMetadata(updates.metadata);
87
107
  }
@@ -275,6 +275,7 @@ export type NftMintSettings = {
275
275
  };
276
276
 
277
277
  export type NftMintDetails = {
278
+ type: LiteralUnion<'arcblock' | 'ethereum' | 'bitcoin', string>;
278
279
  arcblock?: {
279
280
  tx_hash?: string;
280
281
  address: string;
package/blocklet.yml CHANGED
@@ -14,7 +14,7 @@ repository:
14
14
  type: git
15
15
  url: git+https://github.com/blocklet/payment-kit.git
16
16
  specVersion: 1.2.8
17
- version: 1.13.28
17
+ version: 1.13.30
18
18
  logo: logo.png
19
19
  files:
20
20
  - dist
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payment-kit",
3
- "version": "1.13.28",
3
+ "version": "1.13.30",
4
4
  "scripts": {
5
5
  "dev": "blocklet dev",
6
6
  "eject": "vite eject",
@@ -103,7 +103,7 @@
103
103
  "@abtnode/types": "1.16.17-beta-703fb879",
104
104
  "@arcblock/eslint-config": "^0.2.4",
105
105
  "@arcblock/eslint-config-ts": "^0.2.4",
106
- "@did-pay/types": "1.13.28",
106
+ "@did-pay/types": "1.13.30",
107
107
  "@types/cookie-parser": "^1.4.4",
108
108
  "@types/cors": "^2.8.14",
109
109
  "@types/dotenv-flow": "^3.3.1",
@@ -140,5 +140,5 @@
140
140
  "parser": "typescript"
141
141
  }
142
142
  },
143
- "gitHead": "b4a13ea876d489b52fed81b21049fd39bda088d4"
143
+ "gitHead": "eb3b428db29ac33c697ca9ae3796d377ec779335"
144
144
  }