update payment
This commit is contained in:
@@ -1,10 +1,19 @@
|
||||
import { Injectable, Logger } from '@nestjs/common'
|
||||
import { Inject, Injectable, Logger } from '@nestjs/common'
|
||||
|
||||
import { PrismaService } from '../Prisma/prisma.service'
|
||||
|
||||
import PayOS from '@payos/node'
|
||||
import type {
|
||||
CheckoutRequestType,
|
||||
CheckoutResponseDataType,
|
||||
} from '@payos/node/lib/type'
|
||||
export type CreatePaymentBody = CheckoutRequestType
|
||||
export type CreatePaymentResponse = CheckoutResponseDataType
|
||||
@Injectable()
|
||||
export class PayosService {
|
||||
constructor(private readonly prisma: PrismaService) {}
|
||||
constructor(
|
||||
private readonly prisma: PrismaService,
|
||||
@Inject('PayOS') private readonly payos: PayOS,
|
||||
) {}
|
||||
|
||||
async ping() {
|
||||
return 'pong'
|
||||
@@ -16,7 +25,15 @@ export class PayosService {
|
||||
}
|
||||
|
||||
async createPaymentURL(body: any) {
|
||||
return body
|
||||
return await this.payos.createPaymentLink(body)
|
||||
}
|
||||
|
||||
async createPayment(body: CreatePaymentBody): Promise<CreatePaymentResponse> {
|
||||
return await this.payos.createPaymentLink(body)
|
||||
}
|
||||
|
||||
async getPaymentStatus(orderId: string | number) {
|
||||
return await this.payos.getPaymentLinkInformation(orderId)
|
||||
}
|
||||
|
||||
async cancelPaymentURL(body: any) {
|
||||
|
||||
Reference in New Issue
Block a user