import { VNPay } from 'vnpay'; import type { Bank, BuildPaymentUrl, GenerateQrResponse, QueryDr, QueryDrResponse, Refund, ReturnQueryFromVNPay, VerifyIpnCall, VerifyReturnUrl } from 'vnpay'; import type { BuildPaymentUrlOptions, GenerateQrOptions, QueryDrOptions, RefundOptions, VerifyIpnCallOptions, VerifyReturnUrlOptions, VnpayModuleOptions } from './interfaces/'; export declare class VnpayService { private readonly options; private readonly vnpay; constructor(options: VnpayModuleOptions); /** * Sử dụng trực tiếp vnpay instance * * @en Get raw vnpay instance * @returns {VNPay} The raw vnpay instance * * @example * const bankList = await this.vnpayService.instance.getBankList(); * console.log(bankList); */ get instance(): VNPay; /** * Lấy danh sách ngân hàng * @en Get list of banks * @returns {Promise} List of banks */ getBankList(): Promise; /** * Phương thức xây dựng, tạo thành url thanh toán của VNPay * @en Build the payment url * * @param {BuildPaymentUrl} data - Payload that contains the information to build the payment url * @param {BuildPaymentUrlOptions} options - Options * @returns {string} The payment url string * @see https://sandbox.vnpayment.vn/apis/docs/thanh-toan-pay/pay.html#tao-url-thanh-toan */ buildPaymentUrl(data: BuildPaymentUrl, options?: BuildPaymentUrlOptions): string; /** * Phương thức tạo QR thanh toán VNPay (QR Pay). * @en Build VNPay payment QR (QR Pay). * * @param {BuildPaymentUrl} data - Dữ liệu thanh toán (cùng payload cơ bản với buildPaymentUrl) * @param {GenerateQrOptions} options - Tùy chọn (logger, ...) * @returns {Promise} Mã phản hồi, thông báo và nội dung chuỗi QR */ generateQr(data: BuildPaymentUrl, options?: GenerateQrOptions): Promise; /** * Phương thức xác thực tính đúng đắn của các tham số trả về từ VNPay * @en Method to verify the return url from VNPay * * @param {ReturnQueryFromVNPay} query - The object of data return from VNPay * @param {VerifyReturnUrlOptions} options - Options * @returns {VerifyReturnUrl} The return object * @see https://sandbox.vnpayment.vn/apis/docs/thanh-toan-pay/pay.html#code-returnurl */ verifyReturnUrl(data: ReturnQueryFromVNPay, options?: VerifyReturnUrlOptions): Promise; /** * Phương thức xác thực tính đúng đắn của lời gọi ipn từ VNPay * * Sau khi nhận được lời gọi, hệ thống merchant cần xác thực dữ liệu nhận được từ VNPay, kiểm tra đơn hàng có hợp lệ không, kiểm tra số tiền thanh toán có đúng không. * * Sau đó phản hồi lại VNPay kết quả xác thực thông qua các `IpnResponse` * * @en Method to verify the ipn url from VNPay * * After receiving the call, the merchant system needs to verify the data received from VNPay, check if the order is valid, check if the payment amount is correct. * * Then respond to VNPay the verification result through the `IpnResponse` * * @param {ReturnQueryFromVNPay} query The object of data return from VNPay * @param {VerifyIpnCallOptions} options - Options * @returns {VerifyIpnCall} The return object * @see https://sandbox.vnpayment.vn/apis/docs/thanh-toan-pay/pay.html#code-ipn-url */ verifyIpnCall(data: ReturnQueryFromVNPay, options?: VerifyIpnCallOptions): Promise; /** * Đây là API để hệ thống merchant truy vấn kết quả thanh toán của giao dịch tại hệ thống VNPAY. * * @en This is the API for the merchant system to query the payment result of the transaction at the VNPAY system. * * @param {QueryDr} query - The data to query payment result * @param {QueryDrOptions} options - Options * @returns {Promise} The data return from VNPay and after verified * @see https://sandbox.vnpayment.vn/apis/docs/truy-van-hoan-tien/querydr&refund.html#truy-van-ket-qua-thanh-toan-PAY */ queryDr(data: QueryDr, options?: QueryDrOptions): Promise; /** * Đây là API để hệ thống merchant gửi yêu cầu hoàn tiền cho giao dịch qua hệ thống Cổng thanh toán VNPAY. * * @en This is the API for the merchant system to refund the transaction at the VNPAY system. * @param {Refund} data - The data to request refund * @param {RefundOptions} options - Options * @returns The data return from VNPay * @see https://sandbox.vnpayment.vn/apis/docs/truy-van-hoan-tien/querydr&refund.html#hoan-tien-thanh-toan-PAY */ refund(data: Refund, options?: RefundOptions): Promise; }