import { EncryptionService } from "../services/encryption.service.js"; import { Environment } from "../constants.js"; /** * 所有 NewebPay Logistics 請求的抽象基底類別。 * * @template T - 請求內容的型別。 */ export declare abstract class BaseRequest> { protected merchantId: string; protected hashKey: string; protected hashIV: string; protected content: T; protected abstract requestPath: string; protected encryptionService: EncryptionService; protected environment: Environment; /** * 建立 BaseRequest 實例。 * * @param merchantId - NewebPay 提供的 Merchant ID。 * @param hashKey - NewebPay 提供的 Hash Key。 * @param hashIV - NewebPay 提供的 Hash IV。 * @param encryptionService - 可選的自訂 EncryptionService。 * @param environment - API 環境(測試或正式)。預設為測試環境。 */ constructor(merchantId: string, hashKey: string, hashIV: string, encryptionService?: EncryptionService, environment?: Environment); /** * 驗證請求內容。 * * @throws {ValidationError} 當驗證失敗時。 */ protected abstract validate(): void; /** * 產生請求的 payload。 * * 此方法會驗證內容、加密並產生雜湊。 * * @returns 包含加密資料和雜湊的 payload 物件。 */ getPayload(): Record; /** * 取得請求的完整 URL。 * * @returns API URL。 */ getUrl(): string; /** * 設定 Merchant Trade Number(所有請求共用)。 * * @param tradeNo - 商家的唯一交易編號。 * @returns BaseRequest 實例,支援鏈式呼叫。 */ setMerchantTradeNo(tradeNo: string): this; /** * 設定 Timestamp(所有請求共用)。 * * @param timeStamp - 請求的時間戳記。 * @returns BaseRequest 實例,支援鏈式呼叫。 */ setTimeStamp(timeStamp: string | number): this; }