UNPKG

@johntad/m-pesa

Version:

A TypeScript SDK for integrating M-Pesa mobile payment services into applications, enabling seamless money transfers and transactions.

63 lines (62 loc) 1.78 kB
import { StkPushResponseType } from "../models/StkPushResponse"; export declare class MPesaError extends Error { name: string; constructor(message: string, name?: string); } export declare class AuthenticationError extends MPesaError { code: string; constructor(message: string, code: string); } export declare class StkPushError extends MPesaError { data: StkPushResponseType; constructor(message: string, data: StkPushResponseType); /** * Returns a formatted error message including details from the response. * @returns A detailed error message. */ getDetails(): string; } /** * Represents an error from the B2C Pay Out API. */ export declare class B2CError extends MPesaError { data: { requestId: string; errorCode: string; errorMessage: string; }; constructor(message: string, data: { requestId: string; errorCode: string; errorMessage: string; }); /** * Returns a formatted error message including details from the response. * @returns A detailed error message. */ getDetails(): string; } /** * Represents an error from the Register URL API. */ export declare class RegisterUrlError extends MPesaError { data: { responseCode: string; responseMessage: string; customerMessage: string; timestamp: string; }; constructor(message: string, data: { responseCode: string; responseMessage: string; customerMessage: string; timestamp: string; }); /** * Returns a formatted error message including details from the response. * @returns A detailed error message. */ getDetails(): string; } export declare class ApiError extends MPesaError { }