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.
- package/api/src/routes/customers.ts +1 -1
- package/api/src/store/migrations/20230911-seeding.ts +151 -143
- package/blocklet.yml +1 -1
- package/package.json +4 -4
- package/src/components/payment-link/rename.tsx +1 -1
- package/src/components/pricing-table/rename.tsx +3 -3
- package/src/locales/en.tsx +1 -0
- package/src/locales/zh.tsx +1 -0
- package/src/pages/admin/payments/links/detail.tsx +1 -1
- package/src/pages/admin/payments/links/index.tsx +1 -1
- package/src/pages/admin/products/passports/index.tsx +1 -1
- package/src/pages/admin/products/pricing-tables/detail.tsx +1 -1
- package/src/pages/admin/products/pricing-tables/index.tsx +1 -1
|
@@ -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.
|
|
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
|
|
9
|
-
const
|
|
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
|
|
12
|
-
const
|
|
13
|
-
const
|
|
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
|
|
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
|
|
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
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
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
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
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
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
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
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
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
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
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
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
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
|
-
|
|
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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "payment-kit",
|
|
3
|
-
"version": "1.13.
|
|
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.
|
|
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.
|
|
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": "
|
|
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.
|
|
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.
|
|
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.
|
|
60
|
-
placeholder={t('admin.
|
|
59
|
+
label={t('admin.pricingTable.name.label')}
|
|
60
|
+
placeholder={t('admin.pricingTable.name.placeholder')}
|
|
61
61
|
autoFocus
|
|
62
62
|
/>
|
|
63
63
|
</FormProvider>
|
package/src/locales/en.tsx
CHANGED
package/src/locales/zh.tsx
CHANGED