/** * Provider-facing capability interfaces and their shared input/output types. * * Two optional sub-interfaces extend the core `PaymentProviderAdapter`: * * - `BankUtilitiesAdapter` — bank list/search and transfer limits * - `ProviderTreasuryAdapter` — provider wallet balance, wallet management, * transfer status polling, fee estimation, and transfer history * * All amounts are in **major units** (e.g. NGN, not kobo). These types * represent raw provider snapshots, not SDK ledger entries. * * `BankInfo.code` is **provider-scoped**: codes from `pay.banks.list("100pay")` * must only be used with `pay.payouts.createRecipient({ provider: "100pay", … })`. * Never mix codes across providers. */ /** A single bank entry returned by the provider. */ export interface BankInfo { /** Bank code used in payout recipient creation — provider-scoped. */ code: string; /** Display name, e.g. "Guaranty Trust Bank". */ name: string; /** Abbreviated name if available. */ shortName?: string; /** ISO 3166-1 alpha-2 country code, e.g. "NG". */ country?: string; /** Primary currency, e.g. "NGN". */ currency?: string; /** Bank type: "commercial" | "microfinance" | "mobile_money" | etc. */ type?: string; /** Whether the bank currently accepts transfers. */ active?: boolean; /** Unmodified provider response for audit and adapter-specific access. */ raw?: unknown; } export interface ListBanksOptions { country?: string; currency?: string; } export interface SearchBanksOptions { country?: string; currency?: string; } export interface GetTransferLimitsOptions { /** Filter by currency. Future provider compatibility — 100Pay ignores this. */ currency?: string; } /** Transfer limits returned by the provider. All amounts in major units. */ export interface TransferLimits { currency: string; singleMin?: number; singleMax?: number; dailyMax?: number; /** Per-verification-tier limits, if the provider supports tiers. */ tiers?: Array<{ tier: string; singleMin: number; singleMax: number; dailyMax?: number; }>; raw?: unknown; } /** * Optional adapter interface for providers that support bank list/search. * `HundredPayAdapter` implements this. Future: Paystack, Flutterwave adapters. */ export interface BankUtilitiesAdapter { /** List all banks supported by the provider for bank transfers. */ listBanks?(options?: ListBanksOptions): Promise; /** Search banks by name or code fragment. */ searchBanks?(query: string, options?: SearchBanksOptions): Promise; /** Get transfer limits (per-tier if applicable). */ getTransferLimits?(options?: GetTransferLimitsOptions): Promise; } /** Balance snapshot for a single currency/symbol held at the provider. Major units. */ export interface ProviderBalance { symbol: string; /** Spendable now. */ available: number; /** In-flight credits/debits. */ pending: number; /** Fully confirmed credits. */ settled: number; walletType?: string; accountType?: string; /** Present when `targetCurrency` was requested in options. */ convertedAmount?: number; convertedCurrency?: string; raw?: unknown; } export interface GetProviderBalanceOptions { /** Filter to a single currency symbol, e.g. "NGN". */ symbol?: string; /** Convert all balance amounts to this currency. */ targetCurrency?: string; /** Comma-separated wallet types, e.g. "local,crypto". */ walletType?: string; accountType?: string; } /** A wallet registered with the provider. Major units. */ export interface ProviderWallet { id: string; symbol: string; name?: string; walletType?: string; accountType?: string; status?: string; available?: number; pending?: number; settled?: number; raw?: unknown; } export interface ListProviderWalletsOptions { symbol?: string; walletType?: string; accountType?: string; status?: string; page?: number; limit?: number; } export interface CreateProviderWalletInput { /** Currency/asset symbol to create a wallet for. */ symbol: string; /** Blockchain network for crypto wallets. */ network?: string; accountType?: string; label?: string; } export type ProviderTransferStatusValue = "pending" | "success" | "failed" | "processing"; export type ProviderTransferType = "internal" | "external" | "bank"; /** Status of an async provider transfer (e.g. bank payout). Major units. */ export interface ProviderTransferStatus { sessionId: string; status: ProviderTransferStatusValue; amount?: number; currency?: string; /** Provider's internal hash — useful for reconciliation. */ transactionHash?: string; failureReason?: string; raw?: unknown; } /** Estimated fee for a transfer before initiating it. Major units. */ export interface ProviderTransferFee { symbol: string; transferType: ProviderTransferType; fee: number; currency: string; raw?: unknown; } /** A single entry from the provider's transfer history. Major units. */ export interface ProviderTransfer { id?: string; walletAccountId?: string; symbol: string; amount: number; direction: "debit" | "credit"; status: string; reference?: string; description?: string; createdAt?: Date; raw?: unknown; } export interface GetTransferHistoryOptions { symbols?: string[]; accountIds?: string[]; direction?: "debit" | "credit"; page?: number; limit?: number; } /** Input for pre-flighting an asset transfer without moving funds. */ export interface ValidateProviderTransferInput { /** Amount in major units (e.g. 50.00 USDT). */ amount: number; /** Asset symbol to transfer (e.g. "USDT", "NGN"). */ symbol: string; /** "internal" = between 100Pay users (zero fee); "external" = blockchain/bank. */ transferType: ProviderTransferType; /** * Recipient identifier. * - internal: recipient's PayID (6-digit referral code). * - external: blockchain wallet address. * Optional — some providers validate without a recipient. */ to?: string; /** Enable multi-wallet waterfall mode (draw from multiple wallets in priority order). */ multiWallet?: boolean; /** Priority order of symbols to draw from in waterfall mode. */ walletOrder?: string[]; /** Symbols eligible for the waterfall. Overrides provider default when set. */ wallets?: string[]; /** Minimum balance floor per symbol — funds below the floor are excluded from waterfall. */ minBalances?: Record; } export interface ValidateProviderTransferRecipient { payId?: string; businessName?: string | null; appName?: string | null; walletId?: string; symbol?: string; walletStatus?: string; raw?: unknown; } export interface ValidateProviderTransferResult { valid: boolean; symbol: string; transferType: ProviderTransferType; /** Transfer amount (major units, fee excluded). */ transferAmount: number; /** Estimated provider fee (major units). */ fee: number; /** Total debited from sender (transferAmount + fee, major units). */ totalAmount: number; currentBalance?: number; remainingBalance?: number; recipient?: ValidateProviderTransferRecipient; /** Waterfall breakdown — populated when multiWallet=true. */ withdrawalAnalysis?: unknown; raw?: unknown; } /** Input for executing an asset transfer. */ export interface TransferAssetInput { /** Amount in major units. */ amount: number; /** Asset symbol to transfer (e.g. "USDT", "NGN"). */ symbol: string; /** Recipient identifier (PayID for internal, wallet address for external). */ to: string; /** Sender wallet address. Omit to let the provider pick the primary wallet. */ from?: string; /** "internal" = between 100Pay users (zero fee); "external" = blockchain/bank. */ transferType: ProviderTransferType; /** * "crypto" = debit a blockchain/crypto wallet. * "local" = debit a fiat/local currency wallet (e.g. NGN). * Provider-specific — only needed for providers that distinguish wallet types. */ walletType?: "crypto" | "local"; /** Optional memo visible to sender and recipient. */ note?: string; /** Enable multi-wallet waterfall mode. */ multiWallet?: boolean; /** Priority order of symbols in waterfall mode. */ walletOrder?: string[]; /** Symbols eligible for the waterfall. */ wallets?: string[]; /** Minimum balance floor per symbol. */ minBalances?: Record; } export interface TransferAssetResult { /** Provider-assigned transaction ID. */ transactionId?: string; timestamp?: Date; multiWallet?: boolean; /** Provider receipt / confirmation object. */ receipt?: unknown; /** Waterfall breakdown — populated when multiWallet=true. */ withdrawalAnalysis?: unknown; raw?: unknown; } /** * Optional adapter interface for providers that expose treasury/wallet management. * `HundredPayAdapter` implements this. */ export interface ProviderTreasuryAdapter { /** Get the platform's wallet balances at the provider (major units). */ getProviderBalance?(options?: GetProviderBalanceOptions): Promise; /** List the platform's wallets registered with the provider. */ listProviderWallets?(options?: ListProviderWalletsOptions): Promise; /** Create a new wallet at the provider. */ createProviderWallet?(input: CreateProviderWalletInput): Promise; /** Poll the status of an async bank transfer by its provider session ID. */ getTransferStatus?(sessionId: string): Promise; /** Estimate the fee for a transfer before initiating it. */ getTransferFee?(symbol: string, transferType: ProviderTransferType): Promise; /** Fetch the provider's transfer history for reconciliation. */ getTransferHistory?(options?: GetTransferHistoryOptions): Promise; /** * Dry-run validation of an asset transfer. Checks balance sufficiency, calculates * fees, and optionally validates the recipient — without moving any funds. * Use before `transferAsset` to show users a fee preview. */ validateTransfer?(input: ValidateProviderTransferInput): Promise; /** * Execute an asset transfer. Run `validateTransfer` first to preview fees. * Returns the provider's transaction ID and receipt. */ transferAsset?(input: TransferAssetInput): Promise; } //# sourceMappingURL=provider-types.d.ts.map