import { Transaction } from './button'; import type { CountryCode } from './country'; import type { currencyCode } from './currency'; import type { TimeTypes } from './enums'; import type { chargeStatus } from './enums/status'; import type { GatewayResponse } from './gatewayResponse'; export type IPAddress = `${number}.${number}.${number}.${number}`; export interface ChargeRequestBodyBase { intent?: Transaction['intent']; selected_amount?: number; selected_currency?: string; product: string; fee?: number; source: { id: string; }; ipaddress?: IPAddress; authentication?: { id: string; }; } export interface ChargeRequestBody extends ChargeRequestBodyBase { id?: string; amount?: number; currency?: currencyCode; save_card?: boolean; threeDSecure?: boolean; description?: string; hashstring?: string | null; statement_descriptor?: string; customer?: { id?: string; first_name?: string; middle_name?: string; last_name?: string; email?: string; phone?: { country_code: string; number: string; }; }; post?: { url: string; }; redirect?: { url: string; }; merchant?: { id: string; }; order?: { id: string; }; metadata?: { [key: string]: any; }; destinations?: { [key: string]: any; }; receipt?: ChargeReceipt; reference?: ChargeReference; agreement?: ChargeAgreement; subscription?: ChargeSubscription; airline?: ChargeAirline; platform?: { id: string; }; payment_agreement?: { id: string; contract?: { id: string; }; }; [key: string]: any; } export interface ChargeResponseBody { id: string; object: string; live_mode: boolean; api_version: string; method: string; status: chargeStatus; amount: number; currency: currencyCode; threeDSecure: boolean; card_threeDSecure: boolean; save_card: boolean; merchant_id: string; product: string; transaction: { timezone: string; created: string; url: string; expiry: { period: number; type: TimeTypes; }; asynchronous: boolean; amount: number; currency: currencyCode; order: { reference: string; store_url: string; }; }; response: { code: string; message: string; }; receipt: { email: boolean; sms: boolean; }; customer: { id?: string; first_name: string; middle_name?: string; last_name: string; email: string; phone: { country_code: string; number: string; }; }; merchant: { country: CountryCode; currency: currencyCode; id: string; }; source: { object: string; id: string; }; redirect: { status: chargeStatus; url: string; }; post: { status: chargeStatus; }; activities: [ { id: string; object: string; created: number; status: chargeStatus; currency: currencyCode; amount: number; remarks: string; } ]; authenticate: { id: string; object: string; type: string; value: string; by: string; status: string; created: string; count: number; retry_attempt: number; message: string; }; auto_reversed: boolean; gateway_response: GatewayResponse; } interface ChargeReceipt { sms: boolean; email: boolean; } interface ChargeReference { order?: string; transaction?: string; } interface ChargeAgreement { type: 'SCHEDULED' | 'UNSCHEDULED'; amount_variability?: 'FIXED' | 'VARIABLE'; } interface ChargeSubscription extends ChargeAgreement { txn_count?: number; } interface ChargeAirline { reference: { booking: string; }; } export {};