payment-kit 1.14.21 → 1.14.23
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 +19 -19
- package/src/app.tsx +13 -12
- package/src/components/balance-list.tsx +12 -2
- package/src/components/copyable.tsx +3 -2
- package/src/components/customer/edit.tsx +25 -21
- package/src/components/customer/form.tsx +18 -28
- package/src/components/customer/link.tsx +1 -2
- package/src/components/date-range-picker.tsx +21 -0
- package/src/components/drawer-form.tsx +27 -4
- package/src/components/event/list.tsx +3 -2
- package/src/components/filter-toolbar.tsx +11 -4
- package/src/components/info-card.tsx +4 -2
- package/src/components/info-metric.tsx +2 -2
- package/src/components/info-row.tsx +33 -26
- package/src/components/invoice/list.tsx +2 -2
- package/src/components/invoice/table.tsx +148 -85
- package/src/components/invoice-pdf/pdf.tsx +5 -1
- package/src/components/layout/admin.tsx +8 -2
- package/src/components/metadata/editor.tsx +25 -18
- package/src/components/metadata/form.tsx +83 -25
- package/src/components/metadata/list.tsx +22 -6
- package/src/components/payment-intent/list.tsx +3 -3
- package/src/components/payment-link/preview.tsx +42 -24
- package/src/components/payouts/list.tsx +2 -3
- package/src/components/price/form.tsx +28 -15
- package/src/components/price/upsell.tsx +1 -4
- package/src/components/pricing-table/preview.tsx +42 -23
- package/src/components/product/cross-sell-select.tsx +1 -1
- package/src/components/product/cross-sell.tsx +3 -4
- package/src/components/product/edit-price.tsx +0 -1
- package/src/components/refund/list.tsx +9 -4
- package/src/components/section/header.tsx +11 -4
- package/src/components/subscription/description.tsx +10 -6
- package/src/components/subscription/items/index.tsx +28 -6
- package/src/components/subscription/list.tsx +2 -2
- package/src/components/subscription/metrics.tsx +10 -8
- package/src/components/subscription/portal/actions.tsx +37 -11
- package/src/components/subscription/portal/list.tsx +131 -70
- package/src/components/subscription/status.tsx +9 -3
- package/src/global.css +1 -1
- package/src/hooks/mobile.ts +3 -3
- package/src/libs/util.ts +6 -2
- package/src/locales/en.tsx +37 -1
- package/src/locales/zh.tsx +37 -1
- package/src/pages/admin/billing/index.tsx +24 -4
- package/src/pages/admin/billing/invoices/detail.tsx +302 -147
- package/src/pages/admin/billing/subscriptions/detail.tsx +259 -134
- package/src/pages/admin/customers/customers/detail.tsx +358 -175
- package/src/pages/admin/customers/customers/index.tsx +8 -5
- package/src/pages/admin/customers/index.tsx +22 -5
- package/src/pages/admin/developers/webhooks/index.tsx +2 -2
- package/src/pages/admin/index.tsx +24 -10
- package/src/pages/admin/overview.tsx +1 -1
- package/src/pages/admin/payments/index.tsx +22 -7
- package/src/pages/admin/payments/intents/detail.tsx +263 -121
- package/src/pages/admin/payments/payouts/detail.tsx +235 -102
- package/src/pages/admin/payments/refunds/detail.tsx +286 -133
- package/src/pages/admin/products/index.tsx +28 -12
- package/src/pages/admin/products/links/create.tsx +16 -6
- package/src/pages/admin/products/links/detail.tsx +280 -176
- package/src/pages/admin/products/links/index.tsx +4 -7
- package/src/pages/admin/products/passports/index.tsx +6 -3
- package/src/pages/admin/products/prices/detail.tsx +260 -139
- package/src/pages/admin/products/prices/list.tsx +7 -3
- package/src/pages/admin/products/pricing-tables/create.tsx +17 -5
- package/src/pages/admin/products/pricing-tables/detail.tsx +221 -121
- package/src/pages/admin/products/pricing-tables/index.tsx +1 -2
- package/src/pages/admin/products/products/detail.tsx +262 -119
- package/src/pages/admin/products/products/index.tsx +1 -2
- package/src/pages/admin/settings/index.tsx +27 -7
- package/src/pages/customer/index.tsx +431 -143
- package/src/pages/customer/invoice/detail.tsx +138 -26
- package/src/pages/customer/refund/list.tsx +193 -4
- package/src/pages/customer/subscription/change-payment.tsx +20 -20
- package/src/pages/customer/subscription/detail.tsx +168 -34
- package/src/pages/customer/subscription/embed.tsx +22 -19
- package/src/pages/home.tsx +7 -1
- package/src/components/table.tsx +0 -93
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
} from '@blocklet/payment-react';
|
|
14
14
|
import type { TInvoiceExpanded } from '@blocklet/payment-types';
|
|
15
15
|
import { ArrowBackOutlined } from '@mui/icons-material';
|
|
16
|
-
import { Alert, Box, Button, CircularProgress, Stack, Typography } from '@mui/material';
|
|
16
|
+
import { Alert, Box, Button, CircularProgress, Divider, Stack, Typography } from '@mui/material';
|
|
17
17
|
import { styled } from '@mui/system';
|
|
18
18
|
import { useRequest, useSetState } from 'ahooks';
|
|
19
19
|
import { useEffect } from 'react';
|
|
@@ -24,14 +24,16 @@ import CustomerLink from '../../../components/customer/link';
|
|
|
24
24
|
import InfoRow from '../../../components/info-row';
|
|
25
25
|
import { Download } from '../../../components/invoice-pdf/pdf';
|
|
26
26
|
import InvoiceTable from '../../../components/invoice/table';
|
|
27
|
-
import SectionHeader from '../../../components/section/header';
|
|
28
27
|
import { goBackOrFallback } from '../../../libs/util';
|
|
29
28
|
import CustomerRefundList from '../refund/list';
|
|
29
|
+
import InfoMetric from '../../../components/info-metric';
|
|
30
30
|
|
|
31
31
|
const fetchData = (id: string): Promise<TInvoiceExpanded> => {
|
|
32
32
|
return api.get(`/api/invoices/${id}`).then((res) => res.data);
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
+
const InfoDirection = 'column';
|
|
36
|
+
const InfoAlignItems = 'flex-start';
|
|
35
37
|
export default function CustomerInvoiceDetail() {
|
|
36
38
|
const { t } = useLocaleContext();
|
|
37
39
|
const [searchParams] = useSearchParams();
|
|
@@ -100,7 +102,7 @@ export default function CustomerInvoiceDetail() {
|
|
|
100
102
|
}
|
|
101
103
|
|
|
102
104
|
return (
|
|
103
|
-
<
|
|
105
|
+
<InvoiceDetailRoot direction="column" spacing={3} sx={{ my: 2 }}>
|
|
104
106
|
<Stack direction="row" justifyContent="space-between">
|
|
105
107
|
<Stack
|
|
106
108
|
direction="row"
|
|
@@ -115,30 +117,125 @@ export default function CustomerInvoiceDetail() {
|
|
|
115
117
|
<Stack direction="row" spacing={1} justifyContent="flex-end" alignItems="center">
|
|
116
118
|
{['open', 'paid', 'uncollectible'].includes(data.status) && <Download data={data} />}
|
|
117
119
|
{['open', 'uncollectible'].includes(data.status) && (
|
|
118
|
-
<Button
|
|
120
|
+
<Button
|
|
121
|
+
variant="outlined"
|
|
122
|
+
color="primary"
|
|
123
|
+
size="small"
|
|
124
|
+
sx={{ borderColor: 'var(--stroke-border-base, #EFF1F5)' }}
|
|
125
|
+
disabled={state.paying}
|
|
126
|
+
onClick={onPay}>
|
|
119
127
|
{t('payment.customer.invoice.pay')}
|
|
120
128
|
</Button>
|
|
121
129
|
)}
|
|
122
130
|
</Stack>
|
|
123
131
|
</Stack>
|
|
124
|
-
<
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
132
|
+
<Box
|
|
133
|
+
mt={4}
|
|
134
|
+
sx={{
|
|
135
|
+
display: 'flex',
|
|
136
|
+
gap: {
|
|
137
|
+
xs: 2,
|
|
138
|
+
sm: 2,
|
|
139
|
+
md: 5,
|
|
140
|
+
},
|
|
141
|
+
flexWrap: 'wrap',
|
|
142
|
+
flexDirection: {
|
|
143
|
+
xs: 'column',
|
|
144
|
+
sm: 'column',
|
|
145
|
+
md: 'row',
|
|
146
|
+
},
|
|
147
|
+
alignItems: {
|
|
148
|
+
xs: 'flex-start',
|
|
149
|
+
sm: 'flex-start',
|
|
150
|
+
md: 'center',
|
|
151
|
+
},
|
|
152
|
+
}}>
|
|
153
|
+
<Stack direction="row" justifyContent="space-between" alignItems="center">
|
|
154
|
+
<Stack direction="row" alignItems="center" flexWrap="wrap" gap={1}>
|
|
155
|
+
<Typography variant="h1">{data.number}</Typography>
|
|
156
|
+
</Stack>
|
|
157
|
+
</Stack>
|
|
158
|
+
<Stack
|
|
159
|
+
className="section-body"
|
|
160
|
+
justifyContent="flex-start"
|
|
161
|
+
flexWrap="wrap"
|
|
162
|
+
sx={{
|
|
163
|
+
'hr.MuiDivider-root:last-child': {
|
|
164
|
+
display: 'none',
|
|
165
|
+
},
|
|
166
|
+
flexDirection: {
|
|
167
|
+
xs: 'column',
|
|
168
|
+
sm: 'column',
|
|
169
|
+
md: 'row',
|
|
170
|
+
},
|
|
171
|
+
alignItems: {
|
|
172
|
+
xs: 'flex-start',
|
|
173
|
+
sm: 'flex-start',
|
|
174
|
+
md: 'center',
|
|
175
|
+
},
|
|
176
|
+
gap: {
|
|
177
|
+
xs: 1,
|
|
178
|
+
sm: 1,
|
|
179
|
+
md: 3,
|
|
180
|
+
},
|
|
181
|
+
}}>
|
|
182
|
+
<InfoMetric
|
|
131
183
|
label={t('common.status')}
|
|
132
184
|
value={<Status label={data.status} color={getInvoiceStatusColor(data.status)} />}
|
|
185
|
+
divider
|
|
133
186
|
/>
|
|
187
|
+
<InfoMetric label={t('common.createdAt')} value={formatTime(data.created_at)} divider />
|
|
134
188
|
{data.period_start > 0 && data.period_end > 0 && (
|
|
135
|
-
<
|
|
189
|
+
<InfoMetric
|
|
136
190
|
label={t('admin.subscription.currentPeriod')}
|
|
137
191
|
value={[formatTime(data.period_start * 1000), formatTime(data.period_end * 1000)].join(' ~ ')}
|
|
192
|
+
divider
|
|
138
193
|
/>
|
|
139
194
|
)}
|
|
195
|
+
</Stack>
|
|
196
|
+
</Box>
|
|
197
|
+
<Divider />
|
|
198
|
+
<Box className="section">
|
|
199
|
+
<Typography variant="h3" mb={3} className="section-header">
|
|
200
|
+
{t('payment.customer.invoice.details')}
|
|
201
|
+
</Typography>
|
|
202
|
+
<Stack
|
|
203
|
+
className="invoice-summary-wrapper"
|
|
204
|
+
sx={{
|
|
205
|
+
display: 'grid',
|
|
206
|
+
gridTemplateColumns: {
|
|
207
|
+
xs: 'repeat(1, 1fr)',
|
|
208
|
+
sm: 'repeat(1, 1fr)',
|
|
209
|
+
md: 'repeat(2, 1fr)',
|
|
210
|
+
lg: 'repeat(3, 1fr)',
|
|
211
|
+
},
|
|
212
|
+
}}>
|
|
213
|
+
<InfoRow
|
|
214
|
+
label={t('admin.invoice.description')}
|
|
215
|
+
value={data.description}
|
|
216
|
+
direction={InfoDirection}
|
|
217
|
+
alignItems={InfoAlignItems}
|
|
218
|
+
/>
|
|
219
|
+
<InfoRow
|
|
220
|
+
label={t('admin.invoice.from')}
|
|
221
|
+
value={data.statement_descriptor || blocklet.appName}
|
|
222
|
+
direction={InfoDirection}
|
|
223
|
+
alignItems={InfoAlignItems}
|
|
224
|
+
/>
|
|
225
|
+
|
|
226
|
+
<InfoRow
|
|
227
|
+
label={t('admin.invoice.billTo')}
|
|
228
|
+
value={<CustomerLink customer={data.customer} linked={false} />}
|
|
229
|
+
direction={InfoDirection}
|
|
230
|
+
alignItems={InfoAlignItems}
|
|
231
|
+
/>
|
|
140
232
|
{data.status_transitions?.paid_at && (
|
|
141
|
-
<InfoRow
|
|
233
|
+
<InfoRow
|
|
234
|
+
label={t('admin.invoice.paidAt')}
|
|
235
|
+
value={formatTime(data.status_transitions.paid_at * 1000)}
|
|
236
|
+
direction={InfoDirection}
|
|
237
|
+
alignItems={InfoAlignItems}
|
|
238
|
+
/>
|
|
142
239
|
)}
|
|
143
240
|
<InfoRow
|
|
144
241
|
label={t('admin.paymentCurrency.name')}
|
|
@@ -148,11 +245,15 @@ export default function CustomerInvoiceDetail() {
|
|
|
148
245
|
name={`${data.paymentCurrency.symbol} (${data.paymentMethod.name})`}
|
|
149
246
|
/>
|
|
150
247
|
}
|
|
248
|
+
direction={InfoDirection}
|
|
249
|
+
alignItems={InfoAlignItems}
|
|
151
250
|
/>
|
|
152
251
|
{!!data.paymentIntent?.payment_details?.ethereum && (
|
|
153
252
|
<InfoRow
|
|
154
253
|
label={t('common.txGas')}
|
|
155
254
|
value={<TxGas details={data.paymentIntent.payment_details as any} method={data.paymentMethod} />}
|
|
255
|
+
direction={InfoDirection}
|
|
256
|
+
alignItems={InfoAlignItems}
|
|
156
257
|
/>
|
|
157
258
|
)}
|
|
158
259
|
{data.paymentIntent && data.paymentIntent.payment_details && (
|
|
@@ -161,6 +262,8 @@ export default function CustomerInvoiceDetail() {
|
|
|
161
262
|
value={
|
|
162
263
|
<TxLink details={data.paymentIntent.payment_details} method={data.paymentMethod} mode="customer" />
|
|
163
264
|
}
|
|
265
|
+
direction={InfoDirection}
|
|
266
|
+
alignItems={InfoAlignItems}
|
|
164
267
|
/>
|
|
165
268
|
)}
|
|
166
269
|
{data.subscription && (
|
|
@@ -168,36 +271,45 @@ export default function CustomerInvoiceDetail() {
|
|
|
168
271
|
label={t('admin.subscription.name')}
|
|
169
272
|
value={
|
|
170
273
|
<Link to={`/customer/subscription/${data.subscription.id}`}>
|
|
171
|
-
|
|
274
|
+
<Typography variant="body1" color="text.link">
|
|
275
|
+
{data.subscription.description || data.subscription.id}
|
|
276
|
+
</Typography>
|
|
172
277
|
</Link>
|
|
173
278
|
}
|
|
279
|
+
direction={InfoDirection}
|
|
280
|
+
alignItems={InfoAlignItems}
|
|
174
281
|
/>
|
|
175
282
|
)}
|
|
176
|
-
<InfoRow label={t('admin.invoice.billTo')} value={<CustomerLink customer={data.customer} linked={false} />} />
|
|
177
283
|
</Stack>
|
|
178
|
-
</
|
|
179
|
-
<
|
|
180
|
-
|
|
284
|
+
</Box>
|
|
285
|
+
<Divider />
|
|
286
|
+
<Box className="section">
|
|
287
|
+
<Typography variant="h3" mb={1.5} className="section-header">
|
|
288
|
+
{t('payment.customer.specifics')}
|
|
289
|
+
</Typography>
|
|
181
290
|
<InvoiceTable invoice={data} simple />
|
|
182
291
|
</Box>
|
|
292
|
+
<Divider />
|
|
183
293
|
<Box className="section">
|
|
184
|
-
<
|
|
294
|
+
<Typography variant="h3" className="section-header">
|
|
295
|
+
{t('admin.refunds')}
|
|
296
|
+
</Typography>
|
|
185
297
|
<Box className="section-body">
|
|
186
|
-
<CustomerRefundList invoice_id={data.id} />
|
|
298
|
+
<CustomerRefundList invoice_id={data.id} type="table" />
|
|
187
299
|
</Box>
|
|
188
300
|
</Box>
|
|
189
|
-
</
|
|
301
|
+
</InvoiceDetailRoot>
|
|
190
302
|
);
|
|
191
303
|
}
|
|
192
304
|
|
|
193
|
-
const
|
|
305
|
+
const InvoiceDetailRoot = styled(Stack)`
|
|
194
306
|
.invoice-summary-wrapper {
|
|
195
307
|
display: 'grid';
|
|
196
|
-
|
|
308
|
+
grid-template-columns: '50% 50%';
|
|
197
309
|
}
|
|
198
|
-
@media (max-width:
|
|
199
|
-
.
|
|
200
|
-
|
|
310
|
+
@media (max-width: ${({ theme }) => theme.breakpoints.values.md}px) {
|
|
311
|
+
.section-header {
|
|
312
|
+
font-size: 18px;
|
|
201
313
|
}
|
|
202
314
|
}
|
|
203
315
|
`;
|
|
@@ -1,9 +1,21 @@
|
|
|
1
1
|
/* eslint-disable react/no-unstable-nested-components */
|
|
2
2
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
Status,
|
|
5
|
+
Table,
|
|
6
|
+
TxLink,
|
|
7
|
+
api,
|
|
8
|
+
formatBNStr,
|
|
9
|
+
formatTime,
|
|
10
|
+
formatToDate,
|
|
11
|
+
getPaymentIntentStatusColor,
|
|
12
|
+
} from '@blocklet/payment-react';
|
|
4
13
|
import type { Paginated, TRefundExpanded } from '@blocklet/payment-types';
|
|
5
14
|
import { Box, Button, CircularProgress, Stack, Typography } from '@mui/material';
|
|
6
|
-
import {
|
|
15
|
+
import { styled } from '@mui/system';
|
|
16
|
+
import { useInfiniteScroll, useRequest } from 'ahooks';
|
|
17
|
+
import { capitalize, toLower } from 'lodash';
|
|
18
|
+
import { memo, useState } from 'react';
|
|
7
19
|
|
|
8
20
|
const groupByDate = (items: TRefundExpanded[]) => {
|
|
9
21
|
const grouped: { [key: string]: TRefundExpanded[] } = {};
|
|
@@ -31,7 +43,170 @@ type Props = {
|
|
|
31
43
|
|
|
32
44
|
const pageSize = 10;
|
|
33
45
|
|
|
34
|
-
|
|
46
|
+
const RefundTable = memo(({ invoice_id }: Props) => {
|
|
47
|
+
const listKey = 'invoice-table';
|
|
48
|
+
const { t, locale } = useLocaleContext();
|
|
49
|
+
|
|
50
|
+
const [search, setSearch] = useState<{ pageSize: number; page: number }>({
|
|
51
|
+
pageSize: pageSize || 10,
|
|
52
|
+
page: 1,
|
|
53
|
+
});
|
|
54
|
+
const { loading, data = { list: [], count: 0 } } = useRequest(
|
|
55
|
+
() =>
|
|
56
|
+
fetchData({
|
|
57
|
+
...search,
|
|
58
|
+
invoice_id,
|
|
59
|
+
}),
|
|
60
|
+
{
|
|
61
|
+
refreshDeps: [search],
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
const columns = [
|
|
66
|
+
{
|
|
67
|
+
label: t('common.amount'),
|
|
68
|
+
name: 'id',
|
|
69
|
+
options: {
|
|
70
|
+
customBodyRenderLite: (_: string, index: number) => {
|
|
71
|
+
const item = data.list[index] as TRefundExpanded;
|
|
72
|
+
return (
|
|
73
|
+
<Typography component="strong" fontWeight={600}>
|
|
74
|
+
{formatBNStr(item?.amount, item?.paymentCurrency.decimal)}
|
|
75
|
+
{item?.paymentCurrency.symbol}
|
|
76
|
+
</Typography>
|
|
77
|
+
);
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
label: t('common.status'),
|
|
83
|
+
name: 'status',
|
|
84
|
+
width: 100,
|
|
85
|
+
options: {
|
|
86
|
+
filter: true,
|
|
87
|
+
customBodyRenderLite: (_: string, index: number) => {
|
|
88
|
+
const item = data.list[index] as TRefundExpanded;
|
|
89
|
+
return <Status label={item.status} color={getPaymentIntentStatusColor(item.status)} />;
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
label: t('common.type'),
|
|
95
|
+
name: 'type',
|
|
96
|
+
width: 60,
|
|
97
|
+
options: {
|
|
98
|
+
filter: true,
|
|
99
|
+
customBodyRenderLite: (_: string, index: number) => {
|
|
100
|
+
const item = data.list[index] as TRefundExpanded;
|
|
101
|
+
return <Status label={t(`refund.type.${item.type}`)} />;
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
label: t('common.description'),
|
|
107
|
+
name: 'description',
|
|
108
|
+
options: {
|
|
109
|
+
customBodyRenderLite: (_: string, index: number) => {
|
|
110
|
+
const item = data.list[index] as TRefundExpanded;
|
|
111
|
+
return item.description ? capitalize(toLower(item.description.replace(/_/g, ' '))) : item.id;
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
label: t('common.createdAt'),
|
|
117
|
+
name: 'created_at',
|
|
118
|
+
options: {
|
|
119
|
+
sort: true,
|
|
120
|
+
customBodyRenderLite: (_: string, index: number) => {
|
|
121
|
+
const item = data.list[index] as TRefundExpanded;
|
|
122
|
+
return formatTime(item.created_at);
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
label: t('common.updatedAt'),
|
|
128
|
+
name: 'updated_at',
|
|
129
|
+
options: {
|
|
130
|
+
sort: true,
|
|
131
|
+
customBodyRenderLite: (_: string, index: number) => {
|
|
132
|
+
const item = data.list[index] as TRefundExpanded;
|
|
133
|
+
return formatTime(item.updated_at);
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
label: t('common.txHash'),
|
|
139
|
+
name: '',
|
|
140
|
+
options: {
|
|
141
|
+
customBodyRenderLite: (_: string, index: number) => {
|
|
142
|
+
const item = data.list[index] as TRefundExpanded;
|
|
143
|
+
return item.payment_details?.arcblock?.tx_hash || item.payment_details?.ethereum?.tx_hash ? (
|
|
144
|
+
<Box
|
|
145
|
+
sx={{
|
|
146
|
+
'.MuiTypography-root': {
|
|
147
|
+
color: 'text.link',
|
|
148
|
+
},
|
|
149
|
+
}}>
|
|
150
|
+
<TxLink details={item.payment_details} method={item.paymentMethod} mode="customer" />
|
|
151
|
+
</Box>
|
|
152
|
+
) : (
|
|
153
|
+
t('common.none')
|
|
154
|
+
);
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
];
|
|
159
|
+
|
|
160
|
+
const onTableChange = ({ page, rowsPerPage }: any) => {
|
|
161
|
+
if (search.pageSize !== rowsPerPage) {
|
|
162
|
+
setSearch((x) => ({ ...x, pageSize: rowsPerPage, page: 1 }));
|
|
163
|
+
} else if (search.page !== page + 1) {
|
|
164
|
+
setSearch((x) => ({ ...x, page: page + 1 }));
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
return (
|
|
169
|
+
<TableRoot>
|
|
170
|
+
<Table
|
|
171
|
+
hasRowLink
|
|
172
|
+
durable={`__${listKey}__`}
|
|
173
|
+
durableKeys={['page', 'rowsPerPage', 'searchText']}
|
|
174
|
+
data={data.list}
|
|
175
|
+
columns={columns}
|
|
176
|
+
options={{
|
|
177
|
+
count: data.count,
|
|
178
|
+
page: search.page - 1,
|
|
179
|
+
rowsPerPage: search.pageSize,
|
|
180
|
+
}}
|
|
181
|
+
loading={loading}
|
|
182
|
+
onChange={onTableChange}
|
|
183
|
+
toolbar={false}
|
|
184
|
+
sx={{ mt: 2 }}
|
|
185
|
+
showMobile={false}
|
|
186
|
+
locale={locale}
|
|
187
|
+
mobileTDFlexDirection="row"
|
|
188
|
+
emptyNodeText={t('payment.customer.refund.emptyList')}
|
|
189
|
+
/>
|
|
190
|
+
</TableRoot>
|
|
191
|
+
);
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
const TableRoot = styled(Box)`
|
|
195
|
+
@media (max-width: ${({ theme }) => theme.breakpoints.values.md}px) {
|
|
196
|
+
.MuiTable-root > .MuiTableBody-root > .MuiTableRow-root > .MuiTableCell-root {
|
|
197
|
+
> div {
|
|
198
|
+
width: fit-content;
|
|
199
|
+
flex: inherit;
|
|
200
|
+
font-size: 14px;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
.invoice-summary {
|
|
204
|
+
padding-right: 20px;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
`;
|
|
208
|
+
|
|
209
|
+
const RefundList = memo(({ invoice_id }: Props) => {
|
|
35
210
|
const { t } = useLocaleContext();
|
|
36
211
|
|
|
37
212
|
const { data, loadMore, loadingMore, loading } = useInfiniteScroll<Paginated<TRefundExpanded>>(
|
|
@@ -89,7 +264,9 @@ export default function CustomerRefundList({ invoice_id }: Props) {
|
|
|
89
264
|
<Status label={item.status} color={getPaymentIntentStatusColor(item.status)} />
|
|
90
265
|
</Box>
|
|
91
266
|
<Box flex={3}>
|
|
92
|
-
<Typography>
|
|
267
|
+
<Typography>
|
|
268
|
+
{item.description ? capitalize(toLower(item.description.replace(/_/g, ' '))) : '-'}
|
|
269
|
+
</Typography>
|
|
93
270
|
</Box>
|
|
94
271
|
<Box flex={3} sx={{ minWidth: '220px' }}>
|
|
95
272
|
{(item.payment_details?.arcblock?.tx_hash || item.payment_details?.ethereum?.tx_hash) && (
|
|
@@ -117,4 +294,16 @@ export default function CustomerRefundList({ invoice_id }: Props) {
|
|
|
117
294
|
</Box>
|
|
118
295
|
</Stack>
|
|
119
296
|
);
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
export default function CustomerRefundList(props: Props & { type?: 'table' | 'list' }) {
|
|
300
|
+
const { type, ...restProps } = props;
|
|
301
|
+
if (type === 'table') {
|
|
302
|
+
return <RefundTable {...restProps} />;
|
|
303
|
+
}
|
|
304
|
+
return <RefundList {...restProps} />;
|
|
120
305
|
}
|
|
306
|
+
|
|
307
|
+
CustomerRefundList.defaultProps = {
|
|
308
|
+
type: 'list',
|
|
309
|
+
};
|
|
@@ -342,26 +342,26 @@ export default function DataWrapper() {
|
|
|
342
342
|
|
|
343
343
|
const Root = styled(Stack)`
|
|
344
344
|
.cko-payment-form {
|
|
345
|
-
.MuiInputBase-root {
|
|
346
|
-
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
.MuiInputAdornment-positionStart {
|
|
350
|
-
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
.MuiBox-root {
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
.MuiFormHelperText-root {
|
|
359
|
-
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
.MuiOutlinedInput-notchedOutline {
|
|
363
|
-
|
|
364
|
-
}
|
|
345
|
+
// .MuiInputBase-root {
|
|
346
|
+
// border-radius: 0;
|
|
347
|
+
// }
|
|
348
|
+
|
|
349
|
+
// .MuiInputAdornment-positionStart {
|
|
350
|
+
// width: 50px;
|
|
351
|
+
// }
|
|
352
|
+
|
|
353
|
+
// .MuiBox-root {
|
|
354
|
+
// border: 1px solid #ccc;
|
|
355
|
+
// margin: -1px 0 0 -1px;
|
|
356
|
+
// }
|
|
357
|
+
|
|
358
|
+
// .MuiFormHelperText-root {
|
|
359
|
+
// margin-left: 14px;
|
|
360
|
+
// }
|
|
361
|
+
|
|
362
|
+
// .MuiOutlinedInput-notchedOutline {
|
|
363
|
+
// border: none;
|
|
364
|
+
// }
|
|
365
365
|
}
|
|
366
366
|
|
|
367
367
|
.cko-payment-submit {
|