@waffo/waffo-node 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.ja.md +580 -0
- package/README.md +580 -0
- package/README.zh-CN.md +580 -0
- package/dist/index.d.mts +4639 -0
- package/dist/index.d.ts +4639 -0
- package/dist/index.js +1795 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1750 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +76 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/types/config.ts","../src/types/network.ts","../src/types/webhook.ts","../src/types/iso.ts","../src/types/payment.ts","../src/types/order.ts","../src/types/refund.ts","../src/types/subscription.ts","../src/utils/rsa.ts","../src/utils/webhook.ts","../src/core/httpClient.ts","../src/core/webhook.ts","../src/resources/base.ts","../src/resources/order/resource.ts","../src/resources/refund/resource.ts","../src/resources/subscription/resource.ts","../src/resources/merchantconfig/resource.ts","../src/resources/paymethodconfig/resource.ts","../src/core/waffo.ts"],"names":["Environment","HttpStatusCode","WebhookEventType","WebhookResponseStatus","CountryCode","CurrencyCode","ProductName","SubscriptionProductName","UserTerminalType","OrderStatus","OrderActionType","PayMethodUserAccountType","CaptureMode","MerchantInitiatedMode","ThreeDsDecision","RefundStatus","SubscriptionStatus","PeriodType","SubscriptionUserTerminalType","CashierLanguage","SubscriptionPayMethodUserAccountType","SubscriptionOrderStatus","SubscriptionEventType","body"],"mappings":";;;AAsDO,IAAK,WAAA,qBAAAA,YAAAA,KAAL;AAEL,EAAAA,aAAA,SAAA,CAAA,GAAU,SAAA;AAEV,EAAAA,aAAA,YAAA,CAAA,GAAa,YAAA;AAJH,EAAA,OAAAA,YAAAA;AAAA,CAAA,EAAA,WAAA,IAAA,EAAA;AAkBL,IAAM,eAAA,GAA+C;AAAA,EAC1D,CAAC,0BAAsB,sCAAA;AAAA,EACvB,CAAC,gCAAyB;AAC5B;AAYO,IAAM,qB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ACpE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgCA,OAAO,eAAA,GAA2B;AAChC,IAAA,MAAM,OAAO,aAAA,EAAc;AAC3B,IAAA,OAAO;AAAA,MACL,YAAY,IAAA,CAAK,gBAAA;AAAA,MACjB,WAAW,IAAA,CAAK;AAAA,KAClB;AAAA,EACF;AACF","file":"index.mjs","sourcesContent":["/**\n * @fileoverview SDK Configuration Type Definitions\n * @module types/config\n *\n * Configuration types for the Waffo SDK:\n * - Environment settings (SANDBOX/PRODUCTION)\n * - SDK initialization configuration\n * - HTTP request options\n *\n * @see {@link Waffo} for SDK initialization\n * @see {@link HttpClient} for making API requests\n *\n * @example\n * import { Environment, WaffoConfig } from 'waffo-sdk';\n *\n * const config: WaffoConfig = {\n * apiKey: 'your-api-key',\n * privateKey: 'your-private-key',\n * environment: Environment.SANDBOX,\n * };\n */\n\nimport { Logger } from \"./logger\";\n\n// ============================================================\n// Environment Configuration\n// ============================================================\n\n/**\n * SDK runtime environment.\n *\n * - **SANDBOX**: Development and testing (no real transactions)\n * - **PRODUCTION**: Live transactions with real payments\n *\n * @enum {string}\n * @readonly\n *\n * @example\n * import { Environment } from 'waffo-sdk';\n *\n * // Use sandbox for testing\n * const waffo = new Waffo({\n * apiKey: 'test-key',\n * privateKey: 'test-private-key',\n * environment: Environment.SANDBOX,\n * });\n *\n * // Use production for live payments\n * const waffoProd = new Waffo({\n * apiKey: process.env.WAFFO_API_KEY,\n * privateKey: process.env.WAFFO_PRIVATE_KEY,\n * environment: Environment.PRODUCTION,\n * });\n */\nexport enum Environment {\n /** Sandbox testing environment */\n SANDBOX = \"sandbox\",\n /** Production environment for live transactions */\n PRODUCTION = \"production\",\n}\n\n/**\n * Maps environments to their API base URLs.\n *\n * | Environment | Base URL |\n * |-------------|----------|\n * | SANDBOX | https://api-sandbox.waffo.com/api/v1 |\n * | PRODUCTION | https://api.waffo.com/api/v1 |\n *\n * @constant\n * @type {Record<Environment, string>}\n */\nexport const EnvironmentUrls: Record<Environment, string> = {\n [Environment.SANDBOX]: \"https://api-sandbox.waffo.com/api/v1\",\n [Environment.PRODUCTION]: \"https://api.waffo.com/api/v1\",\n};\n\n/**\n * Maps environments to Waffo's RSA public keys.\n *\n * Used to verify API response signatures. Keys are Base64 encoded X509/SPKI DER format.\n * These are embedded in the SDK and updated when Waffo rotates their keys.\n *\n * @constant\n * @type {Record<Environment, string>}\n * @remarks To use a custom public key, provide it via the `waffoPublicKey` config option.\n */\nexport const EnvironmentPublicKeys: Record<Environment, string> = {\n [Environment.SANDBOX]:\n \"MIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAhAbK3dBDZdCaX/5cqlO8EYYL4M4DyigqAMoIaT6R0SuSENu279dHZ3JiS8JukHx/xg85T9S3wDNwnu8KDypcwi8TxNQKgBE4czgAJ5GFEdJ+jtUS1dK46gjJFUnUlavb3uMLJJ0xZZKH0B5GtKOq75MwHWtXLK3zQrPqZosXqdgZhfbV+7bXlQaABdPlqif/ybN1DRrvcWmNVLAgsRiQvu4QnDOTMafzrSsF5tf8Ud3gK+JhcJs50NsXLPZZSc6NryZoH++xmz8atp0dOrBKmsJkZRWjrH+aXDZZT1sZDlgsKBMoRPf6F+lztFOPerrhSE81Y5MFaAp8R/QicMGCPueLhlebjx1OF0oowUD9b7ggZ8LiYpaR4HT9OmDpsu6NMN7zNG81qo7vnKCyy//xdOkpr4bQsm581r312y1UUjaYTZTlqAe+qbGZmZ7zS+ra0uwS6zLoZOY1ToOwlJbTwRPx2epweJcRnJVueiS1fPxaAlQz+tuVtIGONmZ836aHAgMBAAE=\",\n [Environment.PRODUCTION]:\n \"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqVHKdn76r6IhRXxWihdy+AiG0tzVR8LjDXC+0WFdTkn05Ga7ZS0WC3MRpxgRsbBWDlEVZYPUBdrtAmQeZYD7rwKSKSTdd62eZxehDI8DCzNhxppbeMPBhMn72eQvB/RQl1qhP7HLZx9IyTC7EbWWO0zhhomzf0hQ2K7KXDFq9bSYdBGAzSg+kOQFP2eifON8qm4TuwlxNSdTcgRWa8cRwy9h9aLra1iaeFRx9k68KxIcK0ZiGbD6KiR1a2NtZuxjB6bTJ7N/ydfKqQY+wB1CTWIlvouW1qajYYGBAcde9JN6o6CiWz3sPt42312CF3+k+gQeiuofdXkzVlMryVivfwIDAQAB\",\n};\n\n// ============================================================\n// SDK Configuration\n// ============================================================\n\n/**\n * Configuration for initializing the Waffo SDK.\n *\n * **Required:**\n * - `apiKey` - Your API key from Waffo\n * - `privateKey` - Your merchant private key for signing requests\n *\n * **Optional:**\n * - `waffoPublicKey` - Override the built-in Waffo public key\n * - `environment` - API environment (defaults to PRODUCTION)\n * - `timeout` - Request timeout in milliseconds (defaults to 30000)\n * - `logger` - Logger instance for debugging\n *\n * @interface WaffoConfig\n *\n * @example\n * const config: WaffoConfig = {\n * apiKey: process.env.WAFFO_API_KEY!,\n * privateKey: process.env.WAFFO_PRIVATE_KEY!,\n * environment: Environment.PRODUCTION,\n * timeout: 60000,\n * logger: console,\n * };\n *\n * @see {@link Waffo} for SDK initialization\n * @see {@link Environment} for available environments\n */\nexport interface WaffoConfig {\n /** API key assigned by Waffo (required) */\n apiKey: string;\n /** Merchant private key, Base64 encoded PKCS8 DER format (required) */\n privateKey: string;\n /** Waffo's public key for response verification (defaults to built-in) */\n waffoPublicKey?: string;\n /** SDK runtime environment (defaults to PRODUCTION) */\n environment?: Environment;\n /** HTTP request timeout in milliseconds (defaults to 30000) */\n timeout?: number;\n /** Logger instance for debugging */\n logger?: Logger;\n}\n\n/**\n * Options for individual HTTP requests.\n *\n * Used when calling {@link HttpClient.post} directly.\n *\n * @interface RequestOptions\n * @template B - Request body type (defaults to `Record<string, unknown>`)\n *\n * @example\n * const options: RequestOptions<CreateOrderParams> = {\n * body: { paymentRequestId: '123', ... },\n * headers: { 'X-Custom-Header': 'value' },\n * };\n *\n * @see {@link HttpClient.post} for making HTTP requests\n */\nexport interface RequestOptions<B extends object = Record<string, unknown>> {\n /** Request body (will be JSON serialized and signed) */\n body?: B;\n /** Additional HTTP headers to include */\n headers?: Record<string, string>;\n}\n","/**\n * @fileoverview Common Network Type Definitions\n * @module types/network\n *\n * Common network-related types shared across HTTP client and webhook handling:\n * - HTTP status codes\n * - Signature header interface\n */\n\n// ============================================================\n// HTTP Status Codes\n// ============================================================\n\n/**\n * Standard HTTP status codes used in API responses.\n *\n * @enum {number}\n * @readonly\n *\n * @example\n * if (result.statusCode === HttpStatusCode.OK) {\n * console.log('Request successful');\n * } else if (result.statusCode === HttpStatusCode.REQUEST_TIMEOUT) {\n * console.log('Request timed out');\n * }\n */\nexport enum HttpStatusCode {\n OK = 200,\n BAD_REQUEST = 400,\n UNAUTHORIZED = 401,\n PAYMENT_REQUIRED = 402,\n FORBIDDEN = 403,\n NOT_FOUND = 404,\n METHOD_NOT_ALLOWED = 405,\n REQUEST_TIMEOUT = 408,\n INTERNAL_SERVER_ERROR = 500,\n NOT_IMPLEMENTED = 501,\n BAD_GATEWAY = 502,\n SERVICE_UNAVAILABLE = 503,\n GATEWAY_TIMEOUT = 504,\n}\n\n// ============================================================\n// Common Header Types\n// ============================================================\n\n/**\n * Common header structure containing RSA-SHA256 signature.\n *\n * Used in API responses and webhook requests/responses.\n *\n * @interface SignatureHeader\n */\nexport interface SignatureHeader {\n /** RSA-SHA256 signature (Base64 encoded) */\n \"X-SIGNATURE\": string;\n /** MIME type (typically \"application/json\") */\n \"Content-Type\": string;\n}\n","/**\n * @fileoverview Webhook Type Definitions\n * @module types/webhook\n *\n * Types for processing webhook notifications:\n * - Event types and response status enums\n * - Request/Response interfaces\n * - Handler types for processing notifications\n *\n * @see {@link WebhookHandler} for processing webhooks\n *\n * @example\n * import {\n * WebhookEventType,\n * WebhookResponseStatus,\n * WebhookHandlerOptions,\n * } from 'waffo-sdk';\n *\n * const options: WebhookHandlerOptions = {\n * onPayment: async (ctx) => {\n * console.log('Event:', ctx.eventType);\n * console.log('Notification:', ctx.notification);\n * },\n * };\n */\n\nimport { SignatureHeader } from \"./network\";\nimport { PaymentNotification } from \"./order\";\nimport { RefundNotification } from \"./refund\";\nimport {\n SubscriptionStatusNotification,\n SubscriptionPaymentNotification,\n} from \"./subscription\";\n\n// ============================================================\n// Webhook Enums\n// ============================================================\n\n/**\n * Type of webhook notification from Waffo.\n *\n * @enum {string}\n * @readonly\n */\nexport enum WebhookEventType {\n /** Payment order status change */\n PAYMENT_NOTIFICATION = \"PAYMENT_NOTIFICATION\",\n /** Refund status change */\n REFUND_NOTIFICATION = \"REFUND_NOTIFICATION\",\n /** Subscription status change */\n SUBSCRIPTION_STATUS_NOTIFICATION = \"SUBSCRIPTION_STATUS_NOTIFICATION\",\n}\n\n/**\n * Merchant webhook response status.\n *\n * - **SUCCESS**: Waffo stops retrying\n * - **FAILED/UNKNOWN**: Waffo retries within 24 hours\n *\n * @enum {string}\n * @readonly\n *\n * @example\n * // Return SUCCESS to acknowledge receipt\n * const response = buildWebhookResponse(WebhookResponseStatus.SUCCESS, privateKey);\n *\n * // Return FAILED to request retry\n * const response = buildWebhookResponse(WebhookResponseStatus.FAILED, privateKey);\n */\nexport enum WebhookResponseStatus {\n /** Successfully processed, no retry needed */\n SUCCESS = \"success\",\n /** Processing failed, Waffo will retry */\n FAILED = \"failed\",\n /** Unknown status, Waffo will retry */\n UNKNOWN = \"unknown\",\n}\n\n// ============================================================\n// Webhook Request/Response Types\n// ============================================================\n\n/**\n * Webhook request headers from Waffo.\n * @interface WebhookRequestHeader\n */\nexport interface WebhookRequestHeader {\n /** RSA-SHA256 signature for verification */\n \"X-SIGNATURE\": string;\n /** Optional MIME type */\n \"Content-Type\"?: string;\n}\n\n/**\n * Webhook response headers to send back to Waffo.\n * @type WebhookResponseHeader\n */\nexport type WebhookResponseHeader = SignatureHeader;\n\n/**\n * Webhook response body to send back to Waffo.\n * @interface WebhookResponseBody\n */\nexport interface WebhookResponseBody {\n /** Response status message */\n message: WebhookResponseStatus | string;\n}\n\n/**\n * Complete webhook response structure.\n *\n * @interface WebhookResponse\n *\n * @example\n * const response: WebhookResponse = buildSuccessResponse(privateKey);\n * res.set(response.header).json(response.body);\n */\nexport interface WebhookResponse {\n /** Response headers (includes X-SIGNATURE) */\n header: WebhookResponseHeader;\n /** Response body (includes status message) */\n body: WebhookResponseBody;\n}\n\n// ============================================================\n// Webhook Handler Types\n// ============================================================\n\n/**\n * Context passed to webhook handlers.\n *\n * @interface WebhookHandlerContext\n * @template T - The notification type\n *\n * @example\n * const handler: PaymentNotificationHandler = async (ctx) => {\n * console.log('Event type:', ctx.eventType);\n * console.log('Raw body:', ctx.rawBody);\n * console.log('Order status:', ctx.notification.result.orderStatus);\n * };\n */\nexport interface WebhookHandlerContext<T> {\n /** Parsed notification payload */\n notification: T;\n /** Original raw request body (for logging/debugging) */\n rawBody: string;\n /** Webhook event type */\n eventType: WebhookEventType;\n}\n\n/**\n * Handler for payment notifications.\n * @param context - Context with PaymentNotification\n */\nexport type PaymentNotificationHandler = (\n context: WebhookHandlerContext<PaymentNotification>,\n) => void | Promise<void>;\n\n/**\n * Handler for refund notifications.\n * @param context - Context with RefundNotification\n */\nexport type RefundNotificationHandler = (\n context: WebhookHandlerContext<RefundNotification>,\n) => void | Promise<void>;\n\n/**\n * Handler for subscription status notifications.\n * @param context - Context with SubscriptionStatusNotification\n */\nexport type SubscriptionStatusNotificationHandler = (\n context: WebhookHandlerContext<SubscriptionStatusNotification>,\n) => void | Promise<void>;\n\n/**\n * Handler for subscription payment notifications.\n * @param context - Context with SubscriptionPaymentNotification\n */\nexport type SubscriptionPaymentNotificationHandler = (\n context: WebhookHandlerContext<SubscriptionPaymentNotification>,\n) => void | Promise<void>;\n\n/**\n * Handler for webhook processing errors.\n * @param error - The error that occurred\n */\nexport type WebhookErrorHandler = (error: Error) => void | Promise<void>;\n\n/**\n * Options for configuring webhook handlers.\n *\n * @interface WebhookHandlerOptions\n *\n * @example\n * const options: WebhookHandlerOptions = {\n * onPayment: async (ctx) => {\n * await updateOrder(ctx.notification.result);\n * },\n * onRefund: async (ctx) => {\n * await processRefund(ctx.notification.result);\n * },\n * onSubscriptionStatus: async (ctx) => {\n * await updateSubscription(ctx.notification.result);\n * },\n * onSubscriptionPayment: async (ctx) => {\n * await recordPayment(ctx.notification.result);\n * },\n * onError: async (error) => {\n * console.error('Webhook error:', error);\n * },\n * };\n */\nexport interface WebhookHandlerOptions {\n /** Handler for payment notifications */\n onPayment?: PaymentNotificationHandler;\n /** Handler for refund notifications */\n onRefund?: RefundNotificationHandler;\n /** Handler for subscription status changes */\n onSubscriptionStatus?: SubscriptionStatusNotificationHandler;\n /** Handler for subscription recurring payments */\n onSubscriptionPayment?: SubscriptionPaymentNotificationHandler;\n /** Handler for processing errors */\n onError?: WebhookErrorHandler;\n}\n\n/**\n * Result from webhook handler.\n *\n * @interface WebhookHandlerResult\n *\n * @example\n * const result = await waffo.webhook.handle(body, signature, options);\n * if (result.success) {\n * res.set(result.response.header).json(result.response.body);\n * } else {\n * console.error('Webhook failed:', result.error);\n * res.set(result.response.header).json(result.response.body);\n * }\n */\nexport interface WebhookHandlerResult {\n /** Whether processing was successful */\n success: boolean;\n /** Signed response to send back to Waffo */\n response: WebhookResponse;\n /** Error message (only on failure) */\n error?: string;\n}\n","/**\n * @fileoverview ISO Standard Code Definitions\n * @module types/iso\n *\n * @description\n * This module contains ISO standard codes used throughout the SDK:\n *\n * - **{@link CountryCode}** - ISO 3166-1 alpha-3 country codes (e.g., USA, JPN, CHN)\n * - **{@link CurrencyCode}** - ISO 4217 currency codes (e.g., USD, JPY, EUR)\n *\n * These codes ensure international compatibility and standardization\n * for order creation, address information, and payment processing.\n *\n * @example\n * // Using country codes for user address\n * import { CountryCode, CurrencyCode } from 'waffo-sdk-nodejs';\n *\n * const orderParams = {\n * orderAmount: '1000',\n * orderCurrency: CurrencyCode.JPY,\n * userInfo: {\n * userCountry: CountryCode.JPN,\n * },\n * addressInfo: {\n * country: CountryCode.JPN,\n * city: 'Tokyo',\n * },\n * };\n *\n * @example\n * // Multi-currency support\n * const supportedCurrencies = [\n * CurrencyCode.USD,\n * CurrencyCode.EUR,\n * CurrencyCode.JPY,\n * CurrencyCode.GBP,\n * ];\n *\n * @see {@link CreateOrderParams} for order creation parameters\n * @see {@link AddressInfo} for address information structure\n */\n\n// ============================================================\n// Country Codes (ISO 3166-1 alpha-3)\n// ============================================================\n\n/**\n * ISO 3166-1 alpha-3 country codes.\n *\n * @description\n * Three-letter country codes following the ISO 3166-1 standard.\n * Use these codes for specifying user country and address information\n * in order creation and payment processing.\n *\n * Common codes:\n * - `USA` - United States of America\n * - `JPN` - Japan\n * - `CHN` - China\n * - `GBR` - United Kingdom\n * - `DEU` - Germany\n *\n * @example\n * // Specify user's country\n * const userInfo = {\n * userCountry: CountryCode.JPN,\n * userName: 'Taro Yamada',\n * };\n *\n * @example\n * // Specify shipping address country\n * const addressInfo = {\n * country: CountryCode.USA,\n * state: 'CA',\n * city: 'San Francisco',\n * address1: '123 Main St',\n * zipCode: '94102',\n * };\n *\n * @enum {string}\n * @readonly\n * @see https://www.iso.org/iso-3166-country-codes.html\n */\nexport enum CountryCode {\n AFG = \"AFG\", // Afghanistan\n ALB = \"ALB\", // Albania\n DZA = \"DZA\", // Algeria\n ASM = \"ASM\", // American Samoa\n AND = \"AND\", // Andorra\n AGO = \"AGO\", // Angola\n AIA = \"AIA\", // Anguilla\n ATA = \"ATA\", // Antarctica\n ATG = \"ATG\", // Antigua and Barbuda\n ARG = \"ARG\", // Argentina\n ARM = \"ARM\", // Armenia\n ABW = \"ABW\", // Aruba\n AUS = \"AUS\", // Australia\n AUT = \"AUT\", // Austria\n AZE = \"AZE\", // Azerbaijan\n BHS = \"BHS\", // Bahamas\n BHR = \"BHR\", // Bahrain\n BGD = \"BGD\", // Bangladesh\n BRB = \"BRB\", // Barbados\n BLR = \"BLR\", // Belarus\n BEL = \"BEL\", // Belgium\n BLZ = \"BLZ\", // Belize\n BEN = \"BEN\", // Benin\n BMU = \"BMU\", // Bermuda\n BTN = \"BTN\", // Bhutan\n BOL = \"BOL\", // Bolivia\n BES = \"BES\", // Bonaire, Sint Eustatius and Saba\n BIH = \"BIH\", // Bosnia and Herzegovina\n BWA = \"BWA\", // Botswana\n BVT = \"BVT\", // Bouvet Island\n BRA = \"BRA\", // Brazil\n IOT = \"IOT\", // British Indian Ocean Territory\n BRN = \"BRN\", // Brunei Darussalam\n BGR = \"BGR\", // Bulgaria\n BFA = \"BFA\", // Burkina Faso\n BDI = \"BDI\", // Burundi\n CPV = \"CPV\", // Cabo Verde\n KHM = \"KHM\", // Cambodia\n CMR = \"CMR\", // Cameroon\n CAN = \"CAN\", // Canada\n CYM = \"CYM\", // Cayman Islands\n CAF = \"CAF\", // Central African Republic\n TCD = \"TCD\", // Chad\n CHL = \"CHL\", // Chile\n CHN = \"CHN\", // China\n CXR = \"CXR\", // Christmas Island\n CCK = \"CCK\", // Cocos (Keeling) Islands\n COL = \"COL\", // Colombia\n COM = \"COM\", // Comoros\n COD = \"COD\", // Congo (Democratic Republic)\n COG = \"COG\", // Congo\n COK = \"COK\", // Cook Islands\n CRI = \"CRI\", // Costa Rica\n HRV = \"HRV\", // Croatia\n CUB = \"CUB\", // Cuba\n CUW = \"CUW\", // Curaçao\n CYP = \"CYP\", // Cyprus\n CZE = \"CZE\", // Czechia\n CIV = \"CIV\", // Côte d'Ivoire\n DNK = \"DNK\", // Denmark\n DJI = \"DJI\", // Djibouti\n DMA = \"DMA\", // Dominica\n DOM = \"DOM\", // Dominican Republic\n ECU = \"ECU\", // Ecuador\n EGY = \"EGY\", // Egypt\n SLV = \"SLV\", // El Salvador\n GNQ = \"GNQ\", // Equatorial Guinea\n ERI = \"ERI\", // Eritrea\n EST = \"EST\", // Estonia\n SWZ = \"SWZ\", // Eswatini\n ETH = \"ETH\", // Ethiopia\n FLK = \"FLK\", // Falkland Islands\n FRO = \"FRO\", // Faroe Islands\n FJI = \"FJI\", // Fiji\n FIN = \"FIN\", // Finland\n FRA = \"FRA\", // France\n GUF = \"GUF\", // French Guiana\n PYF = \"PYF\", // French Polynesia\n ATF = \"ATF\", // French Southern Territories\n GAB = \"GAB\", // Gabon\n GMB = \"GMB\", // Gambia\n GEO = \"GEO\", // Georgia\n DEU = \"DEU\", // Germany\n GHA = \"GHA\", // Ghana\n GIB = \"GIB\", // Gibraltar\n GRC = \"GRC\", // Greece\n GRL = \"GRL\", // Greenland\n GRD = \"GRD\", // Grenada\n GLP = \"GLP\", // Guadeloupe\n GUM = \"GUM\", // Guam\n GTM = \"GTM\", // Guatemala\n GGY = \"GGY\", // Guernsey\n GIN = \"GIN\", // Guinea\n GNB = \"GNB\", // Guinea-Bissau\n GUY = \"GUY\", // Guyana\n HTI = \"HTI\", // Haiti\n HMD = \"HMD\", // Heard Island and McDonald Islands\n VAT = \"VAT\", // Holy See\n HND = \"HND\", // Honduras\n HKG = \"HKG\", // Hong Kong\n HUN = \"HUN\", // Hungary\n ISL = \"ISL\", // Iceland\n IND = \"IND\", // India\n IDN = \"IDN\", // Indonesia\n IRN = \"IRN\", // Iran\n IRQ = \"IRQ\", // Iraq\n IRL = \"IRL\", // Ireland\n IMN = \"IMN\", // Isle of Man\n ISR = \"ISR\", // Israel\n ITA = \"ITA\", // Italy\n JAM = \"JAM\", // Jamaica\n JPN = \"JPN\", // Japan\n JEY = \"JEY\", // Jersey\n JOR = \"JOR\", // Jordan\n KAZ = \"KAZ\", // Kazakhstan\n KEN = \"KEN\", // Kenya\n KIR = \"KIR\", // Kiribati\n PRK = \"PRK\", // Korea (Democratic People's Republic)\n KOR = \"KOR\", // Korea (Republic)\n KWT = \"KWT\", // Kuwait\n KGZ = \"KGZ\", // Kyrgyzstan\n LAO = \"LAO\", // Lao People's Democratic Republic\n LVA = \"LVA\", // Latvia\n LBN = \"LBN\", // Lebanon\n LSO = \"LSO\", // Lesotho\n LBR = \"LBR\", // Liberia\n LBY = \"LBY\", // Libya\n LIE = \"LIE\", // Liechtenstein\n LTU = \"LTU\", // Lithuania\n LUX = \"LUX\", // Luxembourg\n MAC = \"MAC\", // Macao\n MDG = \"MDG\", // Madagascar\n MWI = \"MWI\", // Malawi\n MYS = \"MYS\", // Malaysia\n MDV = \"MDV\", // Maldives\n MLI = \"MLI\", // Mali\n MLT = \"MLT\", // Malta\n MHL = \"MHL\", // Marshall Islands\n MTQ = \"MTQ\", // Martinique\n MRT = \"MRT\", // Mauritania\n MUS = \"MUS\", // Mauritius\n MYT = \"MYT\", // Mayotte\n MEX = \"MEX\", // Mexico\n FSM = \"FSM\", // Micronesia\n MDA = \"MDA\", // Moldova\n MCO = \"MCO\", // Monaco\n MNG = \"MNG\", // Mongolia\n MNE = \"MNE\", // Montenegro\n MSR = \"MSR\", // Montserrat\n MAR = \"MAR\", // Morocco\n MOZ = \"MOZ\", // Mozambique\n MMR = \"MMR\", // Myanmar\n NAM = \"NAM\", // Namibia\n NRU = \"NRU\", // Nauru\n NPL = \"NPL\", // Nepal\n NLD = \"NLD\", // Netherlands\n NCL = \"NCL\", // New Caledonia\n NZL = \"NZL\", // New Zealand\n NIC = \"NIC\", // Nicaragua\n NER = \"NER\", // Niger\n NGA = \"NGA\", // Nigeria\n NIU = \"NIU\", // Niue\n NFK = \"NFK\", // Norfolk Island\n MKD = \"MKD\", // North Macedonia\n MNP = \"MNP\", // Northern Mariana Islands\n NOR = \"NOR\", // Norway\n OMN = \"OMN\", // Oman\n PAK = \"PAK\", // Pakistan\n PLW = \"PLW\", // Palau\n PSE = \"PSE\", // Palestine\n PAN = \"PAN\", // Panama\n PNG = \"PNG\", // Papua New Guinea\n PRY = \"PRY\", // Paraguay\n PER = \"PER\", // Peru\n PHL = \"PHL\", // Philippines\n PCN = \"PCN\", // Pitcairn\n POL = \"POL\", // Poland\n PRT = \"PRT\", // Portugal\n PRI = \"PRI\", // Puerto Rico\n QAT = \"QAT\", // Qatar\n ROU = \"ROU\", // Romania\n RUS = \"RUS\", // Russian Federation\n RWA = \"RWA\", // Rwanda\n REU = \"REU\", // Réunion\n BLM = \"BLM\", // Saint Barthélemy\n SHN = \"SHN\", // Saint Helena, Ascension and Tristan da Cunha\n KNA = \"KNA\", // Saint Kitts and Nevis\n LCA = \"LCA\", // Saint Lucia\n MAF = \"MAF\", // Saint Martin (French part)\n SPM = \"SPM\", // Saint Pierre and Miquelon\n VCT = \"VCT\", // Saint Vincent and the Grenadines\n WSM = \"WSM\", // Samoa\n SMR = \"SMR\", // San Marino\n STP = \"STP\", // Sao Tome and Principe\n SAU = \"SAU\", // Saudi Arabia\n SEN = \"SEN\", // Senegal\n SRB = \"SRB\", // Serbia\n SYC = \"SYC\", // Seychelles\n SLE = \"SLE\", // Sierra Leone\n SGP = \"SGP\", // Singapore\n SXM = \"SXM\", // Sint Maarten (Dutch part)\n SVK = \"SVK\", // Slovakia\n SVN = \"SVN\", // Slovenia\n SLB = \"SLB\", // Solomon Islands\n SOM = \"SOM\", // Somalia\n ZAF = \"ZAF\", // South Africa\n SGS = \"SGS\", // South Georgia and the South Sandwich Islands\n SSD = \"SSD\", // South Sudan\n ESP = \"ESP\", // Spain\n LKA = \"LKA\", // Sri Lanka\n SDN = \"SDN\", // Sudan\n SUR = \"SUR\", // Suriname\n SJM = \"SJM\", // Svalbard and Jan Mayen\n SWE = \"SWE\", // Sweden\n CHE = \"CHE\", // Switzerland\n SYR = \"SYR\", // Syrian Arab Republic\n TWN = \"TWN\", // Taiwan\n TJK = \"TJK\", // Tajikistan\n TZA = \"TZA\", // Tanzania\n THA = \"THA\", // Thailand\n TLS = \"TLS\", // Timor-Leste\n TGO = \"TGO\", // Togo\n TKL = \"TKL\", // Tokelau\n TON = \"TON\", // Tonga\n TTO = \"TTO\", // Trinidad and Tobago\n TUN = \"TUN\", // Tunisia\n TUR = \"TUR\", // Turkey\n TKM = \"TKM\", // Turkmenistan\n TCA = \"TCA\", // Turks and Caicos Islands\n TUV = \"TUV\", // Tuvalu\n UGA = \"UGA\", // Uganda\n UKR = \"UKR\", // Ukraine\n ARE = \"ARE\", // United Arab Emirates\n GBR = \"GBR\", // United Kingdom\n UMI = \"UMI\", // United States Minor Outlying Islands\n USA = \"USA\", // United States of America\n URY = \"URY\", // Uruguay\n UZB = \"UZB\", // Uzbekistan\n VUT = \"VUT\", // Vanuatu\n VEN = \"VEN\", // Venezuela\n VNM = \"VNM\", // Viet Nam\n VGB = \"VGB\", // Virgin Islands (British)\n VIR = \"VIR\", // Virgin Islands (U.S.)\n WLF = \"WLF\", // Wallis and Futuna\n ESH = \"ESH\", // Western Sahara\n YEM = \"YEM\", // Yemen\n ZMB = \"ZMB\", // Zambia\n ZWE = \"ZWE\", // Zimbabwe\n ALA = \"ALA\", // Åland Islands\n}\n\n// ============================================================\n// Currency Codes (ISO 4217)\n// ============================================================\n\n/**\n * ISO 4217 currency codes.\n *\n * @description\n * Three-letter currency codes following the ISO 4217 standard.\n * Use these codes for specifying order amounts and payment currencies.\n *\n * Common codes:\n * - `USD` - United States Dollar\n * - `EUR` - Euro\n * - `JPY` - Japanese Yen\n * - `GBP` - Pound Sterling\n * - `CNY` - Chinese Yuan\n *\n * Note: Currency codes determine the decimal precision for amounts.\n * For example, JPY has no decimal places, while USD has 2.\n *\n * @example\n * // Create an order with Japanese Yen\n * const orderParams = {\n * orderAmount: '1000', // 1000 JPY (no decimals)\n * orderCurrency: CurrencyCode.JPY,\n * };\n *\n * @example\n * // Create an order with US Dollars\n * const orderParams = {\n * orderAmount: '19.99', // $19.99\n * orderCurrency: CurrencyCode.USD,\n * };\n *\n * @example\n * // Validate supported currencies\n * function isSupportedCurrency(code: string): code is CurrencyCode {\n * return Object.values(CurrencyCode).includes(code as CurrencyCode);\n * }\n *\n * @enum {string}\n * @readonly\n * @see https://www.iso.org/iso-4217-currency-codes.html\n */\nexport enum CurrencyCode {\n AED = \"AED\", // United Arab Emirates Dirham\n AFN = \"AFN\", // Afghan Afghani\n ALL = \"ALL\", // Albanian Lek\n AMD = \"AMD\", // Armenian Dram\n ANG = \"ANG\", // Netherlands Antillean Guilder\n AOA = \"AOA\", // Angolan Kwanza\n ARS = \"ARS\", // Argentine Peso\n AUD = \"AUD\", // Australian Dollar\n AWG = \"AWG\", // Aruban Florin\n AZN = \"AZN\", // Azerbaijani Manat\n BAM = \"BAM\", // Bosnia and Herzegovina Convertible Mark\n BBD = \"BBD\", // Barbados Dollar\n BDT = \"BDT\", // Bangladeshi Taka\n BGN = \"BGN\", // Bulgarian Lev\n BHD = \"BHD\", // Bahraini Dinar\n BIF = \"BIF\", // Burundian Franc\n BMD = \"BMD\", // Bermudian Dollar\n BND = \"BND\", // Brunei Dollar\n BOB = \"BOB\", // Boliviano\n BOV = \"BOV\", // Bolivian Mvdol\n BRL = \"BRL\", // Brazilian Real\n BSD = \"BSD\", // Bahamian Dollar\n BTN = \"BTN\", // Bhutanese Ngultrum\n BWP = \"BWP\", // Botswana Pula\n BYN = \"BYN\", // Belarusian Ruble\n BZD = \"BZD\", // Belize Dollar\n CAD = \"CAD\", // Canadian Dollar\n CDF = \"CDF\", // Congolese Franc\n CHE = \"CHE\", // WIR Euro\n CHF = \"CHF\", // Swiss Franc\n CHW = \"CHW\", // WIR Franc\n CLF = \"CLF\", // Unidad de Fomento\n CLP = \"CLP\", // Chilean Peso\n CNY = \"CNY\", // Chinese Yuan\n COP = \"COP\", // Colombian Peso\n COU = \"COU\", // Unidad de Valor Real\n CRC = \"CRC\", // Costa Rican Colon\n CUC = \"CUC\", // Cuban Convertible Peso\n CUP = \"CUP\", // Cuban Peso\n CVE = \"CVE\", // Cape Verdean Escudo\n CZK = \"CZK\", // Czech Koruna\n DJF = \"DJF\", // Djiboutian Franc\n DKK = \"DKK\", // Danish Krone\n DOP = \"DOP\", // Dominican Peso\n DZD = \"DZD\", // Algerian Dinar\n EGP = \"EGP\", // Egyptian Pound\n ERN = \"ERN\", // Eritrean Nakfa\n ETB = \"ETB\", // Ethiopian Birr\n EUR = \"EUR\", // Euro\n FJD = \"FJD\", // Fiji Dollar\n FKP = \"FKP\", // Falkland Islands Pound\n GBP = \"GBP\", // Pound Sterling\n GEL = \"GEL\", // Georgian Lari\n GHS = \"GHS\", // Ghanaian Cedi\n GIP = \"GIP\", // Gibraltar Pound\n GMD = \"GMD\", // Gambian Dalasi\n GNF = \"GNF\", // Guinean Franc\n GTQ = \"GTQ\", // Guatemalan Quetzal\n GYD = \"GYD\", // Guyanese Dollar\n HKD = \"HKD\", // Hong Kong Dollar\n HNL = \"HNL\", // Honduran Lempira\n HRK = \"HRK\", // Croatian Kuna\n HTG = \"HTG\", // Haitian Gourde\n HUF = \"HUF\", // Hungarian Forint\n IDR = \"IDR\", // Indonesian Rupiah\n ILS = \"ILS\", // Israeli New Shekel\n INR = \"INR\", // Indian Rupee\n IQD = \"IQD\", // Iraqi Dinar\n IRR = \"IRR\", // Iranian Rial\n ISK = \"ISK\", // Icelandic Króna\n JMD = \"JMD\", // Jamaican Dollar\n JOD = \"JOD\", // Jordanian Dinar\n JPY = \"JPY\", // Japanese Yen\n KES = \"KES\", // Kenyan Shilling\n KGS = \"KGS\", // Kyrgyzstani Som\n KHR = \"KHR\", // Cambodian Riel\n KMF = \"KMF\", // Comoro Franc\n KPW = \"KPW\", // North Korean Won\n KRW = \"KRW\", // South Korean Won\n KWD = \"KWD\", // Kuwaiti Dinar\n KYD = \"KYD\", // Cayman Islands Dollar\n KZT = \"KZT\", // Kazakhstani Tenge\n LAK = \"LAK\", // Lao Kip\n LBP = \"LBP\", // Lebanese Pound\n LKR = \"LKR\", // Sri Lankan Rupee\n LRD = \"LRD\", // Liberian Dollar\n LSL = \"LSL\", // Lesotho Loti\n LYD = \"LYD\", // Libyan Dinar\n MAD = \"MAD\", // Moroccan Dirham\n MDL = \"MDL\", // Moldovan Leu\n MGA = \"MGA\", // Malagasy Ariary\n MKD = \"MKD\", // Macedonian Denar\n MMK = \"MMK\", // Myanmar Kyat\n MNT = \"MNT\", // Mongolian Tögrög\n MOP = \"MOP\", // Macanese Pataca\n MRU = \"MRU\", // Mauritanian Ouguiya\n MUR = \"MUR\", // Mauritian Rupee\n MVR = \"MVR\", // Maldivian Rufiyaa\n MWK = \"MWK\", // Malawian Kwacha\n MXN = \"MXN\", // Mexican Peso\n MXV = \"MXV\", // Mexican Unidad de Inversion\n MYR = \"MYR\", // Malaysian Ringgit\n MZN = \"MZN\", // Mozambican Metical\n NAD = \"NAD\", // Namibian Dollar\n NGN = \"NGN\", // Nigerian Naira\n NIO = \"NIO\", // Nicaraguan Córdoba\n NOK = \"NOK\", // Norwegian Krone\n NPR = \"NPR\", // Nepalese Rupee\n NZD = \"NZD\", // New Zealand Dollar\n OMR = \"OMR\", // Omani Rial\n PAB = \"PAB\", // Panamanian Balboa\n PEN = \"PEN\", // Peruvian Sol\n PGK = \"PGK\", // Papua New Guinean Kina\n PHP = \"PHP\", // Philippine Peso\n PKR = \"PKR\", // Pakistani Rupee\n PLN = \"PLN\", // Polish Zloty\n PYG = \"PYG\", // Paraguayan Guarani\n QAR = \"QAR\", // Qatari Riyal\n RON = \"RON\", // Romanian Leu\n RSD = \"RSD\", // Serbian Dinar\n RUB = \"RUB\", // Russian Ruble\n RWF = \"RWF\", // Rwandan Franc\n SAR = \"SAR\", // Saudi Riyal\n SBD = \"SBD\", // Solomon Islands Dollar\n SCR = \"SCR\", // Seychelles Rupee\n SDG = \"SDG\", // Sudanese Pound\n SEK = \"SEK\", // Swedish Krona\n SGD = \"SGD\", // Singapore Dollar\n SHP = \"SHP\", // Saint Helena Pound\n SLE = \"SLE\", // Sierra Leonean Leone\n SLL = \"SLL\", // Sierra Leonean Leone (old)\n SOS = \"SOS\", // Somali Shilling\n SRD = \"SRD\", // Surinamese Dollar\n SSP = \"SSP\", // South Sudanese Pound\n STN = \"STN\", // São Tomé and Príncipe Dobra\n SVC = \"SVC\", // Salvadoran Colón\n SYP = \"SYP\", // Syrian Pound\n SZL = \"SZL\", // Swazi Lilangeni\n THB = \"THB\", // Thai Baht\n TJS = \"TJS\", // Tajikistani Somoni\n TMT = \"TMT\", // Turkmenistan Manat\n TND = \"TND\", // Tunisian Dinar\n TOP = \"TOP\", // Tongan Paʻanga\n TRY = \"TRY\", // Turkish Lira\n TTD = \"TTD\", // Trinidad and Tobago Dollar\n TWD = \"TWD\", // New Taiwan Dollar\n TZS = \"TZS\", // Tanzanian Shilling\n UAH = \"UAH\", // Ukrainian Hryvnia\n UGX = \"UGX\", // Ugandan Shilling\n USD = \"USD\", // United States Dollar\n USN = \"USN\", // United States Dollar (Next day)\n UYI = \"UYI\", // Uruguay Peso en Unidades Indexadas\n UYU = \"UYU\", // Uruguayan Peso\n UYW = \"UYW\", // Unidad Previsional\n UZS = \"UZS\", // Uzbekistan Som\n VED = \"VED\", // Venezuelan Digital Bolívar\n VES = \"VES\", // Venezuelan Sovereign Bolívar\n VND = \"VND\", // Vietnamese Đồng\n VUV = \"VUV\", // Vanuatu Vatu\n WST = \"WST\", // Samoan Tala\n XAF = \"XAF\", // CFA Franc BEAC\n XAG = \"XAG\", // Silver (one troy ounce)\n XAU = \"XAU\", // Gold (one troy ounce)\n XBA = \"XBA\", // European Composite Unit\n XBB = \"XBB\", // European Monetary Unit\n XBC = \"XBC\", // European Unit of Account 9\n XBD = \"XBD\", // European Unit of Account 17\n XCD = \"XCD\", // East Caribbean Dollar\n XDR = \"XDR\", // Special Drawing Rights\n XOF = \"XOF\", // CFA Franc BCEAO\n XPD = \"XPD\", // Palladium (one troy ounce)\n XPF = \"XPF\", // CFP Franc\n XPT = \"XPT\", // Platinum (one troy ounce)\n XSU = \"XSU\", // Sucre\n XTS = \"XTS\", // Code reserved for testing\n XUA = \"XUA\", // ADB Unit of Account\n XXX = \"XXX\", // No currency\n YER = \"YER\", // Yemeni Rial\n ZAR = \"ZAR\", // South African Rand\n ZMW = \"ZMW\", // Zambian Kwacha\n ZWL = \"ZWL\", // Zimbabwean Dollar\n}\n","/**\n * @fileoverview Payment Related Enumeration Definitions\n * @module types/payment\n *\n * Payment-related enumerations shared across Order, Subscription, and Config resources:\n * - **{@link ProductName}** - Payment product types for acquiring API\n * - **{@link SubscriptionProductName}** - Product types for subscription API\n *\n * @see {@link PaymentInfo} for payment configuration\n * @see {@link CreateOrderParams} for order creation\n *\n * @example\n * import { ProductName } from 'waffo-sdk';\n *\n * const paymentInfo = {\n * productName: ProductName.ONE_TIME_PAYMENT,\n * payMethodName: 'DANA',\n * };\n */\n\n// ============================================================\n// Product Name Enums\n// ============================================================\n\n/**\n * Payment product type for acquiring API.\n *\n * @enum {string}\n * @readonly\n *\n * @example\n * paymentInfo: {\n * productName: ProductName.ONE_TIME_PAYMENT,\n * payMethodName: 'DANA',\n * }\n */\nexport enum ProductName {\n /** Standard payment with redirect flow */\n ONE_TIME_PAYMENT = \"ONE_TIME_PAYMENT\",\n /** Payment within mini program environment */\n MINI_PROGRAM_PAYMENT = \"MINI_PROGRAM_PAYMENT\",\n /** Card payment (requires PCI-DSS compliance) */\n DIRECT_PAYMENT = \"DIRECT_PAYMENT\",\n}\n\n/**\n * Payment product type for subscription API.\n *\n * @enum {string}\n * @readonly\n *\n * @example\n * paymentInfo: {\n * productName: SubscriptionProductName.SUBSCRIPTION,\n * payMethodName: 'ALIPAY_HK',\n * }\n */\nexport enum SubscriptionProductName {\n /** Web-based subscription signing */\n SUBSCRIPTION = \"SUBSCRIPTION\",\n /** Subscription within mini program */\n MINI_PROGRAM_SUBSCRIPTION = \"MINI_PROGRAM_SUBSCRIPTION\",\n}\n\n// ============================================================\n// Payment Method Type Constants (Reference)\n// ============================================================\n\n/**\n * Common payment method type values.\n *\n * These are example values for `payMethodType` field (string type).\n * Note: This list may be updated. Please refer to the latest API documentation.\n *\n * Example values:\n * - `\"EWALLET\"` - E-wallet payments (OVO, DANA, GoPay, etc.)\n * - `\"CREDITCARD\"` - Credit/Debit card payments\n * - `\"BANKTRANSFER\"` - Bank transfer / Virtual Account\n * - `\"ONLINE_BANKING\"` - Online banking payments\n * - `\"DIGITAL_BANKING\"` - Digital banking payments\n * - `\"OTC\"` - Over-the-counter payments\n * - `\"DEBITCARD\"` - Debit card payments\n *\n * @example\n * paymentInfo: {\n * payMethodType: 'EWALLET',\n * payMethodName: 'DANA',\n * }\n */\n\n/**\n * Common payment method name values.\n *\n * These are example values for `payMethodName` field (string type).\n * Note: This list may be updated. Please refer to the latest API documentation.\n *\n * Example E-wallets:\n * - `\"OVO\"` - OVO e-wallet (Indonesia)\n * - `\"DANA\"` - DANA e-wallet (Indonesia)\n * - `\"GOPAY\"` - GoPay e-wallet (Indonesia)\n * - `\"SHOPEEPAY\"` - ShopeePay e-wallet (Indonesia)\n * - `\"GCASH\"` - GCash e-wallet (Philippines)\n * - `\"ALIPAY_HK\"` - Alipay Hong Kong\n *\n * Example Credit Cards:\n * - `\"CC_VISA\"` - Visa credit card\n * - `\"CC_MASTERCARD\"` - Mastercard credit card\n *\n * Example Bank Transfer / Virtual Account:\n * - `\"VA_BCA\"` - BCA Virtual Account (Indonesia)\n * - `\"VA_BNI\"` - BNI Virtual Account (Indonesia)\n *\n * @example\n * paymentInfo: {\n * productName: ProductName.ONE_TIME_PAYMENT,\n * payMethodName: 'DANA',\n * }\n */\n","/**\n * @fileoverview Order Resource Type Definitions\n * @module types/order\n *\n * Type definitions for the Order resource (based on Waffo API JSON Schema).\n *\n * **Categories:**\n * - **Enums:** Order status, action types, payment modes\n * - **Request Interfaces:** Parameters for create, inquiry, cancel, refund, capture\n * - **Response Interfaces:** API response data structures\n * - **Webhook Interfaces:** Payment notification structures\n *\n * @see {@link OrderResource} for API methods\n * @see {@link CreateOrderParams} for order creation\n *\n * @example\n * import {\n * CreateOrderParams,\n * OrderStatus,\n * ProductName,\n * UserTerminalType,\n * } from 'waffo-sdk';\n *\n * const params: CreateOrderParams = {\n * paymentRequestId: 'req-123',\n * merchantOrderId: 'order-456',\n * orderCurrency: 'USD',\n * orderAmount: '10.00',\n * // ...\n * };\n */\n\nimport { WebhookEventType, WebhookRequestHeader } from \"./webhook\";\nimport { ProductName } from \"./payment\";\nimport { RiskUserType, RefundUserType } from \"./common\";\n\n// Re-export common types for convenience\nexport { RiskUserType, RefundUserType };\n\n// Re-export common types for convenience\nexport { ProductName };\n\n// ============================================================\n// Enums\n// ============================================================\n\n/**\n * User Terminal Type Enum\n *\n * @description\n * Identifies the terminal environment where the user initiates payment.\n *\n * @enum {string}\n * @readonly\n */\nexport enum UserTerminalType {\n // Web browser\n WEB = \"WEB\",\n // Native app\n APP = \"APP\",\n // Embedded page within wallet app (e.g., inside DANA App)\n IN_WALLET_APP = \"IN_WALLET_APP\",\n // Mini program environment\n IN_MINI_PROGRAM = \"IN_MINI_PROGRAM\",\n}\n\n/**\n * Order Status Enum\n *\n * @description\n * Identifies the current status of an order in the payment process.\n *\n * @enum {string}\n * @readonly\n */\nexport enum OrderStatus {\n // Payment in progress - Order created, waiting for payment channel processing\n PAY_IN_PROGRESS = \"PAY_IN_PROGRESS\",\n // Authorization required - User needs to be redirected to payment page for authorization\n AUTHORIZATION_REQUIRED = \"AUTHORIZATION_REQUIRED\",\n // Authorized waiting capture - In manualCapture mode, user authorized, waiting for merchant to call capture API\n AUTHED_WAITING_CAPTURE = \"AUTHED_WAITING_CAPTURE\",\n // Payment successful - Order payment completed\n PAY_SUCCESS = \"PAY_SUCCESS\",\n // Order closed - Order cancelled or expired\n ORDER_CLOSE = \"ORDER_CLOSE\",\n // Capture in progress - Executing fund capture\n CAPTURE_IN_PROGRESS = \"CAPTURE_IN_PROGRESS\",\n}\n\n/**\n * Order Action Type Enum\n *\n * @description\n * Indicates the redirect method for user to complete payment authorization.\n *\n * @enum {string}\n * @readonly\n */\nexport enum OrderActionType {\n // Web redirect - Use webUrl to open payment page in browser\n WEB = \"WEB\",\n // Deeplink redirect - Use deeplinkUrl to launch wallet app\n DEEPLINK = \"DEEPLINK\",\n}\n\n/**\n * Pay Method User Account Type Enum\n *\n * @description\n * User account type at the designated pay method.\n *\n * @enum {string}\n * @readonly\n */\nexport enum PayMethodUserAccountType {\n // Email account\n EMAIL = \"EMAIL\",\n // Phone number account\n PHONE_NO = \"PHONE_NO\",\n // Account ID\n ACCOUNT_ID = \"ACCOUNT_ID\",\n}\n\n/**\n * Capture Mode Enum\n *\n * @description\n * Capture mode for order payment.\n *\n * @enum {string}\n * @readonly\n */\nexport enum CaptureMode {\n // Manual capture - authorize first then capture later\n MANUAL_CAPTURE = \"manualCapture\",\n}\n\n/**\n * Merchant Initiated Mode Enum\n *\n * @description\n * MIT mode for merchant initiated transactions.\n *\n * @enum {string}\n * @readonly\n */\nexport enum MerchantInitiatedMode {\n // Scheduled MIT\n SCHEDULED = \"scheduled\",\n // Unscheduled MIT\n UNSCHEDULED = \"unscheduled\",\n}\n\n/**\n * 3DS Decision Enum\n *\n * @description\n * Merchant 3DS decision for card payments.\n *\n * @enum {string}\n * @readonly\n */\nexport enum ThreeDsDecision {\n // Force 3DS authentication\n FORCE = \"3DS_FORCE\",\n // Attempt 3DS authentication\n ATTEMPT = \"3DS_ATTEMPT\",\n // No 3DS authentication\n NO_3DS = \"NO_3DS\",\n}\n\n// ============================================================\n// Request Interfaces\n// ============================================================\n\n/**\n * Merchant Information Interface (Request Parameters)\n *\n * @description\n * Used to identify the merchant initiating the request.\n *\n * @interface MerchantInfo\n */\nexport interface MerchantInfo {\n // Merchant ID assigned by Waffo (max 64 characters)\n merchantId: string;\n // Sub-merchant ID assigned by Waffo (max 64 characters)\n subMerchantId?: string;\n}\n\n/**\n * User Information Interface (Request Parameters)\n *\n * @description\n * Basic information of the paying user, used for risk control and user identification.\n *\n * @interface UserInfo\n */\nexport interface UserInfo {\n // Unique user identifier in merchant's system (max 64 characters)\n userId: string;\n // User email address (max 64 characters)\n userEmail: string;\n // User phone number, format: +country code-number (max 16 characters)\n userPhone?: string;\n // Country code of the source of the user request\n userCountryCode?: string;\n // User terminal type: WEB, APP, IN_WALLET_APP, IN_MINI_PROGRAM\n userTerminal: UserTerminalType | string;\n // User first name (max 64 characters)\n userFirstName?: string;\n // User last name (max 64 characters)\n userLastName?: string;\n // User created time (ISO 8601 format, max 24 characters)\n userCreatedAt?: string;\n // User browser IP address (max 128 characters, required for direct card payment)\n userBrowserIp?: string;\n // User browser User-Agent (max 256 characters, required for direct card payment)\n userAgent?: string;\n}\n\n/**\n * Goods Information Interface (Request Parameters)\n *\n * @description\n * Product or service information associated with the order.\n *\n * @interface GoodsInfo\n */\nexport interface GoodsInfo {\n // Product ID in merchant's system (max 32 characters)\n goodsId?: string;\n // Product name, will be displayed on payment page (max 64 characters)\n goodsName: string;\n // Product category (max 32 characters)\n goodsCategory?: string;\n // Product detail page URL (max 128 characters, either this or appName is required)\n goodsUrl?: string;\n // App package name, applicable for virtual goods (max 32 characters, either this or goodsUrl is required)\n appName?: string;\n // SKU name (max 32 characters)\n skuName?: string;\n // Product unique price (max 16 characters)\n goodsUniquePrice?: string;\n // Product quantity\n goodsQuantity?: number | string;\n}\n\n/**\n * Address Information Interface (Request Parameters)\n *\n * @description\n * Shipping address information for the order, used for risk control and logistics.\n *\n * @interface AddressInfo\n */\nexport interface AddressInfo {\n // Detailed shipping address (max 256 characters)\n address?: string;\n // City (max 32 characters)\n city?: string;\n // Region/Province/State (max 32 characters)\n region?: string;\n // Postal code (max 16 characters)\n postcode?: string;\n // Shipping country code (max 16 characters)\n addressCountryCode?: string;\n}\n\n/**\n * Payment Method Properties Interface (Request Parameters)\n *\n * @description\n * Additional properties required for specific payment methods.\n *\n * @interface PayMethodProperties\n */\nexport interface PayMethodProperties {\n // Brazilian tax ID (CPF), required for Brazilian payment methods\n cpf?: string;\n // Card number prefix restriction, used to specify available card BIN range\n cardPrefix?: string;\n // Card prefix purpose\n cardPrefixPurpose?: string;\n // Additional properties\n [key: string]: string | undefined;\n}\n\n/**\n * Cashier Appearance Interface (Request Parameters)\n *\n * @description\n * Cashier UI appearance variables.\n *\n * @interface CashierAppearance\n */\nexport interface CashierAppearance {\n // Appearance variables\n variables?: {\n // Primary color\n colorPrimary?: string;\n // Background color\n colorBackground?: string;\n // Text color\n colorText?: string;\n [key: string]: string | undefined;\n };\n}\n\n/**\n * Card Information Interface (Request Parameters)\n *\n * @description\n * Card information for direct card payment, only applicable for PCI-DSS certified merchants.\n *\n * @interface CardInfo\n * @warning This interface involves sensitive card data, ensure PCI-DSS compliance\n */\nexport interface CardInfo {\n // Card number (max 24 characters)\n cardNumber: string;\n // Card expiry year, 4 digits (max 4 characters, e.g., \"2025\")\n cardExpiryYear: string;\n // Card expiry month, 2 digits (max 2 characters, e.g., \"10\")\n cardExpiryMonth: string;\n // Card CVV (max 4 characters)\n cardCvv: string;\n // Card holder name (max 128 characters)\n cardHolderName: string;\n // 3DS decision indicator: 3DS_FORCE, 3DS_ATTEMPT, NO_3DS\n threeDsDecision?: ThreeDsDecision | string;\n}\n\n/**\n * Payment Information Interface (Request Parameters)\n *\n * @description\n * Specify payment product, method, and mode.\n *\n * @interface PaymentInfo\n */\nexport interface PaymentInfo {\n // Payment product name: ONE_TIME_PAYMENT, MINI_PROGRAM_PAYMENT, DIRECT_PAYMENT\n productName: ProductName | string;\n /**\n * Payment type (max 256 characters)\n * Example values: \"EWALLET\", \"CREDITCARD\", \"BANKTRANSFER\", \"ONLINE_BANKING\", \"DIGITAL_BANKING\", \"OTC\", \"DEBITCARD\"\n * Note: This list may be updated. Please refer to the latest API documentation.\n */\n payMethodType?: string;\n /**\n * Specific payment method (max 24 characters)\n * Example E-wallets: \"OVO\", \"DANA\", \"GOPAY\", \"SHOPEEPAY\", \"GCASH\", \"ALIPAY_HK\"\n * Example Credit Cards: \"CC_VISA\", \"CC_MASTERCARD\"\n * Example Bank Transfer: \"VA_BCA\", \"VA_BNI\"\n * Note: This list may be updated. Please refer to the latest API documentation.\n */\n payMethodName?: string;\n // Payment method country (ISO 3166-1 alpha-3)\n payMethodCountry?: string;\n // Payment method specific properties\n payMethodProperties?: PayMethodProperties | string;\n // User account type at pay method: EMAIL, PHONE_NO, ACCOUNT_ID\n payMethodUserAccountType?: PayMethodUserAccountType | string;\n // User account number at pay method (max 64 characters)\n payMethodUserAccountNo?: string;\n // Cashier language (IETF BCP 47 language tag, max 24 characters)\n cashierLanguage?: string;\n // Cashier UI appearance variables\n cashierAppearance?: CashierAppearance;\n // User payment access token from Waffo tokenization service (max 256 characters)\n userPaymentAccessToken?: string;\n // Capture mode: manualCapture\n captureMode?: CaptureMode | string;\n // MIT mode: scheduled, unscheduled\n merchantInitiatedMode?: MerchantInitiatedMode | string;\n}\n\n/**\n * Risk Data Interface (Request Parameters)\n *\n * @description\n * Auxiliary data for risk assessment.\n *\n * @interface RiskData\n */\nexport interface RiskData {\n // User type: Individual/Agent/Institution/Internal (max 24 characters)\n userType?: RiskUserType;\n // User category: Member/Non-Member (max 24 characters)\n userCategory?: string;\n // User legal name (max 128 characters)\n userLegalName?: string;\n // User display name (max 128 characters)\n userDisplayName?: string;\n // User registration IP (max 24 characters)\n userRegistrationIp?: string;\n // User last seen IP (max 24 characters)\n userLastSeenIp?: string;\n // Whether user is new: Yes/No (max 8 characters)\n userIsNew?: string;\n // Whether this is user's first purchase: Yes/No (max 8 characters)\n userIsFirstPurchase?: string;\n}\n\n/**\n * User Bank Information Interface (Request Parameters)\n *\n * @description\n * Bank account information for bank transfer and similar payment method refunds.\n *\n * @interface UserBankInfo\n */\nexport interface UserBankInfo {\n // Bank account number (max 64 characters)\n bankAccountNo: string;\n // Bank code (max 64 characters)\n bankCode: string;\n // Bank city (max 64 characters)\n bankCity?: string;\n // Bank branch name (max 64 characters)\n bankBranch?: string;\n // Additional properties\n [key: string]: string | undefined;\n}\n\n/**\n * Refund User Information Interface (Request Parameters)\n *\n * @description\n * User information required for refunds with specific payment methods.\n *\n * @interface RefundUserInfo\n */\nexport interface RefundUserInfo {\n // User type: INDIVIDUAL or BUSINESS\n userType?: RefundUserType;\n // User first name (max 64 characters)\n userFirstName?: string;\n // User last name (max 64 characters)\n userLastName?: string;\n // User email for refund communication (max 64 characters)\n userEmail?: string;\n // User bank account information\n userBankInfo?: UserBankInfo | string;\n // User phone number (max 16 characters)\n userPhone?: string;\n // User ID type (max 24 characters)\n userIDType?: string;\n // User ID number (max 64 characters)\n userIDNumber?: string;\n // User ID issue date (dd/mm/yyyy, max 12 characters)\n userIDIssueDate?: string;\n // User ID expiry date (dd/mm/yyyy, max 12 characters)\n userIDExpiryDate?: string;\n}\n\n/**\n * Create Order Request Parameters Interface\n *\n * @description\n * Request parameters for calling `waffo.order.create()`.\n *\n * @interface CreateOrderParams\n */\nexport interface CreateOrderParams {\n // Unique request ID generated by merchant for idempotency check (max 32 characters)\n paymentRequestId: string;\n // Merchant system order ID (max 64 characters)\n merchantOrderId: string;\n // Order currency code (ISO 4217)\n orderCurrency: string;\n // Order amount (string format)\n orderAmount: string;\n // Order description (max 128 characters)\n orderDescription: string;\n // User payment currency code (ISO 4217)\n userCurrency?: string;\n // Merchant information\n merchantInfo: MerchantInfo;\n // User information\n userInfo: UserInfo;\n // Goods information\n goodsInfo: GoodsInfo;\n // Shipping address information\n addressInfo?: AddressInfo;\n // Payment method information\n paymentInfo: PaymentInfo;\n // Card information for direct card payment\n cardInfo?: CardInfo;\n // ApplePay/GooglePay payment token data (max 8192 characters)\n PaymentTokenData?: string;\n // Request time (ISO 8601 format, max 24 characters), defaults to current time if not provided\n orderRequestedAt?: string;\n // Order expiry time (ISO 8601 format, max 24 characters)\n orderExpiredAt?: string;\n // Redirect URL after successful payment (max 512 characters)\n successRedirectUrl?: string;\n // Redirect URL after failed payment (max 512 characters)\n failedRedirectUrl?: string;\n // Redirect URL if user cancels payment (max 512 characters)\n cancelRedirectUrl?: string;\n // Async notification callback URL for payment result (max 256 characters)\n notifyUrl: string;\n // Risk control auxiliary data\n riskData?: RiskData;\n // Reserved extend info (max 128 characters or object)\n extendInfo?: string | Record<string, unknown>;\n}\n\n/**\n * Inquiry Order Request Parameters Interface\n *\n * @description\n * Request parameters for calling `waffo.order.inquiry()`.\n *\n * @interface InquiryOrderParams\n */\nexport interface InquiryOrderParams {\n // Merchant original request ID (max 32 characters)\n paymentRequestId?: string;\n // Acquiring order ID generated by Waffo (max 32 characters)\n acquiringOrderId?: string;\n}\n\n/**\n * Cancel Order Request Parameters Interface\n *\n * @description\n * Request parameters for calling `waffo.order.cancel()`.\n *\n * @interface CancelOrderParams\n */\nexport interface CancelOrderParams {\n // Merchant original request ID (max 32 characters)\n paymentRequestId?: string;\n // Waffo acquiring order ID (max 32 characters)\n acquiringOrderId?: string;\n // Merchant ID (max 64 characters)\n merchantId: string;\n // Cancel request time (ISO 8601 format, max 24 characters), defaults to current time if not provided\n orderRequestedAt?: string;\n}\n\n/**\n * Order Refund Request Parameters Interface\n *\n * @description\n * Request parameters for calling `waffo.order.refund()`.\n *\n * @interface RefundOrderParams\n */\nexport interface RefundOrderParams {\n // Refund request ID generated by merchant (max 32 characters)\n refundRequestId: string;\n // Waffo acquiring order ID (max 32 characters)\n acquiringOrderId: string;\n // Merchant refund order ID (max 64 characters)\n merchantRefundOrderId?: string;\n // Merchant ID (max 64 characters)\n merchantId: string;\n // Refund request time (ISO 8601 format, max 24 characters), defaults to current time if not provided\n requestedAt?: string;\n // Refund amount\n refundAmount: string;\n // Refund reason (max 24 characters)\n refundReason: string;\n // Refund notify callback URL (max 256 characters)\n refundNotifyUrl?: string;\n // Refund user information\n userInfo?: RefundUserInfo;\n // Reserved extend info (max 128 characters or object)\n extendInfo?: string | Record<string, unknown>;\n}\n\n/**\n * Capture Request Parameters Interface\n *\n * @description\n * Request parameters for calling `waffo.order.capture()`.\n *\n * @interface CaptureOrderParams\n */\nexport interface CaptureOrderParams {\n // Merchant original request ID (max 32 characters)\n paymentRequestId?: string;\n // Waffo acquiring order ID (max 32 characters)\n acquiringOrderId?: string;\n // Merchant ID (max 64 characters)\n merchantId: string;\n // Capture request time (ISO 8601 format, max 24 characters), defaults to current time if not provided\n captureRequestedAt?: string;\n // Capture amount (partial or full)\n captureAmount: string;\n}\n\n// ============================================================\n// Response Interfaces\n// ============================================================\n\n/**\n * Order Action Data Interface (Response)\n *\n * @description\n * Payment data for merchant's custom checkout page.\n *\n * @interface OrderActionData\n */\nexport interface OrderActionData {\n // Payment expiry time (ISO 8601 format with millisecond precision)\n paymentExpiryTime?: string;\n // QR code content string (max 2048 characters)\n paymentQr?: string;\n // Payment code (max 256 characters)\n paymentCode?: string;\n // Barcode content string (max 512 characters)\n paymentBarCode?: string;\n // User payment currency\n paymentCurrency?: string;\n // User payment amount\n paymentAmount?: string;\n // User service fee amount\n userFeeAmount?: string;\n // User service fee currency\n userFeeCurrency?: string;\n // Exchange rate (max 64 characters)\n exchangeRate?: string;\n // Additional properties\n [key: string]: string | undefined;\n}\n\n/**\n * Order Action Interface (Response)\n *\n * @description\n * Returned when order status is AUTHORIZATION_REQUIRED.\n *\n * @interface OrderAction\n */\nexport interface OrderAction {\n // Action type: WEB or DEEPLINK\n actionType: OrderActionType | string;\n // Web payment page URL (max 1024 characters)\n webUrl?: string;\n // Deeplink URL (max 1024 characters)\n deeplinkUrl?: string;\n // Payment data for custom checkout page\n actionData?: OrderActionData;\n}\n\n/**\n * Merchant Information Interface (Response)\n *\n * @description\n * Merchant information associated with the order.\n *\n * @interface MerchantInfoResponse\n */\nexport interface MerchantInfoResponse {\n // Merchant ID (max 64 characters)\n merchantId: string;\n // Sub-merchant ID (max 64 characters)\n subMerchantId?: string;\n}\n\n/**\n * User Information Interface (Response)\n *\n * @description\n * User information associated with the order.\n *\n * @interface UserInfoResponse\n */\nexport interface UserInfoResponse {\n // User ID (max 64 characters)\n userId: string;\n // User email (max 64 characters)\n userEmail: string;\n // User phone (max 16 characters)\n userPhone?: string;\n // User country code\n userCountryCode?: string;\n // User terminal type\n userTerminal: UserTerminalType | string;\n // User first name (max 64 characters)\n userFirstName?: string;\n // User last name (max 64 characters)\n userLastName?: string;\n // User created time (max 24 characters)\n userCreatedAt?: string;\n // User browser IP (max 128 characters)\n userBrowserIp?: string;\n // User agent (max 256 characters)\n userAgent?: string;\n}\n\n/**\n * Goods Information Interface (Response)\n *\n * @description\n * Product information associated with the order.\n *\n * @interface GoodsInfoResponse\n */\nexport interface GoodsInfoResponse {\n // Product ID (max 32 characters)\n goodsId?: string;\n // Product name (max 64 characters)\n goodsName: string;\n // Product category (max 32 characters)\n goodsCategory?: string;\n // Product detail page URL (max 128 characters)\n goodsUrl?: string;\n // App package name (max 32 characters)\n appName?: string;\n // SKU name (max 32 characters)\n skuName?: string;\n // Product unique price (max 16 characters)\n goodsUniquePrice?: string;\n // Product quantity\n goodsQuantity?: number | string;\n}\n\n/**\n * Address Information Interface (Response)\n *\n * @description\n * Address information associated with the order.\n *\n * @interface AddressInfoResponse\n */\nexport interface AddressInfoResponse {\n // Detailed shipping address (max 256 characters)\n address?: string;\n // City (max 32 characters)\n city?: string;\n // Region/Province/State (max 32 characters)\n region?: string;\n // Postal code (max 16 characters)\n postcode?: string;\n // Shipping country code (max 16 characters)\n addressCountryCode?: string;\n}\n\n/**\n * Payment Method Response Data Interface (Response)\n *\n * @description\n * Specific data returned by payment channel.\n *\n * @interface PayMethodResponse\n */\nexport interface PayMethodResponse {\n // Transaction reference ID from payment channel (max 128 characters)\n payMethodRefId?: string;\n // Exchange rate (max 64 characters)\n exchangeRate?: string;\n // Unique user open ID assigned by pay method (max 128 characters)\n userOpenId?: string;\n // Masked card data (first 6 and last 4, max 32 characters)\n maskCardData?: string;\n // Additional properties\n [key: string]: string | undefined;\n}\n\n/**\n * Payment Information Interface (Response)\n *\n * @description\n * Payment method details for the order.\n *\n * @interface PaymentInfoResponse\n */\nexport interface PaymentInfoResponse {\n // Payment product name\n productName: ProductName | string;\n /**\n * Payment type (max 256 characters)\n * Example values: \"EWALLET\", \"CREDITCARD\", \"BANKTRANSFER\", \"ONLINE_BANKING\", \"DIGITAL_BANKING\", \"OTC\", \"DEBITCARD\"\n * Note: This list may be updated. Please refer to the latest API documentation.\n */\n payMethodType: string;\n /**\n * Specific payment method (max 24 characters)\n * Example E-wallets: \"OVO\", \"DANA\", \"GOPAY\", \"SHOPEEPAY\", \"GCASH\", \"ALIPAY_HK\"\n * Example Credit Cards: \"CC_VISA\", \"CC_MASTERCARD\"\n * Example Bank Transfer: \"VA_BCA\", \"VA_BNI\"\n * Note: This list may be updated. Please refer to the latest API documentation.\n */\n payMethodName: string;\n // Payment method country code\n payMethodCountry?: string;\n // Payment method properties\n payMethodProperties?: PayMethodProperties | string;\n // Payment method response data\n payMethodResponse?: PayMethodResponse | string;\n // User account type at pay method\n payMethodUserAccountType?: PayMethodUserAccountType | string;\n // User account number at pay method (max 64 characters)\n payMethodUserAccountNo?: string;\n // Cashier language (max 24 characters)\n cashierLanguage?: string;\n // User selected pay option (max 24 characters)\n payOption?: string;\n // User payment access token (max 256 characters)\n userPaymentAccessToken?: string;\n // Capture mode\n captureMode?: CaptureMode | string;\n // MIT mode\n merchantInitiatedMode?: MerchantInitiatedMode | string;\n}\n\n/**\n * Order Failed Reason Interface (Response)\n *\n * @description\n * Error details when order fails.\n *\n * @interface OrderFailedReason\n */\nexport interface OrderFailedReason {\n // Failure error code (max 64 characters)\n orderFailedCode: string;\n // Failure reason description (max 256 characters)\n orderFailedDescription: string;\n}\n\n/**\n * Create Order Response Data Interface\n *\n * @description\n * Business data returned by `waffo.order.create()`.\n *\n * @interface CreateOrderData\n */\nexport interface CreateOrderData {\n // Merchant original request ID (max 32 characters)\n paymentRequestId: string;\n // Merchant order ID (max 64 characters)\n merchantOrderId: string;\n // Unique acquiring order ID generated by Waffo (max 32 characters)\n acquiringOrderId: string;\n // Current order status\n orderStatus: OrderStatus | string;\n // Next step action guide\n orderAction?: OrderAction;\n}\n\n/**\n * Order Inquiry Response Data Interface\n *\n * @description\n * Complete order details returned by `waffo.order.inquiry()`.\n *\n * @interface InquiryOrderData\n */\nexport interface InquiryOrderData {\n // Merchant original request ID (max 32 characters)\n paymentRequestId: string;\n // Merchant order ID (max 64 characters)\n merchantOrderId: string;\n // Waffo acquiring order ID (max 32 characters)\n acquiringOrderId: string;\n // Current order status\n orderStatus: OrderStatus | string;\n // Order action\n orderAction?: OrderAction;\n // Order currency\n orderCurrency: string;\n // Order amount\n orderAmount: string;\n // User payment currency\n userCurrency?: string;\n // Final amount user paid\n finalDealAmount: string;\n // Order description (max 128 characters)\n orderDescription: string;\n // Merchant information\n merchantInfo: MerchantInfoResponse;\n // User information\n userInfo: UserInfoResponse;\n // Goods information\n goodsInfo?: GoodsInfoResponse;\n // Address information\n addressInfo?: AddressInfoResponse;\n // Payment information\n paymentInfo: PaymentInfoResponse;\n // Order request time (max 24 characters)\n orderRequestedAt: string;\n // Order expiry time (max 24 characters)\n orderExpiredAt?: string;\n // Order last updated time (max 24 characters)\n orderUpdatedAt: string;\n // Order completion time (max 24 characters)\n orderCompletedAt: string;\n // Order failure reason\n orderFailedReason?: OrderFailedReason | string;\n // Extended info\n extendInfo?: string | Record<string, unknown>;\n}\n\n/**\n * Cancel Order Response Data Interface\n *\n * @description\n * Business data returned by `waffo.order.cancel()`.\n *\n * @interface CancelOrderData\n */\nexport interface CancelOrderData {\n // Merchant original request ID (max 32 characters)\n paymentRequestId: string;\n // Merchant order ID (max 64 characters)\n merchantOrderId: string;\n // Waffo acquiring order ID (max 32 characters)\n acquiringOrderId: string;\n // Order status (ORDER_CLOSE after successful cancellation)\n orderStatus: OrderStatus.ORDER_CLOSE | string;\n}\n\n/**\n * Capture Response Data Interface\n *\n * @description\n * Business data returned by `waffo.order.capture()`.\n *\n * @interface CaptureOrderData\n */\nexport interface CaptureOrderData {\n // Merchant original request ID (max 32 characters)\n paymentRequestId: string;\n // Merchant order ID (max 64 characters)\n merchantOrderId: string;\n // Waffo acquiring order ID (max 32 characters)\n acquiringOrderId: string;\n // Order status\n orderStatus: OrderStatus | string;\n}\n\n// ============================================================\n// Webhook Notification Interfaces\n// ============================================================\n\n/**\n * Payment Notification Result Interface\n *\n * @description\n * Payload for PAYMENT_NOTIFICATION webhook (one-time/direct payment).\n *\n * @interface PaymentNotificationResult\n */\nexport interface PaymentNotificationResult {\n // Merchant original request ID (max 32 characters)\n paymentRequestId: string;\n // Merchant order ID (max 64 characters)\n merchantOrderId: string;\n // Waffo acquiring order ID (max 32 characters)\n acquiringOrderId: string;\n // Order status\n orderStatus: OrderStatus | string;\n // Order action\n orderAction?: OrderAction;\n // Order currency\n orderCurrency: string;\n // Order amount\n orderAmount: string;\n // User payment currency\n userCurrency?: string;\n // Final amount user paid\n finalDealAmount: string;\n // Order description (max 128 characters)\n orderDescription: string;\n // Merchant information\n merchantInfo: MerchantInfoResponse;\n // User information\n userInfo: UserInfoResponse;\n // Goods information\n goodsInfo?: GoodsInfoResponse;\n // Address information\n addressInfo?: AddressInfoResponse;\n // Payment information\n paymentInfo: PaymentInfoResponse;\n // Order request time (max 24 characters)\n orderRequestedAt: string;\n // Order expiry time (max 24 characters)\n orderExpiredAt?: string;\n // Order last updated time (max 24 characters)\n orderUpdatedAt: string;\n // Order completion time (max 24 characters)\n orderCompletedAt: string;\n // Order failure reason\n orderFailedReason?: OrderFailedReason | string;\n // Extended info\n extendInfo?: string | Record<string, unknown>;\n}\n\n/**\n * Payment Notification Interface\n *\n * @description\n * Webhook notification for payment order status changes.\n *\n * @interface PaymentNotification\n */\nexport interface PaymentNotification {\n // Event type - always PAYMENT_NOTIFICATION\n eventType: WebhookEventType.PAYMENT_NOTIFICATION;\n // Notification result data\n result: PaymentNotificationResult;\n}\n\n/**\n * Payment Webhook Request Interface\n *\n * @description\n * Full structure of payment notification webhook request from Waffo.\n *\n * @interface PaymentWebhookRequest\n */\nexport interface PaymentWebhookRequest {\n // Request headers containing X-SIGNATURE\n header: WebhookRequestHeader;\n // Request body containing notification data\n body: PaymentNotification;\n}\n","/**\n * @fileoverview Refund Resource Type Definitions\n * @module types/refund\n *\n * Type definitions for the Refund resource (based on Waffo API JSON Schema).\n *\n * **Categories:**\n * - **Enums:** Refund status states\n * - **Request Interfaces:** Parameters for refund inquiry\n * - **Response Interfaces:** Refund data structures\n * - **Webhook Interfaces:** Refund notification structures\n *\n * @see {@link RefundResource} for API methods\n * @see {@link RefundInquiryParams} for inquiry parameters\n *\n * @example\n * import { RefundStatus, RefundInquiryParams } from 'waffo-sdk';\n *\n * const params: RefundInquiryParams = {\n * refundRequestId: 'refund-123',\n * };\n */\n\nimport { WebhookEventType, WebhookRequestHeader } from \"./webhook\";\nimport { RefundUserType } from \"./common\";\n\n// ============================================================\n// Enums\n// ============================================================\n\n/**\n * Refund Status Enum\n *\n * @description\n * Identifies the current status of a refund request in the processing flow.\n *\n * @enum {string}\n * @readonly\n */\nexport enum RefundStatus {\n // Refund in progress - Request accepted, waiting for channel processing\n REFUND_IN_PROGRESS = \"REFUND_IN_PROGRESS\",\n // Partial refund successful - Order partially refunded, remaining refundable amount exists\n ORDER_PARTIALLY_REFUNDED = \"ORDER_PARTIALLY_REFUNDED\",\n // Full refund successful - Order fully refunded\n ORDER_FULLY_REFUNDED = \"ORDER_FULLY_REFUNDED\",\n // Refund failed - Refund processing failed, see refundFailedReason for details\n ORDER_REFUND_FAILED = \"ORDER_REFUND_FAILED\",\n}\n\n// ============================================================\n// Request Interfaces\n// ============================================================\n\n/**\n * Refund Inquiry Request Parameters Interface\n *\n * @description\n * Request parameters for calling `waffo.refund.inquiry()`.\n *\n * @interface RefundInquiryParams\n */\nexport interface RefundInquiryParams {\n // Refund request ID generated by merchant (max 32 characters)\n refundRequestId?: string;\n // Refund order ID generated by Waffo (max 32 characters)\n acquiringRefundOrderId?: string;\n}\n\n// ============================================================\n// Response Interfaces\n// ============================================================\n\n/**\n * Refund Failed Reason Interface (Response)\n *\n * @description\n * Error details when refund fails.\n *\n * @interface RefundFailedReason\n */\nexport interface RefundFailedReason {\n // Refund failure error code (max 64 characters)\n refundFailedCode: string;\n // Refund failure reason description (max 256 characters)\n refundFailedDescription: string;\n}\n\n/**\n * Refund User Bank Information Interface (Response)\n *\n * @description\n * Bank account information returned for bank transfer refunds.\n *\n * @interface RefundUserBankInfo\n */\nexport interface RefundUserBankInfo {\n // Recipient bank account number (max 64 characters)\n bankAccountNo: string;\n // Bank code (max 64 characters)\n bankCode: string;\n // Bank city (max 64 characters)\n bankCity?: string;\n // Bank branch (max 64 characters)\n bankBranch?: string;\n // Additional properties\n [key: string]: string | undefined;\n}\n\n/**\n * Refund User Information Interface (Response)\n *\n * @description\n * User information returned for specific payment method refunds.\n *\n * @interface RefundUserInfoResponse\n */\nexport interface RefundUserInfoResponse {\n // User type: INDIVIDUAL or BUSINESS\n userType?: RefundUserType;\n // User first name (max 64 characters)\n userFirstName?: string;\n // User last name (max 64 characters)\n userLastName?: string;\n // User email (max 64 characters)\n userEmail?: string;\n // User bank account information\n userBankInfo?: RefundUserBankInfo | string;\n // User phone number (max 16 characters)\n userPhone?: string;\n // User ID type (max 24 characters)\n userIDType?: string;\n // User ID number (max 64 characters)\n userIDNumber?: string;\n // User ID issue date (dd/mm/yyyy, max 12 characters)\n userIDIssueDate?: string;\n // User ID expiry date (dd/mm/yyyy, max 12 characters)\n userIDExpiryDate?: string;\n}\n\n/**\n * Create Refund Response Data Interface\n *\n * @description\n * Business data returned by `waffo.order.refund()`.\n *\n * @interface CreateRefundData\n */\nexport interface CreateRefundData {\n // Refund request ID generated by merchant (max 32 characters)\n refundRequestId: string;\n // Merchant system refund order ID (max 64 characters)\n merchantRefundOrderId?: string;\n // Waffo acquiring order ID of the original payment transaction (max 32 characters)\n acquiringOrderId: string;\n // Unique refund order ID generated by Waffo (max 32 characters)\n acquiringRefundOrderId: string;\n // Refund amount for this request\n refundAmount: string;\n // Current refund status\n refundStatus: RefundStatus | string;\n // Remaining refundable amount for this order\n remainingRefundAmount: string;\n}\n\n/**\n * Refund Inquiry Response Data Interface\n *\n * @description\n * Complete refund details returned by `waffo.refund.inquiry()`.\n *\n * @interface InquiryRefundData\n */\nexport interface InquiryRefundData {\n // Refund request ID generated by merchant (max 32 characters)\n refundRequestId: string;\n // Merchant system refund order ID (max 64 characters)\n merchantRefundOrderId?: string;\n // Waffo acquiring order ID of the original payment transaction (max 32 characters)\n acquiringOrderId: string;\n // Refund order ID generated by Waffo (max 32 characters)\n acquiringRefundOrderId: string;\n // Original payment request ID (max 32 characters)\n origPaymentRequestId: string;\n // Merchant requested refund amount\n refundAmount: string;\n // Current refund status\n refundStatus: RefundStatus | string;\n // Remaining refundable amount for this order\n remainingRefundAmount: string;\n // User payment currency\n userCurrency?: string;\n // User actual received refund amount\n finalDealAmount: string;\n // Refund reason description (max 32 characters)\n refundReason: string;\n // Refund requested time (max 24 characters)\n refundRequestedAt: string;\n // Refund updated time (max 24 characters)\n refundUpdatedAt: string;\n // Refund completion time (max 24 characters)\n refundCompletedAt: string;\n // Refund failure reason\n refundFailedReason?: RefundFailedReason | string;\n // User information\n userInfo?: RefundUserInfoResponse;\n // Extended info\n extendInfo?: string | Record<string, unknown>;\n}\n\n// ============================================================\n// Webhook Notification Interfaces\n// ============================================================\n\n/**\n * Refund Notification Result Interface\n *\n * @description\n * Payload for REFUND_NOTIFICATION webhook.\n *\n * @interface RefundNotificationResult\n */\nexport interface RefundNotificationResult {\n // Refund request ID generated by merchant (max 32 characters)\n refundRequestId: string;\n // Merchant system refund order ID (max 64 characters)\n merchantRefundOrderId?: string;\n // Waffo acquiring order ID of the original payment (max 32 characters)\n acquiringOrderId: string;\n // Waffo refund order ID (max 32 characters)\n acquiringRefundOrderId: string;\n // Original payment request ID (max 32 characters)\n origPaymentRequestId: string;\n // Refund amount\n refundAmount: string;\n // Refund status\n refundStatus: RefundStatus | string;\n // Remaining refundable amount for this order\n remainingRefundAmount: string;\n // User payment currency\n userCurrency?: string;\n // Final refunded amount the user receives\n finalDealAmount: string;\n // Refund reason (max 32 characters)\n refundReason: string;\n // Refund requested time (max 24 characters)\n refundRequestedAt: string;\n // Refund updated time (max 24 characters)\n refundUpdatedAt: string;\n // Refund completion time (max 24 characters)\n refundCompletedAt: string;\n // Refund failure reason\n refundFailedReason?: RefundFailedReason | string;\n // User information\n userInfo?: RefundUserInfoResponse;\n // Extended info\n extendInfo?: string | Record<string, unknown>;\n}\n\n/**\n * Refund Notification Interface\n *\n * @description\n * Webhook notification for refund order status changes.\n *\n * @interface RefundNotification\n */\nexport interface RefundNotification {\n // Event type - always REFUND_NOTIFICATION\n eventType: WebhookEventType.REFUND_NOTIFICATION;\n // Notification result data\n result: RefundNotificationResult;\n}\n\n/**\n * Refund Webhook Request Interface\n *\n * @description\n * Full structure of refund notification webhook request from Waffo.\n *\n * @interface RefundWebhookRequest\n */\nexport interface RefundWebhookRequest {\n // Request headers containing X-SIGNATURE\n header: WebhookRequestHeader;\n // Request body containing notification data\n body: RefundNotification;\n}\n","/**\n * @fileoverview Subscription Resource Type Definitions\n * @module types/subscription\n *\n * Type definitions for the Subscription resource (based on Waffo API JSON Schema).\n *\n * **Categories:**\n * - **Enums:** Subscription status, period types, event types\n * - **Request Interfaces:** Parameters for create, inquiry, cancel, manage\n * - **Response Interfaces:** Subscription data structures\n * - **Webhook Interfaces:** Subscription notification structures\n *\n * @see {@link SubscriptionResource} for API methods\n * @see {@link CreateSubscriptionParams} for subscription creation\n *\n * @example\n * import {\n * CreateSubscriptionParams,\n * SubscriptionStatus,\n * PeriodType,\n * } from 'waffo-sdk';\n *\n * const params: CreateSubscriptionParams = {\n * subscriptionRequest: 'sub-123',\n * currency: 'USD',\n * amount: '9.99',\n * productInfo: {\n * description: 'Monthly Plan',\n * periodType: PeriodType.MONTHLY,\n * periodInterval: '1',\n * },\n * // ...\n * };\n */\n\nimport { WebhookRequestHeader } from \"./webhook\";\nimport { SubscriptionProductName } from \"./payment\";\nimport { RiskUserType } from \"./common\";\n\n// Re-export SubscriptionProductName for convenience\nexport { SubscriptionProductName };\n\n// ============================================================\n// Enums\n// ============================================================\n\n/**\n * Subscription Status Enum\n *\n * @description\n * Identifies the current status of a subscription.\n *\n * @enum {string}\n * @readonly\n */\nexport enum SubscriptionStatus {\n // Authorization required - User needs to complete subscription signing\n AUTHORIZATION_REQUIRED = \"AUTHORIZATION_REQUIRED\",\n // In progress - Subscription is being processed\n IN_PROGRESS = \"IN_PROGRESS\",\n // Active - Subscription is active and billing\n ACTIVE = \"ACTIVE\",\n // Closed - Subscription is closed\n CLOSE = \"CLOSE\",\n // Cancelled by merchant\n MERCHANT_CANCELLED = \"MERCHANT_CANCELLED\",\n // Cancelled by user\n USER_CANCELLED = \"USER_CANCELLED\",\n // Cancelled by channel\n CHANNEL_CANCELLED = \"CHANNEL_CANCELLED\",\n // Expired - Subscription has reached its end date or period limit\n EXPIRED = \"EXPIRED\",\n}\n\n/**\n * Period Type Enum\n *\n * @description\n * Billing period type for subscription.\n *\n * @enum {string}\n * @readonly\n */\nexport enum PeriodType {\n // Daily billing (for trial period only)\n DAILY = \"DAILY\",\n // Weekly billing\n WEEKLY = \"WEEKLY\",\n // Monthly billing\n MONTHLY = \"MONTHLY\",\n}\n\n/**\n * User Terminal Type Enum\n *\n * @description\n * Identifies the terminal environment where the user initiates subscription.\n *\n * @enum {string}\n * @readonly\n */\nexport enum SubscriptionUserTerminalType {\n // Web browser\n WEB = \"WEB\",\n // Native app\n APP = \"APP\",\n}\n\n/**\n * Cashier Language Enum\n *\n * @description\n * Supported cashier languages.\n *\n * @enum {string}\n * @readonly\n */\nexport enum CashierLanguage {\n // English (Hong Kong)\n EN_HK = \"en-HK\",\n // Traditional Chinese (Hong Kong)\n ZH_HANT_HK = \"zh-Hant-HK\",\n // Simplified Chinese (Hong Kong)\n ZH_HANS_HK = \"zh-Hans-HK\",\n}\n\n/**\n * Pay Method User Account Type Enum\n *\n * @description\n * User account type at the designated pay method.\n *\n * @enum {string}\n * @readonly\n */\nexport enum SubscriptionPayMethodUserAccountType {\n // Email account\n EMAIL = \"EMAIL\",\n // Phone number account\n PHONE_NO = \"PHONE_NO\",\n // Account ID\n ACCOUNT_ID = \"ACCOUNT_ID\",\n}\n\n/**\n * Subscription Order Status Enum\n *\n * @description\n * Status for subscription payment order.\n *\n * @enum {string}\n * @readonly\n */\nexport enum SubscriptionOrderStatus {\n // Payment successful\n PAY_SUCCESS = \"PAY_SUCCESS\",\n // Order closed\n ORDER_CLOSE = \"ORDER_CLOSE\",\n}\n\n/**\n * Subscription Event Type Enum\n *\n * @description\n * Event types for subscription webhook notifications.\n *\n * @enum {string}\n * @readonly\n */\nexport enum SubscriptionEventType {\n // Subscription status changed\n SUBSCRIPTION_STATUS_NOTIFICATION = \"SUBSCRIPTION_STATUS_NOTIFICATION\",\n // Subscription payment completed\n PAYMENT_NOTIFICATION = \"PAYMENT_NOTIFICATION\",\n}\n\n// ============================================================\n// Request Interfaces\n// ============================================================\n\n/**\n * Product Information Interface (Request Parameters)\n *\n * @description\n * Subscription billing product configuration.\n *\n * @interface ProductInfo\n */\nexport interface ProductInfo {\n // Product description (max 128 characters) - required\n description: string;\n // Billing period type: WEEKLY, MONTHLY - required\n periodType: PeriodType | string;\n // Billing interval (max 12 characters, WEEKLY:1-4, MONTHLY:1-12) - required\n periodInterval: string;\n // Total number of billing periods (max 24 characters, empty for unlimited, <= 3 years total)\n numberOfPeriod?: string;\n // Trial period amount (max 24 characters, >0, empty means no trial)\n trialPeriodAmount?: string;\n // Number of trial periods (max 12 characters)\n numberOfTrialPeriod?: string;\n // Trial period type: DAILY, WEEKLY, MONTHLY\n trialPeriodType?: PeriodType | string;\n // Trial period interval (max 12 characters)\n trialPeriodInterval?: string;\n}\n\n/**\n * Merchant Information Interface (Request Parameters)\n *\n * @description\n * Merchant information for subscription.\n *\n * @interface SubscriptionMerchantInfo\n */\nexport interface SubscriptionMerchantInfo {\n // Merchant ID assigned by Waffo (max 64 characters) - required\n merchantId: string;\n // Sub-merchant ID assigned by Waffo (max 64 characters)\n subMerchantId?: string;\n}\n\n/**\n * Subscription User Info Interface (Request Parameters)\n *\n * @description\n * User information for subscription.\n *\n * @interface SubscriptionUserInfo\n */\nexport interface SubscriptionUserInfo {\n // Unique user identifier in merchant's system (max 64 characters) - required\n userId: string;\n // User email address (max 64 characters) - required\n userEmail: string;\n // User terminal type: WEB, APP\n userTerminal?: SubscriptionUserTerminalType | string;\n // User phone number (max 16 characters, +CountryCode-MobileNo format)\n userPhone?: string;\n // User first name (max 64 characters)\n userFirstName?: string;\n // User last name (max 64 characters)\n userLastName?: string;\n // User creation time (max 24 characters, ISO 8601)\n userCreatedAt?: string;\n}\n\n/**\n * Subscription Goods Information Interface (Request Parameters)\n *\n * @description\n * Goods information for subscription.\n *\n * @interface SubscriptionGoodsInfo\n */\nexport interface SubscriptionGoodsInfo {\n // Unique goods ID (max 32 characters) - required\n goodsId: string;\n // Product name (max 64 characters) - required\n goodsName: string;\n // Product category (max 32 characters)\n goodsCategory?: string;\n // Product detail page URL (max 128 characters, either this or appName is required)\n goodsUrl?: string;\n // App package name (max 32 characters, either this or goodsUrl is required)\n appName?: string;\n // SKU name (max 32 characters)\n skuName?: string;\n // Goods unique price (max 16 characters)\n goodsUniquePrice?: string;\n // Goods quantity\n goodsQuantity?: number;\n}\n\n/**\n * Subscription Address Information Interface (Request Parameters)\n *\n * @description\n * Address information for subscription.\n *\n * @interface SubscriptionAddressInfo\n */\nexport interface SubscriptionAddressInfo {\n // Detailed shipping address (max 256 characters)\n address?: string;\n // City (max 32 characters)\n city?: string;\n // Region/Province/State (max 32 characters)\n region?: string;\n // Postal code (max 16 characters)\n postcode?: string;\n // Shipping country code (max 16 characters)\n addressCountryCode?: string;\n}\n\n/**\n * Subscription Payment Info Interface (Request Parameters)\n *\n * @description\n * Payment method configuration for subscription.\n *\n * @interface SubscriptionPaymentInfo\n */\nexport interface SubscriptionPaymentInfo {\n // Product name: SUBSCRIPTION, MINI_PROGRAM_SUBSCRIPTION - required\n productName: SubscriptionProductName | string;\n /**\n * Payment method type (max 256 characters)\n * Example values: \"EWALLET\", \"CREDITCARD\", \"DEBITCARD\"\n * Note: This list may be updated. Please refer to the latest API documentation.\n */\n payMethodType?: string;\n /**\n * Specific payment method name (max 24 characters) - required\n * Example E-wallets: \"DANA\", \"GCASH\", \"ALIPAY_HK\"\n * Example Credit Cards: \"CC_VISA\", \"CC_MASTERCARD\"\n * Note: This list may be updated. Please refer to the latest API documentation.\n */\n payMethodName: string;\n // Payment method properties\n payMethodProperties?: Record<string, unknown> | string;\n // User account type at pay method: EMAIL, PHONE_NO, ACCOUNT_ID\n payMethodUserAccountType?: SubscriptionPayMethodUserAccountType | string;\n // Cashier language\n cashierLanguage?: CashierLanguage | string;\n // User account number at pay method (max 64 characters)\n payMethodUserAccountNo?: string;\n // User access token (max 128 characters, required for MINI_PROGRAM_SUBSCRIPTION)\n payMethodUserAccessToken?: string;\n}\n\n/**\n * Risk Data Interface (Request Parameters)\n *\n * @description\n * Auxiliary data for risk assessment.\n *\n * @interface SubscriptionRiskData\n */\nexport interface SubscriptionRiskData {\n // User type (max 24 characters): Individual/Agent/Institution/Internal\n userType?: RiskUserType;\n // User category (max 24 characters): Member/Non-Member\n userCategory?: string;\n // User legal name (max 128 characters)\n userLegalName?: string;\n // User display name (max 128 characters)\n userDisplayName?: string;\n // User registration IP (max 24 characters)\n userRegistrationIp?: string;\n // User last seen IP (max 24 characters)\n userLastSeenIp?: string;\n // Whether user is new (max 8 characters): Yes/No\n userIsNew?: string;\n // Whether this is user's first purchase (max 8 characters): Yes/No\n userIsFirstPurchase?: string;\n}\n\n/**\n * Create Subscription Request Parameters Interface\n *\n * @description\n * Request parameters for calling `waffo.subscription.create()`.\n *\n * @interface CreateSubscriptionParams\n */\nexport interface CreateSubscriptionParams {\n // Unique request ID generated by merchant (max 32 characters) - required\n subscriptionRequest: string;\n // Merchant subscription plan ID assigned to this user (max 64 characters)\n merchantSubscriptionId?: string;\n // Subscription currency code (ISO 4217) - required\n currency: string;\n // Subscription amount per period - required\n amount: string;\n // User payment currency (when different from merchant currency)\n userCurrency?: string;\n // Subscription product/billing configuration - required\n productInfo: ProductInfo;\n // Merchant information - required\n merchantInfo: SubscriptionMerchantInfo;\n // User information - required\n userInfo: SubscriptionUserInfo;\n // Goods information - required\n goodsInfo: SubscriptionGoodsInfo;\n // Address information\n addressInfo?: SubscriptionAddressInfo;\n // Payment method information - required\n paymentInfo: SubscriptionPaymentInfo;\n // Request time (ISO 8601 format, max 24 characters), defaults to current time if not provided\n requestedAt?: string;\n // Redirect URL after successful subscription signing (max 256 characters)\n successRedirectUrl?: string;\n // Redirect URL after payment pre-verification fails (max 256 characters)\n failedRedirectUrl?: string;\n // Redirect URL after subscription payment is cancelled (max 256 characters)\n cancelRedirectUrl?: string;\n // Async notification URL for subscription status changes (max 256 characters) - required\n notifyUrl: string;\n // Merchant-side subscription management URL (max 256 characters, required for some pay methods)\n subscriptionManagementUrl?: string;\n // Risk control auxiliary data\n riskData?: SubscriptionRiskData;\n // Reserved extend info (max 128 characters or object)\n extendInfo?: string | Record<string, unknown>;\n}\n\n/**\n * Inquiry Subscription Request Parameters Interface\n *\n * @description\n * Request parameters for calling `waffo.subscription.inquiry()`.\n *\n * @interface InquirySubscriptionParams\n */\nexport interface InquirySubscriptionParams {\n // Merchant original request ID (max 32 characters)\n subscriptionRequest?: string;\n // Waffo subscription ID (max 64 characters)\n subscriptionId?: string;\n // Whether to return payment details: \"0\" = no, \"1\" = yes\n paymentDetails?: \"0\" | \"1\";\n}\n\n/**\n * Cancel Subscription Request Parameters Interface\n *\n * @description\n * Request parameters for calling `waffo.subscription.cancel()`.\n *\n * @interface CancelSubscriptionParams\n */\nexport interface CancelSubscriptionParams {\n // Waffo subscription ID (max 64 characters) - required\n subscriptionId: string;\n // Merchant ID (max 64 characters) - required\n merchantId: string;\n // Cancel request time (ISO 8601 format, max 24 characters), defaults to current time if not provided\n requestedAt?: string;\n}\n\n/**\n * Manage Subscription Request Parameters Interface\n *\n * @description\n * Request parameters for calling `waffo.subscription.manage()`.\n *\n * @interface ManageSubscriptionParams\n */\nexport interface ManageSubscriptionParams {\n // Merchant original request ID (max 32 characters)\n subscriptionRequest?: string;\n // Waffo subscription ID (max 64 characters)\n subscriptionId?: string;\n}\n\n// ============================================================\n// Response Interfaces\n// ============================================================\n\n/**\n * Subscription Action Interface (Response)\n *\n * @description\n * Returned when subscription status is AUTHORIZATION_REQUIRED.\n *\n * @interface SubscriptionAction\n */\nexport interface SubscriptionAction {\n // Web URL for user to complete subscription signing (max 256 characters)\n webUrl: string;\n}\n\n/**\n * Product Info Response Interface (Response)\n *\n * @description\n * Subscription product configuration in response.\n *\n * @interface ProductInfoResponse\n */\nexport interface ProductInfoResponse {\n // Subscription product description (max 128 characters)\n description: string;\n // Billing period type: WEEKLY, MONTHLY\n periodType: PeriodType | string;\n // Billing interval (max 12 characters)\n periodInterval: string;\n // Total number of billing periods (max 24 characters)\n numberOfPeriod?: string;\n // Trial period amount (max 24 characters)\n trialPeriodAmount?: string;\n // Number of trial periods (max 12 characters)\n numberOfTrialPeriod?: string;\n // Subscription start date time (max 24 characters, ISO 8601)\n startDateTime?: string;\n // Subscription end date time (max 24 characters, ISO 8601)\n endDateTime?: string;\n // Next payment scheduled time (max 24 characters, ISO 8601)\n nextPaymentDateTime?: string;\n // Current billing period number (max 24 characters)\n currentPeriod?: string;\n}\n\n/**\n * Payment Detail Interface (Response)\n *\n * @description\n * Individual payment record within subscription.\n *\n * @interface PaymentDetail\n */\nexport interface PaymentDetail {\n // Waffo order ID for this payment (max 32 characters)\n acquiringOrderId: string;\n // Payment order currency\n orderCurrency: string;\n // Payment amount\n orderAmount: string;\n // Payment status: PAY_SUCCESS, ORDER_CLOSE\n orderStatus: SubscriptionOrderStatus | string;\n // Payment update time (max 24 characters, ISO 8601)\n orderUpdatedAt: string;\n // Billing period number (max 12 characters)\n period: string;\n}\n\n/**\n * Subscription Failed Reason Interface (Response)\n *\n * @description\n * Error details when subscription fails.\n *\n * @interface SubscriptionFailedReason\n */\nexport interface SubscriptionFailedReason {\n // Order failed code (max 64 characters)\n orderFailedCode: string;\n // Order failed description (max 256 characters)\n orderFailedDescription: string;\n}\n\n/**\n * Payment Method Response Interface (Response)\n *\n * @description\n * Payment method response data.\n *\n * @interface SubscriptionPayMethodResponse\n */\nexport interface SubscriptionPayMethodResponse {\n // Payment reference ID (max 128 characters)\n payMethodRefId?: string;\n // Exchange rate (max 64 characters)\n exchangeRate?: string;\n // User open ID (max 128 characters)\n userOpenId?: string;\n // Masked card data (max 32 characters)\n maskCardData?: string;\n // Additional properties\n [key: string]: string | undefined;\n}\n\n/**\n * Subscription Payment Info Response Interface (Response)\n *\n * @description\n * Payment method information in response.\n *\n * @interface SubscriptionPaymentInfoResponse\n */\nexport interface SubscriptionPaymentInfoResponse {\n // Product name: SUBSCRIPTION, MINI_PROGRAM_SUBSCRIPTION\n productName: SubscriptionProductName | string;\n /**\n * Payment method type (max 256 characters)\n * Example values: \"EWALLET\", \"CREDITCARD\", \"DEBITCARD\"\n * Note: This list may be updated. Please refer to the latest API documentation.\n */\n payMethodType?: string;\n /**\n * Payment method name (max 24 characters)\n * Example E-wallets: \"DANA\", \"GCASH\", \"ALIPAY_HK\"\n * Example Credit Cards: \"CC_VISA\", \"CC_MASTERCARD\"\n * Note: This list may be updated. Please refer to the latest API documentation.\n */\n payMethodName: string;\n // Payment method properties\n payMethodProperties?: Record<string, unknown> | string;\n // Payment method response\n payMethodResponse?: SubscriptionPayMethodResponse | string;\n // User account type at pay method\n payMethodUserAccountType?: SubscriptionPayMethodUserAccountType | string;\n // User account number (max 64 characters)\n payMethodUserAccountNo?: string;\n // User access token (max 128 characters)\n payMethodUserAccessToken?: string;\n // Public user ID at pay method (max 128 characters)\n payMethodPublicUid?: string;\n}\n\n/**\n * Create Subscription Response Data Interface\n *\n * @description\n * Business data returned by `waffo.subscription.create()`.\n *\n * @interface CreateSubscriptionData\n */\nexport interface CreateSubscriptionData {\n // Merchant original request ID (max 32 characters)\n subscriptionRequest: string;\n // Merchant subscription ID (max 64 characters)\n merchantSubscriptionId?: string;\n // Waffo generated subscription ID (max 64 characters)\n subscriptionId: string;\n // Payment method's subscription ID (max 64 characters)\n payMethodSubscriptionId?: string;\n // Current subscription status\n subscriptionStatus: SubscriptionStatus | string;\n // Action guide for user to complete signing\n subscriptionAction?: SubscriptionAction;\n}\n\n/**\n * Inquiry Subscription Response Data Interface\n *\n * @description\n * Business data returned by `waffo.subscription.inquiry()`.\n *\n * @interface InquirySubscriptionData\n */\nexport interface InquirySubscriptionData {\n // Merchant original request ID (max 32 characters)\n subscriptionRequest: string;\n // Merchant subscription ID (max 64 characters)\n merchantSubscriptionId?: string;\n // Waffo subscription ID (max 64 characters)\n subscriptionId: string;\n // Current subscription status\n subscriptionStatus: SubscriptionStatus | string;\n // Subscription action\n subscriptionAction?: SubscriptionAction;\n // Subscription currency\n currency: string;\n // Subscription amount\n amount: string;\n // User payment currency\n userCurrency?: string;\n // Subscription product configuration\n productInfo: ProductInfoResponse;\n // Merchant information\n merchantInfo: SubscriptionMerchantInfo;\n // User information\n userInfo: SubscriptionUserInfo;\n // Goods information\n goodsInfo?: SubscriptionGoodsInfo;\n // Address information\n addressInfo?: SubscriptionAddressInfo;\n // Payment information\n paymentInfo: SubscriptionPaymentInfoResponse;\n // Merchant request time (max 24 characters)\n requestedAt: string;\n // Subscription last update time (max 24 characters)\n updatedAt: string;\n // Failed reason\n failedReason?: SubscriptionFailedReason | string;\n // Extended info\n extendInfo?: string | Record<string, unknown>;\n // Subscription management URL (max 256 characters)\n subscriptionManagementUrl?: string;\n // Payment history (returned when paymentDetails=\"1\")\n paymentDetails?: PaymentDetail[];\n}\n\n/**\n * Cancel Subscription Response Data Interface\n *\n * @description\n * Business data returned by `waffo.subscription.cancel()`.\n *\n * @interface CancelSubscriptionData\n */\nexport interface CancelSubscriptionData {\n // Waffo subscription ID (max 64 characters)\n subscriptionId: string;\n // Merchant original request ID (max 32 characters)\n subscriptionRequest: string;\n // Merchant subscription ID (max 64 characters)\n merchantSubscriptionId?: string;\n // Updated order status: CLOSE, MERCHANT_CANCELLED, CHANNEL_CANCELLED, EXPIRED\n orderStatus: SubscriptionStatus | string;\n}\n\n/**\n * Manage Subscription Response Data Interface\n *\n * @description\n * Business data returned by `waffo.subscription.manage()`.\n *\n * @interface ManageSubscriptionData\n */\nexport interface ManageSubscriptionData {\n // Merchant original request ID (max 32 characters)\n subscriptionRequest: string;\n // Merchant subscription ID (max 64 characters)\n merchantSubscriptionId?: string;\n // Waffo subscription ID (max 64 characters)\n subscriptionId: string;\n // Generated management page URL (max 256 characters)\n managementUrl: string;\n // Expiration time of management URL (max 24 characters, ISO 8601, UTC)\n expiredAt: string;\n // Current subscription status\n subscriptionStatus: SubscriptionStatus | string;\n}\n\n/**\n * Subscription Info Interface (Response)\n *\n * @description\n * Subscription information in payment order response and webhook notifications.\n *\n * @interface SubscriptionInfo\n */\nexport interface SubscriptionInfo {\n // Subscription request ID (max 32 characters)\n subscriptionRequest: string;\n // Waffo subscription ID (max 64 characters)\n subscriptionId: string;\n // Which period the subscription payment belongs to (max 12 characters)\n period: string;\n}\n\n// ============================================================\n// Webhook Notification Interfaces\n// ============================================================\n\n/**\n * Subscription Status Notification Result Interface\n *\n * @description\n * Payload for SUBSCRIPTION_STATUS_NOTIFICATION webhook.\n *\n * @interface SubscriptionStatusNotificationResult\n */\nexport interface SubscriptionStatusNotificationResult {\n // Merchant original request ID (max 32 characters)\n subscriptionRequest: string;\n // Merchant subscription ID (max 64 characters)\n merchantSubscriptionId?: string;\n // Waffo subscription ID (max 64 characters)\n subscriptionId: string;\n // Updated subscription status\n subscriptionStatus: SubscriptionStatus | string;\n // Subscription action\n subscriptionAction?: SubscriptionAction;\n // Subscription currency\n currency: string;\n // Subscription amount\n amount: string;\n // User payment currency\n userCurrency?: string;\n // Subscription product configuration\n productInfo: ProductInfoResponse;\n // Merchant information\n merchantInfo: SubscriptionMerchantInfo;\n // User information\n userInfo: SubscriptionUserInfo;\n // Goods information\n goodsInfo?: SubscriptionGoodsInfo;\n // Address information\n addressInfo?: SubscriptionAddressInfo;\n // Payment information\n paymentInfo: SubscriptionPaymentInfoResponse;\n // Merchant request time (max 24 characters)\n requestedAt: string;\n // Subscription last update time (max 24 characters)\n updatedAt: string;\n // Failed reason\n failedReason?: SubscriptionFailedReason | string;\n // Extended info\n extendInfo?: string | Record<string, unknown>;\n // Subscription management URL (max 256 characters)\n subscriptionManagementUrl?: string;\n // Payment history\n paymentDetails?: PaymentDetail[];\n}\n\n/**\n * Subscription Payment Notification Result Interface\n *\n * @description\n * Payload for PAYMENT_NOTIFICATION webhook (subscription deduction).\n *\n * @interface SubscriptionPaymentNotificationResult\n */\nexport interface SubscriptionPaymentNotificationResult {\n // Waffo acquiring order ID (max 32 characters)\n acquiringOrderId: string;\n // Payment status: PAY_SUCCESS, ORDER_CLOSE\n orderStatus: SubscriptionOrderStatus | string;\n // Order currency\n orderCurrency: string;\n // Order amount\n orderAmount: string;\n // User payment currency\n userCurrency?: string;\n // Final amount user paid\n finalDealAmount: string;\n // Order description (max 128 characters)\n orderDescription: string;\n // Merchant information\n merchantInfo: SubscriptionMerchantInfo;\n // User information\n userInfo: SubscriptionUserInfo;\n // Goods information\n goodsInfo?: SubscriptionGoodsInfo;\n // Address information\n addressInfo?: SubscriptionAddressInfo;\n // Payment information\n paymentInfo: SubscriptionPaymentInfoResponse;\n // Subscription information\n subscriptionInfo: SubscriptionInfo;\n // Order request time (max 24 characters)\n orderRequestedAt: string;\n // Order update time (max 24 characters)\n orderUpdatedAt: string;\n // Order failed reason\n orderFailedReason?: SubscriptionFailedReason | string;\n // Extended info\n extendInfo?: string | Record<string, unknown>;\n}\n\n/**\n * Subscription Status Notification Interface\n *\n * @description\n * Webhook notification for subscription status changes.\n *\n * @interface SubscriptionStatusNotification\n */\nexport interface SubscriptionStatusNotification {\n // Event type - always SUBSCRIPTION_STATUS_NOTIFICATION\n eventType: SubscriptionEventType.SUBSCRIPTION_STATUS_NOTIFICATION;\n // Notification result data\n result: SubscriptionStatusNotificationResult;\n}\n\n/**\n * Subscription Payment Notification Interface\n *\n * @description\n * Webhook notification for subscription payment events (recurring billing).\n *\n * @interface SubscriptionPaymentNotification\n */\nexport interface SubscriptionPaymentNotification {\n // Event type - always PAYMENT_NOTIFICATION\n eventType: SubscriptionEventType.PAYMENT_NOTIFICATION;\n // Notification result data\n result: SubscriptionPaymentNotificationResult;\n}\n\n/**\n * Subscription Notification Union Type\n *\n * @description\n * Union type for all subscription webhook notifications.\n *\n * @typedef {SubscriptionStatusNotification | SubscriptionPaymentNotification} SubscriptionNotification\n */\nexport type SubscriptionNotification =\n | SubscriptionStatusNotification\n | SubscriptionPaymentNotification;\n\n/**\n * Subscription Status Webhook Request Interface\n *\n * @description\n * Full structure of subscription status notification webhook request from Waffo.\n *\n * @interface SubscriptionStatusWebhookRequest\n */\nexport interface SubscriptionStatusWebhookRequest {\n // Request headers containing X-SIGNATURE\n header: WebhookRequestHeader;\n // Request body containing notification data\n body: SubscriptionStatusNotification;\n}\n\n/**\n * Subscription Payment Webhook Request Interface\n *\n * @description\n * Full structure of subscription payment notification webhook request from Waffo.\n *\n * @interface SubscriptionPaymentWebhookRequest\n */\nexport interface SubscriptionPaymentWebhookRequest {\n // Request headers containing X-SIGNATURE\n header: WebhookRequestHeader;\n // Request body containing notification data\n body: SubscriptionPaymentNotification;\n}\n\n/**\n * Subscription Webhook Request Union Type\n *\n * @description\n * Union type for all subscription webhook requests.\n *\n * @typedef {SubscriptionStatusWebhookRequest | SubscriptionPaymentWebhookRequest} SubscriptionWebhookRequest\n */\nexport type SubscriptionWebhookRequest =\n | SubscriptionStatusWebhookRequest\n | SubscriptionPaymentWebhookRequest;\n","/**\n * @fileoverview RSA Cryptographic Utility Functions\n * @module utils/rsa\n *\n * Provides RSA cryptographic operations for the Waffo SDK:\n * - **{@link signForRSA}** - Sign data using RSA-SHA256\n * - **{@link verify}** - Verify RSA-SHA256 signatures\n * - **{@link createKeyPair}** - Generate new RSA key pairs\n *\n * **Key Formats:**\n * - Private keys: Base64 encoded PKCS8 DER format\n * - Public keys: Base64 encoded X509/SPKI DER format\n *\n * @see {@link HttpClient} for automatic request signing\n * @see {@link verifyWebhookSignature} for webhook verification\n *\n * @example\n * import { signForRSA, verify, createKeyPair } from 'waffo-sdk';\n *\n * // Generate a new key pair\n * const keys = createKeyPair();\n *\n * // Sign data\n * const data = JSON.stringify({ message: 'Hello' });\n * const signature = signForRSA(data, keys.PRIVATE_KEY_NAME);\n *\n * // Verify signature\n * const isValid = verify(data, signature, keys.PUBLIC_KEY_NAME);\n */\n\nimport crypto from \"crypto\";\n\n/**\n * RSA-SHA256 algorithm identifier.\n * @constant {string}\n * @internal\n */\nconst SIGN_ALGORITHMS = \"RSA-SHA256\";\n\n/**\n * Callback function for handling cryptographic errors.\n *\n * When provided to signing/verification functions, errors are passed\n * to this callback instead of causing the function to throw.\n *\n * @typedef {Function} ErrorHandler\n * @param {Error} error - The error that occurred\n *\n * @example\n * const signature = signForRSA(data, privateKey, 'utf8', (error) => {\n * console.error('Signing failed:', error.message);\n * });\n */\nexport type ErrorHandler = (error: Error) => void;\n\n/**\n * Signs a payload using RSA-SHA256 algorithm.\n *\n * Returns a Base64 encoded signature. Used internally by the SDK to sign\n * all outgoing API requests (included in `X-SIGNATURE` header).\n *\n * @param {string} body - Payload to sign (typically JSON serialized)\n * @param {string} privateKey - Private key (Base64 encoded PKCS8 DER format)\n * @param {string} [charSet='utf8'] - Character encoding ('utf8', 'ascii', 'latin1')\n * @param {ErrorHandler} [onError] - Optional error handler callback\n *\n * @returns {string | null} Base64 encoded signature, or `null` on failure\n *\n * @example\n * // Sign a JSON payload\n * const payload = JSON.stringify({ orderId: '123', amount: '100' });\n * const signature = signForRSA(payload, privateKey);\n *\n * if (signature) {\n * console.log('Signature:', signature);\n * }\n *\n * @example\n * // With error handling\n * const signature = signForRSA(payload, privateKey, 'utf8', (error) => {\n * console.error('Signing failed:', error.message);\n * });\n *\n * @see {@link verify} for signature verification\n * @see {@link createKeyPair} for generating key pairs\n */\nexport function signForRSA(\n body: string,\n privateKey: string,\n charSet: string = \"utf8\",\n onError?: ErrorHandler,\n): string | null {\n try {\n // Decode base64 private key (PKCS8 DER format)\n const privateKeyDer = Buffer.from(privateKey, \"base64\");\n\n // Convert PKCS8 DER to PEM format for Node.js crypto\n const privateKeyPem = `-----BEGIN PRIVATE KEY-----\\n${privateKeyDer\n .toString(\"base64\")\n .match(/.{1,64}/g)\n ?.join(\"\\n\")}\\n-----END PRIVATE KEY-----`;\n\n // Create signature instance\n const signature = crypto.createSign(SIGN_ALGORITHMS);\n\n // Update with body bytes using specified charset\n signature.update(body, charSet as BufferEncoding);\n\n const signed = signature.sign(privateKeyPem, \"base64\");\n\n return signed;\n } catch (e) {\n onError?.(e instanceof Error ? e : new Error(String(e)));\n return null;\n }\n}\n\n/**\n * Verifies an RSA-SHA256 signature.\n *\n * Returns `true` if the signature is valid. Used internally by the SDK\n * to verify API response and webhook notification signatures.\n *\n * @param {string} body - Original payload that was signed\n * @param {string} sign - Signature to verify (Base64 encoded)\n * @param {string} publicKey - Public key (Base64 encoded X509/SPKI DER format)\n * @param {string} [charSet='utf8'] - Character encoding (must match signing)\n * @param {ErrorHandler} [onError] - Optional error handler callback\n *\n * @returns {boolean} `true` if signature is valid, `false` otherwise\n *\n * @example\n * // Verify a signature\n * const isValid = verify(payload, signature, publicKey);\n *\n * if (isValid) {\n * console.log('Signature verified successfully');\n * } else {\n * console.log('Invalid signature');\n * }\n *\n * @example\n * // With error handling\n * const isValid = verify(payload, signature, publicKey, 'utf8', (error) => {\n * console.error('Verification error:', error.message);\n * });\n *\n * @see {@link signForRSA} for signature generation\n * @see {@link verifyWebhookSignature} for webhook verification\n */\nexport function verify(\n body: string,\n sign: string,\n publicKey: string,\n charSet: string = \"utf8\",\n onError?: ErrorHandler,\n): boolean {\n try {\n // Decode base64 public key (X509 DER format)\n const publicKeyDer = Buffer.from(publicKey, \"base64\");\n\n // Convert X509 DER to PEM format for Node.js crypto\n const publicKeyPem = `-----BEGIN PUBLIC KEY-----\\n${publicKeyDer\n .toString(\"base64\")\n .match(/.{1,64}/g)\n ?.join(\"\\n\")}\\n-----END PUBLIC KEY-----`;\n\n // Create verify instance\n const verifier = crypto.createVerify(SIGN_ALGORITHMS);\n\n // Update with body bytes using specified charset\n verifier.update(body, charSet as BufferEncoding);\n\n // Decode signature from base64\n const signatureBuffer = Buffer.from(sign, \"base64\");\n\n // Verify signature\n return verifier.verify(publicKeyPem, signatureBuffer);\n } catch (e) {\n onError?.(e instanceof Error ? e : new Error(String(e)));\n return false;\n }\n}\n\n/**\n * Generates a new 2048-bit RSA key pair for Waffo API authentication.\n *\n * **Generated Key Formats:**\n * - Private key: Base64 encoded PKCS8 DER format (for signing)\n * - Public key: Base64 encoded X509/SPKI DER format (for verification)\n *\n * **Usage:**\n * 1. Generate a key pair using this function\n * 2. Register the public key with Waffo via merchant dashboard\n * 3. Store the private key securely on your server\n * 4. Use the private key when initializing the SDK\n *\n * **Security Notes:**\n * - Never expose the private key in client-side code\n * - Store privately (environment variables, secrets manager)\n * - Use different keys for sandbox/production\n *\n * @returns {{ PRIVATE_KEY_NAME: string, PUBLIC_KEY_NAME: string }} Generated key pair\n *\n * @example\n * // Generate a new key pair\n * const keys = createKeyPair();\n *\n * console.log('Private Key (store securely):');\n * console.log(keys.PRIVATE_KEY_NAME);\n *\n * console.log('Public Key (register with Waffo):');\n * console.log(keys.PUBLIC_KEY_NAME);\n *\n * @example\n * // Use the generated private key with SDK\n * const waffo = new Waffo({\n * apiKey: 'your-api-key',\n * privateKey: keys.PRIVATE_KEY_NAME,\n * });\n *\n * @see {@link Waffo.generateKeyPair} for static access via Waffo class\n */\nexport function createKeyPair(): {\n PRIVATE_KEY_NAME: string;\n PUBLIC_KEY_NAME: string;\n} {\n // Generate RSA key pair with 2048-bit modulus\n const { publicKey, privateKey } = crypto.generateKeyPairSync(\"rsa\", {\n modulusLength: 2048,\n publicKeyEncoding: {\n type: \"spki\",\n format: \"der\",\n },\n privateKeyEncoding: {\n type: \"pkcs8\",\n format: \"der\",\n },\n });\n\n // Encode keys to base64\n const keyMap: { PRIVATE_KEY_NAME: string; PUBLIC_KEY_NAME: string } = {\n PRIVATE_KEY_NAME: (privateKey as Buffer).toString(\"base64\"),\n PUBLIC_KEY_NAME: (publicKey as Buffer).toString(\"base64\"),\n };\n\n return keyMap;\n}\n","/**\n * @fileoverview Webhook Utility Functions\n * @module utils/webhook\n *\n * Utility functions for handling Waffo webhook notifications:\n * - **{@link verifyWebhookSignature}** - Verify incoming webhook signatures\n * - **{@link buildWebhookResponse}** - Build signed webhook responses\n * - **{@link buildSuccessResponse}** - Shorthand for success responses\n * - **{@link buildFailedResponse}** - Shorthand for failure responses\n * - **Type guard functions** - Check notification types\n *\n * **Webhook Flow:**\n * 1. Receive webhook POST request from Waffo\n * 2. Verify the X-SIGNATURE header\n * 3. Process the notification based on event type\n * 4. Return a signed response\n *\n * @see {@link WebhookEventType} for notification types\n * @see {@link WebhookResponseStatus} for response statuses\n *\n * @example\n * import {\n * verifyWebhookSignature,\n * buildSuccessResponse,\n * isPaymentNotification,\n * } from 'waffo-sdk';\n *\n * // In your webhook handler\n * const result = verifyWebhookSignature(body, signature, waffoPublicKey);\n * if (result.isValid && isPaymentNotification(result.notification)) {\n * // Process payment notification\n * await processPayment(result.notification);\n * return buildSuccessResponse(merchantPrivateKey);\n * }\n */\n\nimport { signForRSA, verify } from \"./rsa\";\nimport {\n // Webhook base types\n WebhookEventType,\n WebhookResponseStatus,\n WebhookResponse,\n WebhookResponseBody,\n // Order notification types\n PaymentNotification,\n // Refund notification types\n RefundNotification,\n // Subscription notification types\n SubscriptionNotification,\n SubscriptionStatusNotification,\n SubscriptionPaymentNotification,\n SubscriptionEventType,\n} from \"../types\";\n\n/**\n * Union type representing all webhook notification types from Waffo.\n *\n * Use type guard functions to narrow down the specific type:\n * - {@link isPaymentNotification} - Payment notifications\n * - {@link isRefundNotification} - Refund notifications\n * - {@link isSubscriptionStatusNotification} - Subscription status changes\n * - {@link isSubscriptionPaymentNotification} - Subscription payments\n *\n * @typedef {PaymentNotification | RefundNotification | SubscriptionNotification} AnyWebhookNotification\n */\nexport type AnyWebhookNotification =\n | PaymentNotification\n | RefundNotification\n | SubscriptionNotification;\n\n/**\n * Result of webhook signature verification.\n *\n * Contains verification status and parsed notification data.\n *\n * @interface WebhookVerificationResult\n *\n * @example\n * const result = verifyWebhookSignature(body, signature, publicKey);\n * if (result.isValid) {\n * console.log('Event type:', result.eventType);\n * console.log('Notification:', result.notification);\n * } else {\n * console.error('Verification failed:', result.error);\n * }\n */\nexport interface WebhookVerificationResult {\n /** Whether the signature verification passed */\n isValid: boolean;\n /** Parsed notification data (only when isValid is true) */\n notification?: AnyWebhookNotification;\n /** Event type from the notification (only when isValid is true) */\n eventType?: WebhookEventType;\n /** Error message (only when isValid is false) */\n error?: string;\n}\n\n/**\n * Verifies the signature of a webhook notification from Waffo.\n *\n * @param {string} requestBody - Raw request body string (JSON)\n * @param {string} signature - X-SIGNATURE header value from Waffo\n * @param {string} waffoPublicKey - Waffo's public key (Base64 encoded X509 DER)\n * @returns {WebhookVerificationResult} Verification result with parsed notification\n *\n * @example\n * // Express.js webhook handler\n * app.post('/webhook', (req, res) => {\n * const result = verifyWebhookSignature(\n * JSON.stringify(req.body),\n * req.headers['x-signature'],\n * waffoPublicKey\n * );\n *\n * if (!result.isValid) {\n * console.error('Invalid signature:', result.error);\n * return res.status(400).send('Invalid signature');\n * }\n *\n * console.log('Event type:', result.eventType);\n * console.log('Notification:', result.notification);\n *\n * // Process notification...\n * });\n *\n * @see {@link WebhookVerificationResult} for return type\n */\nexport function verifyWebhookSignature(\n requestBody: string,\n signature: string,\n waffoPublicKey: string,\n): WebhookVerificationResult {\n try {\n // Verify signature\n const isValid = verify(requestBody, signature, waffoPublicKey);\n\n if (!isValid) {\n return {\n isValid: false,\n error: \"Signature verification failed\",\n };\n }\n\n // Parse notification\n const notification = JSON.parse(requestBody) as AnyWebhookNotification;\n const eventType = notification.eventType as WebhookEventType;\n\n return {\n isValid: true,\n notification,\n eventType,\n };\n } catch (error) {\n return {\n isValid: false,\n error: `Failed to verify webhook: ${(error as Error).message}`,\n };\n }\n}\n\n/**\n * Builds a properly signed webhook response to send back to Waffo.\n *\n * @param {WebhookResponseStatus} status - Response status (SUCCESS, FAILED, UNKNOWN)\n * @param {string} merchantPrivateKey - Merchant's private key (Base64 encoded PKCS8 DER)\n * @returns {WebhookResponse} Complete response with signed header\n * @throws {Error} \"Failed to sign webhook response\" when signing fails\n *\n * @example\n * // Build and send response\n * const response = buildWebhookResponse(\n * WebhookResponseStatus.SUCCESS,\n * merchantPrivateKey\n * );\n *\n * res.set(response.header).json(response.body);\n *\n * @example\n * // With error status\n * const response = buildWebhookResponse(\n * WebhookResponseStatus.FAILED,\n * merchantPrivateKey\n * );\n * // Waffo will retry the notification\n *\n * @see {@link buildSuccessResponse} for shorthand success response\n * @see {@link buildFailedResponse} for shorthand failure response\n */\nexport function buildWebhookResponse(\n status: WebhookResponseStatus,\n merchantPrivateKey: string,\n): WebhookResponse {\n const body: WebhookResponseBody = {\n message: status,\n };\n\n const bodyString = JSON.stringify(body);\n const signature = signForRSA(bodyString, merchantPrivateKey);\n\n if (!signature) {\n throw new Error(\"Failed to sign webhook response\");\n }\n\n return {\n header: {\n \"Content-Type\": \"application/json\",\n \"X-SIGNATURE\": signature,\n },\n body,\n };\n}\n\n/**\n * Builds a success webhook response (shorthand).\n *\n * Use when the notification was successfully processed.\n * Equivalent to `buildWebhookResponse(WebhookResponseStatus.SUCCESS, merchantPrivateKey)`.\n *\n * @param {string} merchantPrivateKey - Merchant's private key (Base64 encoded PKCS8 DER)\n * @returns {WebhookResponse} Response with SUCCESS status\n * @throws {Error} \"Failed to sign webhook response\" when signing fails\n *\n * @example\n * // After successful processing\n * const response = buildSuccessResponse(merchantPrivateKey);\n * res.set(response.header).json(response.body);\n *\n * @see {@link buildFailedResponse} for failure responses\n */\nexport function buildSuccessResponse(\n merchantPrivateKey: string,\n): WebhookResponse {\n return buildWebhookResponse(\n WebhookResponseStatus.SUCCESS,\n merchantPrivateKey,\n );\n}\n\n/**\n * Builds a failed webhook response (shorthand).\n *\n * Use when notification processing failed (database error, validation error, etc.).\n * **Waffo will retry the notification within 24 hours using exponential backoff.**\n *\n * Equivalent to `buildWebhookResponse(WebhookResponseStatus.FAILED, merchantPrivateKey)`.\n *\n * @param {string} merchantPrivateKey - Merchant's private key (Base64 encoded PKCS8 DER)\n * @returns {WebhookResponse} Response with FAILED status\n * @throws {Error} \"Failed to sign webhook response\" when signing fails\n *\n * @example\n * // When processing fails\n * try {\n * await processNotification(notification);\n * return buildSuccessResponse(merchantPrivateKey);\n * } catch (error) {\n * console.error('Processing failed:', error);\n * return buildFailedResponse(merchantPrivateKey);\n * // Waffo will retry later\n * }\n *\n * @see {@link buildSuccessResponse} for success responses\n */\nexport function buildFailedResponse(\n merchantPrivateKey: string,\n): WebhookResponse {\n return buildWebhookResponse(WebhookResponseStatus.FAILED, merchantPrivateKey);\n}\n\n/**\n * Extracts the event type from a webhook notification.\n *\n * Accepts either a parsed notification object or raw JSON string.\n *\n * @param {AnyWebhookNotification | string} notification - Parsed object or raw JSON\n * @returns {WebhookEventType | undefined} Event type, or `undefined` if invalid\n *\n * @example\n * // From parsed notification\n * const eventType = getWebhookEventType(notification);\n * // => 'PAYMENT_NOTIFICATION'\n *\n * @example\n * // From raw JSON string\n * const eventType = getWebhookEventType(requestBody);\n *\n * switch (eventType) {\n * case WebhookEventType.PAYMENT_NOTIFICATION:\n * handlePayment(notification);\n * break;\n * case WebhookEventType.REFUND_NOTIFICATION:\n * handleRefund(notification);\n * break;\n * }\n *\n * @see {@link WebhookEventType} for available event types\n */\nexport function getWebhookEventType(\n notification: AnyWebhookNotification | string,\n): WebhookEventType | undefined {\n try {\n const parsed =\n typeof notification === \"string\"\n ? (JSON.parse(notification) as AnyWebhookNotification)\n : notification;\n\n return parsed.eventType as WebhookEventType;\n } catch {\n return undefined;\n }\n}\n\n/**\n * Type guard: checks if notification is a payment notification.\n *\n * Payment notifications are sent when a one-time/direct payment order status changes.\n * When this returns `true`, TypeScript narrows the type to {@link PaymentNotification}.\n *\n * @param {AnyWebhookNotification} notification - Notification to check\n * @returns {boolean} `true` if payment notification\n *\n * @example\n * if (isPaymentNotification(notification)) {\n * // TypeScript knows this is PaymentNotification\n * const { orderStatus, acquiringOrderId } = notification.result;\n * console.log(`Order ${acquiringOrderId}: ${orderStatus}`);\n * }\n *\n * @see {@link PaymentNotification} for the notification structure\n */\nexport function isPaymentNotification(\n notification: AnyWebhookNotification,\n): notification is PaymentNotification {\n return notification.eventType === WebhookEventType.PAYMENT_NOTIFICATION;\n}\n\n/**\n * Type guard: checks if notification is a refund notification.\n *\n * Refund notifications are sent when a refund order status changes.\n * When this returns `true`, TypeScript narrows the type to {@link RefundNotification}.\n *\n * @param {AnyWebhookNotification} notification - Notification to check\n * @returns {boolean} `true` if refund notification\n *\n * @example\n * if (isRefundNotification(notification)) {\n * // TypeScript knows this is RefundNotification\n * const { refundStatus, refundAmount } = notification.result;\n * console.log(`Refund status: ${refundStatus}, amount: ${refundAmount}`);\n * }\n *\n * @see {@link RefundNotification} for the notification structure\n */\nexport function isRefundNotification(\n notification: AnyWebhookNotification,\n): notification is RefundNotification {\n return notification.eventType === WebhookEventType.REFUND_NOTIFICATION;\n}\n\n/**\n * Type guard: checks if notification is a subscription status notification.\n *\n * Subscription status notifications are sent when subscription status changes\n * (ACTIVE, MERCHANT_CANCELLED, CHANNEL_CANCELLED, EXPIRED).\n * When this returns `true`, TypeScript narrows the type to {@link SubscriptionStatusNotification}.\n *\n * @param {AnyWebhookNotification} notification - Notification to check\n * @returns {boolean} `true` if subscription status notification\n *\n * @example\n * if (isSubscriptionStatusNotification(notification)) {\n * // TypeScript knows this is SubscriptionStatusNotification\n * const { subscriptionStatus, subscriptionId } = notification.result;\n * console.log(`Subscription ${subscriptionId}: ${subscriptionStatus}`);\n * }\n *\n * @see {@link SubscriptionStatusNotification} for the notification structure\n */\nexport function isSubscriptionStatusNotification(\n notification: AnyWebhookNotification,\n): notification is SubscriptionStatusNotification {\n return (\n notification.eventType ===\n SubscriptionEventType.SUBSCRIPTION_STATUS_NOTIFICATION\n );\n}\n\n/**\n * Type guard: checks if notification is a subscription payment notification.\n *\n * Subscription payment notifications are sent when a recurring payment is processed.\n * **Note:** Uses the same `PAYMENT_NOTIFICATION` event type as regular payments,\n * but includes `subscriptionId` in the result to distinguish them.\n *\n * When this returns `true`, TypeScript narrows the type to {@link SubscriptionPaymentNotification}.\n *\n * @param {AnyWebhookNotification} notification - Notification to check\n * @returns {boolean} `true` if subscription payment notification\n *\n * @example\n * if (isSubscriptionPaymentNotification(notification)) {\n * // TypeScript knows this is SubscriptionPaymentNotification\n * const { orderStatus, subscriptionInfo } = notification.result;\n * console.log(`Period ${subscriptionInfo.period}: ${orderStatus}`);\n * }\n *\n * @see {@link SubscriptionPaymentNotification} for the notification structure\n * @see {@link isPaymentNotification} for regular payment notifications\n */\nexport function isSubscriptionPaymentNotification(\n notification: AnyWebhookNotification,\n): notification is SubscriptionPaymentNotification {\n // Subscription payment uses PAYMENT_NOTIFICATION same as acquiring\n // Check for subscriptionId in result to distinguish from acquiring payment\n return (\n notification.eventType === SubscriptionEventType.PAYMENT_NOTIFICATION &&\n \"subscriptionId\" in notification.result\n );\n}\n","/**\n * @fileoverview HTTP Client for Waffo API Communication\n * @module core/httpClient\n *\n * Low-level HTTP client for communicating with the Waffo Payment Platform API.\n *\n * **Features:**\n * - Request signing using RSA-SHA256 algorithm\n * - Response signature verification for integrity\n * - Automatic timeout handling with AbortController\n * - Error handling and response parsing\n *\n * This client is used internally by all resource classes but can also be\n * accessed directly via `waffo.httpClient` for custom API requests.\n *\n * @see {@link Waffo} for the main SDK class\n * @see {@link ApiResponse} for the response format\n *\n * @example\n * // Direct usage through Waffo instance\n * const result = await waffo.httpClient.post('/custom/endpoint', {\n * body: { customField: 'value' },\n * });\n * if (result.success) {\n * console.log('Response:', result.data);\n * }\n */\n\nimport {\n WaffoConfig,\n RequestOptions,\n ApiResponse,\n HttpStatusCode,\n Environment,\n EnvironmentUrls,\n EnvironmentPublicKeys,\n Logger,\n} from \"../types\";\nimport { signForRSA, verify } from \"../utils\";\n\n/**\n * Internal configuration for HttpClient after processing WaffoConfig.\n *\n * @interface HttpClientConfig\n * @internal\n */\ninterface HttpClientConfig {\n /** API key for X-API-KEY header authentication */\n apiKey: string;\n /** Merchant private key for request signing (Base64 encoded PKCS8 DER) */\n privateKey: string;\n /** Waffo public key for response verification (Base64 encoded X509 DER) */\n waffoPublicKey: string;\n /** Resolved API base URL for the environment */\n baseUrl: string;\n /** Request timeout in milliseconds */\n timeout: number;\n /** Optional logger instance for debugging */\n logger?: Logger;\n}\n\n/**\n * Low-level HTTP client for Waffo API communication.\n *\n * Handles all aspects of API communication:\n * - **Request Signing**: Automatically signs request bodies using RSA-SHA256\n * - **Response Verification**: Verifies response signatures for data integrity\n * - **Timeout Handling**: Uses AbortController for reliable timeout management\n * - **Error Handling**: Parses errors and wraps them in consistent response format\n *\n * @class HttpClient\n * @internal Primarily for internal SDK use\n *\n * @example\n * // Typically accessed through Waffo instance\n * const result = await waffo.httpClient.post<CustomResponse>('/custom/endpoint', {\n * body: { field: 'value' },\n * });\n *\n * @see {@link ApiResponse} for the response format\n * @see {@link RequestOptions} for request configuration\n */\nexport class HttpClient {\n /** @private */\n private config: HttpClientConfig;\n\n /**\n * Creates an HTTP client instance with the provided SDK configuration.\n *\n * Resolves environment-specific settings such as API base URL and public key.\n *\n * @param {WaffoConfig} config - Waffo SDK configuration object\n * @param {string} config.apiKey - API key assigned by Waffo\n * @param {string} config.privateKey - Merchant private key (Base64 encoded PKCS8 DER)\n * @param {string} [config.waffoPublicKey] - Waffo public key for response verification\n * @param {Environment} [config.environment=Environment.PRODUCTION] - API environment\n * @param {number} [config.timeout=30000] - Request timeout in milliseconds\n * @param {Logger} [config.logger] - Logger instance for debugging\n *\n * @example\n * const client = new HttpClient({\n * apiKey: 'your-api-key',\n * privateKey: 'your-private-key',\n * environment: Environment.SANDBOX,\n * });\n *\n * @see {@link WaffoConfig} for configuration options\n */\n constructor(config: WaffoConfig) {\n const environment = config.environment || Environment.PRODUCTION;\n\n this.config = {\n apiKey: config.apiKey,\n privateKey: config.privateKey,\n waffoPublicKey:\n config.waffoPublicKey || EnvironmentPublicKeys[environment],\n baseUrl: EnvironmentUrls[environment],\n timeout: config.timeout || 30000,\n logger: config.logger,\n };\n\n this.config.logger?.debug(\"[Waffo SDK] HttpClient initialized\", {\n environment,\n baseUrl: this.config.baseUrl,\n timeout: this.config.timeout,\n });\n }\n\n /**\n * Generates an RSA-SHA256 signature for the request body.\n *\n * @param {string} payload - Request body string to sign (JSON serialized)\n * @returns {string} Base64 encoded RSA-SHA256 signature\n * @throws {Error} \"Failed to generate RSA signature\" when signing fails\n * @private\n */\n private generateSignature(payload: string): string {\n const signature = signForRSA(payload, this.config.privateKey);\n if (!signature) {\n throw new Error(\"Failed to generate RSA signature\");\n }\n return signature;\n }\n\n /**\n * Verifies the RSA-SHA256 signature of the response body.\n *\n * Ensures the response has not been tampered with during transmission.\n *\n * @param {string} responseBody - Response body string (raw JSON)\n * @param {string} signature - X-SIGNATURE header value (Base64 encoded)\n * @returns {boolean} `true` if signature is valid, `false` otherwise\n * @private\n */\n private verifyResponseSignature(\n responseBody: string,\n signature: string,\n ): boolean {\n return verify(responseBody, signature, this.config.waffoPublicKey);\n }\n\n /**\n * Sends an HTTP POST request with automatic signing and verification.\n *\n * **Request Flow:**\n * 1. Serializes the request body to JSON\n * 2. Signs the request body using RSA-SHA256\n * 3. Sends the request with X-API-KEY and X-SIGNATURE headers\n * 4. Verifies the response signature using Waffo's public key\n * 5. Parses and returns the response in standardized format\n *\n * **Error Handling:**\n * - Network errors: `{ success: false, error: message }`\n * - Timeout: status code 408 (REQUEST_TIMEOUT)\n * - Invalid signature: returns error\n * - Business errors (code !== \"0\"): parsed and returned as errors\n *\n * @template T - Expected response data type\n * @template B - Request body type (must extend object)\n *\n * @param {string} endpoint - API endpoint path (e.g., '/order/create')\n * @param {RequestOptions<B>} [options={}] - Request options\n * @param {B} [options.body] - Request body object (will be JSON serialized)\n * @param {Record<string, string>} [options.headers] - Additional request headers\n *\n * @returns {Promise<ApiResponse<T>>} Response object with success status and data/error\n *\n * @example\n * // Make a POST request\n * const result = await httpClient.post<CreateOrderData>('/order/create', {\n * body: {\n * paymentRequestId: 'req-123',\n * merchantOrderId: 'order-456',\n * // ... other fields\n * },\n * });\n *\n * if (result.success) {\n * console.log('Order created:', result.data.acquiringOrderId);\n * } else {\n * console.error('Error:', result.error);\n * }\n *\n * @example\n * // Handle timeout errors\n * const result = await httpClient.post('/order/create', { body: params });\n * if (!result.success && result.statusCode === HttpStatusCode.REQUEST_TIMEOUT) {\n * console.log('Request timed out, please retry');\n * }\n *\n * @see {@link ApiResponse} for the response format\n * @see {@link RequestOptions} for request options\n */\n async post<T, B extends object = Record<string, unknown>>(\n endpoint: string,\n options: RequestOptions<B> = {},\n ): Promise<ApiResponse<T>> {\n const { body, headers = {} } = options;\n const payload = body ? JSON.stringify(body) : \"\";\n const signature = this.generateSignature(payload);\n const url = `${this.config.baseUrl}${endpoint}`;\n\n this.config.logger?.debug(\"[Waffo SDK] Sending request\", {\n method: \"POST\",\n url,\n body: body,\n });\n\n // Setup timeout using AbortController\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), this.config.timeout);\n\n try {\n const response = await fetch(url, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n \"X-API-KEY\": this.config.apiKey,\n \"X-SIGNATURE\": signature,\n ...headers,\n },\n body: payload || undefined,\n signal: controller.signal,\n });\n\n clearTimeout(timeoutId);\n\n const statusCode = response.status as HttpStatusCode;\n const responseSignature = response.headers.get(\"X-SIGNATURE\");\n const responseBody = await response.text();\n\n this.config.logger?.debug(\"[Waffo SDK] Received response\", {\n statusCode,\n hasSignature: !!responseSignature,\n body: responseBody,\n });\n\n // Verify response signature\n if (!responseSignature) {\n this.config.logger?.warn(\n \"[Waffo SDK] Missing X-SIGNATURE in response headers\",\n );\n return {\n success: false,\n statusCode,\n error: \"Missing X-SIGNATURE in response headers\",\n };\n }\n\n const isValid = this.verifyResponseSignature(\n responseBody,\n responseSignature,\n );\n if (!isValid) {\n this.config.logger?.warn(\"[Waffo SDK] Invalid response signature\");\n return {\n success: false,\n statusCode,\n error: \"Invalid response signature\",\n };\n }\n\n // Parse response body - Waffo API returns { code, msg, data } format or raw data T\n let parsedBody: { code?: string; msg?: string; data?: T } | T | null =\n null;\n try {\n parsedBody = JSON.parse(responseBody);\n } catch {\n // If parsing fails, continue with generic error\n }\n\n // Helper to check if parsed body is Waffo API response format\n const isWaffoFormat = (\n body: typeof parsedBody,\n ): body is { code?: string; msg?: string; data?: T } => {\n return body !== null && typeof body === \"object\" && \"code\" in body;\n };\n\n if (!response.ok) {\n // Include detailed error message from API response\n const errorMsg =\n isWaffoFormat(parsedBody) && parsedBody.msg\n ? `[${parsedBody.code}] ${parsedBody.msg}`\n : `HTTP ${response.status}: ${response.statusText}`;\n this.config.logger?.error(\"[Waffo SDK] HTTP error\", {\n statusCode,\n error: errorMsg,\n });\n return {\n success: false,\n statusCode,\n error: errorMsg,\n };\n }\n\n // Check if response indicates business error (code !== \"0\")\n if (\n isWaffoFormat(parsedBody) &&\n parsedBody.code &&\n parsedBody.code !== \"0\"\n ) {\n const errorMsg = `[${parsedBody.code}] ${parsedBody.msg || \"Unknown error\"}`;\n this.config.logger?.error(\"[Waffo SDK] Business error\", {\n code: parsedBody.code,\n msg: parsedBody.msg,\n });\n return {\n success: false,\n statusCode,\n error: errorMsg,\n };\n }\n\n // Extract the actual business data from the nested structure\n const data = isWaffoFormat(parsedBody)\n ? parsedBody.data\n : (parsedBody as T);\n this.config.logger?.debug(\"[Waffo SDK] Request successful\", { data });\n return { success: true, statusCode, data };\n } catch (error) {\n clearTimeout(timeoutId);\n\n // Check for timeout (abort) error\n if (error instanceof Error && error.name === \"AbortError\") {\n this.config.logger?.error(\"[Waffo SDK] Request timeout\", {\n timeout: this.config.timeout,\n url,\n });\n return {\n success: false,\n statusCode: HttpStatusCode.REQUEST_TIMEOUT,\n error: `Request timeout after ${this.config.timeout}ms`,\n };\n }\n\n const errorMessage =\n error instanceof Error ? error.message : \"Unknown error\";\n this.config.logger?.error(\"[Waffo SDK] Request failed\", {\n error: errorMessage,\n url,\n });\n return {\n success: false,\n statusCode: HttpStatusCode.INTERNAL_SERVER_ERROR,\n error: errorMessage,\n };\n }\n }\n}\n","/**\n * @fileoverview Webhook Handler for Waffo Webhook Notifications\n * @module core/webhook\n *\n * Provides the WebhookHandler class for processing incoming webhook\n * notifications from the Waffo Payment Platform.\n *\n * **Features:**\n * - Signature verification using Waffo's public key\n * - Response signing using merchant's private key\n * - Event type routing to appropriate handlers\n * - Error handling and response formatting\n *\n * @see {@link Waffo} for the main SDK class\n * @see {@link WebhookHandlerOptions} for handler configuration\n *\n * @example\n * // Express.js webhook endpoint\n * app.post('/webhook', async (req, res) => {\n * const result = await waffo.webhook.handle(\n * JSON.stringify(req.body),\n * req.headers['x-signature'],\n * {\n * onPayment: async ({ notification }) => {\n * console.log('Payment:', notification.result.orderStatus);\n * },\n * onRefund: async ({ notification }) => {\n * console.log('Refund:', notification.result.refundStatus);\n * },\n * }\n * );\n * res.set(result.response.header).json(result.response.body);\n * });\n */\n\nimport {\n WaffoConfig,\n WebhookHandlerOptions,\n WebhookHandlerResult,\n WebhookResponseStatus,\n Environment,\n EnvironmentPublicKeys,\n} from \"../types\";\nimport {\n verifyWebhookSignature,\n buildWebhookResponse,\n isPaymentNotification,\n isRefundNotification,\n isSubscriptionStatusNotification,\n isSubscriptionPaymentNotification,\n} from \"../utils\";\n\n/**\n * Internal configuration for WebhookHandler.\n *\n * @interface WebhookHandlerInternalConfig\n * @internal\n */\ninterface WebhookHandlerInternalConfig {\n /** Merchant private key for signing responses (Base64 encoded PKCS8 DER) */\n privateKey: string;\n /** Waffo public key for verifying requests (Base64 encoded X509 DER) */\n waffoPublicKey: string;\n}\n\n/**\n * Handles incoming webhook notifications from the Waffo Payment Platform.\n *\n * **Features:**\n * - Signature verification using Waffo's public key\n * - Event routing to appropriate handlers based on event type\n * - Response signing using merchant's private key\n * - Consistent error handling and response formatting\n *\n * Accessed via `waffo.webhook` after SDK initialization.\n *\n * @class WebhookHandler\n *\n * @example\n * // Handle different notification types\n * const result = await waffo.webhook.handle(requestBody, signature, {\n * onPayment: async (ctx) => {\n * const { orderStatus, acquiringOrderId } = ctx.notification.result;\n * if (orderStatus === 'PAY_SUCCESS') {\n * await fulfillOrder(acquiringOrderId);\n * }\n * },\n * onRefund: async (ctx) => {\n * const { refundStatus, acquiringRefundOrderId } = ctx.notification.result;\n * await updateRefundStatus(acquiringRefundOrderId, refundStatus);\n * },\n * onSubscriptionStatus: async (ctx) => {\n * const { subscriptionStatus, subscriptionId } = ctx.notification.result;\n * await updateSubscription(subscriptionId, subscriptionStatus);\n * },\n * onError: async (error) => {\n * console.error('Webhook error:', error.message);\n * },\n * });\n *\n * @see {@link WebhookHandlerOptions} for handler configuration\n * @see {@link WebhookHandlerResult} for return type\n */\nexport class WebhookHandler {\n /** @private */\n private config: WebhookHandlerInternalConfig;\n\n /**\n * Creates a webhook handler instance.\n *\n * Initializes the handler with SDK configuration and resolves\n * environment-specific settings such as Waffo's public key.\n *\n * @param {WaffoConfig} config - Waffo SDK configuration object\n * @param {string} config.privateKey - Merchant private key (Base64 encoded PKCS8 DER)\n * @param {string} [config.waffoPublicKey] - Waffo public key for request verification\n * @param {Environment} [config.environment=Environment.PRODUCTION] - API environment\n *\n * @example\n * // Typically created automatically by Waffo SDK\n * const waffo = new Waffo(config);\n * // Access via: waffo.webhook\n *\n * @see {@link WaffoConfig} for configuration options\n */\n constructor(config: WaffoConfig) {\n const environment = config.environment || Environment.PRODUCTION;\n\n this.config = {\n privateKey: config.privateKey,\n waffoPublicKey:\n config.waffoPublicKey || EnvironmentPublicKeys[environment],\n };\n }\n\n /**\n * Processes an incoming webhook notification from Waffo.\n *\n * **Processing Flow:**\n * 1. Verifies the request signature using Waffo's public key\n * 2. Parses the notification and determines its type\n * 3. Routes to the appropriate handler based on event type\n * 4. Returns a signed response to acknowledge receipt\n *\n * **Supported Event Types:**\n * - `PAYMENT_NOTIFICATION` - Payment order status changes\n * - `REFUND_NOTIFICATION` - Refund status changes\n * - `SUBSCRIPTION_STATUS_NOTIFICATION` - Subscription status changes\n * - `PAYMENT_NOTIFICATION` with subscriptionId - Subscription payments\n *\n * @param {string} requestBody - Raw request body string (JSON)\n * @param {string} signature - X-SIGNATURE header value from Waffo\n * @param {WebhookHandlerOptions} options - Handler configuration options\n *\n * @returns {Promise<WebhookHandlerResult>} Result with success status and signed response\n *\n * @example\n * // Express.js endpoint\n * app.post('/webhook', async (req, res) => {\n * const result = await waffo.webhook.handle(\n * JSON.stringify(req.body),\n * req.headers['x-signature'],\n * {\n * onPayment: async ({ notification }) => {\n * const { orderStatus, acquiringOrderId } = notification.result;\n * await db.orders.updateStatus(acquiringOrderId, orderStatus);\n * },\n * onRefund: async ({ notification }) => {\n * const { refundStatus } = notification.result;\n * await db.refunds.update(notification.result);\n * },\n * onSubscriptionStatus: async ({ notification }) => {\n * await db.subscriptions.update(notification.result);\n * },\n * onSubscriptionPayment: async ({ notification }) => {\n * await db.payments.create(notification.result);\n * },\n * onError: async (error) => {\n * logger.error('Webhook error', error);\n * },\n * }\n * );\n *\n * // Return signed response to Waffo\n * res.set(result.response.header).json(result.response.body);\n * });\n *\n * @example\n * // Next.js API route\n * export async function POST(request: Request) {\n * const body = await request.text();\n * const signature = request.headers.get('x-signature') || '';\n *\n * const result = await waffo.webhook.handle(body, signature, {\n * onPayment: async (ctx) => { ... },\n * });\n *\n * return new Response(JSON.stringify(result.response.body), {\n * headers: result.response.header,\n * });\n * }\n *\n * @see {@link WebhookHandlerOptions} for handler configuration\n * @see {@link WebhookHandlerResult} for return type\n */\n async handle(\n requestBody: string,\n signature: string,\n options: WebhookHandlerOptions = {},\n ): Promise<WebhookHandlerResult> {\n const {\n onPayment,\n onRefund,\n onSubscriptionStatus,\n onSubscriptionPayment,\n onError,\n } = options;\n\n try {\n // Verify webhook signature\n const verificationResult = verifyWebhookSignature(\n requestBody,\n signature,\n this.config.waffoPublicKey,\n );\n\n if (!verificationResult.isValid) {\n const error = new Error(\n verificationResult.error || \"Signature verification failed\",\n );\n await onError?.(error);\n return {\n success: false,\n response: buildWebhookResponse(\n WebhookResponseStatus.FAILED,\n this.config.privateKey,\n ),\n error: verificationResult.error,\n };\n }\n\n const { notification, eventType } = verificationResult;\n\n if (!notification || !eventType) {\n const error = new Error(\"Invalid notification format\");\n await onError?.(error);\n return {\n success: false,\n response: buildWebhookResponse(\n WebhookResponseStatus.FAILED,\n this.config.privateKey,\n ),\n error: \"Invalid notification format\",\n };\n }\n\n // Route to appropriate handler based on event type\n if (isSubscriptionPaymentNotification(notification)) {\n // Subscription payment notification (uses PAYMENT_NOTIFICATION event type)\n await onSubscriptionPayment?.({\n notification,\n rawBody: requestBody,\n eventType,\n });\n } else if (isPaymentNotification(notification)) {\n // Regular payment notification\n await onPayment?.({\n notification,\n rawBody: requestBody,\n eventType,\n });\n } else if (isRefundNotification(notification)) {\n // Refund notification\n await onRefund?.({\n notification,\n rawBody: requestBody,\n eventType,\n });\n } else if (isSubscriptionStatusNotification(notification)) {\n // Subscription status notification\n await onSubscriptionStatus?.({\n notification,\n rawBody: requestBody,\n eventType,\n });\n }\n\n // Return success response\n return {\n success: true,\n response: buildWebhookResponse(\n WebhookResponseStatus.SUCCESS,\n this.config.privateKey,\n ),\n };\n } catch (error) {\n const err = error instanceof Error ? error : new Error(String(error));\n await onError?.(err);\n return {\n success: false,\n response: buildWebhookResponse(\n WebhookResponseStatus.FAILED,\n this.config.privateKey,\n ),\n error: err.message,\n };\n }\n }\n}\n","/**\n * @fileoverview Base Resource Class\n * @module resources/base\n *\n * Abstract base class for all API resource classes.\n * Defines common structure and dependencies shared by all resources.\n *\n * **Resource Inheritance:**\n * - {@link OrderResource} - Order operations\n * - {@link RefundResource} - Refund operations\n * - {@link SubscriptionResource} - Subscription operations\n * - {@link MerchantConfigResource} - Merchant config operations\n * - {@link PayMethodConfigResource} - Payment method config operations\n *\n * @internal For internal SDK use only\n */\n\nimport { HttpClient } from \"../core\";\n\n/**\n * Abstract base class for all API resources in the Waffo SDK.\n *\n * Provides common foundation for all resource classes:\n * - HTTP client reference for making API requests\n * - Base path configuration for API endpoints\n *\n * @abstract\n * @class BaseResource\n * @internal For internal SDK use only\n *\n * @see {@link OrderResource} for order operations\n * @see {@link RefundResource} for refund operations\n * @see {@link SubscriptionResource} for subscription operations\n */\nexport abstract class BaseResource {\n /**\n * HTTP client for making API requests with automatic signing.\n * @protected\n */\n protected client: HttpClient;\n\n /**\n * Base path for API endpoints (e.g., '/order', '/refund').\n * @protected\n */\n protected basePath: string;\n\n /**\n * Initializes the base resource with HTTP client and base path.\n *\n * @param {HttpClient} client - HTTP client instance\n * @param {string} basePath - Base path for API endpoints\n * @protected\n */\n constructor(client: HttpClient, basePath: string) {\n this.client = client;\n this.basePath = basePath;\n }\n}\n","/**\n * @fileoverview Order Resource Implementation\n * @module resources/order/resource\n *\n * Implements the Order resource class providing all order-related API operations.\n *\n * @see {@link OrderResource} for the main class\n * @see {@link CreateOrderParams} for order creation parameters\n *\n * @example\n * // Access via Waffo instance\n * const result = await waffo.order.create({\n * paymentRequestId: 'req-123',\n * merchantOrderId: 'order-456',\n * orderCurrency: 'USD',\n * orderAmount: '10.00',\n * // ... other required fields\n * });\n */\n\nimport { ApiResponse } from \"../../types\";\nimport { HttpClient } from \"../../core\";\nimport { BaseResource } from \"../base\";\nimport {\n CreateOrderParams,\n CreateOrderData,\n InquiryOrderParams,\n InquiryOrderData,\n CancelOrderParams,\n CancelOrderData,\n CaptureOrderParams,\n CaptureOrderData,\n RefundOrderParams,\n} from \"./types\";\nimport { CreateRefundData } from \"../refund/types\";\n\n/**\n * Order resource for all payment order operations.\n *\n * Provides methods for creating, querying, canceling, refunding,\n * and capturing payment orders.\n *\n * @class OrderResource\n * @extends BaseResource\n *\n * @example\n * // Create an order\n * const createResult = await waffo.order.create({ ... });\n *\n * // Query order status\n * const inquiryResult = await waffo.order.inquiry({\n * acquiringOrderId: createResult.data.acquiringOrderId,\n * });\n *\n * // Request a refund\n * const refundResult = await waffo.order.refund({\n * refundRequestId: 'refund-123',\n * acquiringOrderId: createResult.data.acquiringOrderId,\n * merchantId: 'M001',\n * refundAmount: '5.00',\n * refundReason: 'Customer request',\n * });\n */\nexport class OrderResource extends BaseResource {\n /**\n * Creates an Order resource instance.\n * @param {HttpClient} client - HTTP client instance\n */\n constructor(client: HttpClient) {\n super(client, \"/order\");\n }\n\n /**\n * Creates a new payment order.\n *\n * Supports multiple payment methods including e-wallet, credit card,\n * bank transfer, and more.\n *\n * @param {CreateOrderParams} params - Order creation parameters\n * @returns {Promise<ApiResponse<CreateOrderData>>} Order creation result\n *\n * @example\n * const result = await waffo.order.create({\n * paymentRequestId: 'req-' + Date.now(),\n * merchantOrderId: 'order-456',\n * orderCurrency: 'IDR',\n * orderAmount: '100000',\n * orderDescription: 'Product purchase',\n * merchantInfo: { merchantId: 'M001' },\n * userInfo: {\n * userId: 'U001',\n * userEmail: 'user@example.com',\n * userTerminal: 'WEB',\n * },\n * goodsInfo: {\n * goodsName: 'Premium Plan',\n * goodsUrl: 'https://example.com/product',\n * },\n * paymentInfo: {\n * productName: 'ONE_TIME_PAYMENT',\n * payMethodName: 'DANA',\n * },\n * notifyUrl: 'https://example.com/webhook',\n * successRedirectUrl: 'https://example.com/success',\n * });\n *\n * if (result.success) {\n * // Redirect user to payment page\n * const redirectUrl = result.data.orderAction?.webUrl;\n * }\n *\n * @see {@link CreateOrderParams} for all available parameters\n */\n async create(\n params: CreateOrderParams,\n ): Promise<ApiResponse<CreateOrderData>> {\n const body = {\n ...params,\n orderRequestedAt: params.orderRequestedAt ?? new Date().toISOString(),\n };\n return this.client.post<CreateOrderData, CreateOrderParams>(\n `${this.basePath}/create`,\n { body },\n );\n }\n\n /**\n * Queries current order status and details.\n *\n * Provide either `paymentRequestId` or `acquiringOrderId` to identify the order.\n *\n * @param {InquiryOrderParams} params - Query parameters\n * @returns {Promise<ApiResponse<InquiryOrderData>>} Order details\n *\n * @example\n * // Query by acquiring order ID\n * const result = await waffo.order.inquiry({\n * acquiringOrderId: 'ACQ123456789',\n * });\n *\n * if (result.success) {\n * console.log('Order status:', result.data.orderStatus);\n * console.log('Amount:', result.data.orderAmount, result.data.orderCurrency);\n * }\n *\n * @example\n * // Query by payment request ID\n * const result = await waffo.order.inquiry({\n * paymentRequestId: 'req-123',\n * });\n *\n * @see {@link InquiryOrderData} for response structure\n */\n async inquiry(\n params: InquiryOrderParams,\n ): Promise<ApiResponse<InquiryOrderData>> {\n return this.client.post<InquiryOrderData, InquiryOrderParams>(\n `${this.basePath}/inquiry`,\n { body: params },\n );\n }\n\n /**\n * Cancels an unpaid order.\n *\n * Only orders with status `AUTHORIZATION_REQUIRED` or `PAY_IN_PROGRESS` can be canceled.\n *\n * @param {CancelOrderParams} params - Cancel parameters\n * @returns {Promise<ApiResponse<CancelOrderData>>} Cancellation result\n *\n * @example\n * const result = await waffo.order.cancel({\n * acquiringOrderId: 'ACQ123456789',\n * merchantId: 'M001',\n * });\n *\n * if (result.success) {\n * console.log('Order canceled:', result.data.orderStatus);\n * // => 'ORDER_CLOSE'\n * }\n *\n * @see {@link CancelOrderData} for response structure\n */\n async cancel(\n params: CancelOrderParams,\n ): Promise<ApiResponse<CancelOrderData>> {\n const body = {\n ...params,\n orderRequestedAt: params.orderRequestedAt ?? new Date().toISOString(),\n };\n return this.client.post<CancelOrderData, CancelOrderParams>(\n `${this.basePath}/cancel`,\n { body },\n );\n }\n\n /**\n * Initiates a refund request for a paid order.\n *\n * Supports both full and partial refunds. Multiple partial refunds can be\n * made until the total refunded amount equals the original order amount.\n *\n * @param {RefundOrderParams} params - Refund parameters\n * @returns {Promise<ApiResponse<CreateRefundData>>} Refund request result\n *\n * @example\n * // Full refund\n * const result = await waffo.order.refund({\n * refundRequestId: 'refund-' + Date.now(),\n * acquiringOrderId: 'ACQ123456789',\n * merchantId: 'M001',\n * refundAmount: '100000',\n * refundReason: 'Customer request',\n * refundNotifyUrl: 'https://example.com/refund-webhook',\n * });\n *\n * if (result.success) {\n * console.log('Refund status:', result.data.refundStatus);\n * console.log('Remaining refundable:', result.data.remainingRefundAmount);\n * }\n *\n * @example\n * // Partial refund\n * const result = await waffo.order.refund({\n * refundRequestId: 'refund-partial-123',\n * acquiringOrderId: 'ACQ123456789',\n * merchantId: 'M001',\n * refundAmount: '50000', // Partial amount\n * refundReason: 'Partial refund',\n * });\n *\n * @see {@link CreateRefundData} for response structure\n */\n async refund(\n params: RefundOrderParams,\n ): Promise<ApiResponse<CreateRefundData>> {\n const body = {\n ...params,\n requestedAt: params.requestedAt ?? new Date().toISOString(),\n };\n return this.client.post<CreateRefundData, RefundOrderParams>(\n `${this.basePath}/refund`,\n { body },\n );\n }\n\n /**\n * Captures an authorized payment (manualCapture mode only).\n *\n * Converts an authorization to an actual charge. Supports both\n * partial and full capture amounts.\n *\n * @param {CaptureOrderParams} params - Capture parameters\n * @returns {Promise<ApiResponse<CaptureOrderData>>} Capture result\n *\n * @example\n * // Full capture\n * const result = await waffo.order.capture({\n * acquiringOrderId: 'ACQ123456789',\n * merchantId: 'M001',\n * captureAmount: '100000', // Full authorized amount\n * });\n *\n * if (result.success) {\n * console.log('Capture status:', result.data.orderStatus);\n * }\n *\n * @example\n * // Partial capture\n * const result = await waffo.order.capture({\n * acquiringOrderId: 'ACQ123456789',\n * merchantId: 'M001',\n * captureAmount: '75000', // Capture less than authorized\n * });\n *\n * @see {@link CaptureOrderData} for response structure\n */\n async capture(\n params: CaptureOrderParams,\n ): Promise<ApiResponse<CaptureOrderData>> {\n const body = {\n ...params,\n captureRequestedAt: params.captureRequestedAt ?? new Date().toISOString(),\n };\n return this.client.post<CaptureOrderData, CaptureOrderParams>(\n `${this.basePath}/capture`,\n { body },\n );\n }\n}\n","/**\n * @fileoverview Refund Resource Implementation\n * @module resources/refund/resource\n *\n * Implements the Refund resource class providing refund inquiry operations.\n *\n * @see {@link RefundResource} for the main class\n * @see {@link RefundInquiryParams} for inquiry parameters\n *\n * @example\n * // Query refund status\n * const result = await waffo.refund.inquiry({\n * refundRequestId: 'refund-123',\n * });\n */\n\nimport { ApiResponse } from \"../../types\";\nimport { HttpClient } from \"../../core\";\nimport { BaseResource } from \"../base\";\nimport { RefundInquiryParams, InquiryRefundData } from \"./types\";\n\n/**\n * Refund resource for querying refund status and details.\n *\n * Note: Refund creation is done through {@link OrderResource.refund}.\n *\n * @class RefundResource\n * @extends BaseResource\n *\n * @example\n * const result = await waffo.refund.inquiry({\n * acquiringRefundOrderId: 'REF123456789',\n * });\n *\n * if (result.success) {\n * console.log('Refund status:', result.data.refundStatus);\n * }\n */\nexport class RefundResource extends BaseResource {\n /**\n * Creates a Refund resource instance.\n * @param {HttpClient} client - HTTP client instance\n */\n constructor(client: HttpClient) {\n super(client, \"/refund\");\n }\n\n /**\n * Queries current refund status and details.\n *\n * Provide either `refundRequestId` or `acquiringRefundOrderId` to identify the refund.\n *\n * @param {RefundInquiryParams} params - Query parameters\n * @returns {Promise<ApiResponse<InquiryRefundData>>} Refund details\n *\n * @example\n * // Query by refund request ID\n * const result = await waffo.refund.inquiry({\n * refundRequestId: 'refund-123',\n * });\n *\n * if (result.success) {\n * const { refundStatus, refundAmount, remainingRefundAmount } = result.data;\n * console.log(`Status: ${refundStatus}`);\n * console.log(`Refunded: ${refundAmount}`);\n * console.log(`Remaining: ${remainingRefundAmount}`);\n * }\n *\n * @example\n * // Query by acquiring refund order ID\n * const result = await waffo.refund.inquiry({\n * acquiringRefundOrderId: 'REF123456789',\n * });\n *\n * @see {@link InquiryRefundData} for response structure\n */\n async inquiry(\n params: RefundInquiryParams,\n ): Promise<ApiResponse<InquiryRefundData>> {\n return this.client.post<InquiryRefundData, RefundInquiryParams>(\n `${this.basePath}/inquiry`,\n { body: params },\n );\n }\n}\n","/**\n * @fileoverview Subscription Resource Implementation\n * @module resources/subscription/resource\n *\n * Implements the Subscription resource class providing all subscription-related\n * API operations for recurring payments.\n *\n * @see {@link SubscriptionResource} for the main class\n * @see {@link CreateSubscriptionParams} for subscription creation parameters\n *\n * @example\n * // Create a subscription\n * const result = await waffo.subscription.create({\n * subscriptionRequest: 'sub-req-123',\n * currency: 'USD',\n * amount: '9.99',\n * productInfo: {\n * description: 'Monthly Premium',\n * periodType: 'MONTHLY',\n * periodInterval: '1',\n * },\n * // ... other required fields\n * });\n */\n\nimport { ApiResponse } from \"../../types\";\nimport { HttpClient } from \"../../core\";\nimport { BaseResource } from \"../base\";\nimport {\n CreateSubscriptionParams,\n CreateSubscriptionData,\n InquirySubscriptionParams,\n InquirySubscriptionData,\n CancelSubscriptionParams,\n CancelSubscriptionData,\n ManageSubscriptionParams,\n ManageSubscriptionData,\n} from \"./types\";\n\n/**\n * Subscription resource for recurring payment operations.\n *\n * Provides methods for creating, querying, canceling, and managing subscriptions.\n *\n * @class SubscriptionResource\n * @extends BaseResource\n *\n * @example\n * // Full subscription lifecycle\n * const createResult = await waffo.subscription.create({ ... });\n * const inquiryResult = await waffo.subscription.inquiry({\n * subscriptionId: createResult.data.subscriptionId,\n * });\n * const cancelResult = await waffo.subscription.cancel({\n * subscriptionId: createResult.data.subscriptionId,\n * merchantId: 'M001',\n * });\n */\nexport class SubscriptionResource extends BaseResource {\n /**\n * Creates a Subscription resource instance.\n * @param {HttpClient} client - HTTP client instance\n */\n constructor(client: HttpClient) {\n super(client, \"/subscription\");\n }\n\n /**\n * Creates a new subscription signing request for recurring payments.\n *\n * After creation, redirect the user to the signing URL to authorize\n * the recurring payment agreement.\n *\n * @param {CreateSubscriptionParams} params - Subscription creation parameters\n * @returns {Promise<ApiResponse<CreateSubscriptionData>>} Subscription creation result\n *\n * @example\n * const result = await waffo.subscription.create({\n * subscriptionRequest: 'sub-' + Date.now(),\n * currency: 'HKD',\n * amount: '99.00',\n * productInfo: {\n * description: 'Premium Monthly Plan',\n * periodType: 'MONTHLY',\n * periodInterval: '1',\n * numberOfPeriod: '12', // 12 months\n * },\n * merchantInfo: { merchantId: 'M001' },\n * userInfo: {\n * userId: 'U001',\n * userEmail: 'user@example.com',\n * },\n * goodsInfo: {\n * goodsId: 'PREMIUM-PLAN',\n * goodsName: 'Premium Plan',\n * goodsUrl: 'https://example.com/plan',\n * },\n * paymentInfo: {\n * productName: 'SUBSCRIPTION',\n * payMethodName: 'ALIPAY_HK',\n * },\n * notifyUrl: 'https://example.com/webhook',\n * successRedirectUrl: 'https://example.com/success',\n * });\n *\n * if (result.success) {\n * // Redirect user to subscription signing page\n * const signingUrl = result.data.subscriptionAction?.webUrl;\n * }\n *\n * @see {@link CreateSubscriptionData} for response structure\n */\n async create(\n params: CreateSubscriptionParams,\n ): Promise<ApiResponse<CreateSubscriptionData>> {\n const body = {\n ...params,\n requestedAt: params.requestedAt ?? new Date().toISOString(),\n };\n return this.client.post<CreateSubscriptionData, CreateSubscriptionParams>(\n `${this.basePath}/create`,\n { body },\n );\n }\n\n /**\n * Queries subscription details and optionally payment history.\n *\n * @param {InquirySubscriptionParams} params - Query parameters\n * @returns {Promise<ApiResponse<InquirySubscriptionData>>} Subscription details\n *\n * @example\n * // Query subscription status\n * const result = await waffo.subscription.inquiry({\n * subscriptionId: 'SUB123456789',\n * });\n *\n * if (result.success) {\n * console.log('Status:', result.data.subscriptionStatus);\n * console.log('Next payment:', result.data.productInfo.nextPaymentDateTime);\n * }\n *\n * @example\n * // Query with payment history\n * const result = await waffo.subscription.inquiry({\n * subscriptionId: 'SUB123456789',\n * paymentDetails: '1', // Include payment history\n * });\n *\n * if (result.success && result.data.paymentDetails) {\n * result.data.paymentDetails.forEach(payment => {\n * console.log(`Period ${payment.period}: ${payment.orderStatus}`);\n * });\n * }\n *\n * @see {@link InquirySubscriptionData} for response structure\n */\n async inquiry(\n params: InquirySubscriptionParams,\n ): Promise<ApiResponse<InquirySubscriptionData>> {\n return this.client.post<InquirySubscriptionData, InquirySubscriptionParams>(\n `${this.basePath}/inquiry`,\n { body: params },\n );\n }\n\n /**\n * Cancels an active subscription.\n *\n * Once canceled, no further recurring payments will be processed.\n *\n * @param {CancelSubscriptionParams} params - Cancel parameters\n * @returns {Promise<ApiResponse<CancelSubscriptionData>>} Cancellation result\n *\n * @example\n * const result = await waffo.subscription.cancel({\n * subscriptionId: 'SUB123456789',\n * merchantId: 'M001',\n * });\n *\n * if (result.success) {\n * console.log('Subscription canceled:', result.data.orderStatus);\n * // => 'MERCHANT_CANCELLED'\n * }\n *\n * @see {@link CancelSubscriptionData} for response structure\n */\n async cancel(\n params: CancelSubscriptionParams,\n ): Promise<ApiResponse<CancelSubscriptionData>> {\n const body = {\n ...params,\n requestedAt: params.requestedAt ?? new Date().toISOString(),\n };\n return this.client.post<CancelSubscriptionData, CancelSubscriptionParams>(\n `${this.basePath}/cancel`,\n { body },\n );\n }\n\n /**\n * Generates a temporary management URL for users to manage their subscription.\n *\n * The URL allows users to view subscription details and cancel if needed.\n * The URL expires after a certain period (check `expiredAt` in response).\n *\n * @param {ManageSubscriptionParams} params - Management parameters\n * @returns {Promise<ApiResponse<ManageSubscriptionData>>} Management URL and expiration\n *\n * @example\n * const result = await waffo.subscription.manage({\n * subscriptionId: 'SUB123456789',\n * });\n *\n * if (result.success) {\n * console.log('Management URL:', result.data.managementUrl);\n * console.log('Expires at:', result.data.expiredAt);\n * // Send URL to user via email or display in app\n * }\n *\n * @see {@link ManageSubscriptionData} for response structure\n */\n async manage(\n params: ManageSubscriptionParams,\n ): Promise<ApiResponse<ManageSubscriptionData>> {\n return this.client.post<ManageSubscriptionData, ManageSubscriptionParams>(\n `${this.basePath}/manage`,\n { body: params },\n );\n }\n}\n","/**\n * @fileoverview Merchant Config Resource Implementation\n * @module resources/merchantconfig/resource\n *\n * Implements the Merchant Config resource class providing merchant\n * configuration inquiry operations.\n *\n * @see {@link MerchantConfigResource} for the main class\n * @see {@link MerchantConfigInquiryParams} for inquiry parameters\n *\n * @example\n * const result = await waffo.merchantConfig.inquiry({\n * merchantId: 'M001',\n * });\n */\n\nimport { ApiResponse } from \"../../types\";\nimport { HttpClient } from \"../../core\";\nimport { BaseResource } from \"../base\";\nimport {\n MerchantConfigInquiryParams,\n MerchantConfigInquiryData,\n} from \"./types\";\n\n/**\n * Merchant configuration resource for querying transaction limits.\n *\n * Use this to retrieve daily limits, remaining limits, and\n * per-transaction limits for a merchant.\n *\n * @class MerchantConfigResource\n * @extends BaseResource\n *\n * @example\n * const result = await waffo.merchantConfig.inquiry({ merchantId: 'M001' });\n * if (result.success) {\n * console.log('Daily limit:', result.data.totalDailyLimit);\n * console.log('Remaining:', result.data.remainingDailyLimit);\n * }\n */\nexport class MerchantConfigResource extends BaseResource {\n /**\n * Creates a Merchant Config resource instance.\n * @param {HttpClient} client - HTTP client instance\n */\n constructor(client: HttpClient) {\n super(client, \"/merchantconfig\");\n }\n\n /**\n * Queries merchant configuration including transaction limits.\n *\n * @param {MerchantConfigInquiryParams} params - Query parameters\n * @returns {Promise<ApiResponse<MerchantConfigInquiryData>>} Merchant configuration\n *\n * @example\n * const result = await waffo.merchantConfig.inquiry({\n * merchantId: 'M001',\n * });\n *\n * if (result.success) {\n * const { totalDailyLimit, remainingDailyLimit, transactionLimit } = result.data;\n *\n * // Limits are returned as currency -> value maps\n * console.log('Daily limit (USD):', totalDailyLimit?.['USD']);\n * console.log('Remaining (USD):', remainingDailyLimit?.['USD']);\n * console.log('Per transaction (USD):', transactionLimit?.['USD']);\n * }\n *\n * @see {@link MerchantConfigInquiryData} for response structure\n */\n async inquiry(\n params: MerchantConfigInquiryParams,\n ): Promise<ApiResponse<MerchantConfigInquiryData>> {\n return this.client.post<\n MerchantConfigInquiryData,\n MerchantConfigInquiryParams\n >(`${this.basePath}/inquiry`, { body: params });\n }\n}\n","/**\n * @fileoverview Pay Method Config Resource Implementation\n * @module resources/paymethodconfig/resource\n *\n * Implements the Pay Method Config resource class providing payment method\n * configuration inquiry operations.\n *\n * @see {@link PayMethodConfigResource} for the main class\n * @see {@link PayMethodConfigInquiryParams} for inquiry parameters\n *\n * @example\n * const result = await waffo.payMethodConfig.inquiry({\n * merchantId: 'M001',\n * });\n */\n\nimport { ApiResponse } from \"../../types\";\nimport { HttpClient } from \"../../core\";\nimport { BaseResource } from \"../base\";\nimport {\n PayMethodConfigInquiryParams,\n PayMethodConfigInquiryData,\n} from \"./types\";\n\n/**\n * Payment method configuration resource for querying available methods.\n *\n * Use this to retrieve available payment methods, their current status,\n * and scheduled maintenance windows.\n *\n * @class PayMethodConfigResource\n * @extends BaseResource\n *\n * @example\n * const result = await waffo.payMethodConfig.inquiry({ merchantId: 'M001' });\n * if (result.success) {\n * const availableMethods = result.data.payMethodDetails.filter(\n * m => m.currentStatus === '1'\n * );\n * }\n */\nexport class PayMethodConfigResource extends BaseResource {\n /**\n * Creates a Pay Method Config resource instance.\n * @param {HttpClient} client - HTTP client instance\n */\n constructor(client: HttpClient) {\n super(client, \"/paymethodconfig\");\n }\n\n /**\n * Queries available payment methods and their status.\n *\n * @param {PayMethodConfigInquiryParams} params - Query parameters\n * @returns {Promise<ApiResponse<PayMethodConfigInquiryData>>} Payment method details\n *\n * @example\n * const result = await waffo.payMethodConfig.inquiry({\n * merchantId: 'M001',\n * });\n *\n * if (result.success) {\n * result.data.payMethodDetails.forEach(method => {\n * const status = method.currentStatus === '1' ? 'Available' : 'Unavailable';\n * console.log(`${method.payMethodName} (${method.country}): ${status}`);\n *\n * // Check maintenance windows\n * if (method.fixedMaintenanceRules?.length) {\n * console.log(' Maintenance:', method.fixedMaintenanceRules);\n * }\n * });\n * }\n *\n * @example\n * // Filter available e-wallet methods\n * const ewallets = result.data.payMethodDetails.filter(\n * m => m.currentStatus === '1' && m.productName === 'ONE_TIME_PAYMENT'\n * );\n *\n * @see {@link PayMethodConfigInquiryData} for response structure\n */\n async inquiry(\n params: PayMethodConfigInquiryParams,\n ): Promise<ApiResponse<PayMethodConfigInquiryData>> {\n return this.client.post<\n PayMethodConfigInquiryData,\n PayMethodConfigInquiryParams\n >(`${this.basePath}/inquiry`, { body: params });\n }\n}\n","/**\n * @fileoverview Waffo SDK Main Entry Point\n * @module core/waffo\n *\n * Provides the main SDK class for interacting with the Waffo Payment Platform.\n *\n * **Supported Operations:**\n * - Order management (create, inquiry, cancel, refund, capture)\n * - Refund status inquiry\n * - Subscription management (create, inquiry, cancel, manage)\n * - Merchant and payment method configuration inquiry\n *\n * @see {@link WaffoConfig} for SDK configuration options\n * @see {@link OrderResource} for order operations\n * @see {@link SubscriptionResource} for subscription operations\n *\n * @example\n * // Initialize the SDK\n * import { Waffo, Environment } from 'waffo-sdk';\n *\n * const waffo = new Waffo({\n * apiKey: 'your-api-key',\n * privateKey: 'your-base64-encoded-private-key',\n * environment: Environment.SANDBOX,\n * });\n *\n * // Create a payment order\n * const result = await waffo.order.create({\n * paymentRequestId: 'req-123',\n * merchantOrderId: 'order-456',\n * orderCurrency: 'USD',\n * orderAmount: '10.00',\n * // ... other required fields\n * });\n */\n\nimport { WaffoConfig, KeyPair } from \"../types\";\nimport { HttpClient } from \"./httpClient\";\nimport { WebhookHandler } from \"./webhook\";\nimport {\n OrderResource,\n RefundResource,\n SubscriptionResource,\n MerchantConfigResource,\n PayMethodConfigResource,\n} from \"../resources\";\nimport { createKeyPair } from \"../utils\";\n\n/**\n * Main SDK class for the Waffo Payment Platform.\n *\n * Provides a unified interface for all payment operations with automatic\n * RSA-SHA256 request signing and response verification.\n *\n * **Features:**\n * - Order operations: create, inquiry, cancel, refund, capture\n * - Refund inquiry\n * - Subscription management: create, inquiry, cancel, manage\n * - Configuration queries: merchant limits, payment methods\n *\n * @class Waffo\n *\n * @example\n * // Basic SDK initialization\n * const waffo = new Waffo({\n * apiKey: 'your-api-key',\n * privateKey: 'base64-encoded-pkcs8-private-key',\n * environment: Environment.PRODUCTION,\n * });\n *\n * @example\n * // Create and query an order\n * const createResult = await waffo.order.create({ ... });\n * if (createResult.success) {\n * const inquiryResult = await waffo.order.inquiry({\n * acquiringOrderId: createResult.data.acquiringOrderId,\n * });\n * }\n *\n * @example\n * // Handle webhooks\n * const result = await waffo.webhook.handle(requestBody, signature, {\n * onPayment: async (ctx) => {\n * console.log('Payment received:', ctx.notification.result.orderStatus);\n * },\n * });\n *\n * @see {@link WaffoConfig} - Configuration options\n * @see {@link OrderResource} - Order operations\n * @see {@link SubscriptionResource} - Subscription operations\n */\nexport class Waffo {\n /**\n * Order resource for payment processing operations.\n *\n * **Available methods:**\n * - `create()` - Create a new payment order\n * - `inquiry()` - Query order status and details\n * - `cancel()` - Cancel an unpaid order\n * - `refund()` - Request a refund for a paid order\n * - `capture()` - Capture an authorized payment (manualCapture mode)\n *\n * @type {OrderResource}\n * @readonly\n *\n * @example\n * const result = await waffo.order.create({\n * paymentRequestId: 'req-123',\n * merchantOrderId: 'order-456',\n * orderCurrency: 'USD',\n * orderAmount: '10.00',\n * orderDescription: 'Product purchase',\n * merchantInfo: { merchantId: 'M001' },\n * userInfo: { userId: 'U001', userEmail: 'user@example.com', userTerminal: 'WEB' },\n * goodsInfo: { goodsName: 'Product', goodsUrl: 'https://example.com/product' },\n * paymentInfo: { productName: 'ONE_TIME_PAYMENT', payMethodName: 'DANA' },\n * notifyUrl: 'https://example.com/webhook',\n * });\n *\n * @see {@link OrderResource}\n */\n public readonly order: OrderResource;\n\n /**\n * Refund resource for querying refund status.\n *\n * **Available methods:**\n * - `inquiry()` - Query refund status by refundRequestId or acquiringRefundOrderId\n *\n * @type {RefundResource}\n * @readonly\n *\n * @example\n * const result = await waffo.refund.inquiry({\n * refundRequestId: 'refund-req-123',\n * });\n * if (result.success) {\n * console.log('Refund status:', result.data.refundStatus);\n * }\n *\n * @see {@link RefundResource}\n */\n public readonly refund: RefundResource;\n\n /**\n * Subscription resource for recurring payment operations.\n *\n * **Available methods:**\n * - `create()` - Create a new subscription signing request\n * - `inquiry()` - Query subscription status and payment history\n * - `cancel()` - Cancel an active subscription\n * - `manage()` - Generate a temporary management URL for users\n *\n * @type {SubscriptionResource}\n * @readonly\n *\n * @example\n * const result = await waffo.subscription.create({\n * subscriptionRequest: 'sub-req-123',\n * currency: 'USD',\n * amount: '9.99',\n * productInfo: {\n * description: 'Monthly subscription',\n * periodType: 'MONTHLY',\n * periodInterval: '1',\n * },\n * // ... other required fields\n * });\n *\n * @see {@link SubscriptionResource}\n */\n public readonly subscription: SubscriptionResource;\n\n /**\n * Merchant configuration resource for querying transaction limits.\n *\n * **Available methods:**\n * - `inquiry()` - Query daily limits, remaining limits, and transaction limits\n *\n * @type {MerchantConfigResource}\n * @readonly\n *\n * @example\n * const result = await waffo.merchantConfig.inquiry({\n * merchantId: 'M001',\n * });\n * if (result.success) {\n * console.log('Daily limit:', result.data.totalDailyLimit);\n * }\n *\n * @see {@link MerchantConfigResource}\n */\n public readonly merchantConfig: MerchantConfigResource;\n\n /**\n * Payment method configuration resource for querying available methods.\n *\n * **Available methods:**\n * - `inquiry()` - Query available payment methods, status, and maintenance schedules\n *\n * @type {PayMethodConfigResource}\n * @readonly\n *\n * @example\n * const result = await waffo.payMethodConfig.inquiry({\n * merchantId: 'M001',\n * });\n * if (result.success) {\n * result.data.payMethodDetails.forEach(method => {\n * console.log(`${method.payMethodName}: ${method.currentStatus === '1' ? 'Available' : 'Unavailable'}`);\n * });\n * }\n *\n * @see {@link PayMethodConfigResource}\n */\n public readonly payMethodConfig: PayMethodConfigResource;\n\n /**\n * Low-level HTTP client for direct API requests.\n *\n * All requests are automatically signed and responses are verified.\n * Use this for custom endpoints not covered by the resource classes.\n *\n * @type {HttpClient}\n * @readonly\n *\n * @example\n * // Make a custom API request\n * const result = await waffo.httpClient.post('/custom/endpoint', {\n * body: { customField: 'value' },\n * });\n *\n * @see {@link HttpClient}\n */\n public readonly httpClient: HttpClient;\n\n /**\n * Webhook handler for processing incoming notifications from Waffo.\n *\n * Use `handle()` method to process webhook notifications with custom handlers.\n *\n * @type {WebhookHandler}\n * @readonly\n *\n * @example\n * // Express.js webhook endpoint\n * app.post('/webhook', async (req, res) => {\n * const result = await waffo.webhook.handle(\n * JSON.stringify(req.body),\n * req.headers['x-signature'],\n * {\n * onPayment: async (ctx) => {\n * await updateOrderStatus(ctx.notification.result);\n * },\n * onRefund: async (ctx) => {\n * await processRefund(ctx.notification.result);\n * },\n * }\n * );\n * res.set(result.response.header).json(result.response.body);\n * });\n *\n * @see {@link WebhookHandler}\n */\n public readonly webhook: WebhookHandler;\n\n /**\n * Creates a new Waffo SDK instance.\n *\n * Initializes the SDK with the provided configuration. The SDK automatically\n * selects the appropriate API endpoint and public key based on the environment.\n *\n * @param {WaffoConfig} config - SDK configuration object\n * @param {string} config.apiKey - API key assigned by Waffo (required)\n * @param {string} config.privateKey - Merchant private key, Base64 encoded PKCS8 DER format (required)\n * @param {string} [config.waffoPublicKey] - Waffo public key for response verification (optional)\n * @param {Environment} [config.environment=Environment.PRODUCTION] - API environment (optional)\n * @param {number} [config.timeout=30000] - Request timeout in milliseconds (optional)\n * @param {Logger} [config.logger] - Logger instance for debugging (optional)\n *\n * @throws {Error} When API key or private key is missing or invalid\n *\n * @example\n * // Production configuration\n * const waffo = new Waffo({\n * apiKey: process.env.WAFFO_API_KEY,\n * privateKey: process.env.WAFFO_PRIVATE_KEY,\n * environment: Environment.PRODUCTION,\n * });\n *\n * @example\n * // Sandbox configuration with debugging\n * const waffo = new Waffo({\n * apiKey: 'sandbox-api-key',\n * privateKey: 'sandbox-private-key',\n * environment: Environment.SANDBOX,\n * timeout: 60000,\n * logger: console,\n * });\n *\n * @see {@link WaffoConfig} for configuration options\n * @see {@link Environment} for available environments\n */\n constructor(config: WaffoConfig) {\n this.httpClient = new HttpClient(config);\n this.webhook = new WebhookHandler(config);\n\n // Mount resources\n this.order = new OrderResource(this.httpClient);\n this.refund = new RefundResource(this.httpClient);\n this.subscription = new SubscriptionResource(this.httpClient);\n this.merchantConfig = new MerchantConfigResource(this.httpClient);\n this.payMethodConfig = new PayMethodConfigResource(this.httpClient);\n }\n\n /**\n * Generates a new 2048-bit RSA key pair for API signing and verification.\n *\n * **Generated key formats:**\n * - Private key: Base64 encoded PKCS8 DER format (for signing requests)\n * - Public key: Base64 encoded X509/SPKI DER format (for verification)\n *\n * **Usage:**\n * 1. Generate a key pair using this method\n * 2. Register the public key with Waffo via merchant dashboard\n * 3. Store the private key securely on your server\n * 4. Use the private key when initializing the SDK\n *\n * @static\n * @returns {KeyPair} Object containing the generated key pair\n *\n * @example\n * // Generate a new key pair\n * const keys = Waffo.generateKeyPair();\n * console.log('Private Key:', keys.privateKey);\n * console.log('Public Key:', keys.publicKey);\n *\n * // Use the private key to initialize SDK\n * const waffo = new Waffo({\n * apiKey: 'your-api-key',\n * privateKey: keys.privateKey,\n * });\n *\n * @see {@link KeyPair} for the return type structure\n */\n static generateKeyPair(): KeyPair {\n const keys = createKeyPair();\n return {\n privateKey: keys.PRIVATE_KEY_NAME,\n publicKey: keys.PUBLIC_KEY_NAME,\n };\n }\n}\n"]}
|