There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
fix(server): selfhost subscription customer portal creation (#10149)
forehaloab538ef9bb8b
diff --git a/packages/backend/server/src/plugins/license/service.ts b/packages/backend/server/src/plugins/license/service.tsindex cfadfdd22a..0675ca2709 100644--- a/packages/backend/server/src/plugins/license/service.ts+++ b/packages/backend/server/src/plugins/license/service.ts@@ -222,11 +222,8 @@ export class LicenseService implements OnModuleInit {await this.fetchAffinePro(`/api/team/licenses/${license.key}/seats`, {method: 'POST',body: JSON.stringify({- quantity: count,+ seats: count,}),- headers: {- 'Content-Type': 'application/json',- },});// stripe payment is async, we can't directly the charge result in update callingdiff --git a/packages/backend/server/src/plugins/payment/license/controller.ts b/packages/backend/server/src/plugins/payment/license/controller.tsindex 0b9e587be3..adef69d123 100644--- a/packages/backend/server/src/plugins/payment/license/controller.ts+++ b/packages/backend/server/src/plugins/payment/license/controller.ts@@ -228,24 +228,24 @@ export class LicenseController {@Post('/:license/create-customer-portal')async createCustomerPortal(@Param('license') key: string) {- const invoice = await this.db.invoice.findFirst({+ const subscription = await this.db.subscription.findFirst({where: {targetId: key,},});- if (!invoice) {+ if (!subscription || !subscription.stripeSubscriptionId) {throw new LicenseNotFound();}- const invoiceData = await this.stripe.invoices.retrieve(- invoice.stripeInvoiceId,+ const subscriptionData = await this.stripe.subscriptions.retrieve(+ subscription.stripeSubscriptionId,{expand: ['customer'],});- const customer = invoiceData.customer as Stripe.Customer;+ const customer = subscriptionData.customer as Stripe.Customer;try {const portal = await this.stripe.billingPortal.sessions.create({customer: customer.id,