payment-kit 1.13.179 → 1.13.181
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 +1 -1
- package/package.json +4 -4
- package/src/components/invoice/list.tsx +2 -3
- package/src/components/invoice/table.tsx +1 -1
- package/src/components/payment-intent/list.tsx +2 -3
- package/src/components/refund/list.tsx +2 -3
- package/src/pages/admin/billing/invoices/detail.tsx +2 -3
- package/src/pages/admin/customers/customers/detail.tsx +3 -4
- package/src/pages/admin/payments/intents/detail.tsx +3 -3
- package/src/pages/admin/payments/refunds/detail.tsx +11 -3
- package/src/pages/customer/invoice/detail.tsx +7 -9
- package/src/pages/customer/refund/list.tsx +2 -3
- package/src/pages/customer/subscription/change-plan.tsx +2 -3
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.181",
|
|
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.181",
|
|
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.181",
|
|
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": "41ae4de4f5af08670937d5328ea809623afeab87"
|
|
153
153
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/* eslint-disable react/no-unstable-nested-components */
|
|
2
2
|
import { getDurableData } from '@arcblock/ux/lib/Datatable';
|
|
3
3
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
4
|
-
import { Status, api, formatTime, getInvoiceStatusColor } from '@blocklet/payment-react';
|
|
4
|
+
import { Status, api, formatBNStr, formatTime, getInvoiceStatusColor } from '@blocklet/payment-react';
|
|
5
5
|
import type { TInvoiceExpanded } from '@blocklet/payment-types';
|
|
6
6
|
import { CircularProgress, Typography } from '@mui/material';
|
|
7
|
-
import { fromUnitToToken } from '@ocap/util';
|
|
8
7
|
import { useEffect, useState } from 'react';
|
|
9
8
|
import { useNavigate } from 'react-router-dom';
|
|
10
9
|
|
|
@@ -121,7 +120,7 @@ export default function InvoiceList({ customer_id, subscription_id, features, st
|
|
|
121
120
|
const item = data.list[index];
|
|
122
121
|
return (
|
|
123
122
|
<Typography component="strong" fontWeight={600}>
|
|
124
|
-
{
|
|
123
|
+
{formatBNStr(item?.total, item?.paymentCurrency.decimal)}
|
|
125
124
|
{item?.paymentCurrency.symbol}
|
|
126
125
|
</Typography>
|
|
127
126
|
);
|
|
@@ -53,7 +53,7 @@ export default function InvoiceTable({ invoice, simple }: Props) {
|
|
|
53
53
|
<TableCell sx={{ textTransform: 'none', fontWeight: 'normal', width: 120 }} align="right">
|
|
54
54
|
{t('payment.customer.invoice.unitPrice')}
|
|
55
55
|
</TableCell>
|
|
56
|
-
<TableCell sx={{ textTransform: 'none', fontWeight: 'normal', width:
|
|
56
|
+
<TableCell sx={{ textTransform: 'none', fontWeight: 'normal', width: 110 }} align="right">
|
|
57
57
|
{t('common.amount')}
|
|
58
58
|
</TableCell>
|
|
59
59
|
{!simple && (
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/* eslint-disable react/no-unstable-nested-components */
|
|
2
2
|
import { getDurableData } from '@arcblock/ux/lib/Datatable';
|
|
3
3
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
4
|
-
import { Status, api, formatTime, getPaymentIntentStatusColor } from '@blocklet/payment-react';
|
|
4
|
+
import { Status, api, formatBNStr, formatTime, getPaymentIntentStatusColor } from '@blocklet/payment-react';
|
|
5
5
|
import type { TPaymentIntentExpanded } from '@blocklet/payment-types';
|
|
6
6
|
import { CircularProgress, Typography } from '@mui/material';
|
|
7
|
-
import { fromUnitToToken } from '@ocap/util';
|
|
8
7
|
import { useEffect, useState } from 'react';
|
|
9
8
|
import { useNavigate } from 'react-router-dom';
|
|
10
9
|
|
|
@@ -114,7 +113,7 @@ export default function PaymentList({ customer_id, invoice_id, features }: ListP
|
|
|
114
113
|
component="strong"
|
|
115
114
|
sx={{ color: item.amount_received === '0' ? 'warning.main' : 'inherit' }}
|
|
116
115
|
fontWeight={600}>
|
|
117
|
-
{
|
|
116
|
+
{formatBNStr(
|
|
118
117
|
item.amount_received === '0' ? item.amount : item.amount_received,
|
|
119
118
|
item?.paymentCurrency.decimal
|
|
120
119
|
)}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/* eslint-disable react/no-unstable-nested-components */
|
|
2
2
|
import { getDurableData } from '@arcblock/ux/lib/Datatable';
|
|
3
3
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
4
|
-
import { Status, api, formatTime, getPaymentIntentStatusColor } from '@blocklet/payment-react';
|
|
4
|
+
import { Status, api, formatBNStr, formatTime, getPaymentIntentStatusColor } from '@blocklet/payment-react';
|
|
5
5
|
import type { TRefundExpanded } from '@blocklet/payment-types';
|
|
6
6
|
import { CircularProgress, Typography } from '@mui/material';
|
|
7
|
-
import { fromUnitToToken } from '@ocap/util';
|
|
8
7
|
import { useEffect, useState } from 'react';
|
|
9
8
|
import { useNavigate } from 'react-router-dom';
|
|
10
9
|
|
|
@@ -114,7 +113,7 @@ export default function RefundList({ customer_id, invoice_id, subscription_id, f
|
|
|
114
113
|
const item = data.list[index] as TRefundExpanded;
|
|
115
114
|
return (
|
|
116
115
|
<Typography component="strong" fontWeight={600}>
|
|
117
|
-
{
|
|
116
|
+
{formatBNStr(item?.amount, item?.paymentCurrency.decimal)}
|
|
118
117
|
{item?.paymentCurrency.symbol}
|
|
119
118
|
</Typography>
|
|
120
119
|
);
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/* eslint-disable react/no-unstable-nested-components */
|
|
2
2
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
3
3
|
import Toast from '@arcblock/ux/lib/Toast';
|
|
4
|
-
import { Status, api, formatError, formatTime, getInvoiceStatusColor } from '@blocklet/payment-react';
|
|
4
|
+
import { Status, api, formatBNStr, formatError, formatTime, getInvoiceStatusColor } from '@blocklet/payment-react';
|
|
5
5
|
import type { TInvoice, TInvoiceExpanded } from '@blocklet/payment-types';
|
|
6
6
|
import { ArrowBackOutlined, Edit } from '@mui/icons-material';
|
|
7
7
|
import { Alert, Box, Button, CircularProgress, Stack, Typography } from '@mui/material';
|
|
8
8
|
import { styled } from '@mui/system';
|
|
9
|
-
import { fromUnitToToken } from '@ocap/util';
|
|
10
9
|
import { useRequest, useSetState } from 'ahooks';
|
|
11
10
|
import { Link } from 'react-router-dom';
|
|
12
11
|
|
|
@@ -92,7 +91,7 @@ export default function InvoiceDetail(props: { id: string }) {
|
|
|
92
91
|
</Typography>
|
|
93
92
|
<Typography sx={{ mx: 1 }}>for</Typography>
|
|
94
93
|
<Typography variant="h5" sx={{ fontWeight: 600 }}>
|
|
95
|
-
{
|
|
94
|
+
{formatBNStr(data.total, data.paymentCurrency.decimal)} {data.paymentCurrency.symbol}
|
|
96
95
|
</Typography>
|
|
97
96
|
<Status label={data.status} color={getInvoiceStatusColor(data.status)} sx={{ ml: 1 }} />
|
|
98
97
|
</Stack>
|
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
import DidAddress from '@arcblock/ux/lib/DID';
|
|
3
3
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
4
4
|
import Toast from '@arcblock/ux/lib/Toast';
|
|
5
|
-
import { api, formatError, formatTime, usePaymentContext } from '@blocklet/payment-react';
|
|
5
|
+
import { api, formatBNStr, formatError, formatTime, usePaymentContext } from '@blocklet/payment-react';
|
|
6
6
|
import type { GroupedBN, TCustomerExpanded, TPaymentMethodExpanded } from '@blocklet/payment-types';
|
|
7
7
|
import { ArrowBackOutlined, Edit } from '@mui/icons-material';
|
|
8
8
|
import { Alert, Box, Button, CircularProgress, Stack, Typography } from '@mui/material';
|
|
9
9
|
import { styled } from '@mui/system';
|
|
10
|
-
import { fromUnitToToken } from '@ocap/util';
|
|
11
10
|
import { useRequest, useSetState } from 'ahooks';
|
|
12
11
|
import { isEmpty } from 'lodash';
|
|
13
12
|
import { FlagEmoji } from 'react-international-phone';
|
|
@@ -48,7 +47,7 @@ function getTokenBalances(customer: TCustomerExpanded, paymentMethods: TPaymentM
|
|
|
48
47
|
if (customer.balance) {
|
|
49
48
|
tokens.push({
|
|
50
49
|
currency: 'USD',
|
|
51
|
-
balance:
|
|
50
|
+
balance: formatBNStr(customer.balance, 2),
|
|
52
51
|
});
|
|
53
52
|
}
|
|
54
53
|
|
|
@@ -61,7 +60,7 @@ function getTokenBalances(customer: TCustomerExpanded, paymentMethods: TPaymentM
|
|
|
61
60
|
// @ts-ignore
|
|
62
61
|
currency: currency.symbol,
|
|
63
62
|
// @ts-ignore
|
|
64
|
-
balance:
|
|
63
|
+
balance: formatBNStr(customer.token_balance[currencyId], currency.decimal),
|
|
65
64
|
});
|
|
66
65
|
}
|
|
67
66
|
});
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
Status,
|
|
7
7
|
TxLink,
|
|
8
8
|
api,
|
|
9
|
+
formatBNStr,
|
|
9
10
|
formatError,
|
|
10
11
|
formatTime,
|
|
11
12
|
getPaymentIntentStatusColor,
|
|
@@ -14,7 +15,6 @@ import type { TPaymentIntentExpanded } from '@blocklet/payment-types';
|
|
|
14
15
|
import { ArrowBackOutlined, Edit, InfoOutlined } from '@mui/icons-material';
|
|
15
16
|
import { Alert, Box, Button, CircularProgress, Stack, Tooltip, Typography } from '@mui/material';
|
|
16
17
|
import { styled } from '@mui/system';
|
|
17
|
-
import { fromUnitToToken } from '@ocap/util';
|
|
18
18
|
import { useRequest, useSetState } from 'ahooks';
|
|
19
19
|
import { Link } from 'react-router-dom';
|
|
20
20
|
|
|
@@ -77,8 +77,8 @@ export default function PaymentIntentDetail(props: { id: string }) {
|
|
|
77
77
|
const onUpdateMetadata = createUpdater('metadata');
|
|
78
78
|
|
|
79
79
|
const currency = data.paymentCurrency;
|
|
80
|
-
const received = [
|
|
81
|
-
const total = [
|
|
80
|
+
const received = [formatBNStr(data?.amount_received, currency.decimal), currency.symbol].join(' ');
|
|
81
|
+
const total = [formatBNStr(data?.amount, currency.decimal), currency.symbol].join(' ');
|
|
82
82
|
|
|
83
83
|
return (
|
|
84
84
|
<Root direction="column" spacing={4} mb={4}>
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
/* eslint-disable react/no-unstable-nested-components */
|
|
2
2
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
3
3
|
import Toast from '@arcblock/ux/lib/Toast';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
Amount,
|
|
6
|
+
Status,
|
|
7
|
+
TxLink,
|
|
8
|
+
api,
|
|
9
|
+
formatBNStr,
|
|
10
|
+
formatError,
|
|
11
|
+
formatTime,
|
|
12
|
+
getRefundStatusColor,
|
|
13
|
+
} from '@blocklet/payment-react';
|
|
5
14
|
import type { TRefundExpanded } from '@blocklet/payment-types';
|
|
6
15
|
import { ArrowBackOutlined, Edit, InfoOutlined } from '@mui/icons-material';
|
|
7
16
|
import { Alert, Box, Button, CircularProgress, Stack, Tooltip, Typography } from '@mui/material';
|
|
8
17
|
import { styled } from '@mui/system';
|
|
9
|
-
import { fromUnitToToken } from '@ocap/util';
|
|
10
18
|
import { useRequest, useSetState } from 'ahooks';
|
|
11
19
|
import { Link } from 'react-router-dom';
|
|
12
20
|
|
|
@@ -69,7 +77,7 @@ export default function RefundDetail(props: { id: string }) {
|
|
|
69
77
|
const onUpdateMetadata = createUpdater('metadata');
|
|
70
78
|
|
|
71
79
|
const currency = data.paymentCurrency;
|
|
72
|
-
const amount = [
|
|
80
|
+
const amount = [formatBNStr(data?.amount, currency.decimal), currency.symbol].join(' ');
|
|
73
81
|
|
|
74
82
|
return (
|
|
75
83
|
<Root direction="column" spacing={4} mb={4}>
|
|
@@ -142,16 +142,14 @@ export default function CustomerInvoiceDetail() {
|
|
|
142
142
|
label={t('admin.paymentCurrency.name')}
|
|
143
143
|
value={<Currency logo={data.paymentCurrency.logo} name={data.paymentCurrency.symbol} />}
|
|
144
144
|
/>
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
145
|
+
{data.paymentIntent && data.paymentIntent.payment_details && (
|
|
146
|
+
<InfoRow
|
|
147
|
+
label={t(`common.${data.paymentIntent.payment_details?.arcblock?.type || 'transfer'}TxHash`)}
|
|
148
|
+
value={
|
|
149
149
|
<TxLink details={data.paymentIntent.payment_details} method={data.paymentMethod} mode="customer" />
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
154
|
-
/>
|
|
150
|
+
}
|
|
151
|
+
/>
|
|
152
|
+
)}
|
|
155
153
|
{data.subscription && (
|
|
156
154
|
<InfoRow
|
|
157
155
|
label={t('admin.subscription.name')}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/* eslint-disable react/no-unstable-nested-components */
|
|
2
2
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
3
|
-
import { Status, TxLink, api, formatToDate, getPaymentIntentStatusColor } from '@blocklet/payment-react';
|
|
3
|
+
import { Status, TxLink, api, formatBNStr, formatToDate, getPaymentIntentStatusColor } from '@blocklet/payment-react';
|
|
4
4
|
import type { Paginated, PaymentDetails, TPaymentIntentExpanded } from '@blocklet/payment-types';
|
|
5
5
|
import { Box, Button, CircularProgress, Stack, Typography } from '@mui/material';
|
|
6
|
-
import { fromUnitToToken } from '@ocap/util';
|
|
7
6
|
import { useInfiniteScroll } from 'ahooks';
|
|
8
7
|
|
|
9
8
|
const groupByDate = (items: TPaymentIntentExpanded[]) => {
|
|
@@ -82,7 +81,7 @@ export default function CustomerRefundList({ invoice_id }: Props) {
|
|
|
82
81
|
</Box>
|
|
83
82
|
<Box flex={2}>
|
|
84
83
|
<Typography textAlign="right">
|
|
85
|
-
{
|
|
84
|
+
{formatBNStr(item.amount, item.paymentCurrency.decimal)}
|
|
86
85
|
{item.paymentCurrency.symbol}
|
|
87
86
|
</Typography>
|
|
88
87
|
</Box>
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/* eslint-disable react/no-unstable-nested-components */
|
|
2
2
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
3
3
|
import Toast from '@arcblock/ux/lib/Toast';
|
|
4
|
-
import { PricingTable, api, formatError, formatPrice, formatTime } from '@blocklet/payment-react';
|
|
4
|
+
import { PricingTable, api, formatBNStr, formatError, formatPrice, formatTime } from '@blocklet/payment-react';
|
|
5
5
|
import type { TLineItemExpanded, TPricingTableExpanded, TSubscriptionExpanded } from '@blocklet/payment-types';
|
|
6
6
|
import { ArrowBackOutlined } from '@mui/icons-material';
|
|
7
7
|
import { LoadingButton } from '@mui/lab';
|
|
8
8
|
import { Alert, CircularProgress, Divider, Stack, Typography } from '@mui/material';
|
|
9
|
-
import { fromUnitToToken } from '@ocap/util';
|
|
10
9
|
import { useRequest, useSetState } from 'ahooks';
|
|
11
10
|
import { Link, useNavigate, useParams } from 'react-router-dom';
|
|
12
11
|
|
|
@@ -206,7 +205,7 @@ export default function CustomerSubscriptionChangePlan() {
|
|
|
206
205
|
</Typography>
|
|
207
206
|
<Typography component="p" style={{ fontWeight: 'bold' }}>
|
|
208
207
|
{prefix}
|
|
209
|
-
{
|
|
208
|
+
{formatBNStr(value, data.subscription.paymentCurrency.decimal)} {data.subscription.paymentCurrency.symbol}
|
|
210
209
|
</Typography>
|
|
211
210
|
</Stack>
|
|
212
211
|
);
|