///
import { MobileMoneyCheckoutOptions, CheckoutResult, PaymentProvider, RefundOptions, RefundResult, CreditCardCheckoutOptions, MobileMoneyPayoutOptions, PayoutResult, RedirectCheckoutOptions } from "../payment-provider.interface";
import EventEmitter2 from "eventemitter2";
import { PaymentCancelledEvent, PaymentFailedEvent, PaymentSuccessfulEvent } from "../payment-events";
declare class PaydunyaPaymentProvider implements PaymentProvider {
private config;
private api;
private eventEmitter?;
private masterKeySha512Hash;
constructor(config: PaydunyaPaymentProviderConfig);
useEventEmitter(eventEmitter: EventEmitter2): void;
private determineOrangeMoneyApiType;
private buildOrangeMoneyRequest;
checkout(options: MobileMoneyCheckoutOptions | CreditCardCheckoutOptions): Promise;
checkoutMobileMoney(options: MobileMoneyCheckoutOptions): Promise;
checkoutCreditCard(options: CreditCardCheckoutOptions): Promise;
checkoutRedirect(options: RedirectCheckoutOptions): Promise;
refund(options: RefundOptions): Promise;
payoutMobileMoney(options: MobileMoneyPayoutOptions): Promise;
handleWebhook(rawBody: Buffer | string | Record): Promise;
}
export type PaydunyaPaymentProviderConfig = {
masterKey: string;
privateKey: string;
publicKey: string;
token: string;
mode: "test" | "live";
store: {
name: string;
};
callbackUrl: string;
};
export type PaydunyaCreateInvoiceSuccessResponse = {
response_code: "00";
response_text: string;
description: string;
token: string;
};
export type PaydunyaCreateInvoiceErrorResponse = {
response_code: Exclude;
response_text: string;
};
export type PaydunyaWavePaymentSuccessResponse = {
success: true;
message: string;
url: string;
};
export type PaydunyaWavePaymentErrorResponse = {
success: false | undefined;
message: string;
};
export type PaydunyaOrangeMoneyApiType = "OTPCODE" | "QRCODE";
export type PaydunyaOrangeMoneyCodeOtpRequest = {
customer_name: string;
customer_email: string;
phone_number: string;
authorization_code: string;
invoice_token: string;
api_type: "OTPCODE";
};
export type PaydunyaOrangeMoneyQrCodeRequest = {
customer_name: string;
customer_email: string;
phone_number: string;
invoice_token: string;
api_type: "QRCODE";
};
export type PaydunyaOrangeMoneyRequest = PaydunyaOrangeMoneyCodeOtpRequest | PaydunyaOrangeMoneyQrCodeRequest;
export type PaydunyaOrangeMoneyPaymentSuccessResponse = {
success: true;
message: string;
fees?: number;
currency?: string;
url?: string;
other_url?: {
om_url?: string;
maxit_url?: string;
};
};
export type PaydunyaOrangeMoneyPaymentErrorResponse = {
success: false | undefined;
message: string;
};
export type PaydunyaPaymentWebhookBody = {
response_code: string;
response_text: string;
hash: string;
invoice: PaydunyaInvoice;
custom_data: Record;
actions: {
cancel_url: string;
callback_url: string;
return_url: string;
};
mode: string;
status: string;
fail_reason: string;
customer: {
name: string;
phone: string;
email: string;
payment_method: string;
};
receipt_identifier: string;
receipt_url: string;
provider_reference: string;
};
export type PaydunyaInvoice = {
token: string;
pal_is_on: string;
total_amount: string;
total_amount_without_fees: string;
description: string;
expire_date: string;
};
export type PaydunyaGetInvoiceSuccessResponse = {
response_code: "00";
response_text: string;
hash: string;
invoice: PaydunyaInvoice;
custom_data: Record;
actions: {
cancel_url: string;
callback_url: string;
return_url: string;
};
mode: string;
status: string;
fail_reason: string;
customer: {
name: string;
phone: string;
email: string;
payment_method: string;
};
receipt_url: string;
};
export type PaydunyaGetInvoiceErrorResponse = {
response_code: Exclude;
response_text: string;
};
export type PaydunyaCreateDisburseInvoiceSuccessResponse = {
response_code: "00";
response_text?: never;
disburse_token: string;
};
export type PaydunyaCreateDisburseInvoiceErrorResponse = {
response_code: Exclude;
response_text: string;
};
export type PaydunyaSubmitDisburseInvoiceSuccessResponse = {
response_code: "00";
response_text: string;
description: string;
transaction_id: string;
provider_ref?: string;
};
export type PaydunyaSubmitDisburseInvoiceErrorResponse = {
response_code: Exclude;
response_text: string;
};
export default PaydunyaPaymentProvider;
//# sourceMappingURL=paydunya.d.ts.map