UNPKG

@afriex/payment-batches

Version:

Bulk payouts to bank accounts and mobile money wallets with the Afriex Business API

97 lines • 4.09 kB
import { HttpClient } from "@afriex/core"; import { PaymentBatch, PaymentBatchRequest, PaymentBatchListParams, PaymentBatchListResponse, PaymentBatchRecipientRequest, UpdatePaymentBatchRecipientRequest, SavedPaymentBatchRecipient, PaymentBatchRecipientListResponse, PaymentBatchOutcomes, WithdrawPaymentBatchParams, PaymentBatchSessionListResponse } from "./types.js"; export declare class PaymentBatchService { private httpClient; constructor(httpClient: HttpClient); /** * List payment batches with pagination * GET /payment-batch */ list(params?: PaymentBatchListParams): Promise<PaymentBatchListResponse>; /** * Create an empty payment batch * POST /payment-batch * * Add recipients next, then start the payouts with `withdraw()`. */ create(request: PaymentBatchRequest): Promise<PaymentBatch>; /** * Get a payment batch by ID * GET /payment-batch/{batchId} */ get(batchId: string): Promise<PaymentBatch>; /** * Update a payment batch * PATCH /payment-batch/{batchId} * * The batch is replaced whole: send the name and the funding method, even * when only one of them changes. */ update(batchId: string, request: PaymentBatchRequest): Promise<PaymentBatch>; /** * Delete a payment batch * DELETE /payment-batch/{batchId} */ delete(batchId: string): Promise<void>; /** * List the recipients in a batch * GET /payment-batch/{batchId}/recipients */ listRecipients(batchId: string, params?: PaymentBatchListParams): Promise<PaymentBatchRecipientListResponse>; /** * Add one recipient to a batch * POST /payment-batch/{batchId}/recipients * * The returned `id` is the saved account's id, not the recipient's id in * the batch. Read the `recipientId` from `listRecipients()` to update or * remove the recipient. */ addRecipient(batchId: string, recipient: PaymentBatchRecipientRequest): Promise<SavedPaymentBatchRecipient>; /** * Add several recipients to a batch * POST /payment-batch/{batchId}/recipients/bulk * * Each recipient is added independently, so the call succeeds even when * some of them fail. Both outcome maps are keyed by account number. */ addRecipients(batchId: string, recipients: PaymentBatchRecipientRequest[]): Promise<PaymentBatchOutcomes>; /** * Update a recipient in a batch * PATCH /payment-batch/{batchId}/recipients/{recipientId} * * The recipient is replaced whole: send its account details and amount, * even when only one of them changes. Pass `paymentMethodId` to update the * saved account in place. */ updateRecipient(batchId: string, recipientId: string, request: UpdatePaymentBatchRecipientRequest): Promise<SavedPaymentBatchRecipient>; /** * Remove a recipient from a batch * DELETE /payment-batch/{batchId}/recipients/{recipientId} * * Removes the recipient from this batch only. The saved account is kept. */ removeRecipient(batchId: string, recipientId: string): Promise<void>; /** * Start the payouts for a batch * POST /payment-batch/{batchId}/withdraw * * Every call is a new run and pays every recipient again. To retry only the * payouts that failed, pass the `sessionId` of the run to retry. The * outcomes are keyed by `recipientId`, and a payout that was accepted still * settles asynchronously. */ withdraw(batchId: string, params?: WithdrawPaymentBatchParams): Promise<PaymentBatchOutcomes>; /** * List the runs of a batch * GET /payment-batch/{batchId}/sessions */ listSessions(batchId: string, params?: PaymentBatchListParams): Promise<PaymentBatchSessionListResponse>; private requireBatchId; private requireRecipientId; private validateBatchRequest; /** * As on a payment method, UPI and INTERAC recipients take no institution. */ private validateRecipient; } //# sourceMappingURL=PaymentBatchService.d.ts.map