ecocash
Version: 
Ecocash Javascript SDK
31 lines (30 loc) • 1.1 kB
TypeScript
import { InitPaymentResponse, LookupTransactionResponse, RefundDetails, RefundResponse } from "./interfaces";
declare enum PollStrategies {
    SIMPLE = "simple",
    INTERVAL = "interval",
    BACKOFF = "backoff"
}
interface PollOptions {
    multiplier?: number;
    sleep?: number;
    interval?: number;
}
declare class Ecocash {
    apiKey: string;
    merchant: string;
    baseUrl: string;
    mode: string;
    constructor(apiKey: string, merchant: string, mode?: string);
    setLiveMode(): void;
    getHeaders(): {
        "Content-Type": string;
        "X-API-KEY": string;
        Merchant: string;
    };
    initPayment(phone: string, amount: number, reason: string): Promise<InitPaymentResponse>;
    refundPayment(details: RefundDetails): Promise<RefundResponse>;
    lookupTransaction(reference: string, phone: string): Promise<LookupTransactionResponse>;
    pollTransaction(response: InitPaymentResponse, strategy?: PollStrategies, options?: PollOptions): Promise<LookupTransactionResponse>;
    makeRequest(url: string, method: string, body: any): Promise<any>;
}
export = Ecocash;