import { DineroObject } from 'dinero.js'; import { Ref } from '@typegoose/typegoose'; import { Restaurant } from '~backend/business/business.model'; import { RM } from 'rm-api-sdk'; import { Order } from '~backend/order/order.interface'; import { AdjustmentAmount } from '~backend/utils/model'; export declare enum PaymentIssuer { ALIPAY = "ALIPAY", BOOST = "BOOST", GRABPAY = "GRABPAY", MAYBANKQRPAY = "MAYBANKQRPAY", PRESTOPAY = "PRESTOPAY", RAZERPAY = "RAZERPAY", SHOPEEPAY = "SHOPEEPAY", TOUCHNGO = "TOUCHNGO", WECHATPAY = "WECHATPAY", CARD = "CARD", OTHER = "OTHER", FEEDME = "FEEDME", DUITNOW = "DUITNOW", FPX = "FPX", DEBITCARD = "DEBITCARD", CREDITCARD = "CREDITCARD" } export declare enum PaymentGatewayKey { RevenueMonster = "REVENUE_MONSTER", Feedme = "FEEDME", FeedmeMemberCredit = "FEEDME_MEMBER_CREDIT", RazerMerchantService = "RAZER_MERCHANT_SERVICE" } export interface PaymentIdentifier { issuer: PaymentIssuer; variant: string; } export interface PaymentMethod extends PaymentIdentifier { rate: AdjustmentAmount; tPlus: number; } interface RMSChannel { icon: string; label: string; value: string; } export interface CheckoutResponse { gatewayKey: PaymentGatewayKey; checkoutUrl?: string; checkoutId?: string; callbackUrl?: string; vcode?: string; merchantId?: string; amount?: string; currency?: string; returnUrl?: string; notifyUrl?: string; channels?: RMSChannel[]; transactionId?: string; } export interface RevenueMonsterOrder { title: string; detail: string; amount: DineroObject; additionalData: string; currencyType: RM.CurrencyType; } export interface OnTransactionSuccessPayload { method: PaymentMethod; successAt: Date; transactionId: string; gatewayTransactionId: string; result: RM.Response | RM.WebPaymentWebhook; amount?: DineroObject; } export interface Preprocessed { baseAmount: DineroObject; feedmeCharge: DineroObject; deliveryFee: DineroObject; } export declare enum CheckoutType { RM_MOBILE, RM_WEB } export interface GenerateCheckoutUrlPayload { redirectUrl: string; amount: DineroObject; transactionId: string; type: CheckoutType; } export interface PerformScanPayPayload { authCode: string; amount: DineroObject; transactionId: string; } export interface PerformRefundPayload { gatewayTransactionId: string; reason: string; amount: DineroObject; } export interface ValidateOrderPayload { transactionId: string; } export interface PaymentTransactionResponse { method: PaymentMethod | null; updatedAt: Date | null; status: TransactionStatus; transactionId: string | null; gatewayTransactionId: string | null; raw: RM.Response; } export interface PaymentTransactionRefundResponse { successAt: Date | null; success: boolean; gatewayTransactionId: string | null; raw: RM.Response; } export interface PaymentGateway { key: PaymentGatewayKey; createOnlinePay(payload: GenerateCheckoutUrlPayload): Promise; parseMethodFromCallback(payload: any): PaymentMethod; performRefund(payload: PerformRefundPayload): Promise; performScanPay(payload: PerformScanPayPayload): Promise; getPaymentTransactionResponseByTransactionId(payload: ValidateOrderPayload): Promise; } export declare enum TransactionStatus { success = "SUCCESS", pending = "PENDING", failed = "FAILED", refunded = "REFUNDED" } export declare const CompletedTransactionStatus: TransactionStatus[]; export declare const IncompletedTransactionStatus: TransactionStatus[]; export interface PaymentTransaction { id: string; createdAt: Date; method: PaymentMethod | null; gateway: PaymentGatewayKey; amount: DineroObject; restaurant: Ref; callbackAt: Date; callbackResponse: any; gatewayAmount: DineroObject; status: TransactionStatus; order: Ref; refundedAt?: Date; refundResponse?: RM.Response; bill?: string; canSettleAt: Date; settlement?: Ref; gatewayTransactionId: string | null; fee: DineroObject; payout: DineroObject; } export interface BeneficiaryBank { holderName: string; name: string; swiftCode: string; accountNumber: string; } export interface Settlement { id: string; createdAt: Date; beneficiaryBank: BeneficiaryBank; remark?: string; totalAmount: DineroObject; totalFee: DineroObject; totalPayout: DineroObject; restaurant: Ref; } export declare function ePaymentToPosPayment(paymentMethod: PaymentMethod): string; export declare function fullPaymentMethod(): PaymentMethod[]; export declare class GenerateCheckoutUrlPayloadDto { orderId: string; redirectUrl: string; type: CheckoutType; } export interface CreditPayDto { orderId: string; } export declare class PerformRefundPayloadDto { transactionId: string; reason: string; amount: DineroObject; } export declare class PerformScanPayPayloadDto { authCode: string; amount: DineroObject; billId: string; } export declare class ValidateOrderPayloadDto { orderId: string; } export interface CreateOrderTransactionPayload { orderId: string; restaurantId: string; amount: DineroObject; gatewayAmount: DineroObject; } export {};