afrimomo-sdk
Version:
A unified SDK for African payment providers
58 lines • 1.77 kB
TypeScript
export interface GenericTransaction {
id: string;
amount: string;
status: string;
timestamp: string;
[key: string]: unknown;
}
export interface GenericPaymentRequest {
amount: string | number;
currency: string;
reference: string;
description?: string;
customerInfo?: {
email?: string;
name?: string;
phone?: string;
[key: string]: unknown;
};
metadata?: Record<string, unknown>;
[key: string]: unknown;
}
export interface GenericPaymentResponse {
success: boolean;
transactionId?: string;
redirectUrl?: string;
message?: string;
[key: string]: unknown;
}
export interface PaymentProviderConfig {
name: string;
baseUrl: string;
authType: "bearer" | "basic" | "none";
authToken?: string;
username?: string;
password?: string;
defaultHeaders?: Record<string, string>;
endpoints: {
createPayment: string;
getTransaction: string;
getBalance?: string;
[key: string]: string | undefined;
};
requestTransformer?: (request: GenericPaymentRequest) => Record<string, unknown>;
responseTransformer?: <T>(response: unknown) => T;
}
export declare class PaymentProviderAdapter {
private readonly network;
private readonly config;
constructor(config: PaymentProviderConfig);
createPayment(request: GenericPaymentRequest): Promise<GenericPaymentResponse>;
getTransaction(transactionId: string): Promise<GenericTransaction | null>;
getBalance(): Promise<{
balance: string;
currency: string;
} | null>;
request<T>(method: "get" | "post" | "put" | "delete", endpoint: string, data?: unknown): Promise<T | null>;
}
//# sourceMappingURL=paymentProvider.d.ts.map