The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
fix(billing): reenable trial (#14616)
Antoine Moreauxdeed08ba259f
diff --git a/packages/twenty-server/src/engine/core-modules/billing/services/billing-portal.workspace-service.ts b/packages/twenty-server/src/engine/core-modules/billing/services/billing-portal.workspace-service.tsindex d899763e7ec..acfbdee7eb2 100644--- a/packages/twenty-server/src/engine/core-modules/billing/services/billing-portal.workspace-service.ts+++ b/packages/twenty-server/src/engine/core-modules/billing/services/billing-portal.workspace-service.ts@@ -101,6 +101,8 @@ export class BillingPortalWorkspaceService {stripeCustomerId: customer?.stripeCustomerId,plan,requirePaymentMethod,+ withTrialPeriod:+ !isDefined(customer) || customer.billingSubscriptions.length === 0,});const createdBillingSubscription =diff --git a/packages/twenty-server/src/engine/core-modules/billing/stripe/services/stripe-checkout.service.ts b/packages/twenty-server/src/engine/core-modules/billing/stripe/services/stripe-checkout.service.tsindex bce91a6ae91..41066f39cd8 100644--- a/packages/twenty-server/src/engine/core-modules/billing/stripe/services/stripe-checkout.service.ts+++ b/packages/twenty-server/src/engine/core-modules/billing/stripe/services/stripe-checkout.service.ts@@ -95,6 +95,7 @@ export class StripeCheckoutService {stripeCustomerId,plan = BillingPlanKey.PRO,requirePaymentMethod = false,+ withTrialPeriod,}: {user: User;workspace: Pick<Workspace, 'id' | 'displayName'>;@@ -102,6 +103,7 @@ export class StripeCheckoutService {stripeCustomerId?: string;plan?: BillingPlanKey;requirePaymentMethod?: boolean;+ withTrialPeriod: boolean;}): Promise<Stripe.Subscription> {if (!isDefined(stripeCustomerId)) {const stripeCustomer =@@ -128,6 +130,10 @@ export class StripeCheckoutService {workspaceId: workspace.id,plan,},+ ...this.getStripeSubscriptionTrialPeriodConfig(+ withTrialPeriod,+ requirePaymentMethod,+ ),automatic_tax: { enabled: !!requirePaymentMethod },};