add fetch billing products from tables instead of env variables (#9601)
Solves https://github.com/twentyhq/private-issues/issues/237 **TLDR:** - Fetches billing products and prices from the tables BilllingProducts and BillingPrices instead of fetching the product from the environment variables and the prices from the stripe API. - Adds new feature flag for this feature - Fixes calls used to fetch stripe products and prices for the command Billing Sync Plans Data. **In order to test:** 1. Have the environment variable IS_BILLING_ENABLED set to true and add the other required environment variables for Billing to work 2. Do a database reset (to ensure that the new feature flag is properly added and that the billing tables are created) 3. Run the command: `npx nx run twenty-server:command billing:sync-plans-data` (if you don't do that the products and prices will not be present in the database) 4. Run the server , the frontend, the worker, and the stripe listen command (`stripe listen --forward-to http://localhost:3000/billing/webhooks`) 5. Buy a subscription for the Acme workspace and play with the project **Doing** I think there is some room of progress for the function formatProductPrices, I used a similar version that was done before, I'll look into that.
This commit is contained in:
committed by
GitHub
parent
3d2bb03c6d
commit
7d30b7577d
@ -1,6 +1,6 @@
|
||||
import { Field, ObjectType, registerEnumType } from '@nestjs/graphql';
|
||||
|
||||
import { TrialPeriodDTO } from 'src/engine/core-modules/billing/dto/trial-period.dto';
|
||||
import { BillingTrialPeriodDTO } from 'src/engine/core-modules/billing/dtos/billing-trial-period.dto';
|
||||
import { CaptchaDriverType } from 'src/engine/core-modules/captcha/interfaces';
|
||||
import { FeatureFlagKey } from 'src/engine/core-modules/feature-flag/enums/feature-flag-key.enum';
|
||||
import { AuthProviders } from 'src/engine/core-modules/workspace/dtos/public-workspace-data-output';
|
||||
@ -17,8 +17,8 @@ class Billing {
|
||||
@Field(() => String, { nullable: true })
|
||||
billingUrl?: string;
|
||||
|
||||
@Field(() => [TrialPeriodDTO])
|
||||
trialPeriods: TrialPeriodDTO[];
|
||||
@Field(() => [BillingTrialPeriodDTO])
|
||||
trialPeriods: BillingTrialPeriodDTO[];
|
||||
}
|
||||
|
||||
@ObjectType()
|
||||
|
||||
Reference in New Issue
Block a user