payment-kit 1.20.12 → 1.20.14
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/crons/index.ts +8 -0
- package/api/src/libs/env.ts +1 -0
- package/api/src/libs/vendor-util/adapters/launcher-adapter.ts +1 -1
- package/api/src/libs/vendor-util/adapters/types.ts +1 -0
- package/api/src/libs/vendor-util/fulfillment.ts +1 -1
- package/api/src/queues/vendors/fulfillment-coordinator.ts +1 -29
- package/api/src/queues/vendors/return-processor.ts +184 -0
- package/api/src/queues/vendors/return-scanner.ts +119 -0
- package/api/src/queues/vendors/status-check.ts +1 -1
- package/api/src/routes/checkout-sessions.ts +15 -2
- package/api/src/routes/coupons.ts +7 -0
- package/api/src/routes/credit-grants.ts +8 -1
- package/api/src/routes/credit-transactions.ts +153 -13
- package/api/src/routes/invoices.ts +35 -1
- package/api/src/routes/meter-events.ts +31 -3
- package/api/src/routes/meters.ts +4 -0
- package/api/src/routes/payment-currencies.ts +2 -1
- package/api/src/routes/promotion-codes.ts +2 -2
- package/api/src/routes/subscription-items.ts +4 -0
- package/api/src/routes/vendor.ts +89 -2
- package/api/src/routes/webhook-endpoints.ts +4 -0
- package/api/src/store/migrations/20250918-add-vendor-extends.ts +20 -0
- package/api/src/store/migrations/20250919-add-source-data.ts +20 -0
- package/api/src/store/models/checkout-session.ts +5 -2
- package/api/src/store/models/credit-transaction.ts +5 -0
- package/api/src/store/models/meter-event.ts +22 -12
- package/api/src/store/models/product-vendor.ts +6 -0
- package/api/src/store/models/types.ts +18 -0
- package/blocklet.yml +1 -1
- package/package.json +5 -5
- package/src/components/customer/credit-overview.tsx +1 -1
- package/src/components/customer/related-credit-grants.tsx +194 -0
- package/src/components/meter/add-usage-dialog.tsx +8 -0
- package/src/components/meter/events-list.tsx +93 -96
- package/src/components/product/form.tsx +0 -1
- package/src/locales/en.tsx +9 -0
- package/src/locales/zh.tsx +9 -0
- package/src/pages/admin/billing/invoices/detail.tsx +21 -2
- package/src/pages/customer/invoice/detail.tsx +11 -2
package/src/locales/en.tsx
CHANGED
|
@@ -74,9 +74,11 @@ export default flat({
|
|
|
74
74
|
saturday: 'Saturday',
|
|
75
75
|
},
|
|
76
76
|
name: 'Name',
|
|
77
|
+
type: 'Type',
|
|
77
78
|
status: 'Status',
|
|
78
79
|
remainingCredit: 'Remaining Credit',
|
|
79
80
|
scope: 'Scope',
|
|
81
|
+
source: 'Source',
|
|
80
82
|
effectiveDate: 'Effective Date',
|
|
81
83
|
expirationDate: 'Expiration Date',
|
|
82
84
|
creditGrant: 'Grant',
|
|
@@ -85,8 +87,13 @@ export default flat({
|
|
|
85
87
|
meterEvent: 'Meter Event',
|
|
86
88
|
creditAmount: 'Credit',
|
|
87
89
|
createdAt: 'Created At',
|
|
90
|
+
expiresAt: 'Expires At',
|
|
88
91
|
general: 'All usage-based prices',
|
|
89
92
|
specific: 'Specific usage-based prices',
|
|
93
|
+
paid: 'Paid',
|
|
94
|
+
promotional: 'Promotional',
|
|
95
|
+
viewInvoice: 'View Invoice',
|
|
96
|
+
viewSourceData: 'View Source',
|
|
90
97
|
},
|
|
91
98
|
notification: {
|
|
92
99
|
preferences: {
|
|
@@ -1317,6 +1324,8 @@ export default flat({
|
|
|
1317
1324
|
backToGrants: 'Back to Credit Grants',
|
|
1318
1325
|
viewDetails: 'View Details',
|
|
1319
1326
|
overview: 'Overview',
|
|
1327
|
+
relatedGrants: 'Credit Grants',
|
|
1328
|
+
category: 'Category',
|
|
1320
1329
|
overviewDescription: 'Monitor all currency credit balances, usage, and outstanding debt.',
|
|
1321
1330
|
availableBalance: 'Available Balance',
|
|
1322
1331
|
viewGrants: 'View Grants',
|
package/src/locales/zh.tsx
CHANGED
|
@@ -73,9 +73,11 @@ export default flat({
|
|
|
73
73
|
},
|
|
74
74
|
maxAmount: '最大金额为 {max}',
|
|
75
75
|
name: '名称',
|
|
76
|
+
type: '类型',
|
|
76
77
|
status: '状态',
|
|
77
78
|
remainingCredit: '剩余额度',
|
|
78
79
|
scope: '适用范围',
|
|
80
|
+
source: '来源',
|
|
79
81
|
effectiveDate: '生效时间',
|
|
80
82
|
expirationDate: '过期时间',
|
|
81
83
|
creditGrant: '信用额度',
|
|
@@ -84,8 +86,13 @@ export default flat({
|
|
|
84
86
|
meterEvent: '计量事件',
|
|
85
87
|
creditAmount: '额度',
|
|
86
88
|
createdAt: '创建时间',
|
|
89
|
+
expiresAt: '过期时间',
|
|
87
90
|
general: '通用',
|
|
88
91
|
specific: '指定使用范围',
|
|
92
|
+
paid: '付费',
|
|
93
|
+
promotional: '促销',
|
|
94
|
+
viewInvoice: '查看账单',
|
|
95
|
+
viewSourceData: '查看来源',
|
|
89
96
|
},
|
|
90
97
|
notification: {
|
|
91
98
|
preferences: {
|
|
@@ -1282,6 +1289,8 @@ export default flat({
|
|
|
1282
1289
|
pendingAmount: '欠费额度',
|
|
1283
1290
|
grantCount: '额度数量',
|
|
1284
1291
|
noGrantsDescription: '您还没有任何信用额度',
|
|
1292
|
+
relatedGrants: '信用额度',
|
|
1293
|
+
category: '分类',
|
|
1285
1294
|
status: {
|
|
1286
1295
|
granted: '生效中',
|
|
1287
1296
|
pending: '待生效',
|
|
@@ -13,7 +13,13 @@ import {
|
|
|
13
13
|
getInvoiceStatusColor,
|
|
14
14
|
useMobile,
|
|
15
15
|
} from '@blocklet/payment-react';
|
|
16
|
-
import type {
|
|
16
|
+
import type {
|
|
17
|
+
TCheckoutSession,
|
|
18
|
+
TCreditGrantExpanded,
|
|
19
|
+
TInvoice,
|
|
20
|
+
TInvoiceExpanded,
|
|
21
|
+
TPaymentLink,
|
|
22
|
+
} from '@blocklet/payment-types';
|
|
17
23
|
import { ArrowBackOutlined } from '@mui/icons-material';
|
|
18
24
|
import { Alert, Box, Button, CircularProgress, Divider, Stack, Typography } from '@mui/material';
|
|
19
25
|
import { styled } from '@mui/system';
|
|
@@ -37,8 +43,18 @@ import SectionHeader from '../../../../components/section/header';
|
|
|
37
43
|
import { goBackOrFallback } from '../../../../libs/util';
|
|
38
44
|
import InfoMetric from '../../../../components/info-metric';
|
|
39
45
|
import InfoRowGroup from '../../../../components/info-row-group';
|
|
46
|
+
import RelatedCreditGrants from '../../../../components/customer/related-credit-grants';
|
|
40
47
|
|
|
41
|
-
const fetchData = (
|
|
48
|
+
const fetchData = (
|
|
49
|
+
id: string
|
|
50
|
+
): Promise<
|
|
51
|
+
TInvoiceExpanded & {
|
|
52
|
+
relatedInvoice?: TInvoiceExpanded;
|
|
53
|
+
checkoutSession: TCheckoutSession;
|
|
54
|
+
paymentLink: TPaymentLink;
|
|
55
|
+
relatedCreditGrants?: TCreditGrantExpanded[];
|
|
56
|
+
}
|
|
57
|
+
> => {
|
|
42
58
|
return api.get(`/api/invoices/${id}`).then((res) => res.data);
|
|
43
59
|
};
|
|
44
60
|
|
|
@@ -366,6 +382,9 @@ export default function InvoiceDetail(props: { id: string }) {
|
|
|
366
382
|
)}
|
|
367
383
|
</InfoRowGroup>
|
|
368
384
|
</Box>
|
|
385
|
+
{data?.relatedCreditGrants && data.relatedCreditGrants.length > 0 && (
|
|
386
|
+
<RelatedCreditGrants grants={data.relatedCreditGrants} mode="dashboard" />
|
|
387
|
+
)}
|
|
369
388
|
<Divider />
|
|
370
389
|
<Box className="section">
|
|
371
390
|
<SectionHeader title={t('admin.summary')} />
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
PaymentBeneficiaries,
|
|
17
17
|
useMobile,
|
|
18
18
|
} from '@blocklet/payment-react';
|
|
19
|
-
import type { TCheckoutSession, TInvoiceExpanded, TPaymentLink } from '@blocklet/payment-types';
|
|
19
|
+
import type { TCheckoutSession, TCreditGrantExpanded, TInvoiceExpanded, TPaymentLink } from '@blocklet/payment-types';
|
|
20
20
|
import { ArrowBackOutlined } from '@mui/icons-material';
|
|
21
21
|
import { Alert, Box, Button, CircularProgress, Divider, Stack, Tooltip, Typography, useTheme } from '@mui/material';
|
|
22
22
|
import { styled } from '@mui/system';
|
|
@@ -36,11 +36,17 @@ import { goBackOrFallback } from '../../../libs/util';
|
|
|
36
36
|
import CustomerRefundList from '../refund/list';
|
|
37
37
|
import InfoMetric from '../../../components/info-metric';
|
|
38
38
|
import InfoRowGroup from '../../../components/info-row-group';
|
|
39
|
+
import RelatedCreditGrants from '../../../components/customer/related-credit-grants';
|
|
39
40
|
|
|
40
41
|
const fetchData = (
|
|
41
42
|
id: string
|
|
42
43
|
): Promise<
|
|
43
|
-
TInvoiceExpanded & {
|
|
44
|
+
TInvoiceExpanded & {
|
|
45
|
+
relatedInvoice?: TInvoiceExpanded;
|
|
46
|
+
checkoutSession: TCheckoutSession;
|
|
47
|
+
paymentLink: TPaymentLink;
|
|
48
|
+
relatedCreditGrants?: TCreditGrantExpanded[];
|
|
49
|
+
}
|
|
44
50
|
> => {
|
|
45
51
|
return api.get(`/api/invoices/${id}`).then((res) => res.data);
|
|
46
52
|
};
|
|
@@ -426,6 +432,9 @@ export default function CustomerInvoiceDetail() {
|
|
|
426
432
|
</Box>
|
|
427
433
|
</>
|
|
428
434
|
)}
|
|
435
|
+
{data?.relatedCreditGrants && data.relatedCreditGrants.length > 0 && (
|
|
436
|
+
<RelatedCreditGrants grants={data.relatedCreditGrants} />
|
|
437
|
+
)}
|
|
429
438
|
{!isSlashStake && !isDonation && (
|
|
430
439
|
<>
|
|
431
440
|
{!isStake && (
|