import { IApiResponseObject } from '../interfaces/responses/ApiResponse'; import { CheckoutConfig } from '../interfaces/CheckoutConfig'; import { ITransactionEnquiry } from '../interfaces/responses/TransactionEnquiry'; import { ICancelTransaction } from '../interfaces/responses/cancelTransaction'; /** * Represents transaction data. * @interface */ export interface ITransactionData { command: string; transaction_id?: string; nimbbl_error_code?: string; nimbbl_consumer_message?: string; nimbbl_merchant_message?: string; cancellation_reason?: string; } /** * Represents order data. * @interface */ export interface IOrderData { order_level: number; closed_reason: string; checkout_id: string; } /** * Represents properties required to get transaction information. * Either transaction_id or order_id (or both) must be provided. * @interface */ export interface IGetTransactionProps { transaction_id?: string; order_id?: string; } /** * Transaction class to handle transaction-related operations. * @class */ declare class Transaction { private config; /** * Constructor for the Transaction class. * @constructor * @param {TransactionConfig} config - The transaction configuration. */ constructor(config: typeof CheckoutConfig); /** * Gets the transaction status. * @async * @function * @param {IGetTransactionProps} params - The parameters for getting transaction status. Either transaction_id or order_id (or both) must be provided. * @returns {Promise>} The transaction status response. * @throws Will throw an error if neither transaction_id nor order_id is provided. */ getTransactionStatus: (params?: IGetTransactionProps) => Promise>; /** * Cancels a transaction. * @async * @function * @param {ITransactionData} params - The parameters for canceling the transaction. * @returns {Promise} The cancel transaction response. * @throws Will throw an error if the authentication token is missing or if the command is not provided. */ cancelTransaction: (params: ITransactionData) => Promise>; } export default Transaction;