payment-kit 1.13.85 → 1.13.87

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.
@@ -173,6 +173,10 @@ export const handleSubscription = async (job: SubscriptionJob) => {
173
173
  end: setup.period.end - duration,
174
174
  usage: x.price.recurring?.aggregate_usage,
175
175
  });
176
+
177
+ // record raw quantity in metadata
178
+ x.metadata = x.metadata || {};
179
+ x.metadata.quantity = rawQuantity;
176
180
  }
177
181
 
178
182
  return x;
@@ -429,7 +429,7 @@ export async function ensureInvoiceAndItems({
429
429
  discount_amounts: [],
430
430
  proration: false,
431
431
  proration_details: {},
432
- metadata: {},
432
+ metadata: x.metadata || {},
433
433
  });
434
434
  })
435
435
  );
@@ -95,7 +95,11 @@ export type TPriceExpanded = TPrice & {
95
95
  };
96
96
  };
97
97
 
98
- export type TLineItemExpanded = LineItem & { price: TPriceExpanded; upsell_price: TPriceExpanded };
98
+ export type TLineItemExpanded = LineItem & {
99
+ price: TPriceExpanded;
100
+ upsell_price: TPriceExpanded;
101
+ metadata?: Record<string, any>;
102
+ };
99
103
 
100
104
  export type TProductExpanded = TProduct & {
101
105
  object: 'price';
package/blocklet.yml CHANGED
@@ -14,7 +14,7 @@ repository:
14
14
  type: git
15
15
  url: git+https://github.com/blocklet/payment-kit.git
16
16
  specVersion: 1.2.8
17
- version: 1.13.85
17
+ version: 1.13.87
18
18
  logo: logo.png
19
19
  files:
20
20
  - dist
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payment-kit",
3
- "version": "1.13.85",
3
+ "version": "1.13.87",
4
4
  "scripts": {
5
5
  "dev": "COMPONENT_STORE_URL=https://test.store.blocklet.dev blocklet dev",
6
6
  "eject": "vite eject",
@@ -110,7 +110,7 @@
110
110
  "@abtnode/types": "1.16.21-beta-e828f413",
111
111
  "@arcblock/eslint-config": "^0.2.4",
112
112
  "@arcblock/eslint-config-ts": "^0.2.4",
113
- "@did-pay/types": "1.13.85",
113
+ "@did-pay/types": "1.13.87",
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": "3d976b6a4bb4c0f910ddda7a60d42ec0e08ea5d9"
152
+ "gitHead": "e56e774ed27b74caa9b6ecdc8e02d7e0cc8d7fce"
153
153
  }
@@ -1,6 +1,7 @@
1
1
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
2
2
  import type { TInvoiceExpanded } from '@did-pay/types';
3
- import { Table, TableBody, TableCell, TableHead, TableRow, Typography } from '@mui/material';
3
+ import { InfoOutlined } from '@mui/icons-material';
4
+ import { Stack, Table, TableBody, TableCell, TableHead, TableRow, Tooltip, Typography } from '@mui/material';
4
5
  import { styled } from '@mui/system';
5
6
  import { toBN } from '@ocap/util';
6
7
 
@@ -78,7 +79,18 @@ export default function InvoiceTable({ invoice, simple }: Props) {
78
79
  {line.description}
79
80
  {line.price.product.unit_label ? ` (per ${line.price.product.unit_label})` : ''}
80
81
  </TableCell>
81
- <TableCell align="right">{line.quantity}</TableCell>
82
+ <TableCell align="right">
83
+ <Stack direction="row" spacing={0.5} alignItems="center" justifyContent="flex-end">
84
+ <Typography>{line.quantity}</Typography>
85
+ {line.metadata && line.metadata.quantity && (
86
+ <Tooltip
87
+ title={t('customer.invoice.rawQuantity', { quantity: line.metadata.quantity })}
88
+ placement="top">
89
+ <InfoOutlined fontSize="small" sx={{ color: 'text.secondary', cursor: 'pointer' }} />
90
+ </Tooltip>
91
+ )}
92
+ </Stack>
93
+ </TableCell>
82
94
  <TableCell align="right">
83
95
  {!line.proration
84
96
  ? formatAmount(getPriceUintAmountByCurrency(line.price, invoice.paymentCurrency), invoice.paymentCurrency.decimal) // prettier-ignore
@@ -609,6 +609,7 @@ export default flat({
609
609
  download: 'Download PDF',
610
610
  unitPrice: 'Unit Price',
611
611
  amountPaid: 'Amount Paid',
612
+ rawQuantity: 'Raw Quantity: {quantity}',
612
613
  amountDue: 'Amount Due',
613
614
  amountApplied: 'Applied Balance',
614
615
  pay: 'Pay this invoice',
@@ -594,6 +594,7 @@ export default flat({
594
594
  details: '详情',
595
595
  download: '下载PDF',
596
596
  unitPrice: '单价',
597
+ rawQuantity: '汇总前数量: {quantity}',
597
598
  amountPaid: '已支付',
598
599
  amountDue: '待支付',
599
600
  amountApplied: '余额变更',
@@ -37,12 +37,9 @@ function getTokenBalances(customer: TCustomerExpanded, paymentMethods: TPaymentM
37
37
  const currencies = paymentMethods.reduce((acc, x) => acc.concat(x.payment_currencies), []);
38
38
 
39
39
  if (customer.balance) {
40
- const currency = currencies.find((x: any) => x.symbol === 'USD');
41
40
  tokens.push({
42
- // @ts-ignore
43
- currency: currency.symbol,
44
- // @ts-ignore
45
- balance: fromUnitToToken(customer.balance, currency.decimal),
41
+ currency: 'USD',
42
+ balance: fromUnitToToken(customer.balance, 2),
46
43
  });
47
44
  }
48
45