payment-kit 1.13.30 → 1.13.32

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.
Files changed (45) hide show
  1. package/api/src/integrations/blockchain/nft.ts +0 -1
  2. package/api/src/integrations/blocklet/passport.ts +1 -1
  3. package/api/src/integrations/stripe/handlers/invoice.ts +44 -2
  4. package/api/src/integrations/stripe/handlers/payment-intent.ts +32 -8
  5. package/api/src/integrations/stripe/resource.ts +7 -4
  6. package/api/src/jobs/subscription.ts +1 -1
  7. package/api/src/libs/payment.ts +6 -1
  8. package/api/src/libs/session.ts +78 -27
  9. package/api/src/libs/util.ts +15 -0
  10. package/api/src/routes/checkout-sessions.ts +161 -20
  11. package/api/src/routes/connect/collect.ts +5 -9
  12. package/api/src/routes/connect/pay.ts +5 -9
  13. package/api/src/routes/connect/setup.ts +22 -10
  14. package/api/src/routes/connect/shared.ts +13 -10
  15. package/api/src/routes/connect/subscribe.ts +29 -20
  16. package/api/src/routes/invoices.ts +5 -1
  17. package/api/src/routes/payment-intents.ts +5 -1
  18. package/api/src/routes/payment-links.ts +3 -2
  19. package/api/src/routes/prices.ts +32 -21
  20. package/api/src/store/migrations/20231023-upsell.ts +11 -0
  21. package/api/src/store/models/index.ts +10 -2
  22. package/api/src/store/models/price.ts +89 -23
  23. package/api/src/store/models/types.ts +1 -0
  24. package/blocklet.yml +1 -1
  25. package/package.json +17 -17
  26. package/src/components/blockchain/tx.tsx +3 -1
  27. package/src/components/checkout/pay.tsx +39 -19
  28. package/src/components/checkout/product-card.tsx +2 -6
  29. package/src/components/checkout/product-item.tsx +84 -21
  30. package/src/components/checkout/summary.tsx +11 -2
  31. package/src/components/info-row.tsx +3 -1
  32. package/src/components/invoice/table.tsx +1 -1
  33. package/src/components/price/upsell-select.tsx +83 -0
  34. package/src/components/price/upsell.tsx +74 -0
  35. package/src/components/status.tsx +1 -1
  36. package/src/components/subscription/actions/cancel.tsx +25 -27
  37. package/src/components/subscription/items/index.tsx +1 -1
  38. package/src/libs/util.ts +51 -31
  39. package/src/locales/en.tsx +23 -2
  40. package/src/locales/zh.tsx +52 -40
  41. package/src/pages/admin/billing/index.tsx +3 -3
  42. package/src/pages/admin/customers/customers/detail.tsx +1 -0
  43. package/src/pages/admin/index.tsx +1 -0
  44. package/src/pages/admin/products/prices/detail.tsx +7 -0
  45. package/src/pages/customer/invoice.tsx +7 -6
@@ -149,6 +149,7 @@ export default flat({
149
149
  amountTip: '对于订阅选择周期,对于其他所有选择一次性。',
150
150
  duplicate: '复制价格',
151
151
  edit: '编辑价格',
152
+ find: '选择或新建价格',
152
153
  archive: '存档价格',
153
154
  archiveTip: '存档将隐藏此价格不再允许新购买。确定要存档此价格吗?',
154
155
  remove: '删除价格',
@@ -192,6 +193,11 @@ export default flat({
192
193
  last_during_period: '周期内的最近使用值',
193
194
  last_ever: '最近的使用值',
194
195
  },
196
+ upsell: {
197
+ title: '升级选项',
198
+ to: '可升级至',
199
+ tip: '',
200
+ },
195
201
  },
196
202
  coupon: {
197
203
  create: '创建优惠券',
@@ -465,48 +471,54 @@ export default flat({
465
471
  processing: '处理中',
466
472
  payment: '支付',
467
473
  try: '免费试用',
468
- include: '包括',
469
- promo: '在开始之前免费试用{percent}%的套餐!',
470
- promoInfo: '您可以随时取消,取消后无需付款。未来的计费将按月',
471
- subtotal: '小计',
472
- coupon: '优惠券',
473
- complete: '完成支付',
474
- details: '订单详情',
475
- total: '总计',
476
- billing: '账单',
477
- first_name: '名',
478
- last_name: '',
479
- country: '国家',
480
- state: '',
481
- city: '城市',
482
- address: '地址',
483
- postal_code: '邮政编码',
484
- phone: '电话',
485
- credit_card: {
486
- info: '信用卡信息',
487
- name: '卡片姓名',
488
- number: '卡号',
489
- expires: '过期日期',
490
- expiresPlaceholder: 'MM/YY',
491
- cvc: 'CVC',
474
+ include: '包括:',
475
+ subscription: '订阅',
476
+ noPricing: '没有可购买的物品',
477
+ setup: '订阅',
478
+ continue: '确认{action}',
479
+ connect: '连接并{action}',
480
+ login: '登录以加载并保存联系信息',
481
+ portal: '管理订阅',
482
+ cardPay: '使用卡片{action}',
483
+ completed: {
484
+ payment: '感谢您的购买',
485
+ subscription: '感谢您的订阅',
486
+ setup: '感谢您的订阅',
487
+ tip: '向{payee}的付款已完成。您可以在您的账户中查看此付款的详细信息。',
492
488
  },
493
- pay: '付款',
494
- paymentFailed: '付款失败',
495
- subscribe: '购买套餐',
496
- cancel: '取消',
497
- thanks: '感谢您的付款!',
498
- subscriptionDetails: '订阅详情',
499
- transaction: {
500
- subscription: '订阅',
501
- date: '日期',
502
- amount: '金额',
489
+ confirm: '通过确认您的订阅,您允许{payee}按照其条款对您的账户进行付款。您随时可以取消您的订阅。',
490
+ required: '必填项',
491
+ invalid: '无效',
492
+ billing: {
493
+ auto: '国家/地区',
494
+ required: '账单地址',
495
+ country: '国家/地区',
496
+ state: '州或省',
497
+ city: '城市或镇',
498
+ line1: '地址',
499
+ line2: '地址2',
500
+ postal_code: '邮政编码',
501
+ },
502
+ customer: {
503
+ name: '姓名',
504
+ email: '电子邮件',
505
+ phone: '电话',
506
+ phonePlaceholder: '电话号码',
507
+ phoneTip: '以防需要与您联系有关您的订单',
508
+ },
509
+ upsell: {
510
+ save: '使用{recurring}计费方式节省',
511
+ revert: '切换到{recurring}计费方式',
512
+ off: '{saving}%折扣',
513
+ },
514
+ expired: {
515
+ title: '链接已过期',
516
+ description: '此链接已过期。这意味着您的付款已经处理完成或会话已过期。',
517
+ },
518
+ complete: {
519
+ title: '结账已完成',
520
+ description: '此结账会话已完成。这意味着您的付款已成功处理完成。',
503
521
  },
504
- nextPaymentOn: '下一次付款日期:{date}',
505
- productCount: '1个产品',
506
- productCount_plural: '{count}个产品',
507
- currencyMismatch: '此订阅与选择的货币不匹配',
508
- lockedProduct: '此产品无法购买',
509
- notFound: '支付链接不存在',
510
522
  },
511
523
  customer: {
512
524
  subscriptions: '当前订阅',
@@ -8,14 +8,14 @@ const SubscriptionDetail = React.lazy(() => import('./subscriptions/detail'));
8
8
  const InvoiceDetail = React.lazy(() => import('./invoices/detail'));
9
9
 
10
10
  const pages = {
11
- subscriptions: React.lazy(() => import('./subscriptions')),
12
11
  invoices: React.lazy(() => import('./invoices')),
12
+ subscriptions: React.lazy(() => import('./subscriptions')),
13
13
  };
14
14
 
15
15
  export default function BillingIndex() {
16
16
  const navigate = useNavigate();
17
17
  const { t } = useLocaleContext();
18
- const { page = 'subscriptions' } = useParams();
18
+ const { page = 'invoices' } = useParams();
19
19
 
20
20
  if (page.startsWith('sub_')) {
21
21
  return <SubscriptionDetail id={page} />;
@@ -32,8 +32,8 @@ export default function BillingIndex() {
32
32
  // @ts-ignore
33
33
  const TabComponent = pages[page] || pages.subscriptions;
34
34
  const tabs = [
35
- { label: t('admin.subscriptions'), value: 'subscriptions' },
36
35
  { label: t('admin.invoices'), value: 'invoices' },
36
+ { label: t('admin.subscriptions'), value: 'subscriptions' },
37
37
  ];
38
38
 
39
39
  return (
@@ -150,6 +150,7 @@ export default function CustomerDetail(props: { id: string }) {
150
150
  <InfoRow label={t('common.createdAt')} value={formatTime(data.created_at)} />
151
151
  <InfoRow label={t('common.updatedAt')} value={formatTime(data.updated_at)} />
152
152
  <InfoRow
153
+ alignItems="flex-start"
153
154
  label={t('admin.customer.address.label')}
154
155
  value={
155
156
  <Stack direction="column">
@@ -83,6 +83,7 @@ function Admin() {
83
83
  style={{
84
84
  fontSize: 14,
85
85
  fontWeight: 600,
86
+ cursor: 'pointer',
86
87
  color: settings.livemode ? 'text.primary' : 'warning.light',
87
88
  }}>
88
89
  {t('common.livemode')}
@@ -14,6 +14,7 @@ import EventList from '../../../../components/event/list';
14
14
  import InfoMetric from '../../../../components/info-metric';
15
15
  import InfoRow from '../../../../components/info-row';
16
16
  import MetadataEditor from '../../../../components/metadata/editor';
17
+ import PriceUpsell from '../../../../components/price/upsell';
17
18
  import EditPrice from '../../../../components/product/edit-price';
18
19
  import SectionHeader from '../../../../components/section/header';
19
20
  import Table from '../../../../components/table';
@@ -234,6 +235,12 @@ export default function PriceDetail(props: { id: string }) {
234
235
  />
235
236
  </Box>
236
237
  </Box>
238
+ <Box className="section">
239
+ <SectionHeader title={t('admin.price.upsell.title')} />
240
+ <Box className="section-body">
241
+ <PriceUpsell data={data} onChange={runAsync} />
242
+ </Box>
243
+ </Box>
237
244
  <Box className="section">
238
245
  <SectionHeader title={t('admin.events')} />
239
246
  <Box className="section-body">
@@ -3,10 +3,10 @@ import Toast from '@arcblock/ux/lib/Toast';
3
3
  import type { TInvoiceExpanded } from '@did-pay/types';
4
4
  import { ArrowBackOutlined } from '@mui/icons-material';
5
5
  import { Alert, Box, Button, CircularProgress, Grid, Stack, Typography } from '@mui/material';
6
- import { fromUnitToToken } from '@ocap/util';
7
6
  import { useRequest, useSetState } from 'ahooks';
8
7
  import { Link, useParams } from 'react-router-dom';
9
8
 
9
+ import TxLink from '../../components/blockchain/tx';
10
10
  import Currency from '../../components/currency';
11
11
  import InfoRow from '../../components/info-row';
12
12
  import InvoiceTable from '../../components/invoice/table';
@@ -108,12 +108,13 @@ export default function CustomerHome() {
108
108
  value={<Currency logo={data.paymentCurrency.logo} name={data.paymentCurrency.symbol} />}
109
109
  />
110
110
  <InfoRow
111
- label={t('common.total')}
111
+ label={t('common.txHash')}
112
112
  value={
113
- <Typography component="span" fontWeight="bold">
114
- {fromUnitToToken(data.total, data.paymentCurrency.decimal)}&nbsp;
115
- {data.paymentCurrency.symbol}
116
- </Typography>
113
+ data.paymentIntent?.payment_details ? (
114
+ <TxLink details={data.paymentIntent.payment_details} method={data.paymentMethod} />
115
+ ) : (
116
+ ''
117
+ )
117
118
  }
118
119
  />
119
120
  </Stack>