refactor source code
This commit is contained in:
@@ -7,9 +7,9 @@ import {
|
||||
Param,
|
||||
Body,
|
||||
Headers,
|
||||
} from '@nestjs/common';
|
||||
import { PayosService } from './payos.service';
|
||||
import { ApiTags, ApiOperation } from '@nestjs/swagger';
|
||||
} from '@nestjs/common'
|
||||
import { PayosService } from './payos.service'
|
||||
import { ApiTags, ApiOperation } from '@nestjs/swagger'
|
||||
|
||||
@ApiTags('Payos')
|
||||
@Controller('payos')
|
||||
@@ -23,13 +23,13 @@ export class PayosController {
|
||||
@Body() body: any,
|
||||
@Headers('x-payos-signature') signature: string,
|
||||
) {
|
||||
return this.payosService.webhook(body, signature);
|
||||
return this.payosService.webhook(body, signature)
|
||||
}
|
||||
|
||||
// ping webhook
|
||||
@Get('webhook')
|
||||
@ApiOperation({ summary: 'Ping webhook' })
|
||||
async ping() {
|
||||
return this.payosService.ping();
|
||||
return this.payosService.ping()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { PayosController } from './payos.controller';
|
||||
import { PayosService } from './payos.service';
|
||||
import { Module } from '@nestjs/common'
|
||||
import { PayosController } from './payos.controller'
|
||||
import { PayosService } from './payos.service'
|
||||
|
||||
@Module({
|
||||
providers: [PayosService],
|
||||
|
||||
@@ -1,29 +1,29 @@
|
||||
import { Injectable, Logger } from '@nestjs/common';
|
||||
import { Injectable, Logger } from '@nestjs/common'
|
||||
|
||||
import { PrismaService } from '../Prisma/prisma.service';
|
||||
import { PrismaService } from '../Prisma/prisma.service'
|
||||
|
||||
@Injectable()
|
||||
export class PayosService {
|
||||
constructor(private readonly prisma: PrismaService) {}
|
||||
|
||||
async ping() {
|
||||
return 'pong';
|
||||
return 'pong'
|
||||
}
|
||||
|
||||
async webhook(body: any, signature: string) {
|
||||
Logger.log('Webhook received', body);
|
||||
return body;
|
||||
Logger.log('Webhook received', body)
|
||||
return body
|
||||
}
|
||||
|
||||
async createPaymentURL(body: any) {
|
||||
return body;
|
||||
return body
|
||||
}
|
||||
|
||||
async cancelPaymentURL(body: any) {
|
||||
return body;
|
||||
return body
|
||||
}
|
||||
|
||||
async refundPayment(body: any) {
|
||||
return body;
|
||||
return body
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user