payment-kit 1.19.3 → 1.19.4

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.
@@ -23,6 +23,7 @@ const listSchema = createListParamSchema<{
23
23
  customer_id?: string;
24
24
  subscription_id?: string;
25
25
  credit_grant_id?: string;
26
+ meter_id?: string;
26
27
  start?: number;
27
28
  end?: number;
28
29
  source?: string;
@@ -30,6 +31,7 @@ const listSchema = createListParamSchema<{
30
31
  customer_id: Joi.string().empty(''),
31
32
  subscription_id: Joi.string().empty(''),
32
33
  credit_grant_id: Joi.string().empty(''),
34
+ meter_id: Joi.string().empty(''),
33
35
  start: Joi.number().integer().optional(),
34
36
  end: Joi.number().integer().optional(),
35
37
  source: Joi.string().empty(''),
@@ -40,6 +42,9 @@ router.get('/', authMine, async (req, res) => {
40
42
  const { page, pageSize, ...query } = await listSchema.validateAsync(req.query, { stripUnknown: true });
41
43
  const where = getWhereFromKvQuery(query.q);
42
44
 
45
+ if (query.meter_id) {
46
+ where.meter_id = query.meter_id;
47
+ }
43
48
  if (query.customer_id) {
44
49
  where.customer_id = query.customer_id;
45
50
  }
@@ -123,6 +128,7 @@ const summarySchema = Joi.object({
123
128
  customer_id: Joi.string().optional(),
124
129
  subscription_id: Joi.string().optional(),
125
130
  currency_id: Joi.string().optional(),
131
+ meter_id: Joi.string().optional(),
126
132
  start: Joi.number().integer().optional(),
127
133
  end: Joi.number().integer().optional(),
128
134
  }).unknown(true);
@@ -134,6 +140,7 @@ router.get('/summary', authMine, async (req, res) => {
134
140
  customer_id: customerId,
135
141
  subscription_id: subscriptionId,
136
142
  currency_id: currencyId,
143
+ meter_id: meterId,
137
144
  start,
138
145
  end,
139
146
  } = await summarySchema.validateAsync(req.query, { stripUnknown: true });
@@ -142,6 +149,7 @@ router.get('/summary', authMine, async (req, res) => {
142
149
  customerId,
143
150
  subscriptionId,
144
151
  currencyId,
152
+ meterId,
145
153
  startTime: start ? new Date(start * 1000) : undefined,
146
154
  endTime: end ? new Date(end * 1000) : undefined,
147
155
  });
@@ -142,6 +142,7 @@ export class CreditTransaction extends Model<
142
142
  subscriptionId,
143
143
  meterEventName,
144
144
  currencyId,
145
+ meterId,
145
146
  startTime,
146
147
  endTime,
147
148
  }: {
@@ -149,6 +150,7 @@ export class CreditTransaction extends Model<
149
150
  subscriptionId?: string;
150
151
  meterEventName?: string;
151
152
  currencyId?: string;
153
+ meterId?: string;
152
154
  startTime?: Date;
153
155
  endTime?: Date;
154
156
  }) {
@@ -169,6 +171,10 @@ export class CreditTransaction extends Model<
169
171
  whereClause['$creditGrant.currency_id$'] = currencyId;
170
172
  }
171
173
 
174
+ if (meterId) {
175
+ whereClause.meter_id = meterId;
176
+ }
177
+
172
178
  if (startTime || endTime) {
173
179
  whereClause.created_at = {};
174
180
  if (startTime) {
@@ -212,6 +218,7 @@ export class CreditTransaction extends Model<
212
218
  customer_id: customerId,
213
219
  subscription_id: subscriptionId,
214
220
  meter_event_name: meterEventName,
221
+ meter_id: meterId,
215
222
  currency_id: currencyId,
216
223
  start_time: startTime?.toISOString(),
217
224
  end_time: endTime?.toISOString(),
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.19.3
17
+ version: 1.19.4
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.19.3",
3
+ "version": "1.19.4",
4
4
  "scripts": {
5
5
  "dev": "blocklet dev --open",
6
6
  "lint": "tsc --noEmit && eslint src api/src --ext .mjs,.js,.jsx,.ts,.tsx",
@@ -43,20 +43,20 @@
43
43
  ]
44
44
  },
45
45
  "dependencies": {
46
- "@abtnode/cron": "^1.16.45",
46
+ "@abtnode/cron": "^1.16.46",
47
47
  "@arcblock/did": "^1.20.15",
48
48
  "@arcblock/did-auth-storage-nedb": "^1.7.1",
49
- "@arcblock/did-connect": "^3.0.22",
49
+ "@arcblock/did-connect": "^3.0.24",
50
50
  "@arcblock/did-util": "^1.20.15",
51
51
  "@arcblock/jwt": "^1.20.15",
52
- "@arcblock/ux": "^3.0.22",
52
+ "@arcblock/ux": "^3.0.24",
53
53
  "@arcblock/validator": "^1.20.15",
54
54
  "@blocklet/did-space-js": "^1.1.5",
55
- "@blocklet/js-sdk": "^1.16.45",
56
- "@blocklet/logger": "^1.16.45",
57
- "@blocklet/payment-react": "1.19.3",
58
- "@blocklet/sdk": "^1.16.45",
59
- "@blocklet/ui-react": "^3.0.22",
55
+ "@blocklet/js-sdk": "^1.16.46",
56
+ "@blocklet/logger": "^1.16.46",
57
+ "@blocklet/payment-react": "1.19.4",
58
+ "@blocklet/sdk": "^1.16.46",
59
+ "@blocklet/ui-react": "^3.0.24",
60
60
  "@blocklet/uploader": "^0.2.4",
61
61
  "@blocklet/xss": "^0.2.2",
62
62
  "@mui/icons-material": "^7.1.2",
@@ -120,9 +120,9 @@
120
120
  "web3": "^4.16.0"
121
121
  },
122
122
  "devDependencies": {
123
- "@abtnode/types": "^1.16.45",
123
+ "@abtnode/types": "^1.16.46",
124
124
  "@arcblock/eslint-config-ts": "^0.3.3",
125
- "@blocklet/payment-types": "1.19.3",
125
+ "@blocklet/payment-types": "1.19.4",
126
126
  "@types/cookie-parser": "^1.4.9",
127
127
  "@types/cors": "^2.8.19",
128
128
  "@types/debug": "^4.1.12",
@@ -168,5 +168,5 @@
168
168
  "parser": "typescript"
169
169
  }
170
170
  },
171
- "gitHead": "f274edb338c8f5a23ae46d9f7fea8458a6001cf7"
171
+ "gitHead": "ced79cc9e205a344b6fdce2f43ac8d27bb37f5f4"
172
172
  }