Stripe Pricing + Subscriptions
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Body, Controller, HttpException, HttpStatus, Post, Req, Res } from '@nestjs/common';
|
||||
import { Body, Controller, Get, HttpException, HttpStatus, Param, Post, Req, Res } from '@nestjs/common';
|
||||
import { Request, Response } from 'express';
|
||||
import { Checkout } from 'src/models/main.model.js';
|
||||
import Stripe from 'stripe';
|
||||
@@ -13,8 +13,8 @@ export class PaymentController {
|
||||
// return this.paymentService.createSubscription(subscriptionData);
|
||||
// }
|
||||
@Post('create-checkout-session')
|
||||
async calculateTax(@Body() checkout: Checkout) {
|
||||
return this.paymentService.checkout(checkout);
|
||||
async createCheckoutSession(@Body() checkout: Checkout) {
|
||||
return this.paymentService.createCheckoutSession(checkout);
|
||||
}
|
||||
@Post('webhook')
|
||||
async handleWebhook(@Req() req: Request, @Res() res: Response): Promise<void> {
|
||||
@@ -33,4 +33,8 @@ export class PaymentController {
|
||||
throw new HttpException('Webhook Error', HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
@Get('subscriptions/:email')
|
||||
async findSubscriptionsById(@Param('email') email: string): Promise<any> {
|
||||
return await this.paymentService.getSubscription(email);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user