@blocklet/payment-react 1.24.2 → 1.24.4
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/es/contexts/payment.js +7 -0
- package/es/history/credit/transactions-list.js +177 -138
- package/es/history/invoice/list.js +88 -19
- package/es/locales/en.js +20 -4
- package/es/locales/zh.js +20 -4
- package/es/payment/product-item.js +2 -0
- package/lib/contexts/payment.js +4 -0
- package/lib/history/credit/transactions-list.js +257 -142
- package/lib/history/invoice/list.js +113 -28
- package/lib/locales/en.js +20 -4
- package/lib/locales/zh.js +20 -4
- package/lib/payment/product-item.js +2 -0
- package/package.json +3 -3
- package/src/contexts/payment.tsx +9 -0
- package/src/history/credit/transactions-list.tsx +227 -147
- package/src/history/invoice/list.tsx +114 -28
- package/src/locales/en.tsx +18 -2
- package/src/locales/zh.tsx +18 -2
- package/src/payment/product-item.tsx +4 -0
package/src/locales/en.tsx
CHANGED
|
@@ -67,14 +67,24 @@ export default flat({
|
|
|
67
67
|
remainingBalance: 'Remaining Balance',
|
|
68
68
|
credits: 'credits',
|
|
69
69
|
ofCredits: 'of credits',
|
|
70
|
+
creditActivity: {
|
|
71
|
+
consumption: 'Credit Consumed',
|
|
72
|
+
paidGrant: 'Credit Top-up',
|
|
73
|
+
paidAmount: 'Paid {amount}',
|
|
74
|
+
promotionalGrant: 'Bonus',
|
|
75
|
+
resetGrant: 'Credit Reset',
|
|
76
|
+
repayment: 'Repayment',
|
|
77
|
+
},
|
|
70
78
|
transferStatus: 'Transaction Status',
|
|
71
79
|
sourceData: 'Source Data',
|
|
72
80
|
viewGrant: 'View Grant',
|
|
73
|
-
viewSubscription: '
|
|
81
|
+
viewSubscription: 'Subscription Detail',
|
|
74
82
|
view: 'View',
|
|
75
83
|
meterEvent: 'Meter Event',
|
|
76
84
|
source: 'Source',
|
|
77
85
|
viewDetail: 'View Detail',
|
|
86
|
+
viewTransactionDetail: 'Transaction Detail',
|
|
87
|
+
viewConsumptionDetail: 'Consumption Detail',
|
|
78
88
|
customer: 'Customer',
|
|
79
89
|
currency: 'Currency',
|
|
80
90
|
custom: 'Custom',
|
|
@@ -121,6 +131,8 @@ export default flat({
|
|
|
121
131
|
slashStakeAmount: 'Slash Stake Amount',
|
|
122
132
|
know: 'I know',
|
|
123
133
|
relatedSubscription: 'Subscription',
|
|
134
|
+
subscriptionOrCredit: 'Subscription / Credit',
|
|
135
|
+
purchaseItems: 'Purchase Items',
|
|
124
136
|
connect: {
|
|
125
137
|
defaultScan: 'Use the following methods to complete this action',
|
|
126
138
|
scan: 'Use the following methods to complete this {action}',
|
|
@@ -128,8 +140,10 @@ export default flat({
|
|
|
128
140
|
cancel: 'Cancel',
|
|
129
141
|
},
|
|
130
142
|
paymentMethod: 'Payment Method',
|
|
131
|
-
viewInvoice: '
|
|
143
|
+
viewInvoice: 'Invoice Detail',
|
|
132
144
|
submit: 'Submit',
|
|
145
|
+
expired: 'Expired',
|
|
146
|
+
consumed: 'Consumed',
|
|
133
147
|
},
|
|
134
148
|
payment: {
|
|
135
149
|
checkout: {
|
|
@@ -516,6 +530,8 @@ export default flat({
|
|
|
516
530
|
paymentConfirmDescription:
|
|
517
531
|
'After completing this payment, the payment method you use will be automatically set as the default for this subscription. Additionally, we will retry payment for any other unpaid invoices associated with this subscription.',
|
|
518
532
|
continue: 'Continue',
|
|
533
|
+
credit: 'Credit',
|
|
534
|
+
creditRefresh: 'Refresh every {interval} {unit}',
|
|
519
535
|
},
|
|
520
536
|
overduePayment: {
|
|
521
537
|
setupPaymentDescription: 'Use your saved card or add a new one to complete payment via Stripe.',
|
package/src/locales/zh.tsx
CHANGED
|
@@ -67,14 +67,24 @@ export default flat({
|
|
|
67
67
|
remainingBalance: '剩余余额',
|
|
68
68
|
credits: '额度',
|
|
69
69
|
ofCredits: '额度',
|
|
70
|
+
creditActivity: {
|
|
71
|
+
consumption: '额度消耗',
|
|
72
|
+
paidGrant: '额度充值',
|
|
73
|
+
paidAmount: '支付 {amount}',
|
|
74
|
+
promotionalGrant: '赠送',
|
|
75
|
+
resetGrant: '额度重置',
|
|
76
|
+
repayment: '支付欠费',
|
|
77
|
+
},
|
|
70
78
|
transferStatus: '交易状态',
|
|
71
79
|
sourceData: '源数据',
|
|
72
80
|
viewGrant: '查看额度',
|
|
73
|
-
viewSubscription: '
|
|
81
|
+
viewSubscription: '订阅详情',
|
|
74
82
|
view: '查看',
|
|
75
83
|
meterEvent: '计量事件',
|
|
76
84
|
source: '来源',
|
|
77
85
|
viewDetail: '查看详情',
|
|
86
|
+
viewTransactionDetail: '交易详情',
|
|
87
|
+
viewConsumptionDetail: '消费详情',
|
|
78
88
|
customer: '客户',
|
|
79
89
|
currency: '币种',
|
|
80
90
|
custom: '自定义',
|
|
@@ -121,6 +131,8 @@ export default flat({
|
|
|
121
131
|
slashStakeAmount: '罚没金额',
|
|
122
132
|
know: '我知道了',
|
|
123
133
|
relatedSubscription: '订阅',
|
|
134
|
+
subscriptionOrCredit: '订阅 / 额度',
|
|
135
|
+
purchaseItems: '购买项',
|
|
124
136
|
connect: {
|
|
125
137
|
defaultScan: '使用以下方式完成本次操作',
|
|
126
138
|
scan: '使用以下方式完成本次{action}',
|
|
@@ -128,8 +140,10 @@ export default flat({
|
|
|
128
140
|
cancel: '取消',
|
|
129
141
|
},
|
|
130
142
|
paymentMethod: '支付方式',
|
|
131
|
-
viewInvoice: '
|
|
143
|
+
viewInvoice: '账单详情',
|
|
132
144
|
submit: '提交',
|
|
145
|
+
expired: '已过期',
|
|
146
|
+
consumed: '已消费',
|
|
133
147
|
},
|
|
134
148
|
payment: {
|
|
135
149
|
checkout: {
|
|
@@ -502,6 +516,8 @@ export default flat({
|
|
|
502
516
|
paymentConfirmDescription:
|
|
503
517
|
'完成本次支付后,您使用的支付方式将自动设置为该订阅的默认支付方式。此外,我们还将对该订阅的其他欠费账单进行重试收费。',
|
|
504
518
|
continue: '继续',
|
|
519
|
+
credit: '额度',
|
|
520
|
+
creditRefresh: '每{interval}{unit}刷新',
|
|
505
521
|
},
|
|
506
522
|
payment: {
|
|
507
523
|
empty: '没有支付记录',
|
|
@@ -147,7 +147,11 @@ export default function ProductItem({
|
|
|
147
147
|
if (!isCreditProduct || !pendingAmount) return null;
|
|
148
148
|
const pendingAmountBN = new BN(pendingAmount || '0');
|
|
149
149
|
if (!pendingAmountBN.gt(new BN(0))) return null;
|
|
150
|
+
// Check if creditAmount is valid (should be > 0 for non-schedule mode)
|
|
151
|
+
if (!creditAmount || creditAmount <= 0) return null;
|
|
150
152
|
const creditAmountBN = fromTokenToUnit(creditAmount, creditCurrency?.decimal || 2);
|
|
153
|
+
// Check if creditAmountBN is zero to avoid division by zero error
|
|
154
|
+
if (!creditAmountBN || creditAmountBN.isZero()) return null;
|
|
151
155
|
return Math.ceil(pendingAmountBN.mul(new BN(100)).div(creditAmountBN).toNumber() / 100);
|
|
152
156
|
}, [isCreditProduct, pendingAmount, creditAmount, creditCurrency?.decimal]);
|
|
153
157
|
|