payment-kit 1.13.102 → 1.13.103

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/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.102
17
+ version: 1.13.103
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.102",
3
+ "version": "1.13.103",
4
4
  "scripts": {
5
5
  "dev": "COMPONENT_STORE_URL=https://test.store.blocklet.dev blocklet dev",
6
6
  "eject": "vite eject",
@@ -110,7 +110,7 @@
110
110
  "@abtnode/types": "1.16.21",
111
111
  "@arcblock/eslint-config": "^0.2.4",
112
112
  "@arcblock/eslint-config-ts": "^0.2.4",
113
- "@did-pay/types": "1.13.102",
113
+ "@did-pay/types": "1.13.103",
114
114
  "@types/cookie-parser": "^1.4.6",
115
115
  "@types/cors": "^2.8.17",
116
116
  "@types/dotenv-flow": "^3.3.3",
@@ -149,5 +149,5 @@
149
149
  "parser": "typescript"
150
150
  }
151
151
  },
152
- "gitHead": "8754f63a70fb2580f60176d84248cdd6118abc51"
152
+ "gitHead": "a86ded7d5fba51f50a987f3b7152185b3d704e8c"
153
153
  }
@@ -615,7 +615,10 @@ export default flat({
615
615
  config: 'Switch to another plan or billing cycle',
616
616
  confirm: 'Confirm changes to your subscription',
617
617
  summary: 'What you will pay for starting {date}',
618
- due: 'Amount due today',
618
+ total: 'Total (metered items excluded)',
619
+ appliedCredit: 'Credit applied',
620
+ newCredit: 'Credit issued',
621
+ remaining: 'Amount due today',
619
622
  },
620
623
  invoice: {
621
624
  summary: 'Summary',
@@ -601,7 +601,10 @@ export default flat({
601
601
  config: '切换套餐或周期',
602
602
  confirm: '确认变更细节',
603
603
  summary: '新的付款计划({date} 开始)',
604
- due: '今天还需支付',
604
+ total: '套餐定价(不含按量部分)',
605
+ appliedCredit: '信用扣除',
606
+ newCredit: '信用增加',
607
+ remaining: '还需支付',
605
608
  },
606
609
  invoice: {
607
610
  summary: '摘要',
@@ -55,6 +55,8 @@ export default function CustomerSubscriptionUpdate() {
55
55
  priceId: '',
56
56
  total: '',
57
57
  remaining: '',
58
+ newCredit: '',
59
+ appliedCredit: '',
58
60
  setup: null,
59
61
  prorations: [],
60
62
  items: [],
@@ -198,6 +200,20 @@ export default function CustomerSubscriptionUpdate() {
198
200
  const { recurring } = data.subscription.items.find((x) => x.price.type === 'recurring')?.price || {};
199
201
  const interval = [recurring?.interval, recurring?.interval_count].join('-');
200
202
 
203
+ const getInfoRow = (label: string, value: string, prefix?: string) => {
204
+ return (
205
+ <Stack direction="row" justifyContent="space-between">
206
+ <Typography variant="h6" sx={{ fontWeight: 'normal' }}>
207
+ {label}
208
+ </Typography>
209
+ <Typography component="p" style={{ fontWeight: 'bold' }}>
210
+ {prefix}
211
+ {fromUnitToToken(value, data.subscription.paymentCurrency.decimal)} {data.subscription.paymentCurrency.symbol}
212
+ </Typography>
213
+ </Stack>
214
+ );
215
+ };
216
+
201
217
  return (
202
218
  <Root direction="column" spacing={4} sx={{ mb: 4 }}>
203
219
  <Stack className="page-header" direction="row" justifyContent="space-between" alignItems="center">
@@ -244,33 +260,32 @@ export default function CustomerSubscriptionUpdate() {
244
260
  })}
245
261
  </Stack>
246
262
  <Divider />
247
- <Stack direction="row" justifyContent="space-between">
248
- <Typography variant="h6" sx={{ fontWeight: 'normal' }}>
249
- {t('customer.upgrade.due')}
250
- </Typography>
251
- <Typography component="p" style={{ fontWeight: 'bold' }}>
252
- {fromUnitToToken(state.remaining, data.subscription.paymentCurrency.decimal)}{' '}
253
- {data.subscription.paymentCurrency.symbol}
254
- </Typography>
255
- </Stack>
256
- <Divider />
257
- <Stack direction="row" alignItems="center" justifyContent="flex-end" spacing={2}>
258
- <LoadingButton
259
- disabled={state.loading || state.paying}
260
- onClick={() => setState({ priceId: '' })}
261
- variant="text"
262
- size="large">
263
- {t('common.cancel')}
264
- </LoadingButton>
265
- <LoadingButton
266
- onClick={handleConfirm}
267
- variant="contained"
268
- size="large"
269
- sx={{ width: 150 }}
270
- loading={state.loading || state.paying}
271
- loadingPosition="end">
272
- {t('common.confirm')}
273
- </LoadingButton>
263
+ <Stack direction="column" spacing={1}>
264
+ {getInfoRow(t('customer.upgrade.total'), state.total)}
265
+ {state.prorations.map((x: any) => getInfoRow(x.description, x.amount))}
266
+ {state.appliedCredit > '0' && getInfoRow(t('customer.upgrade.appliedCredit'), state.appliedCredit, '-')}
267
+ {state.newCredit > '0' && getInfoRow(t('customer.upgrade.newCredit'), state.newCredit)}
268
+ <Divider />
269
+ {getInfoRow(t('customer.upgrade.remaining'), state.remaining)}
270
+ <Divider />
271
+ <Stack direction="row" alignItems="center" justifyContent="flex-end" spacing={2} sx={{ pt: 2 }}>
272
+ <LoadingButton
273
+ disabled={state.loading || state.paying}
274
+ onClick={() => setState({ priceId: '' })}
275
+ variant="text"
276
+ size="large">
277
+ {t('common.cancel')}
278
+ </LoadingButton>
279
+ <LoadingButton
280
+ onClick={handleConfirm}
281
+ variant="contained"
282
+ size="large"
283
+ sx={{ width: 150 }}
284
+ loading={state.loading || state.paying}
285
+ loadingPosition="end">
286
+ {t('common.confirm')}
287
+ </LoadingButton>
288
+ </Stack>
274
289
  </Stack>
275
290
  </Stack>
276
291
  )}