payment-kit 1.13.176 → 1.13.178

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.
@@ -108,7 +108,7 @@ router.get('/me', user(), async (req, res) => {
108
108
  try {
109
109
  const doc = await Customer.findByPkOrDid(req.user.did as string);
110
110
  if (!doc) {
111
- res.status(404).json({ error: 'Customer not found' });
111
+ res.json(null);
112
112
  } else {
113
113
  const summary = await doc.getSummary();
114
114
  res.json({ ...doc.toJSON(), summary });
@@ -1,164 +1,172 @@
1
- import { getUrl } from '@blocklet/sdk/lib/component';
2
1
  import { fromTokenToUnit } from '@ocap/util';
3
2
  import Sequelize from 'sequelize';
3
+ import { joinURL } from 'ufo';
4
4
 
5
5
  import { createIdGenerator } from '../../libs/util';
6
6
  import type { Migration } from '../migrate';
7
7
 
8
- const genPaymentMethodId = createIdGenerator('pm', 24);
9
- const genPaymentCurrencyId = createIdGenerator('pc', 12);
8
+ const getUrl = (...parts: string[]): string => {
9
+ const { BLOCKLET_COMPONENT_DID, BLOCKLET_APP_URL } = process.env;
10
+ const components = JSON.parse(process.env.BLOCKLET_MOUNT_POINTS || '[]');
11
+ const component = components.find((x: any) => [x.title, x.name, x.did].includes(BLOCKLET_COMPONENT_DID));
12
+ const mountPoint = component?.mountPoint || '/';
13
+ return joinURL(BLOCKLET_APP_URL as string, mountPoint === '/' ? '' : mountPoint, ...parts);
14
+ };
10
15
 
11
- const abtId = genPaymentCurrencyId();
12
- const tbaId = genPaymentCurrencyId();
13
- const marsId = genPaymentCurrencyId();
14
- const play3Id = genPaymentCurrencyId();
15
- const mainId = genPaymentMethodId();
16
- const betaId = genPaymentMethodId();
17
- const now = new Date();
16
+ export const up: Migration = async ({ context }) => {
17
+ const genPaymentMethodId = createIdGenerator('pm', 24);
18
+ const genPaymentCurrencyId = createIdGenerator('pc', 12);
18
19
 
19
- const logo = getUrl('/methods/arcblock.png');
20
+ const abtId = genPaymentCurrencyId();
21
+ const tbaId = genPaymentCurrencyId();
22
+ const marsId = genPaymentCurrencyId();
23
+ const play3Id = genPaymentCurrencyId();
24
+ const mainId = genPaymentMethodId();
25
+ const betaId = genPaymentMethodId();
26
+ const now = new Date();
20
27
 
21
- const paymentCurrencies = [
22
- {
23
- id: abtId,
24
- active: true,
25
- livemode: true,
26
- locked: true,
27
- is_base_currency: true,
28
- payment_method_id: mainId,
29
- name: 'Native ABT',
30
- description: 'ABT on ArcBlock main chain',
31
- logo,
32
- symbol: 'ABT',
33
- decimal: 18,
34
- minimum_payment_amount: fromTokenToUnit(0.1, 18).toString(), // 0.1 token
35
- maximum_payment_amount: fromTokenToUnit(100000000, 18).toString(), // 0.1 billion
36
- contract: 'z35nNRvYxBoHitx9yZ5ATS88psfShzPPBLxYD',
37
- metadata: {},
38
- created_at: now,
39
- updated_at: now,
40
- },
41
- {
42
- id: tbaId,
43
- active: true,
44
- livemode: false,
45
- locked: true,
46
- is_base_currency: true,
47
- payment_method_id: betaId,
48
- name: 'Test ABT',
49
- description: 'ABT on ArcBlock beta chain',
50
- logo,
51
- symbol: 'TBA',
52
- decimal: 18,
53
- minimum_payment_amount: fromTokenToUnit(0.1, 18).toString(), // 0.1 token
54
- maximum_payment_amount: fromTokenToUnit(100000000, 18).toString(), // 0.1 billion
55
- contract: 'z35n6UoHSi9MED4uaQy6ozFgKPaZj2UKrurBG',
56
- metadata: {},
57
- created_at: now,
58
- updated_at: now,
59
- },
60
- {
61
- id: marsId,
62
- active: true,
63
- livemode: false,
64
- locked: false,
65
- is_base_currency: false,
66
- payment_method_id: betaId,
67
- name: 'RollupTestToken',
68
- description: 'Token to test rollup on staging',
69
- logo,
70
- symbol: 'MARS',
71
- decimal: 18,
72
- minimum_payment_amount: fromTokenToUnit(0.1, 18).toString(), // 0.1 token
73
- maximum_payment_amount: fromTokenToUnit(100000000, 18).toString(), // 0.1 billion
74
- contract: 'z35n4nCsnAEWa2zVSKNKZhDGXSszaJAogSc3A',
75
- metadata: {},
76
- created_at: now,
77
- updated_at: now,
78
- },
79
- {
80
- id: play3Id,
81
- active: true,
82
- livemode: false,
83
- locked: false,
84
- is_base_currency: false,
85
- payment_method_id: betaId,
86
- name: 'Playground Token',
87
- description: 'Test Token for OCAP Playground',
88
- logo,
89
- symbol: 'PLAY3',
90
- decimal: 18,
91
- minimum_payment_amount: fromTokenToUnit(0.1, 18).toString(), // 0.1 token
92
- maximum_payment_amount: fromTokenToUnit(100000000, 18).toString(), // 0.1 billion
93
- contract: 'z35n3WVTnN7KrR4gXn3szR6oneVefkBBx78Fc',
94
- metadata: {},
95
- created_at: now,
96
- updated_at: now,
97
- },
98
- ];
28
+ const logo = getUrl('/methods/arcblock.png');
99
29
 
100
- const paymentMethods = [
101
- {
102
- id: mainId,
103
- active: true,
104
- livemode: true,
105
- locked: true,
106
- type: 'arcblock',
107
- name: 'ArcBlock Main',
108
- description: 'Process payments with tokens on ArcBlock main chain',
109
- logo,
110
- default_currency_id: abtId,
111
- confirmation: {
112
- type: 'immediate',
30
+ const paymentCurrencies = [
31
+ {
32
+ id: abtId,
33
+ active: true,
34
+ livemode: true,
35
+ locked: true,
36
+ is_base_currency: true,
37
+ payment_method_id: mainId,
38
+ name: 'Native ABT',
39
+ description: 'ABT on ArcBlock main chain',
40
+ logo,
41
+ symbol: 'ABT',
42
+ decimal: 18,
43
+ minimum_payment_amount: fromTokenToUnit(0.1, 18).toString(), // 0.1 token
44
+ maximum_payment_amount: fromTokenToUnit(100000000, 18).toString(), // 0.1 billion
45
+ contract: 'z35nNRvYxBoHitx9yZ5ATS88psfShzPPBLxYD',
46
+ metadata: {},
47
+ created_at: now,
48
+ updated_at: now,
113
49
  },
114
- settings: {
115
- arcblock: {
116
- chain_id: 'main',
117
- api_host: 'https://main.abtnetwork.io/api/',
118
- explorer_host: 'https://main.abtnetwork.io/explorer/',
119
- },
50
+ {
51
+ id: tbaId,
52
+ active: true,
53
+ livemode: false,
54
+ locked: true,
55
+ is_base_currency: true,
56
+ payment_method_id: betaId,
57
+ name: 'Test ABT',
58
+ description: 'ABT on ArcBlock beta chain',
59
+ logo,
60
+ symbol: 'TBA',
61
+ decimal: 18,
62
+ minimum_payment_amount: fromTokenToUnit(0.1, 18).toString(), // 0.1 token
63
+ maximum_payment_amount: fromTokenToUnit(100000000, 18).toString(), // 0.1 billion
64
+ contract: 'z35n6UoHSi9MED4uaQy6ozFgKPaZj2UKrurBG',
65
+ metadata: {},
66
+ created_at: now,
67
+ updated_at: now,
120
68
  },
121
- features: {
122
- recurring: true,
123
- refund: true,
124
- dispute: true,
69
+ {
70
+ id: marsId,
71
+ active: true,
72
+ livemode: false,
73
+ locked: false,
74
+ is_base_currency: false,
75
+ payment_method_id: betaId,
76
+ name: 'RollupTestToken',
77
+ description: 'Token to test rollup on staging',
78
+ logo,
79
+ symbol: 'MARS',
80
+ decimal: 18,
81
+ minimum_payment_amount: fromTokenToUnit(0.1, 18).toString(), // 0.1 token
82
+ maximum_payment_amount: fromTokenToUnit(100000000, 18).toString(), // 0.1 billion
83
+ contract: 'z35n4nCsnAEWa2zVSKNKZhDGXSszaJAogSc3A',
84
+ metadata: {},
85
+ created_at: now,
86
+ updated_at: now,
125
87
  },
126
- metadata: {},
127
- created_at: now,
128
- updated_at: now,
129
- },
130
- {
131
- id: betaId,
132
- active: true,
133
- livemode: false,
134
- locked: true,
135
- type: 'arcblock',
136
- name: 'ArcBlock Beta',
137
- description: 'Process payments with tokens on ArcBlock beta chain, just for test purpose',
138
- logo,
139
- default_currency_id: tbaId,
140
- confirmation: {
141
- type: 'immediate',
88
+ {
89
+ id: play3Id,
90
+ active: true,
91
+ livemode: false,
92
+ locked: false,
93
+ is_base_currency: false,
94
+ payment_method_id: betaId,
95
+ name: 'Playground Token',
96
+ description: 'Test Token for OCAP Playground',
97
+ logo,
98
+ symbol: 'PLAY3',
99
+ decimal: 18,
100
+ minimum_payment_amount: fromTokenToUnit(0.1, 18).toString(), // 0.1 token
101
+ maximum_payment_amount: fromTokenToUnit(100000000, 18).toString(), // 0.1 billion
102
+ contract: 'z35n3WVTnN7KrR4gXn3szR6oneVefkBBx78Fc',
103
+ metadata: {},
104
+ created_at: now,
105
+ updated_at: now,
142
106
  },
143
- settings: {
144
- arcblock: {
145
- chain_id: 'beta',
146
- api_host: 'https://beta.abtnetwork.io/api/',
147
- explorer_host: 'https://beta.abtnetwork.io/explorer/',
107
+ ];
108
+
109
+ const paymentMethods = [
110
+ {
111
+ id: mainId,
112
+ active: true,
113
+ livemode: true,
114
+ locked: true,
115
+ type: 'arcblock',
116
+ name: 'ArcBlock Main',
117
+ description: 'Process payments with tokens on ArcBlock main chain',
118
+ logo,
119
+ default_currency_id: abtId,
120
+ confirmation: {
121
+ type: 'immediate',
122
+ },
123
+ settings: {
124
+ arcblock: {
125
+ chain_id: 'main',
126
+ api_host: 'https://main.abtnetwork.io/api/',
127
+ explorer_host: 'https://main.abtnetwork.io/explorer/',
128
+ },
148
129
  },
130
+ features: {
131
+ recurring: true,
132
+ refund: true,
133
+ dispute: true,
134
+ },
135
+ metadata: {},
136
+ created_at: now,
137
+ updated_at: now,
149
138
  },
150
- features: {
151
- recurring: true,
152
- refund: true,
153
- dispute: true,
139
+ {
140
+ id: betaId,
141
+ active: true,
142
+ livemode: false,
143
+ locked: true,
144
+ type: 'arcblock',
145
+ name: 'ArcBlock Beta',
146
+ description: 'Process payments with tokens on ArcBlock beta chain, just for test purpose',
147
+ logo,
148
+ default_currency_id: tbaId,
149
+ confirmation: {
150
+ type: 'immediate',
151
+ },
152
+ settings: {
153
+ arcblock: {
154
+ chain_id: 'beta',
155
+ api_host: 'https://beta.abtnetwork.io/api/',
156
+ explorer_host: 'https://beta.abtnetwork.io/explorer/',
157
+ },
158
+ },
159
+ features: {
160
+ recurring: true,
161
+ refund: true,
162
+ dispute: true,
163
+ },
164
+ metadata: {},
165
+ created_at: now,
166
+ updated_at: now,
154
167
  },
155
- metadata: {},
156
- created_at: now,
157
- updated_at: now,
158
- },
159
- ];
168
+ ];
160
169
 
161
- export const up: Migration = async ({ context }) => {
162
170
  await context.bulkInsert(
163
171
  'payment_methods',
164
172
  paymentMethods,
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.176
17
+ version: 1.13.178
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.176",
3
+ "version": "1.13.178",
4
4
  "scripts": {
5
5
  "dev": "cross-env COMPONENT_STORE_URL=https://test.store.blocklet.dev blocklet dev --open",
6
6
  "eject": "vite eject",
@@ -50,7 +50,7 @@
50
50
  "@arcblock/jwt": "^1.18.110",
51
51
  "@arcblock/ux": "^2.9.39",
52
52
  "@blocklet/logger": "1.16.23",
53
- "@blocklet/payment-react": "1.13.176",
53
+ "@blocklet/payment-react": "1.13.178",
54
54
  "@blocklet/sdk": "1.16.23",
55
55
  "@blocklet/ui-react": "^2.9.39",
56
56
  "@blocklet/uploader": "^0.0.74",
@@ -110,7 +110,7 @@
110
110
  "devDependencies": {
111
111
  "@abtnode/types": "1.16.23",
112
112
  "@arcblock/eslint-config-ts": "^0.2.4",
113
- "@blocklet/payment-types": "1.13.176",
113
+ "@blocklet/payment-types": "1.13.178",
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": "d39e02f65d5f7a168b3ee3d589b47c4d77c53125"
152
+ "gitHead": "1484b62c0e39622bffd1382b0fcddb8381918997"
153
153
  }
@@ -41,7 +41,7 @@ export default function RenamePaymentLink({
41
41
  maxWidth="sm"
42
42
  onClose={() => onCancel(null)}
43
43
  showCloseButton={false}
44
- title={t('admin.product.edit')}
44
+ title={t('admin.paymentLink.rename')}
45
45
  actions={
46
46
  <Stack direction="row">
47
47
  <Button size="small" sx={{ mr: 2 }} onClick={onCancel}>
@@ -41,7 +41,7 @@ export default function RenamePricingTable({
41
41
  maxWidth="sm"
42
42
  onClose={() => onCancel(null)}
43
43
  showCloseButton={false}
44
- title={t('admin.product.edit')}
44
+ title={t('admin.pricingTable.rename')}
45
45
  actions={
46
46
  <Stack direction="row">
47
47
  <Button size="small" sx={{ mr: 2 }} onClick={onCancel}>
@@ -56,8 +56,8 @@ export default function RenamePricingTable({
56
56
  <FormInput
57
57
  name="name"
58
58
  rules={{ required: true }}
59
- label={t('admin.paymentLink.name.label')}
60
- placeholder={t('admin.paymentLink.name.placeholder')}
59
+ label={t('admin.pricingTable.name.label')}
60
+ placeholder={t('admin.pricingTable.name.placeholder')}
61
61
  autoFocus
62
62
  />
63
63
  </FormProvider>
@@ -3,6 +3,7 @@ import flat from 'flat';
3
3
  export default flat({
4
4
  common: {
5
5
  redirecting: 'Redirecting...',
6
+ title: 'Name',
6
7
  metadata: {
7
8
  label: 'Metadata',
8
9
  add: 'Add more metadata',
@@ -3,6 +3,7 @@ import flat from 'flat';
3
3
  export default flat({
4
4
  common: {
5
5
  redirecting: '跳转中...',
6
+ title: '名称',
6
7
  metadata: {
7
8
  label: '元数据',
8
9
  add: '添加更多元数据',
@@ -144,7 +144,7 @@ export default function PaymentLinkDetail(props: { id: string }) {
144
144
  data={data.line_items}
145
145
  columns={[
146
146
  {
147
- label: t('common.name'),
147
+ label: t('common.title'),
148
148
  name: 'name',
149
149
  options: {
150
150
  sort: false,
@@ -80,7 +80,7 @@ function PaymentLinks() {
80
80
  },
81
81
  },
82
82
  {
83
- label: t('common.name'),
83
+ label: t('common.title'),
84
84
  name: 'name',
85
85
  },
86
86
  {
@@ -37,7 +37,7 @@ export default function PassportList() {
37
37
 
38
38
  const columns = [
39
39
  {
40
- label: t('common.name'),
40
+ label: t('common.title'),
41
41
  name: 'title',
42
42
  options: {
43
43
  sort: false,
@@ -124,7 +124,7 @@ export default function PricingTableDetail(props: { id: string }) {
124
124
  data={data.items}
125
125
  columns={[
126
126
  {
127
- label: t('common.name'),
127
+ label: t('common.title'),
128
128
  name: 'product_id',
129
129
  options: {
130
130
  sort: false,
@@ -79,7 +79,7 @@ function PricingTables() {
79
79
  },
80
80
  },
81
81
  {
82
- label: t('common.name'),
82
+ label: t('common.title'),
83
83
  name: 'name',
84
84
  },
85
85
  {