pawapay-nodejs-sdk
Version:
Unofficial Node.js SDK for the PawaPay Merchant API v2. Simplify Mobile Money integrations (Deposits, Payouts, Refunds, status checks, provider prediction) with this type-safe TypeScript client.
179 lines (178 loc) • 5.28 kB
TypeScript
export interface PawaPayConfig {
apiToken: string;
baseUrl: 'sandbox' | 'production' | string;
}
export interface PawaPayMetadataField {
[key: string]: string | boolean | undefined;
isPII?: boolean;
}
export type PawaPayFinalStatus = 'COMPLETED' | 'FAILED';
export type PawaPaySearchStatus = 'ACCEPTED' | 'PROCESSING' | 'IN_RECONCILIATION' | PawaPayFinalStatus;
export type PawaPayInitiationStatus = 'ACCEPTED' | 'REJECTED' | 'DUPLICATE_IGNORED';
export interface PawaPayFailureReason {
failureCode: string;
failureMessage: string;
}
export interface PawaPayMmoAccountDetails {
phoneNumber: string;
provider: string;
}
export interface PawaPayMmoParty {
type: 'MMO';
accountDetails: PawaPayMmoAccountDetails;
}
export interface PawaPayDepositPayload {
depositId?: string;
payer: PawaPayMmoParty;
amount: string;
currency: string;
preAuthorisationCode?: string;
clientReferenceId?: string;
customerMessage?: string;
metadata?: PawaPayMetadataField[];
}
export interface PawaPayDepositResponse {
depositId: string;
status: PawaPayInitiationStatus;
created: string;
failureReason?: PawaPayFailureReason;
}
export interface PawaPayDepositDetails {
depositId: string;
status: PawaPaySearchStatus;
amount: string;
currency: string;
country: string;
payer: PawaPayMmoParty;
customerMessage?: string;
clientReferenceId?: string;
created: string;
providerTransactionId?: string;
failureReason?: PawaPayFailureReason;
metadata?: Record<string, string>;
}
export interface PawaPayDepositSearchResult {
status: 'FOUND' | 'NOT_FOUND';
data?: PawaPayDepositDetails;
}
export interface PawaPayPayoutPayload {
payoutId?: string;
recipient: PawaPayMmoParty;
amount: string;
currency: string;
clientReferenceId?: string;
customerMessage?: string;
metadata?: PawaPayMetadataField[];
}
export interface PawaPayPayoutResponse {
payoutId: string;
status: PawaPayInitiationStatus;
created: string;
failureReason?: PawaPayFailureReason;
}
export type PawaPayPayoutSearchStatus = 'ACCEPTED' | 'ENQUEUED' | 'PROCESSING' | 'IN_RECONCILIATION' | PawaPayFinalStatus;
export interface PawaPayPayoutDetails {
payoutId: string;
status: PawaPayPayoutSearchStatus;
amount: string;
currency: string;
country: string;
recipient: PawaPayMmoParty;
customerMessage?: string;
clientReferenceId?: string;
created: string;
providerTransactionId?: string;
failureReason?: PawaPayFailureReason;
metadata?: Record<string, string>;
}
export interface PawaPayPayoutSearchResult {
status: 'FOUND' | 'NOT_FOUND';
data?: PawaPayPayoutDetails;
}
export interface PawaPayCancelEnqueuedPayoutResponse {
payoutId: string;
status: 'ACCEPTED' | 'REJECTED';
failureReason?: PawaPayFailureReason;
}
export interface PawaPayRefundPayload {
refundId?: string;
depositId: string;
amount: string;
currency: string;
clientReferenceId?: string;
metadata?: PawaPayMetadataField[];
}
export interface PawaPayRefundResponse {
refundId: string;
status: PawaPayInitiationStatus;
created: string;
failureReason?: PawaPayFailureReason;
}
export type PawaPayRefundSearchStatus = 'ACCEPTED' | 'ENQUEUED' | 'PROCESSING' | 'IN_RECONCILIATION' | PawaPayFinalStatus;
export interface PawaPayRefundDetails {
refundId: string;
status: PawaPayRefundSearchStatus;
amount: string;
currency: string;
country: string;
customerMessage?: string;
clientReferenceId?: string;
created: string;
providerTransactionId?: string;
failureReason?: PawaPayFailureReason;
metadata?: Record<string, string>;
}
export interface PawaPayRefundSearchResult {
status: 'FOUND' | 'NOT_FOUND';
data?: PawaPayRefundDetails;
}
export interface PawaPayCancelEnqueuedRefundResponse {
refundId: string;
status: 'ACCEPTED' | 'REJECTED';
failureReason?: PawaPayFailureReason;
}
export type PawaPayOperationType = 'DEPOSIT' | 'PAYOUT' | 'REMITTANCE' | 'PUSH_DEPOSIT' | 'REFUND' | 'NAME_LOOKUP';
export interface PawaPayActiveConfigurationQuery {
country?: string;
operationType?: PawaPayOperationType;
}
export interface PawaPayProviderConfiguration {
provider: string;
displayName: string;
nameDisplayedToCustomer: string;
logo: string;
currencies: Record<string, unknown>;
}
export interface PawaPayCountryConfiguration {
country: string;
displayName: {
en: string;
fr?: string;
[locale: string]: string | undefined;
};
prefix: string;
flag: string;
providers: PawaPayProviderConfiguration[];
}
export interface PawaPayActiveConfiguration {
companyName: string;
signatureConfiguration: {
signedRequestsOnly: boolean;
signedCallbacks: boolean;
};
countries: PawaPayCountryConfiguration[];
}
export interface PawaPayPredictProviderResponse {
country: string;
provider: string;
phoneNumber: string;
}
export interface PawaPayWalletBalance {
country: string;
balance: string;
currency: string;
provider: string;
}
export interface PawaPayWalletBalancesResponse {
balances: PawaPayWalletBalance[];
}