payment-kit 1.13.142 → 1.13.143

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.
@@ -133,6 +133,9 @@ export async function ensureStripeInvoice(stripeInvoice: any, subscription: Subs
133
133
  stripe_id: stripeInvoice.id,
134
134
  },
135
135
  });
136
+ if (checkoutSession) {
137
+ await checkoutSession.update({ invoice_id: invoice.id });
138
+ }
136
139
  await client.invoices.update(stripeInvoice.id, { metadata: { appPid: env.appPid, id: invoice.id } });
137
140
  logger.info('stripe invoice mirrored', { local: invoice.id, remote: stripeInvoice.id });
138
141
 
@@ -106,6 +106,17 @@ export async function startCheckoutSessionQueue() {
106
106
  checkoutSession: checkoutSession.id,
107
107
  invoice: checkoutSession.invoice_id,
108
108
  });
109
+ } else {
110
+ // Do some reverse lookup if invoice is not related to checkout session
111
+ const invoice = await Invoice.findOne({ where: { checkout_session_id: checkoutSession.id } });
112
+ if (invoice) {
113
+ await InvoiceItem.destroy({ where: { invoice_id: invoice.id } });
114
+ await Invoice.destroy({ where: { id: invoice.id } });
115
+ logger.info('Invoice and InvoiceItem for checkout session deleted on expire', {
116
+ checkoutSession: checkoutSession.id,
117
+ invoice: invoice.id,
118
+ });
119
+ }
109
120
  }
110
121
  if (checkoutSession.setup_intent_id) {
111
122
  await SetupIntent.destroy({ where: { id: checkoutSession.setup_intent_id } });
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.142
17
+ version: 1.13.143
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.142",
3
+ "version": "1.13.143",
4
4
  "scripts": {
5
5
  "dev": "cross-env COMPONENT_STORE_URL=https://test.store.blocklet.dev blocklet dev --open",
6
6
  "eject": "vite eject",
@@ -50,7 +50,7 @@
50
50
  "@arcblock/jwt": "^1.18.110",
51
51
  "@arcblock/ux": "^2.9.29",
52
52
  "@blocklet/logger": "1.16.23",
53
- "@blocklet/payment-react": "1.13.142",
53
+ "@blocklet/payment-react": "1.13.143",
54
54
  "@blocklet/sdk": "1.16.23",
55
55
  "@blocklet/ui-react": "^2.9.29",
56
56
  "@blocklet/uploader": "^0.0.73",
@@ -110,7 +110,7 @@
110
110
  "devDependencies": {
111
111
  "@abtnode/types": "1.16.23",
112
112
  "@arcblock/eslint-config-ts": "^0.2.4",
113
- "@blocklet/payment-types": "1.13.142",
113
+ "@blocklet/payment-types": "1.13.143",
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": "99dfea2fee995b1a5a086675119585a8f23eed0a"
152
+ "gitHead": "7eca8fb8eda6bd07cddb0f916602a35d4f7b39a3"
153
153
  }