46 add stripe product endpoint (#4133)
* Add self billing feature flag * Add two core tables for billing * Remove useless imports * Remove graphql decorators * Rename subscriptionProduct table * WIP: Add stripe config * Add controller to get product prices * Add billing service * Remove unecessary package * Simplify stripe service * Code review returns * Use nestjs param * Rename subscription to basePlan * Rename env variable
This commit is contained in:
@ -305,4 +305,15 @@ export class EnvironmentService {
|
||||
this.configService.get<number>('MUTATION_MAXIMUM_RECORD_AFFECTED') ?? 100
|
||||
);
|
||||
}
|
||||
|
||||
getBillingStripeBasePlanProductId(): string {
|
||||
return (
|
||||
this.configService.get<string>('BILLING_STRIPE_BASE_PLAN_PRODUCT_ID') ??
|
||||
''
|
||||
);
|
||||
}
|
||||
|
||||
getStripeApiKey(): string {
|
||||
return this.configService.get<string>('STRIPE_API_KEY') ?? '';
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,6 +48,14 @@ export class EnvironmentVariables {
|
||||
@IsString()
|
||||
BILLING_URL?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
BILLING_STRIPE_BASE_PLAN_PRODUCT_ID?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
STRIPE_API_KEY?: string;
|
||||
|
||||
@CastToBoolean()
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
@ -83,21 +91,25 @@ export class EnvironmentVariables {
|
||||
// Json Web Token
|
||||
@IsString()
|
||||
ACCESS_TOKEN_SECRET: string;
|
||||
|
||||
@IsDuration()
|
||||
@IsOptional()
|
||||
ACCESS_TOKEN_EXPIRES_IN: string;
|
||||
|
||||
@IsString()
|
||||
REFRESH_TOKEN_SECRET: string;
|
||||
|
||||
@IsDuration()
|
||||
@IsOptional()
|
||||
REFRESH_TOKEN_EXPIRES_IN: string;
|
||||
|
||||
@IsDuration()
|
||||
@IsOptional()
|
||||
REFRESH_TOKEN_COOL_DOWN: string;
|
||||
|
||||
@IsString()
|
||||
LOGIN_TOKEN_SECRET: string;
|
||||
|
||||
@IsDuration()
|
||||
@IsOptional()
|
||||
LOGIN_TOKEN_EXPIRES_IN: string;
|
||||
@ -205,7 +217,6 @@ export class EnvironmentVariables {
|
||||
@IsNumber()
|
||||
MUTATION_MAXIMUM_RECORD_AFFECTED: number;
|
||||
}
|
||||
|
||||
export const validate = (config: Record<string, unknown>) => {
|
||||
const validatedConfig = plainToClass(EnvironmentVariables, config);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user