38 add billing webhook endpoint (#4158)
* 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 * Add checkout endpoint * Remove resolver * Merge controllers * Fix security issue * Handle missing url error * Add workspaceId in checkout metadata * Add BILLING_STRIPE_WEBHOOK_SECRET env variable * WIP: add webhook endpoint * Fix body parser * Create Billing Subscription on payment success * Set subscriptionStatus active on webhook * Add useful log --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { ValidationPipe } from '@nestjs/common';
|
||||
import { NestExpressApplication } from '@nestjs/platform-express';
|
||||
|
||||
import * as bodyParser from 'body-parser';
|
||||
import { graphqlUploadExpress } from 'graphql-upload';
|
||||
import bytes from 'bytes';
|
||||
import { useContainer } from 'class-validator';
|
||||
@ -14,9 +14,10 @@ import { LoggerService } from './integrations/logger/logger.service';
|
||||
import { EnvironmentService } from './integrations/environment/environment.service';
|
||||
|
||||
const bootstrap = async () => {
|
||||
const app = await NestFactory.create(AppModule, {
|
||||
const app = await NestFactory.create<NestExpressApplication>(AppModule, {
|
||||
cors: true,
|
||||
bufferLogs: process.env.LOGGER_IS_BUFFER_ENABLED === 'true',
|
||||
rawBody: true,
|
||||
});
|
||||
const logger = app.get(LoggerService);
|
||||
|
||||
@ -32,14 +33,11 @@ const bootstrap = async () => {
|
||||
transform: true,
|
||||
}),
|
||||
);
|
||||
|
||||
app.use(bodyParser.json({ limit: settings.storage.maxFileSize }));
|
||||
app.use(
|
||||
bodyParser.urlencoded({
|
||||
limit: settings.storage.maxFileSize,
|
||||
extended: true,
|
||||
}),
|
||||
);
|
||||
app.useBodyParser('json', { limit: settings.storage.maxFileSize });
|
||||
app.useBodyParser('urlencoded', {
|
||||
limit: settings.storage.maxFileSize,
|
||||
extended: true,
|
||||
});
|
||||
|
||||
// Graphql file upload
|
||||
app.use(
|
||||
|
||||
Reference in New Issue
Block a user