Spaces:
Sleeping
Sleeping
// payment.controller.ts | |
import { Controller, Post, Body, Req, Res, Get } from '@nestjs/common'; | |
import { PaymentService } from './payment.service.js'; | |
import { Request, Response } from 'express'; | |
import { Public } from '../modules/authentication/authentication.decorator.js'; | |
import { CreatePaymentUrlDto } from './dto/create-payment-url.dto.js'; | |
'payment') | (|
export class PaymentController { | |
constructor(private readonly paymentService: PaymentService) {} | |
() | |
'create_payment_url') | (|
async createPaymentUrl() { () req: Request, () body: CreatePaymentUrlDto | |
const ipAddr = | |
req.headers['x-forwarded-for'] || | |
req.socket.remoteAddress || | |
req.socket?.remoteAddress; | |
return await this.paymentService.createPaymentUrl( | |
body.amount, | |
body.orderId, | |
body.orderDescription, | |
body.orderType, | |
body.language, | |
ipAddr as string, | |
); | |
} | |
() | |
'vnpay_ipn') | (|
async vnpayIpn(any){ () req: Request, () body: | |
const reqQuery = req.query; | |
const res = await this.paymentService.vnpayIpn(reqQuery) | |
console.log(res); | |
return res; | |
} | |
} | |