UNPKG

better-paynow

Version:

Node.JS SDK for Zimbabwe's Leading Payment Gateway, Paynow

93 lines (86 loc) 2.64 kB
type InnBucksInfo = { authorizationcode: string; deep_link_url: string; qr_code: string; expires_at: number; }; declare class InitResponse { success: boolean; hasRedirect: boolean; redirectUrl: string; error: string; pollUrl: string; instructions: string; paynowReference: string; status: string; innbucks_info: InnBucksInfo[]; isInnbucks: boolean; constructor(data: any); } declare class CartItem { title: string; amount: number; quantity: number; constructor(title: string, amount: number, quantity?: number); } declare class Cart { items: CartItem[]; constructor(_items?: CartItem[]); length(): number; add(item: CartItem): number; getTotal(): number; summary(): string; } declare class Payment { reference: string; authEmail: string; cart: Cart; constructor(reference: string, authEmail: string, cart?: Cart); add(title: string, amount: number, quantity?: number): void; info(): string; total(): number; } declare class StatusResponse { reference: string; amount: string; paynowReference: string; pollUrl: string; status: string; error: string; constructor(data: any); paid(): boolean; } declare class Paynow { integrationId: string; integrationKey: string; resultUrl: string; returnUrl: string; constructor(integrationId?: string, integrationKey?: string, resultUrl?: string, returnUrl?: string); send(payment: Payment): Promise<InitResponse>; sendMobile(payment: Payment, phone: string, method: string): Promise<InitResponse>; createPayment(reference: string, authEmail: string): Payment; fail(message: string): Error; init(payment: Payment): Promise<InitResponse | null>; initMobile(payment: Payment, phone: string, method: string): Promise<InitResponse | null>; isValidEmail(emailAddress: string): boolean; parse(response: any): InitResponse | null; generateHash(values: { [key: string]: string; }, integrationKey: String): any; verifyHash(values: { [key: string]: string; }): boolean; parseQuery(queryString: string): { [key: string]: string; }; build(payment: Payment): { [key: string]: string; }; buildMobile(payment: Payment, phone: string, method: string): { [key: string]: string; }; pollTransaction(url: string): Promise<StatusResponse>; parseStatusUpdate(response: any): StatusResponse; validate(payment: Payment): void; } export { Cart, CartItem, InitResponse, type InnBucksInfo, Payment, Paynow, StatusResponse };