payment-kit 1.21.15 → 1.21.17

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 (30) hide show
  1. package/api/src/index.ts +2 -0
  2. package/api/src/integrations/stripe/handlers/invoice.ts +30 -25
  3. package/api/src/integrations/stripe/handlers/setup-intent.ts +231 -0
  4. package/api/src/integrations/stripe/handlers/subscription.ts +31 -9
  5. package/api/src/integrations/stripe/resource.ts +29 -0
  6. package/api/src/libs/payment.ts +9 -3
  7. package/api/src/libs/util.ts +17 -0
  8. package/api/src/queues/vendors/return-processor.ts +52 -75
  9. package/api/src/queues/vendors/return-scanner.ts +38 -3
  10. package/api/src/routes/connect/change-payer.ts +148 -0
  11. package/api/src/routes/connect/shared.ts +30 -0
  12. package/api/src/routes/invoices.ts +141 -2
  13. package/api/src/routes/payment-links.ts +2 -1
  14. package/api/src/routes/subscriptions.ts +130 -3
  15. package/api/src/routes/vendor.ts +100 -72
  16. package/api/src/store/models/checkout-session.ts +1 -0
  17. package/blocklet.yml +1 -1
  18. package/package.json +6 -6
  19. package/src/components/invoice-pdf/template.tsx +30 -0
  20. package/src/components/subscription/payment-method-info.tsx +222 -0
  21. package/src/global.css +4 -0
  22. package/src/locales/en.tsx +13 -0
  23. package/src/locales/zh.tsx +13 -0
  24. package/src/pages/admin/billing/invoices/detail.tsx +5 -3
  25. package/src/pages/admin/billing/subscriptions/detail.tsx +16 -0
  26. package/src/pages/admin/overview.tsx +14 -14
  27. package/src/pages/admin/products/vendors/create.tsx +6 -40
  28. package/src/pages/admin/products/vendors/index.tsx +5 -1
  29. package/src/pages/customer/invoice/detail.tsx +59 -17
  30. package/src/pages/customer/subscription/detail.tsx +20 -1
@@ -52,6 +52,7 @@ import { useSessionContext } from '../../../contexts/session';
52
52
  import { usePendingAmountForSubscription, useUnpaidInvoicesCheckForSubscription } from '../../../hooks/subscription';
53
53
  import { formatSmartDuration, TimeUnit } from '../../../libs/dayjs';
54
54
  import { canChangePaymentMethod } from '../../../libs/util';
55
+ import PaymentMethodInfo from '../../../components/subscription/payment-method-info';
55
56
 
56
57
  const fetchData = (id: string | undefined): Promise<TSubscriptionExpanded> => {
57
58
  return api.get(`/api/subscriptions/${id}`).then((res) => res.data);
@@ -622,7 +623,7 @@ export default function CustomerSubscriptionDetail() {
622
623
  {canChangePaymentMethod(data) && (
623
624
  <Button
624
625
  variant="text"
625
- sx={{ color: 'text.link', fontSize: 14 }}
626
+ sx={{ color: 'text.link' }}
626
627
  size="small"
627
628
  onClick={async () => {
628
629
  // only check unpaid invoices when overdraft protection is enabled
@@ -640,6 +641,24 @@ export default function CustomerSubscriptionDetail() {
640
641
  </Stack>
641
642
  }
642
643
  />
644
+ {(data as any).paymentMethodDetails && (
645
+ <InfoRow
646
+ label={t('admin.subscription.payerAddress')}
647
+ value={
648
+ <PaymentMethodInfo
649
+ subscriptionId={id}
650
+ customer={data.customer}
651
+ paymentMethodDetails={(data as any).paymentMethodDetails}
652
+ editable={['active', 'trialing', 'past_due'].includes(data.status)}
653
+ onUpdate={() => {
654
+ refresh();
655
+ checkUnpaidInvoices();
656
+ }}
657
+ paymentMethodType={data.paymentMethod?.type}
658
+ />
659
+ }
660
+ />
661
+ )}
643
662
 
644
663
  {data.payment_details && hasDelegateTxHash(data.payment_details, data.paymentMethod) && (
645
664
  <InfoRow