UNPKG

@tutorbot/payment-interface

Version:

Payment API Library for Tutor Platform

86 lines (85 loc) 2.33 kB
import { AxiosInstance } from 'axios/index'; import BaseInterface from './base'; import { PaymentStatusesEnum } from '../enums/payment-statuses.enum'; interface ArcaPaymentDetailsInterface { Amount: number; ApprovedAmount: number; DepositedAmount: number; RefundedAmount: number; ResponseCode: string; ApprovalCode?: string; CardNumber?: string; ClientName?: string; ClientEmail?: string; Currency?: string; DateTime?: string; Description?: string; MDOrderID?: string; MerchantId?: string; TerminalId?: string; OrderID?: string; PaymentState?: string; PaymentType?: number; PrimaryRC?: string; ExpDate?: string; ProcessingIP?: string; OrderStatus?: string; CardHolderID?: string; BindingID?: string; Opaque?: string; TrxnDescription?: string; rrn?: string; ActionCode?: string; ExchangeRate?: number; } interface ArcaRedirectBackDataInterface { orderID?: string; resposneCode?: string; paymentID?: string; opaque?: string; description?: string; } export default class ArcaInterface extends BaseInterface { languages: string[]; currencies: string[]; testPayAmount: number; apiClient: AxiosInstance; credentials: { clientId?: string; username?: string; password?: string; }; constructor(); protected init(): void; protected productionConfigs(): { baseURL: string; ClientID: string; Username: string; Password: string; }; protected developmentConfigs(): { baseURL: string; ClientID: string; Username: string; Password: string; }; fetchTransactionId(queryParams: { paymentID?: string; }): string; details: () => Promise<{ paymentData: ArcaPaymentDetailsInterface; redirectBackData: ArcaRedirectBackDataInterface; approved?: number; deposited?: number; refunded?: number; paymentStatus?: PaymentStatusesEnum; }>; submit: () => Promise<false | { transaction: string; redirect: string; }>; deposit: (amount: number) => Promise<import("axios").AxiosResponse<any>>; refund: (amount: number) => Promise<boolean>; cancel: () => Promise<boolean>; } export {};