import type { RecordRequest, RefundRequest } from '../payments/PaymentRequest'; import type { CapCancelResponse, CapTodayResponse, RecordResponse, RefundCancelResponse, RefundResponse } from '../payments/PaymentResponse'; import { BaseService } from './BaseService'; /** * 交易管理服務 * * 提供交易相關的 API 方法,包括退款、請款、取消等操作。 */ export declare class TransactionService extends BaseService { /** * 退款 * * 對已完成的交易進行退款,支援全額或部分退款。 * * @param recTradeId - TapPay 交易 ID * @param options - 退款選項(金額為可選,若未指定則為全額退款) * @returns Promise 解析為退款回應 * @throws {TapPayValidationError} 當交易 ID 無效或金額格式不正確時 * @throws {TapPayError} 當 API 回應錯誤時 * @throws {TapPayTimeoutError} 當請求超時時 * * @example * ```typescript * // 全額退款 * await transactionService.refund('D20231201123456789') * * // 部分退款 * await transactionService.refund('D20231201123456789', { amount: 50 }) * ``` */ refund(recTradeId: string, options?: Omit): Promise; /** * 取消退款 * * 在銀行批次處理前取消待處理的退款。 * 目前僅支援台新銀行。 * * @param recTradeId - TapPay 交易 ID * @param refundId - 要取消的退款 ID * @returns Promise 解析為取消退款回應 * @throws {TapPayValidationError} 當交易 ID 或退款 ID 無效時 * @throws {TapPayError} 當 API 回應錯誤時 * @throws {TapPayTimeoutError} 當請求超時時 * * @example * ```typescript * await transactionService.cancelRefund('D20231201123456789', 'R20231201123456789') * ``` */ cancelRefund(recTradeId: string, refundId: string): Promise; /** * 立即請款(當日) * * 立即請款交易(當日)。 * 用於將延遲請款交易的請款日期改為當日。 * * @param recTradeId - TapPay 交易 ID * @returns Promise 解析為請款回應 * @throws {TapPayValidationError} 當交易 ID 無效時 * @throws {TapPayError} 當 API 回應錯誤時 * @throws {TapPayTimeoutError} 當請求超時時 * * @example * ```typescript * await transactionService.capToday('D20231201123456789') * ``` */ capToday(recTradeId: string): Promise; /** * 取消請款 * * 在銀行批次處理前取消待處理的請款。 * * @param recTradeId - TapPay 交易 ID * @returns Promise 解析為取消請款回應 * @throws {TapPayValidationError} 當交易 ID 無效時 * @throws {TapPayError} 當 API 回應錯誤時 * @throws {TapPayTimeoutError} 當請求超時時 * * @example * ```typescript * await transactionService.cancelCapture('D20231201123456789') * ``` */ cancelCapture(recTradeId: string): Promise; /** * 查詢交易記錄 * * 使用篩選和分頁功能取得交易記錄。 * 時間範圍篩選限制為 90 天。 * * @param options - 查詢選項(篩選、分頁、排序) * @returns Promise 解析為交易記錄回應 * @throws {TapPayError} 當 API 回應錯誤時 * @throws {TapPayTimeoutError} 當請求超時時 * * @example * ```typescript * const records = await transactionService.getRecords({ * records_per_page: 10, * page: 0, * filters: { * rec_trade_id: 'D20231201123456789' * } * }) * ``` */ getRecords(options?: Omit): Promise; /** * 根據 ID 取得單筆交易 * * 便利方法,用於查詢單筆交易記錄。 * * @param recTradeId - TapPay 交易 ID * @returns Promise 解析為交易記錄,如果找不到則返回 null * @throws {TapPayValidationError} 當交易 ID 無效時 * @throws {TapPayError} 當 API 回應錯誤時 * @throws {TapPayTimeoutError} 當請求超時時 * * @example * ```typescript * const record = await transactionService.getTransaction('D20231201123456789') * if (record) { * console.log(`Status: ${record.status}`) * } * ``` */ getTransaction(recTradeId: string): Promise; } //# sourceMappingURL=TransactionService.d.ts.map