@johntad/m-pesa
Version:
A TypeScript SDK for integrating M-Pesa mobile payment services into applications, enabling seamless money transfers and transactions.
46 lines (45 loc) • 1.38 kB
TypeScript
/**
* Represents the response from the Register URL API.
*/
export type RegisterUrlResponseType = {
responseCode: string;
responseMessage: string;
customerMessage: string;
timestamp: string;
};
/**
* Represents the payload required for the Register URL request.
*/
export type RegisterUrlPayloadType = {
ShortCode: number;
ResponseType: 'Canceled' | 'Completed';
CommandID: 'RegisterURL';
ValidationURL: string;
ConfirmationURL: string;
};
/**
* Represents the response object from the Register URL API.
*/
export declare class RegisterUrlResponse {
responseCode: string;
responseMessage: string;
customerMessage: string;
timestamp: string;
constructor(responseCode: string, responseMessage: string, customerMessage: string, timestamp: string);
/**
* Factory method to create an instance from API response data.
* @param data - The raw response data from the API.
* @returns An instance of RegisterUrlResponse.
*/
static fromApiResponse(data: RegisterUrlResponseType): RegisterUrlResponse;
/**
* Determines if the response indicates success.
* @returns True if the response was successful, false otherwise.
*/
isSuccess(): boolean;
/**
* Returns a formatted string summarizing the response.
* @returns A formatted string.
*/
toString(): string;
}