Files
epess-web-backend/src/Payos/payos.controller.ts
Ly Tuan Kiet 10e20092ab chore: update configuration and improve schema imports
- Updated biome.json to include "graphql.d.ts" in the ignored files list.
- Updated subproject commit reference in epess-database to the latest version.
- Removed unused script from package.json and streamlined module file extensions in tsconfig.json.
- Consolidated exclude patterns in tsconfig.build.json for clarity.
- Refactored imports across multiple schema files for consistency and improved readability.
- Enhanced various schema files by ensuring proper import order and removing redundant code.
- Improved error handling and data integrity checks in several service and schema files.
2024-12-08 20:49:52 +07:00

40 lines
1.2 KiB
TypeScript

import { Body, Controller, Delete, Get, Headers, Param, Post, Put } from '@nestjs/common'
import { ApiOperation, ApiTags } from '@nestjs/swagger'
import { WebhookType } from '@payos/node/lib/type'
import { PayosService } from './payos.service'
@ApiTags('Payos')
@Controller('payos')
export class PayosController {
constructor(private readonly payosService: PayosService) {}
// webhook
@Post('webhook')
@ApiOperation({ summary: 'Webhook for Payos' })
async webhook(@Body() body: WebhookType) {
return this.payosService.webhook(body)
}
// ping webhook
@Get('webhook')
@ApiOperation({ summary: 'Ping webhook' })
async ping() {
return this.payosService.ping()
}
// test create payment url
@Post('create-payment-url')
@ApiOperation({ summary: 'Test create payment url' })
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
async createPaymentURL(@Body() body: any) {
return this.payosService.createPaymentURL(body)
}
// get payment status
@Get('get-payment-status/:orderId')
@ApiOperation({ summary: 'Get payment status' })
async getPaymentStatus(@Param('orderId') orderId: string | number) {
return this.payosService.getPaymentStatus(orderId)
}
}