@waffo/waffo-node 2.5.0 → 2.6.0

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/dist/index.d.ts CHANGED
@@ -119,7 +119,7 @@ interface WaffoLogger {
119
119
  interface WaffoConfig {
120
120
  /** API key provided by Waffo */
121
121
  apiKey: string;
122
- /** Merchant's private key for signing requests (Base64 encoded PKCS8) */
122
+ /** Merchant's private key for signing requests (Base64 PKCS8 DER or unencrypted PKCS8 PEM) */
123
123
  privateKey: string;
124
124
  /** Waffo's public key for verifying responses (Base64 encoded X509) */
125
125
  waffoPublicKey: string;
@@ -187,6 +187,7 @@ interface CreateSubscriptionParams {
187
187
  merchantSubscriptionId: string;
188
188
  currency: string;
189
189
  amount: string;
190
+ promotionInfo?: SubscriptionPromotionInfo;
190
191
  userCurrency?: string;
191
192
  notifyUrl: string;
192
193
  productInfo: ProductInfo;
@@ -206,6 +207,10 @@ interface CreateSubscriptionParams {
206
207
  cancelRedirectUrl?: string;
207
208
  subscriptionManagementUrl?: string;
208
209
  requestedAt?: string;
210
+ /**
211
+ * Subscription start time (ISO 8601 format).
212
+ */
213
+ startTime?: string;
209
214
  extendInfo?: string;
210
215
  /**
211
216
  * Order expiry time (ISO 8601 format, max 24 characters).
@@ -214,12 +219,24 @@ interface CreateSubscriptionParams {
214
219
  addressInfo?: SubscriptionAddressInfo;
215
220
  riskData?: SubscriptionRiskData;
216
221
  brandInfo?: SubscriptionBrandInfo;
222
+ /** @deprecated Legacy field retained for source compatibility; not in the current OpenAPI contract. */
217
223
  subscriptionMode?: string;
224
+ /** @deprecated Legacy field retained for source compatibility; not in the current OpenAPI contract. */
218
225
  acqMerchant?: Record<string, unknown>;
226
+ /** @deprecated Legacy field retained for source compatibility; not in the current OpenAPI contract. */
219
227
  acqProduct?: Record<string, unknown>;
228
+ /** @deprecated Legacy field retained for source compatibility; not in the current OpenAPI contract. */
220
229
  acqAgreements?: Record<string, unknown>[];
221
230
  [key: string]: unknown;
222
231
  }
232
+ /**
233
+ * Promotion information for a subscription.
234
+ */
235
+ interface SubscriptionPromotionInfo {
236
+ promotionCode?: string;
237
+ couponId?: string;
238
+ [key: string]: unknown;
239
+ }
223
240
  /**
224
241
  * Create subscription response data.
225
242
  */
@@ -263,6 +280,7 @@ interface InquirySubscriptionData {
263
280
  payMethodSubscriptionId?: string;
264
281
  subscriptionStatus?: SubscriptionStatus;
265
282
  subscriptionAction?: string;
283
+ cancelReason?: string;
266
284
  currency?: string;
267
285
  userCurrency?: string;
268
286
  amount?: string;
@@ -504,9 +522,11 @@ interface ProductInfo {
504
522
  interface SubscriptionUserInfo {
505
523
  userId: string;
506
524
  userEmail: string;
525
+ userTerminal?: string;
507
526
  userPhone?: string;
508
527
  userFirstName?: string;
509
528
  userLastName?: string;
529
+ userCreatedAt?: string;
510
530
  userCountryCode?: string;
511
531
  userBrowserIp?: string;
512
532
  userAgent?: string;
@@ -519,12 +539,23 @@ interface SubscriptionPaymentInfo {
519
539
  productName: string;
520
540
  payMethodType?: string;
521
541
  payMethodName?: string;
542
+ payMethodProperties?: string;
543
+ payMethodUserAccountType?: string;
544
+ payMethodUserAccountNo?: string;
545
+ payMethodUserAccessToken?: string;
546
+ cashierLanguage?: string;
547
+ cashierAppearance?: string;
522
548
  [key: string]: unknown;
523
549
  }
524
550
  /**
525
551
  * Address information for subscription.
526
552
  */
527
553
  interface SubscriptionAddressInfo {
554
+ address?: string;
555
+ city?: string;
556
+ region?: string;
557
+ postcode?: string;
558
+ addressCountryCode?: string;
528
559
  shippingAddress?: {
529
560
  country?: string;
530
561
  state?: string;
@@ -549,6 +580,14 @@ interface SubscriptionAddressInfo {
549
580
  * Risk data for subscription.
550
581
  */
551
582
  interface SubscriptionRiskData {
583
+ userType?: string;
584
+ userCategory?: string;
585
+ userLegalName?: string;
586
+ userDisplayName?: string;
587
+ userRegistrationIp?: string;
588
+ userLastSeenIp?: string;
589
+ userIsNew?: string;
590
+ userIsFirstPurchase?: string;
552
591
  deviceType?: string;
553
592
  deviceId?: string;
554
593
  deviceTokenId?: string;
@@ -658,6 +697,10 @@ interface SubscriptionChangeParams {
658
697
  * New merchant subscription plan ID (max 64 characters).
659
698
  */
660
699
  merchantSubscriptionId?: string;
700
+ /**
701
+ * Promotion information.
702
+ */
703
+ promotionInfo?: SubscriptionPromotionInfo;
661
704
  /**
662
705
  * Original subscription request ID to be changed (max 32 characters).
663
706
  */
@@ -678,6 +721,10 @@ interface SubscriptionChangeParams {
678
721
  * Request time (ISO 8601 format). Auto-injected if not provided.
679
722
  */
680
723
  requestedAt?: string;
724
+ /**
725
+ * Subscription start time (ISO 8601 format).
726
+ */
727
+ startTime?: string;
681
728
  /**
682
729
  * Redirect URL after successful subscription change.
683
730
  */
@@ -913,67 +960,106 @@ interface SubscriptionChangeInquiryData {
913
960
  }
914
961
 
915
962
  /**
916
- * Webhook event types sent by Waffo.
963
+ * Order-related type definitions.
964
+ *
965
+ * Note: Full type definitions should be generated from openapi.json.
966
+ * These are placeholder interfaces for the SDK structure.
917
967
  */
918
- declare enum WebhookEventType {
919
- PAYMENT_NOTIFICATION = "PAYMENT_NOTIFICATION",
920
- REFUND_NOTIFICATION = "REFUND_NOTIFICATION",
921
- SUBSCRIPTION_STATUS_NOTIFICATION = "SUBSCRIPTION_STATUS_NOTIFICATION",
922
- SUBSCRIPTION_PERIOD_CHANGED_NOTIFICATION = "SUBSCRIPTION_PERIOD_CHANGED_NOTIFICATION",
923
- SUBSCRIPTION_CHANGE_NOTIFICATION = "SUBSCRIPTION_CHANGE_NOTIFICATION"
968
+
969
+ /**
970
+ * Create order request parameters.
971
+ */
972
+ interface CreateOrderParams {
973
+ paymentRequestId: string;
974
+ merchantOrderId: string;
975
+ orderCurrency: string;
976
+ orderAmount: string;
977
+ orderDescription: string;
978
+ notifyUrl: string;
979
+ userInfo: UserInfo;
980
+ paymentInfo: PaymentInfo;
981
+ merchantInfo?: MerchantInfo;
982
+ goodsInfo?: GoodsInfo;
983
+ addressInfo?: AddressInfo;
984
+ cardInfo?: CardInfo;
985
+ riskData?: RiskData;
986
+ paymentTokenData?: PaymentTokenData;
987
+ brandInfo?: BrandInfo;
988
+ /** @deprecated Legacy field retained for source compatibility; not in the current OpenAPI contract. */
989
+ productDetail?: ProductDetail;
990
+ /** @deprecated Legacy field retained for source compatibility; not in the current OpenAPI contract. */
991
+ acqOrderExtSubscriptionInfo?: AcqOrderExtSubscriptionInfo;
992
+ /** @deprecated Legacy field retained for source compatibility; not in the current OpenAPI contract. */
993
+ channelId?: string;
994
+ /** @deprecated Legacy field retained for source compatibility; not in the current OpenAPI contract. */
995
+ innerCardData?: WaffoTokenCardData;
996
+ promotionInfo?: PromotionInfo;
997
+ x402Info?: X402Info;
998
+ userCurrency?: string;
999
+ successRedirectUrl?: string;
1000
+ failedRedirectUrl?: string;
1001
+ cancelRedirectUrl?: string;
1002
+ orderRequestedAt?: string;
1003
+ orderExpiredAt?: string;
1004
+ extendInfo?: string;
1005
+ [key: string]: unknown;
924
1006
  }
925
1007
  /**
926
- * Result of webhook handling.
1008
+ * Create order response data.
927
1009
  */
928
- interface WebhookResult {
929
- /** Whether the webhook was processed successfully */
930
- success: boolean;
931
- /** Response body to send back to Waffo */
932
- responseBody: string;
933
- /** Signature for the response body */
934
- responseSignature: string;
935
- /** Error message if processing failed */
936
- error?: string;
1010
+ interface CreateOrderData {
1011
+ paymentRequestId?: string;
1012
+ merchantOrderId?: string;
1013
+ acquiringOrderId?: string;
1014
+ orderStatus?: OrderStatus;
1015
+ orderAction?: string;
1016
+ x402Info?: X402Info;
1017
+ [key: string]: unknown;
937
1018
  }
938
1019
  /**
939
- * Base notification interface.
1020
+ * Inquiry order request parameters.
1021
+ * Provide paymentRequestId or acquiringOrderId.
940
1022
  */
941
- interface BaseNotification {
942
- eventType: string;
1023
+ interface InquiryOrderParams {
1024
+ paymentRequestId?: string;
1025
+ acquiringOrderId?: string;
1026
+ [key: string]: unknown;
943
1027
  }
944
1028
  /**
945
- * Payment notification result payload (21 fields).
1029
+ * Inquiry order response data.
946
1030
  */
947
- interface PaymentNotificationResult {
1031
+ interface InquiryOrderData {
948
1032
  paymentRequestId?: string;
949
1033
  merchantOrderId?: string;
950
1034
  acquiringOrderId?: string;
951
- orderStatus?: string;
1035
+ orderStatus?: OrderStatus;
952
1036
  orderAction?: string;
953
1037
  orderCurrency?: string;
954
1038
  orderAmount?: string;
955
- userCurrency?: string;
1039
+ originalAmount?: string;
956
1040
  finalDealAmount?: string;
957
1041
  orderDescription?: string;
958
- merchantInfo?: Record<string, unknown>;
959
- userInfo?: Record<string, unknown>;
960
- goodsInfo?: Record<string, unknown>;
961
- addressInfo?: Record<string, unknown>;
962
- paymentInfo?: Record<string, unknown>;
1042
+ merchantInfo?: MerchantInfo;
1043
+ userInfo?: UserInfo;
1044
+ goodsInfo?: GoodsInfo;
1045
+ paymentInfo?: PaymentInfo;
1046
+ addressInfo?: AddressInfo;
963
1047
  orderRequestedAt?: string;
964
1048
  orderExpiredAt?: string;
965
1049
  orderUpdatedAt?: string;
966
1050
  orderCompletedAt?: string;
967
- orderFailedReason?: Record<string, unknown>;
1051
+ /**
1052
+ * Refund expiry time (ISO 8601 format).
1053
+ */
1054
+ refundExpiryAt?: string;
1055
+ orderFailedReason?: string;
968
1056
  extendInfo?: string;
1057
+ userCurrency?: string;
1058
+ x402Info?: X402Info;
969
1059
  /**
970
1060
  * The associated subscription info.
971
1061
  */
972
1062
  subscriptionInfo?: SubscriptionInfo;
973
- /**
974
- * Refund expiry time (ISO 8601 format).
975
- */
976
- refundExpiryAt?: string;
977
1063
  /**
978
1064
  * The address of the merchant page to redirect to when user cancels the payment.
979
1065
  */
@@ -981,699 +1067,700 @@ interface PaymentNotificationResult {
981
1067
  [key: string]: unknown;
982
1068
  }
983
1069
  /**
984
- * Refund notification result payload (17 fields).
1070
+ * Cancel order request parameters.
985
1071
  */
986
- interface RefundNotificationResult {
987
- refundRequestId?: string;
988
- merchantRefundOrderId?: string;
1072
+ interface CancelOrderParams {
1073
+ paymentRequestId?: string;
989
1074
  acquiringOrderId?: string;
990
- acquiringRefundOrderId?: string;
991
- origPaymentRequestId?: string;
992
- refundAmount?: string;
993
- refundStatus?: string;
994
- remainingRefundAmount?: string;
995
- userCurrency?: string;
996
- finalDealAmount?: string;
997
- refundReason?: string;
998
- refundRequestedAt?: string;
999
- refundUpdatedAt?: string;
1000
- refundCompletedAt?: string;
1001
- refundFailedReason?: Record<string, unknown>;
1002
- userInfo?: Record<string, unknown>;
1003
- extendInfo?: string;
1004
- /**
1005
- * Refund source. Possible values: MERCHANT, RDR, ETHOCA.
1006
- */
1007
- refundSource?: string;
1075
+ merchantId?: string;
1076
+ orderRequestedAt?: string;
1008
1077
  [key: string]: unknown;
1009
1078
  }
1010
1079
  /**
1011
- * Subscription notification result payload (20 fields).
1012
- * Shared by SubscriptionStatusNotification and SubscriptionPeriodChangedNotification.
1080
+ * Cancel order response data.
1013
1081
  */
1014
- interface SubscriptionNotificationResult {
1015
- subscriptionRequest?: string;
1016
- merchantSubscriptionId?: string;
1017
- subscriptionId?: string;
1018
- /**
1019
- * Payment method's subscription id.
1020
- */
1021
- payMethodSubscriptionId?: string;
1022
- subscriptionStatus?: string;
1023
- subscriptionAction?: string;
1024
- currency?: string;
1025
- amount?: string;
1026
- userCurrency?: string;
1027
- productInfo?: Record<string, unknown>;
1028
- merchantInfo?: Record<string, unknown>;
1029
- userInfo?: Record<string, unknown>;
1030
- goodsInfo?: Record<string, unknown>;
1031
- addressInfo?: Record<string, unknown>;
1032
- paymentInfo?: Record<string, unknown>;
1033
- requestedAt?: string;
1034
- updatedAt?: string;
1035
- failedReason?: Record<string, unknown>;
1036
- extendInfo?: string;
1037
- subscriptionManagementUrl?: string;
1038
- paymentDetails?: Record<string, unknown>[];
1082
+ interface CancelOrderData {
1083
+ paymentRequestId?: string;
1084
+ merchantOrderId?: string;
1085
+ acquiringOrderId?: string;
1086
+ orderStatus?: OrderStatus;
1039
1087
  [key: string]: unknown;
1040
1088
  }
1041
1089
  /**
1042
- * Subscription change notification result payload.
1043
- * Triggered when a subscription change (upgrade/downgrade) reaches final status (SUCCESS or CLOSED).
1090
+ * Refund order request parameters.
1044
1091
  */
1045
- interface SubscriptionChangeNotificationResult {
1046
- subscriptionRequest?: string;
1047
- originSubscriptionRequest?: string;
1048
- merchantSubscriptionId?: string;
1049
- subscriptionId?: string;
1050
- /** Final status: SUCCESS or CLOSED */
1051
- subscriptionChangeStatus?: string;
1052
- subscriptionAction?: string;
1053
- remainingAmount?: string;
1054
- currency?: string;
1055
- userCurrency?: string;
1092
+ interface RefundOrderParams {
1093
+ refundRequestId: string;
1094
+ acquiringOrderId: string;
1095
+ merchantId?: string;
1096
+ merchantRefundOrderId?: string;
1097
+ refundAmount: string;
1098
+ refundReason: string;
1056
1099
  requestedAt?: string;
1057
- subscriptionManagementUrl?: string;
1100
+ refundNotifyUrl?: string;
1101
+ userInfo?: RefundUserInfo;
1058
1102
  extendInfo?: string;
1059
- orderExpiredAt?: string;
1060
- productInfoList?: Record<string, unknown>[];
1061
- merchantInfo?: Record<string, unknown>;
1062
- userInfo?: Record<string, unknown>;
1063
- goodsInfo?: Record<string, unknown>;
1064
- addressInfo?: Record<string, unknown>;
1065
- paymentInfo?: Record<string, unknown>;
1103
+ refundSource?: string;
1066
1104
  [key: string]: unknown;
1067
1105
  }
1068
1106
  /**
1069
- * Payment notification from Waffo.
1107
+ * Refund order response data.
1070
1108
  */
1071
- interface PaymentNotification extends BaseNotification {
1072
- eventType: 'PAYMENT_NOTIFICATION';
1073
- result?: PaymentNotificationResult;
1109
+ interface RefundOrderData {
1110
+ refundRequestId?: string;
1111
+ merchantRefundOrderId?: string;
1112
+ acquiringOrderId?: string;
1113
+ acquiringRefundOrderId?: string;
1114
+ refundAmount?: string;
1115
+ refundStatus?: RefundStatus$1;
1116
+ remainingRefundAmount?: string;
1117
+ refundSource?: string;
1074
1118
  [key: string]: unknown;
1075
1119
  }
1076
1120
  /**
1077
- * Refund notification from Waffo.
1121
+ * Capture order request parameters.
1078
1122
  */
1079
- interface RefundNotification extends BaseNotification {
1080
- eventType: 'REFUND_NOTIFICATION';
1081
- result?: RefundNotificationResult;
1123
+ interface CaptureOrderParams {
1124
+ paymentRequestId?: string;
1125
+ acquiringOrderId?: string;
1126
+ merchantId?: string;
1127
+ captureRequestedAt?: string;
1128
+ captureAmount: string;
1082
1129
  [key: string]: unknown;
1083
1130
  }
1084
1131
  /**
1085
- * Subscription status notification from Waffo.
1132
+ * Capture order response data.
1086
1133
  */
1087
- interface SubscriptionStatusNotification extends BaseNotification {
1088
- eventType: 'SUBSCRIPTION_STATUS_NOTIFICATION';
1089
- result?: SubscriptionNotificationResult;
1134
+ interface CaptureOrderData {
1135
+ paymentRequestId?: string;
1136
+ merchantOrderId?: string;
1137
+ acquiringOrderId?: string;
1138
+ orderStatus?: OrderStatus;
1139
+ compensateSuccess?: boolean;
1090
1140
  [key: string]: unknown;
1091
1141
  }
1092
1142
  /**
1093
- * Subscription period changed notification from Waffo.
1143
+ * Order status enum.
1094
1144
  */
1095
- interface SubscriptionPeriodChangedNotification extends BaseNotification {
1096
- eventType: 'SUBSCRIPTION_PERIOD_CHANGED_NOTIFICATION';
1097
- result?: SubscriptionNotificationResult;
1145
+ type OrderStatus = 'PAY_IN_PROGRESS' | 'AUTHORIZATION_REQUIRED' | 'AUTHED_WAITING_CAPTURE' | 'PAY_SUCCESS' | 'ORDER_CLOSE' | 'CAPTURE_IN_PROGRESS';
1146
+ /**
1147
+ * Refund status enum.
1148
+ */
1149
+ type RefundStatus$1 = 'REFUND_IN_PROGRESS' | 'ORDER_PARTIALLY_REFUNDED' | 'ORDER_FULLY_REFUNDED' | 'ORDER_REFUND_FAILED';
1150
+ /**
1151
+ * User information.
1152
+ */
1153
+ interface UserInfo {
1154
+ userId: string;
1155
+ userEmail: string;
1156
+ userPhone?: string;
1157
+ userFirstName?: string;
1158
+ userLastName?: string;
1159
+ userCreatedAt?: string;
1160
+ userTerminal?: string;
1161
+ userCountryCode?: string;
1162
+ userBrowserIp?: string;
1163
+ userAgent?: string;
1164
+ /**
1165
+ * User receipt URL (max 256 characters).
1166
+ */
1167
+ userReceiptUrl?: string;
1098
1168
  [key: string]: unknown;
1099
1169
  }
1100
1170
  /**
1101
- * Subscription change notification from Waffo.
1171
+ * Payment information.
1102
1172
  */
1103
- interface SubscriptionChangeNotification extends BaseNotification {
1104
- eventType: 'SUBSCRIPTION_CHANGE_NOTIFICATION';
1105
- result?: SubscriptionChangeNotificationResult;
1173
+ interface PaymentInfo {
1174
+ productName: string;
1175
+ payMethodType?: string;
1176
+ payMethodName?: string;
1177
+ payMethodProperties?: string;
1178
+ payMethodResponse?: string;
1179
+ userPaymentAccessToken?: string;
1180
+ payMethodUserAccountNo?: string;
1181
+ payMethodUserAccountType?: string;
1182
+ payOption?: string;
1183
+ cashierLanguage?: string;
1184
+ cashierAppearance?: string;
1185
+ payMethodCountry?: string;
1186
+ captureMode?: string;
1187
+ merchantInitiatedMode?: string;
1106
1188
  [key: string]: unknown;
1107
1189
  }
1108
- type PaymentHandler = (notification: PaymentNotification) => void | Promise<void>;
1109
- type RefundHandler = (notification: RefundNotification) => void | Promise<void>;
1110
- type SubscriptionStatusHandler = (notification: SubscriptionStatusNotification) => void | Promise<void>;
1111
- type SubscriptionPaymentHandler = (notification: SubscriptionStatusNotification) => void | Promise<void>;
1112
- type SubscriptionPeriodChangedHandler = (notification: SubscriptionPeriodChangedNotification) => void | Promise<void>;
1113
- type SubscriptionChangeHandler = (notification: SubscriptionChangeNotification) => void | Promise<void>;
1114
1190
  /**
1115
- * Webhook handler for processing Waffo webhook notifications.
1116
- *
1117
- * @example
1118
- * ```typescript
1119
- * // Setup handler
1120
- * const handler = waffo.webhook()
1121
- * .onPayment((notification) => {
1122
- * console.log('Payment:', notification.result?.orderStatus);
1123
- * })
1124
- * .onRefund((notification) => {
1125
- * console.log('Refund:', notification.result?.refundStatus);
1126
- * });
1127
- *
1128
- * // Process webhook (e.g., in Express.js)
1129
- * app.post('/webhook', async (req, res) => {
1130
- * const body = req.body.toString();
1131
- * const signature = req.headers['x-signature'];
1132
- * const result = await handler.handleWebhook(body, signature);
1133
- *
1134
- * res.setHeader('X-SIGNATURE', result.responseSignature);
1135
- * res.status(200).send(result.responseBody);
1136
- * });
1137
- * ```
1191
+ * Merchant information.
1138
1192
  */
1139
- declare class WebhookHandler {
1140
- private readonly waffoPublicKey;
1141
- private readonly privateKey;
1142
- private readonly logger?;
1143
- private paymentHandler?;
1144
- private refundHandler?;
1145
- private subscriptionStatusHandler?;
1146
- private subscriptionPaymentHandler?;
1147
- private subscriptionPeriodChangedHandler?;
1148
- private subscriptionChangeHandler?;
1149
- constructor(config: WaffoConfig);
1150
- /**
1151
- * Registers a handler for payment notifications.
1152
- */
1153
- onPayment(handler: PaymentHandler): this;
1154
- /**
1155
- * Registers a handler for refund notifications.
1156
- */
1157
- onRefund(handler: RefundHandler): this;
1158
- /**
1159
- * Registers a handler for subscription status notifications.
1160
- */
1161
- onSubscriptionStatus(handler: SubscriptionStatusHandler): this;
1162
- /**
1163
- * Registers a fallback handler for SUBSCRIPTION_STATUS_NOTIFICATION events.
1164
- * Only called when onSubscriptionStatus handler is not registered.
1165
- */
1166
- onSubscriptionPayment(handler: SubscriptionPaymentHandler): this;
1167
- /**
1168
- * Registers a handler for subscription period changed notifications.
1169
- */
1170
- onSubscriptionPeriodChanged(handler: SubscriptionPeriodChangedHandler): this;
1171
- /**
1172
- * Registers a handler for subscription change notifications.
1173
- */
1174
- onSubscriptionChange(handler: SubscriptionChangeHandler): this;
1175
- /**
1176
- * Processes a webhook notification.
1177
- *
1178
- * @param body - The raw webhook body
1179
- * @param signature - The X-SIGNATURE header value
1180
- * @returns Result with response body and signature
1181
- */
1182
- handleWebhook(body: string, signature: string): Promise<WebhookResult>;
1183
- /**
1184
- * Verifies a webhook signature.
1185
- *
1186
- * @param body - The raw webhook body
1187
- * @param signature - The X-SIGNATURE header value
1188
- * @returns true if signature is valid
1189
- */
1190
- verifySignature(body: string, signature: string): boolean;
1191
- /**
1192
- * Builds a success response with signature.
1193
- */
1194
- buildSuccessResponse(): {
1195
- body: string;
1196
- signature: string;
1197
- };
1198
- /**
1199
- * Builds a failed response with signature.
1200
- */
1201
- buildFailedResponse(_message: string): {
1202
- body: string;
1203
- signature: string;
1204
- };
1205
- private createSuccessResult;
1206
- private createFailedResult;
1193
+ interface MerchantInfo {
1194
+ merchantId: string;
1195
+ subMerchantId?: string;
1196
+ [key: string]: unknown;
1207
1197
  }
1208
-
1209
1198
  /**
1210
- * Generic API response wrapper.
1211
- *
1212
- * All API responses are wrapped in this class for consistent handling.
1213
- *
1214
- * @example
1215
- * ```typescript
1216
- * const response = await waffo.order().create(params);
1217
- *
1218
- * if (response.isSuccess()) {
1219
- * const data = response.getData();
1220
- * console.log('Order ID:', data?.acquiringOrderId);
1221
- * } else {
1222
- * console.error(`Error [${response.code}]: ${response.getMessage()}`);
1223
- * }
1224
- * ```
1199
+ * Goods information.
1225
1200
  */
1226
- declare class ApiResponse<T> {
1227
- /** Response code. "0" indicates success, other values indicate errors. */
1228
- readonly code: string;
1229
- /** Response data (present when code is "0") */
1230
- readonly data?: T;
1231
- /** Error message (present when code is not "0") */
1232
- readonly message?: string;
1233
- private constructor();
1234
- /**
1235
- * Creates a successful response.
1236
- *
1237
- * @param data - The response data
1238
- */
1239
- static success<T>(data?: T): ApiResponse<T>;
1240
- /**
1241
- * Creates an error response.
1242
- *
1243
- * @param code - The error code
1244
- * @param message - The error message
1245
- */
1246
- static error<T>(code: string, message?: string): ApiResponse<T>;
1247
- /**
1248
- * Checks if the response indicates success.
1249
- *
1250
- * @returns true if the response code is "0"
1251
- */
1252
- isSuccess(): boolean;
1253
- /**
1254
- * Gets the response data.
1255
- *
1256
- * @returns The response data, or undefined if the response is an error
1257
- */
1258
- getData(): T | undefined;
1259
- /**
1260
- * Gets the error message.
1261
- *
1262
- * @returns The error message, or undefined if the response is successful
1263
- */
1264
- getMessage(): string | undefined;
1265
- /**
1266
- * Gets the response code.
1267
- *
1268
- * @returns The response code
1269
- */
1270
- getCode(): string;
1271
- /**
1272
- * Gets the response data or throws an error.
1273
- *
1274
- * @returns The response data
1275
- * @throws Error if the response is not successful or data is undefined
1276
- */
1277
- getDataOrThrow(): T;
1201
+ interface GoodsInfo {
1202
+ goodsId?: string;
1203
+ goodsName?: string;
1204
+ goodsCategory?: string;
1205
+ goodsUrl?: string;
1206
+ appName?: string;
1207
+ skuName?: string;
1208
+ goodsUniquePrice?: string;
1209
+ goodsQuantity?: number;
1210
+ [key: string]: unknown;
1278
1211
  }
1279
-
1280
1212
  /**
1281
- * HTTP client for making requests to the Waffo API.
1282
- *
1283
- * Handles:
1284
- * - Request signing with merchant's private key
1285
- * - Response signature verification with Waffo's public key
1286
- * - MerchantId auto-injection
1287
- * - Error handling and timeout management
1213
+ * Address information.
1288
1214
  */
1289
- declare class WaffoHttpClient {
1290
- private readonly baseUrl;
1291
- private readonly apiKey;
1292
- private readonly privateKey;
1293
- private readonly waffoPublicKey;
1294
- private readonly merchantId;
1295
- private readonly connectTimeout;
1296
- private readonly readTimeout;
1297
- private readonly logger?;
1298
- private readonly httpTransport;
1299
- constructor(config: WaffoConfig);
1300
- /**
1301
- * Sends a POST request to the Waffo API.
1302
- *
1303
- * @param path - API endpoint path (e.g., "/order/create")
1304
- * @param request - Request body
1305
- * @param options - Per-request options
1306
- * @returns API response
1307
- * @throws WaffoUnknownStatusError for network errors or unknown status
1308
- */
1309
- post<T extends object, R>(path: string, request: T, options?: RequestOptions): Promise<ApiResponse<R>>;
1310
- /**
1311
- * Parses the API response body.
1312
- */
1313
- private parseResponse;
1314
- /**
1315
- * Auto-injects merchantId into the request if configured.
1316
- */
1317
- private injectMerchantIdIfNeeded;
1318
- /**
1319
- * Checks if the error is a network-related error.
1320
- */
1321
- private isNetworkError;
1215
+ interface AddressInfo {
1216
+ address?: string;
1217
+ city?: string;
1218
+ region?: string;
1219
+ postcode?: string;
1220
+ addressCountryCode?: string;
1221
+ [key: string]: unknown;
1322
1222
  }
1323
-
1324
1223
  /**
1325
- * Base class for API resources.
1224
+ * Card information.
1326
1225
  */
1327
- declare abstract class BaseResource {
1328
- protected readonly httpClient: WaffoHttpClient;
1329
- protected readonly basePath: string;
1330
- constructor(httpClient: WaffoHttpClient, basePath: string);
1331
- /**
1332
- * Gets the full path for an endpoint.
1333
- *
1334
- * @param endpoint - The endpoint (e.g., "/create")
1335
- * @returns Full path (e.g., "/order/create")
1336
- */
1337
- protected getPath(endpoint: string): string;
1226
+ interface CardInfo {
1227
+ cardNumber?: string;
1228
+ cardExpiryYear?: number;
1229
+ cardExpiryMonth?: number;
1230
+ cardCvv?: string;
1231
+ cardHolderName?: string;
1232
+ threeDsDecision?: string;
1233
+ [key: string]: unknown;
1338
1234
  }
1339
-
1340
1235
  /**
1341
- * Order-related type definitions.
1342
- *
1343
- * Note: Full type definitions should be generated from openapi.json.
1344
- * These are placeholder interfaces for the SDK structure.
1236
+ * Risk data.
1345
1237
  */
1346
-
1238
+ interface RiskData {
1239
+ userType?: string;
1240
+ userCategory?: string;
1241
+ userLegalName?: string;
1242
+ userDisplayName?: string;
1243
+ userRegistrationIp?: string;
1244
+ userLastSeenIp?: string;
1245
+ userIsNew?: string;
1246
+ userIsFirstPurchase?: string;
1247
+ [key: string]: unknown;
1248
+ }
1347
1249
  /**
1348
- * Create order request parameters.
1250
+ * Payment token data.
1349
1251
  */
1350
- interface CreateOrderParams {
1351
- paymentRequestId: string;
1352
- merchantOrderId: string;
1353
- orderCurrency: string;
1354
- orderAmount: string;
1355
- orderDescription: string;
1356
- notifyUrl: string;
1357
- userInfo: UserInfo;
1358
- paymentInfo: PaymentInfo;
1359
- merchantInfo?: MerchantInfo;
1360
- goodsInfo?: GoodsInfo;
1361
- addressInfo?: AddressInfo;
1362
- cardInfo?: CardInfo;
1363
- riskData?: RiskData;
1364
- paymentTokenData?: PaymentTokenData;
1365
- brandInfo?: BrandInfo;
1366
- productDetail?: ProductDetail;
1367
- acqOrderExtSubscriptionInfo?: AcqOrderExtSubscriptionInfo;
1368
- channelId?: string;
1369
- innerCardData?: WaffoTokenCardData;
1370
- userCurrency?: string;
1371
- successRedirectUrl?: string;
1372
- failedRedirectUrl?: string;
1373
- cancelRedirectUrl?: string;
1374
- orderRequestedAt?: string;
1375
- orderExpiredAt?: string;
1376
- extendInfo?: string;
1252
+ interface PaymentTokenData {
1253
+ tokenId?: string;
1377
1254
  [key: string]: unknown;
1378
1255
  }
1379
1256
  /**
1380
- * Create order response data.
1257
+ * Brand display information for cashier.
1381
1258
  */
1382
- interface CreateOrderData {
1383
- paymentRequestId?: string;
1384
- merchantOrderId?: string;
1385
- acquiringOrderId?: string;
1386
- orderStatus?: OrderStatus;
1387
- orderAction?: string;
1259
+ interface BrandInfo {
1260
+ cashierLogoUrl?: string;
1261
+ cashierDisplayName?: string;
1262
+ cashierProductImageUrl?: string;
1388
1263
  [key: string]: unknown;
1389
1264
  }
1390
1265
  /**
1391
- * Inquiry order request parameters.
1392
- * Provide paymentRequestId or acquiringOrderId.
1266
+ * @deprecated Legacy order extension retained for source compatibility.
1393
1267
  */
1394
- interface InquiryOrderParams {
1395
- paymentRequestId?: string;
1396
- acquiringOrderId?: string;
1268
+ interface ProductDetail {
1269
+ subscriptionInfo?: SubscriptionInfo;
1397
1270
  [key: string]: unknown;
1398
1271
  }
1399
1272
  /**
1400
- * Inquiry order response data.
1273
+ * @deprecated Legacy subscription extension retained for source compatibility.
1401
1274
  */
1402
- interface InquiryOrderData {
1275
+ interface AcqOrderExtSubscriptionInfo {
1276
+ subscriptionId?: string;
1277
+ periodNo?: number;
1278
+ merchantRequest?: string;
1279
+ subscriptionEvent?: string;
1280
+ [key: string]: unknown;
1281
+ }
1282
+ /**
1283
+ * @deprecated Legacy tokenized card data retained for source compatibility.
1284
+ */
1285
+ interface WaffoTokenCardData {
1286
+ cardBinDataList?: Record<string, unknown>[];
1287
+ maskedCardInfo?: string;
1288
+ cardBin?: string;
1289
+ cardExpiry?: string;
1290
+ [key: string]: unknown;
1291
+ }
1292
+ /**
1293
+ * x402 stablecoin payment information.
1294
+ */
1295
+ interface X402Info {
1296
+ x402Request?: boolean;
1297
+ paymentSignatureHeader?: string;
1298
+ x402Response?: string;
1299
+ [key: string]: unknown;
1300
+ }
1301
+ /**
1302
+ * Promotion information for an order.
1303
+ */
1304
+ interface PromotionInfo {
1305
+ promotionCode?: string;
1306
+ couponId?: string;
1307
+ [key: string]: unknown;
1308
+ }
1309
+ /**
1310
+ * Refund user information.
1311
+ */
1312
+ interface RefundUserInfo {
1313
+ userType?: string;
1314
+ userFirstName?: string;
1315
+ userMiddleName?: string;
1316
+ userLastName?: string;
1317
+ nationality?: string;
1318
+ userEmail?: string;
1319
+ userPhone?: string;
1320
+ userBirthDay?: string;
1321
+ userIDType?: string;
1322
+ userIDNumber?: string;
1323
+ userIDIssueDate?: string;
1324
+ userIDExpiryDate?: string;
1325
+ userBankInfo?: RefundUserBankInfo;
1326
+ [key: string]: unknown;
1327
+ }
1328
+ interface RefundUserBankInfo {
1329
+ bankAccountNo?: string;
1330
+ bankCode?: string;
1331
+ bankName?: string;
1332
+ bankCity?: string;
1333
+ bankBranch?: string;
1334
+ [key: string]: unknown;
1335
+ }
1336
+
1337
+ /**
1338
+ * Webhook event types sent by Waffo.
1339
+ */
1340
+ declare enum WebhookEventType {
1341
+ PAYMENT_NOTIFICATION = "PAYMENT_NOTIFICATION",
1342
+ REFUND_NOTIFICATION = "REFUND_NOTIFICATION",
1343
+ SUBSCRIPTION_STATUS_NOTIFICATION = "SUBSCRIPTION_STATUS_NOTIFICATION",
1344
+ SUBSCRIPTION_PERIOD_CHANGED_NOTIFICATION = "SUBSCRIPTION_PERIOD_CHANGED_NOTIFICATION",
1345
+ SUBSCRIPTION_CHANGE_NOTIFICATION = "SUBSCRIPTION_CHANGE_NOTIFICATION"
1346
+ }
1347
+ /**
1348
+ * Result of webhook handling.
1349
+ */
1350
+ interface WebhookResult {
1351
+ /** Whether the webhook was processed successfully */
1352
+ success: boolean;
1353
+ /** Response body to send back to Waffo */
1354
+ responseBody: string;
1355
+ /** Signature for the response body */
1356
+ responseSignature: string;
1357
+ /** Error message if processing failed */
1358
+ error?: string;
1359
+ }
1360
+ /**
1361
+ * Base notification interface.
1362
+ */
1363
+ interface BaseNotification {
1364
+ eventType: string;
1365
+ }
1366
+ /**
1367
+ * Payment notification result payload (21 fields).
1368
+ */
1369
+ interface PaymentNotificationResult {
1403
1370
  paymentRequestId?: string;
1404
1371
  merchantOrderId?: string;
1405
1372
  acquiringOrderId?: string;
1406
- orderStatus?: OrderStatus;
1373
+ orderStatus?: string;
1407
1374
  orderAction?: string;
1408
1375
  orderCurrency?: string;
1409
1376
  orderAmount?: string;
1377
+ userCurrency?: string;
1410
1378
  finalDealAmount?: string;
1411
1379
  orderDescription?: string;
1412
- merchantInfo?: MerchantInfo;
1413
- userInfo?: UserInfo;
1414
- goodsInfo?: GoodsInfo;
1415
- paymentInfo?: PaymentInfo;
1416
- addressInfo?: AddressInfo;
1380
+ merchantInfo?: Record<string, unknown>;
1381
+ userInfo?: Record<string, unknown>;
1382
+ goodsInfo?: Record<string, unknown>;
1383
+ addressInfo?: Record<string, unknown>;
1384
+ paymentInfo?: Record<string, unknown>;
1417
1385
  orderRequestedAt?: string;
1418
1386
  orderExpiredAt?: string;
1419
1387
  orderUpdatedAt?: string;
1420
1388
  orderCompletedAt?: string;
1421
- /**
1422
- * Refund expiry time (ISO 8601 format).
1423
- */
1424
- refundExpiryAt?: string;
1425
- orderFailedReason?: string;
1389
+ orderFailedReason?: Record<string, unknown>;
1426
1390
  extendInfo?: string;
1427
- userCurrency?: string;
1428
1391
  /**
1429
1392
  * The associated subscription info.
1430
- */
1431
- subscriptionInfo?: SubscriptionInfo;
1432
- /**
1433
- * The address of the merchant page to redirect to when user cancels the payment.
1434
- */
1435
- cancelRedirectUrl?: string;
1436
- [key: string]: unknown;
1437
- }
1438
- /**
1439
- * Cancel order request parameters.
1440
- */
1441
- interface CancelOrderParams {
1442
- paymentRequestId?: string;
1443
- acquiringOrderId?: string;
1444
- merchantId?: string;
1445
- orderRequestedAt?: string;
1446
- [key: string]: unknown;
1447
- }
1448
- /**
1449
- * Cancel order response data.
1450
- */
1451
- interface CancelOrderData {
1452
- paymentRequestId?: string;
1453
- merchantOrderId?: string;
1454
- acquiringOrderId?: string;
1455
- orderStatus?: OrderStatus;
1456
- [key: string]: unknown;
1457
- }
1458
- /**
1459
- * Refund order request parameters.
1460
- */
1461
- interface RefundOrderParams {
1462
- refundRequestId: string;
1463
- acquiringOrderId: string;
1464
- merchantId?: string;
1465
- merchantRefundOrderId?: string;
1466
- refundAmount: string;
1467
- refundReason: string;
1468
- requestedAt?: string;
1469
- refundNotifyUrl?: string;
1470
- userInfo?: RefundUserInfo;
1471
- extendInfo?: string;
1472
- refundSource?: string;
1393
+ */
1394
+ subscriptionInfo?: SubscriptionInfo;
1395
+ /**
1396
+ * Refund expiry time (ISO 8601 format).
1397
+ */
1398
+ refundExpiryAt?: string;
1399
+ /**
1400
+ * The address of the merchant page to redirect to when user cancels the payment.
1401
+ */
1402
+ cancelRedirectUrl?: string;
1403
+ /**
1404
+ * x402 stablecoin payment information.
1405
+ */
1406
+ x402Info?: X402Info;
1473
1407
  [key: string]: unknown;
1474
1408
  }
1475
1409
  /**
1476
- * Refund order response data.
1410
+ * Refund notification result payload (17 fields).
1477
1411
  */
1478
- interface RefundOrderData {
1412
+ interface RefundNotificationResult {
1479
1413
  refundRequestId?: string;
1480
1414
  merchantRefundOrderId?: string;
1481
1415
  acquiringOrderId?: string;
1482
1416
  acquiringRefundOrderId?: string;
1417
+ origPaymentRequestId?: string;
1483
1418
  refundAmount?: string;
1484
- refundStatus?: RefundStatus$1;
1419
+ refundStatus?: string;
1485
1420
  remainingRefundAmount?: string;
1421
+ userCurrency?: string;
1422
+ finalDealAmount?: string;
1423
+ refundReason?: string;
1424
+ refundRequestedAt?: string;
1425
+ refundUpdatedAt?: string;
1426
+ refundCompletedAt?: string;
1427
+ refundFailedReason?: Record<string, unknown>;
1428
+ userInfo?: Record<string, unknown>;
1429
+ extendInfo?: string;
1430
+ /**
1431
+ * Refund source. Possible values: MERCHANT, RDR, ETHOCA.
1432
+ */
1486
1433
  refundSource?: string;
1487
1434
  [key: string]: unknown;
1488
1435
  }
1489
1436
  /**
1490
- * Capture order request parameters.
1491
- */
1492
- interface CaptureOrderParams {
1493
- paymentRequestId?: string;
1494
- acquiringOrderId?: string;
1495
- merchantId?: string;
1496
- captureRequestedAt?: string;
1497
- captureAmount: string;
1498
- [key: string]: unknown;
1499
- }
1500
- /**
1501
- * Capture order response data.
1502
- */
1503
- interface CaptureOrderData {
1504
- paymentRequestId?: string;
1505
- merchantOrderId?: string;
1506
- acquiringOrderId?: string;
1507
- orderStatus?: OrderStatus;
1508
- [key: string]: unknown;
1509
- }
1510
- /**
1511
- * Order status enum.
1512
- */
1513
- type OrderStatus = 'PAY_IN_PROGRESS' | 'AUTHORIZATION_REQUIRED' | 'AUTHED_WAITING_CAPTURE' | 'PAY_SUCCESS' | 'ORDER_CLOSE' | 'CAPTURE_IN_PROGRESS';
1514
- /**
1515
- * Refund status enum.
1516
- */
1517
- type RefundStatus$1 = 'REFUND_IN_PROGRESS' | 'ORDER_PARTIALLY_REFUNDED' | 'ORDER_FULLY_REFUNDED' | 'ORDER_REFUND_FAILED';
1518
- /**
1519
- * User information.
1437
+ * Subscription notification result payload (20 fields).
1438
+ * Shared by SubscriptionStatusNotification and SubscriptionPeriodChangedNotification.
1520
1439
  */
1521
- interface UserInfo {
1522
- userId: string;
1523
- userEmail: string;
1524
- userPhone?: string;
1525
- userFirstName?: string;
1526
- userLastName?: string;
1527
- userCreatedAt?: string;
1528
- userTerminal?: string;
1529
- userCountryCode?: string;
1530
- userBrowserIp?: string;
1531
- userAgent?: string;
1440
+ interface SubscriptionNotificationResult {
1441
+ subscriptionRequest?: string;
1442
+ merchantSubscriptionId?: string;
1443
+ subscriptionId?: string;
1532
1444
  /**
1533
- * User receipt URL (max 256 characters).
1445
+ * Payment method's subscription id.
1534
1446
  */
1535
- userReceiptUrl?: string;
1536
- [key: string]: unknown;
1537
- }
1538
- /**
1539
- * Payment information.
1540
- */
1541
- interface PaymentInfo {
1542
- productName: string;
1543
- payMethodType?: string;
1544
- payMethodName?: string;
1545
- payMethodProperties?: string;
1546
- captureMode?: string;
1547
- [key: string]: unknown;
1548
- }
1549
- /**
1550
- * Merchant information.
1551
- */
1552
- interface MerchantInfo {
1553
- merchantId: string;
1554
- subMerchantId?: string;
1447
+ payMethodSubscriptionId?: string;
1448
+ subscriptionStatus?: string;
1449
+ subscriptionAction?: string;
1450
+ currency?: string;
1451
+ amount?: string;
1452
+ userCurrency?: string;
1453
+ productInfo?: Record<string, unknown>;
1454
+ merchantInfo?: Record<string, unknown>;
1455
+ userInfo?: Record<string, unknown>;
1456
+ goodsInfo?: Record<string, unknown>;
1457
+ addressInfo?: Record<string, unknown>;
1458
+ paymentInfo?: Record<string, unknown>;
1459
+ requestedAt?: string;
1460
+ updatedAt?: string;
1461
+ failedReason?: Record<string, unknown>;
1462
+ extendInfo?: string;
1463
+ subscriptionManagementUrl?: string;
1464
+ paymentDetails?: Record<string, unknown>[];
1555
1465
  [key: string]: unknown;
1556
1466
  }
1557
1467
  /**
1558
- * Goods information.
1468
+ * Subscription change notification result payload.
1469
+ * Triggered when a subscription change (upgrade/downgrade) reaches final status (SUCCESS or CLOSED).
1559
1470
  */
1560
- interface GoodsInfo {
1561
- goodsId?: string;
1562
- goodsName?: string;
1563
- goodsCategory?: string;
1564
- goodsUrl?: string;
1565
- appName?: string;
1566
- skuName?: string;
1567
- goodsUniquePrice?: string;
1568
- goodsQuantity?: number;
1471
+ interface SubscriptionChangeNotificationResult {
1472
+ subscriptionRequest?: string;
1473
+ originSubscriptionRequest?: string;
1474
+ merchantSubscriptionId?: string;
1475
+ subscriptionId?: string;
1476
+ /** Final status: SUCCESS or CLOSED */
1477
+ subscriptionChangeStatus?: string;
1478
+ subscriptionAction?: string;
1479
+ remainingAmount?: string;
1480
+ currency?: string;
1481
+ userCurrency?: string;
1482
+ requestedAt?: string;
1483
+ subscriptionManagementUrl?: string;
1484
+ extendInfo?: string;
1485
+ orderExpiredAt?: string;
1486
+ productInfoList?: Record<string, unknown>[];
1487
+ merchantInfo?: Record<string, unknown>;
1488
+ userInfo?: Record<string, unknown>;
1489
+ goodsInfo?: Record<string, unknown>;
1490
+ addressInfo?: Record<string, unknown>;
1491
+ paymentInfo?: Record<string, unknown>;
1569
1492
  [key: string]: unknown;
1570
1493
  }
1571
1494
  /**
1572
- * Address information.
1495
+ * Payment notification from Waffo.
1573
1496
  */
1574
- interface AddressInfo {
1575
- address?: string;
1576
- city?: string;
1577
- region?: string;
1578
- postcode?: string;
1579
- addressCountryCode?: string;
1497
+ interface PaymentNotification extends BaseNotification {
1498
+ eventType: 'PAYMENT_NOTIFICATION';
1499
+ result?: PaymentNotificationResult;
1580
1500
  [key: string]: unknown;
1581
1501
  }
1582
1502
  /**
1583
- * Card information.
1503
+ * Refund notification from Waffo.
1584
1504
  */
1585
- interface CardInfo {
1586
- cardNumber?: string;
1587
- cardExpiryYear?: number;
1588
- cardExpiryMonth?: number;
1589
- cardCvv?: string;
1590
- cardHolderName?: string;
1591
- threeDsDecision?: string;
1505
+ interface RefundNotification extends BaseNotification {
1506
+ eventType: 'REFUND_NOTIFICATION';
1507
+ result?: RefundNotificationResult;
1592
1508
  [key: string]: unknown;
1593
1509
  }
1594
1510
  /**
1595
- * Risk data.
1511
+ * Subscription status notification from Waffo.
1596
1512
  */
1597
- interface RiskData {
1598
- userType?: string;
1599
- userCategory?: string;
1600
- userLegalName?: string;
1601
- userDisplayName?: string;
1602
- userRegistrationIp?: string;
1603
- userLastSeenIp?: string;
1604
- userIsNew?: string;
1605
- userIsFirstPurchase?: string;
1513
+ interface SubscriptionStatusNotification extends BaseNotification {
1514
+ eventType: 'SUBSCRIPTION_STATUS_NOTIFICATION';
1515
+ result?: SubscriptionNotificationResult;
1606
1516
  [key: string]: unknown;
1607
1517
  }
1608
1518
  /**
1609
- * Payment token data.
1519
+ * Subscription period changed notification from Waffo.
1610
1520
  */
1611
- interface PaymentTokenData {
1612
- tokenId?: string;
1521
+ interface SubscriptionPeriodChangedNotification extends BaseNotification {
1522
+ eventType: 'SUBSCRIPTION_PERIOD_CHANGED_NOTIFICATION';
1523
+ result?: SubscriptionNotificationResult;
1613
1524
  [key: string]: unknown;
1614
1525
  }
1615
1526
  /**
1616
- * Brand display information for cashier.
1527
+ * Subscription change notification from Waffo.
1617
1528
  */
1618
- interface BrandInfo {
1619
- cashierLogoUrl?: string;
1620
- cashierDisplayName?: string;
1621
- cashierProductImageUrl?: string;
1529
+ interface SubscriptionChangeNotification extends BaseNotification {
1530
+ eventType: 'SUBSCRIPTION_CHANGE_NOTIFICATION';
1531
+ result?: SubscriptionChangeNotificationResult;
1622
1532
  [key: string]: unknown;
1623
1533
  }
1534
+ type PaymentHandler = (notification: PaymentNotification) => void | Promise<void>;
1535
+ type RefundHandler = (notification: RefundNotification) => void | Promise<void>;
1536
+ type SubscriptionStatusHandler = (notification: SubscriptionStatusNotification) => void | Promise<void>;
1537
+ type SubscriptionPaymentHandler = (notification: SubscriptionStatusNotification) => void | Promise<void>;
1538
+ type SubscriptionPeriodChangedHandler = (notification: SubscriptionPeriodChangedNotification) => void | Promise<void>;
1539
+ type SubscriptionChangeHandler = (notification: SubscriptionChangeNotification) => void | Promise<void>;
1624
1540
  /**
1625
- * Product detail extension payload.
1541
+ * Webhook handler for processing Waffo webhook notifications.
1542
+ *
1543
+ * @example
1544
+ * ```typescript
1545
+ * // Setup handler
1546
+ * const handler = waffo.webhook()
1547
+ * .onPayment((notification) => {
1548
+ * console.log('Payment:', notification.result?.orderStatus);
1549
+ * })
1550
+ * .onRefund((notification) => {
1551
+ * console.log('Refund:', notification.result?.refundStatus);
1552
+ * });
1553
+ *
1554
+ * // Process webhook (e.g., in Express.js)
1555
+ * app.post('/webhook', async (req, res) => {
1556
+ * const body = req.body.toString();
1557
+ * const signature = req.headers['x-signature'];
1558
+ * const result = await handler.handleWebhook(body, signature);
1559
+ *
1560
+ * res.setHeader('X-SIGNATURE', result.responseSignature);
1561
+ * res.status(200).send(result.responseBody);
1562
+ * });
1563
+ * ```
1626
1564
  */
1627
- interface ProductDetail {
1628
- subscriptionInfo?: SubscriptionInfo;
1629
- [key: string]: unknown;
1565
+ declare class WebhookHandler {
1566
+ private readonly waffoPublicKey;
1567
+ private readonly privateKey;
1568
+ private readonly logger?;
1569
+ private paymentHandler?;
1570
+ private refundHandler?;
1571
+ private subscriptionStatusHandler?;
1572
+ private subscriptionPaymentHandler?;
1573
+ private subscriptionPeriodChangedHandler?;
1574
+ private subscriptionChangeHandler?;
1575
+ constructor(config: WaffoConfig);
1576
+ /**
1577
+ * Registers a handler for payment notifications.
1578
+ */
1579
+ onPayment(handler: PaymentHandler): this;
1580
+ /**
1581
+ * Registers a handler for refund notifications.
1582
+ */
1583
+ onRefund(handler: RefundHandler): this;
1584
+ /**
1585
+ * Registers a handler for subscription status notifications.
1586
+ */
1587
+ onSubscriptionStatus(handler: SubscriptionStatusHandler): this;
1588
+ /**
1589
+ * Registers a fallback handler for SUBSCRIPTION_STATUS_NOTIFICATION events.
1590
+ * Only called when onSubscriptionStatus handler is not registered.
1591
+ */
1592
+ onSubscriptionPayment(handler: SubscriptionPaymentHandler): this;
1593
+ /**
1594
+ * Registers a handler for subscription period changed notifications.
1595
+ */
1596
+ onSubscriptionPeriodChanged(handler: SubscriptionPeriodChangedHandler): this;
1597
+ /**
1598
+ * Registers a handler for subscription change notifications.
1599
+ */
1600
+ onSubscriptionChange(handler: SubscriptionChangeHandler): this;
1601
+ /**
1602
+ * Processes a webhook notification.
1603
+ *
1604
+ * @param body - The raw webhook body
1605
+ * @param signature - The X-SIGNATURE header value
1606
+ * @returns Result with response body and signature
1607
+ */
1608
+ handleWebhook(body: string, signature: string): Promise<WebhookResult>;
1609
+ /**
1610
+ * Verifies a webhook signature.
1611
+ *
1612
+ * @param body - The raw webhook body
1613
+ * @param signature - The X-SIGNATURE header value
1614
+ * @returns true if signature is valid
1615
+ */
1616
+ verifySignature(body: string, signature: string): boolean;
1617
+ /**
1618
+ * Builds a success response with signature.
1619
+ */
1620
+ buildSuccessResponse(): {
1621
+ body: string;
1622
+ signature: string;
1623
+ };
1624
+ /**
1625
+ * Builds a failed response with signature.
1626
+ */
1627
+ buildFailedResponse(_message: string): {
1628
+ body: string;
1629
+ signature: string;
1630
+ };
1631
+ private createSuccessResult;
1632
+ private createFailedResult;
1630
1633
  }
1634
+
1631
1635
  /**
1632
- * Subscription extension information for an acquiring order.
1636
+ * Generic API response wrapper.
1637
+ *
1638
+ * All API responses are wrapped in this class for consistent handling.
1639
+ *
1640
+ * @example
1641
+ * ```typescript
1642
+ * const response = await waffo.order().create(params);
1643
+ *
1644
+ * if (response.isSuccess()) {
1645
+ * const data = response.getData();
1646
+ * console.log('Order ID:', data?.acquiringOrderId);
1647
+ * } else {
1648
+ * console.error(`Error [${response.code}]: ${response.getMessage()}`);
1649
+ * }
1650
+ * ```
1633
1651
  */
1634
- interface AcqOrderExtSubscriptionInfo {
1635
- subscriptionId?: string;
1636
- periodNo?: number;
1637
- merchantRequest?: string;
1638
- subscriptionEvent?: string;
1639
- [key: string]: unknown;
1652
+ declare class ApiResponse<T> {
1653
+ /** Response code. "0" indicates success, other values indicate errors. */
1654
+ readonly code: string;
1655
+ /** Response data (present when code is "0") */
1656
+ readonly data?: T;
1657
+ /** Error message (present when code is not "0") */
1658
+ readonly message?: string;
1659
+ private constructor();
1660
+ /**
1661
+ * Creates a successful response.
1662
+ *
1663
+ * @param data - The response data
1664
+ */
1665
+ static success<T>(data?: T): ApiResponse<T>;
1666
+ /**
1667
+ * Creates an error response.
1668
+ *
1669
+ * @param code - The error code
1670
+ * @param message - The error message
1671
+ */
1672
+ static error<T>(code: string, message?: string): ApiResponse<T>;
1673
+ /**
1674
+ * Checks if the response indicates success.
1675
+ *
1676
+ * @returns true if the response code is "0"
1677
+ */
1678
+ isSuccess(): boolean;
1679
+ /**
1680
+ * Gets the response data.
1681
+ *
1682
+ * @returns The response data, or undefined if the response is an error
1683
+ */
1684
+ getData(): T | undefined;
1685
+ /**
1686
+ * Gets the error message.
1687
+ *
1688
+ * @returns The error message, or undefined if the response is successful
1689
+ */
1690
+ getMessage(): string | undefined;
1691
+ /**
1692
+ * Gets the response code.
1693
+ *
1694
+ * @returns The response code
1695
+ */
1696
+ getCode(): string;
1697
+ /**
1698
+ * Gets the response data or throws an error.
1699
+ *
1700
+ * @returns The response data
1701
+ * @throws Error if the response is not successful or data is undefined
1702
+ */
1703
+ getDataOrThrow(): T;
1640
1704
  }
1705
+
1641
1706
  /**
1642
- * Tokenized card data used for direct card payment flows.
1707
+ * HTTP client for making requests to the Waffo API.
1708
+ *
1709
+ * Handles:
1710
+ * - Request signing with merchant's private key
1711
+ * - Response signature verification with Waffo's public key
1712
+ * - MerchantId auto-injection
1713
+ * - Error handling and timeout management
1643
1714
  */
1644
- interface WaffoTokenCardData {
1645
- cardBinDataList?: Record<string, unknown>[];
1646
- maskedCardInfo?: string;
1647
- cardBin?: string;
1648
- cardExpiry?: string;
1649
- [key: string]: unknown;
1715
+ declare class WaffoHttpClient {
1716
+ private readonly baseUrl;
1717
+ private readonly apiKey;
1718
+ private readonly privateKey;
1719
+ private readonly waffoPublicKey;
1720
+ private readonly merchantId;
1721
+ private readonly connectTimeout;
1722
+ private readonly readTimeout;
1723
+ private readonly logger?;
1724
+ private readonly httpTransport;
1725
+ constructor(config: WaffoConfig);
1726
+ /**
1727
+ * Sends a POST request to the Waffo API.
1728
+ *
1729
+ * @param path - API endpoint path (e.g., "/order/create")
1730
+ * @param request - Request body
1731
+ * @param options - Per-request options
1732
+ * @returns API response
1733
+ * @throws WaffoUnknownStatusError for network errors or unknown status
1734
+ */
1735
+ post<T extends object, R>(path: string, request: T, options?: RequestOptions): Promise<ApiResponse<R>>;
1736
+ /**
1737
+ * Parses the API response body.
1738
+ */
1739
+ private parseResponse;
1740
+ /**
1741
+ * Auto-injects merchantId into the request if configured.
1742
+ */
1743
+ private injectMerchantIdIfNeeded;
1744
+ /**
1745
+ * Checks if the error is a network-related error.
1746
+ */
1747
+ private isNetworkError;
1650
1748
  }
1749
+
1651
1750
  /**
1652
- * Refund user information.
1751
+ * Base class for API resources.
1653
1752
  */
1654
- interface RefundUserInfo {
1655
- userType?: string;
1656
- userFirstName?: string;
1657
- userMiddleName?: string;
1658
- userLastName?: string;
1659
- nationality?: string;
1660
- userEmail?: string;
1661
- userPhone?: string;
1662
- userBirthDay?: string;
1663
- userIDType?: string;
1664
- userIDNumber?: string;
1665
- userIDIssueDate?: string;
1666
- userIDExpiryDate?: string;
1667
- userBankInfo?: RefundUserBankInfo;
1668
- [key: string]: unknown;
1669
- }
1670
- interface RefundUserBankInfo {
1671
- bankAccountNo?: string;
1672
- bankCode?: string;
1673
- bankName?: string;
1674
- bankCity?: string;
1675
- bankBranch?: string;
1676
- [key: string]: unknown;
1753
+ declare abstract class BaseResource {
1754
+ protected readonly httpClient: WaffoHttpClient;
1755
+ protected readonly basePath: string;
1756
+ constructor(httpClient: WaffoHttpClient, basePath: string);
1757
+ /**
1758
+ * Gets the full path for an endpoint.
1759
+ *
1760
+ * @param endpoint - The endpoint (e.g., "/create")
1761
+ * @returns Full path (e.g., "/order/create")
1762
+ */
1763
+ protected getPath(endpoint: string): string;
1677
1764
  }
1678
1765
 
1679
1766
  /**
@@ -2019,7 +2106,6 @@ interface InquiryMerchantConfigData {
2019
2106
  */
2020
2107
  interface InquiryPayMethodConfigParams {
2021
2108
  merchantId: string;
2022
- payMethodType?: string;
2023
2109
  [key: string]: unknown;
2024
2110
  }
2025
2111
  /**
@@ -2027,21 +2113,33 @@ interface InquiryPayMethodConfigParams {
2027
2113
  */
2028
2114
  interface InquiryPayMethodConfigData {
2029
2115
  merchantId?: string;
2030
- payMethods?: PayMethodInfo[];
2116
+ payMethodDetails?: PayMethodDetail[];
2031
2117
  [key: string]: unknown;
2032
2118
  }
2033
2119
  /**
2034
- * Pay method information.
2120
+ * Pay method detail.
2035
2121
  */
2036
- interface PayMethodInfo {
2037
- payMethodType?: string;
2122
+ interface PayMethodDetail {
2123
+ productName?: string;
2038
2124
  payMethodName?: string;
2039
- payMethodStatus?: string;
2040
- supportedCurrencies?: string[];
2041
- minAmount?: string;
2042
- maxAmount?: string;
2125
+ country?: string;
2126
+ currentStatus?: string;
2127
+ fixedMaintenanceRules?: FixedMaintenanceRule[];
2128
+ fixedMaintenanceTimezone?: string;
2043
2129
  [key: string]: unknown;
2044
2130
  }
2131
+ /**
2132
+ * Fixed maintenance rule for a payment method.
2133
+ */
2134
+ interface FixedMaintenanceRule {
2135
+ startRule?: string;
2136
+ endRule?: string;
2137
+ [key: string]: unknown;
2138
+ }
2139
+ /**
2140
+ * @deprecated Use PayMethodDetail.
2141
+ */
2142
+ type PayMethodInfo = PayMethodDetail;
2045
2143
 
2046
2144
  /**
2047
2145
  * Merchant config resource for querying merchant configuration.
@@ -2085,8 +2183,8 @@ declare class MerchantConfigResource extends BaseResource {
2085
2183
  *
2086
2184
  * if (response.isSuccess()) {
2087
2185
  * const data = response.getData();
2088
- * data?.payMethods?.forEach(method => {
2089
- * console.log(`${method.payMethodName}: ${method.payMethodStatus}`);
2186
+ * data?.payMethodDetails?.forEach(method => {
2187
+ * console.log(`${method.payMethodName}: ${method.currentStatus}`);
2090
2188
  * });
2091
2189
  * }
2092
2190
  * ```
@@ -2104,6 +2202,69 @@ declare class PayMethodConfigResource extends BaseResource {
2104
2202
  inquiry(params: InquiryPayMethodConfigParams, options?: RequestOptions): Promise<ApiResponse<InquiryPayMethodConfigData>>;
2105
2203
  }
2106
2204
 
2205
+ /**
2206
+ * Wallet-related type definitions.
2207
+ *
2208
+ * Note: Full type definitions should be generated from openapi.json.
2209
+ * These are placeholder interfaces for the SDK structure.
2210
+ */
2211
+
2212
+ /**
2213
+ * Wallet inquiry request parameters (x402 stablecoin receiving-address inquiry).
2214
+ * Based on openapi.json WalletInquiryReq schema.
2215
+ *
2216
+ * Note: `merchantInfo` is auto-injected by the HTTP client before signing,
2217
+ * so it is optional in the public surface.
2218
+ */
2219
+ interface WalletInquiryParams {
2220
+ paymentRequestId: string;
2221
+ merchantInfo?: MerchantInfo;
2222
+ orderCurrency: string;
2223
+ [key: string]: unknown;
2224
+ }
2225
+ /**
2226
+ * Wallet inquiry response data.
2227
+ * Based on openapi.json WalletInquiryResponse schema.
2228
+ */
2229
+ interface WalletInquiryData {
2230
+ network?: string;
2231
+ asset?: string;
2232
+ payTo?: string;
2233
+ [key: string]: unknown;
2234
+ }
2235
+
2236
+ /**
2237
+ * Wallet resource for x402 stablecoin receiving-address inquiry.
2238
+ *
2239
+ * @example
2240
+ * ```typescript
2241
+ * // Inquire the stablecoin receiving address
2242
+ * const response = await waffo.wallet().inquiry({
2243
+ * paymentRequestId: 'unique-request-id',
2244
+ * orderCurrency: 'USDC',
2245
+ * });
2246
+ *
2247
+ * if (response.isSuccess()) {
2248
+ * const data = response.getData();
2249
+ * console.log('Network:', data?.network);
2250
+ * console.log('Asset:', data?.asset);
2251
+ * console.log('Pay to:', data?.payTo);
2252
+ * }
2253
+ * ```
2254
+ */
2255
+ declare class WalletResource extends BaseResource {
2256
+ private static readonly PATH_INQUIRY;
2257
+ /**
2258
+ * Inquires the stablecoin receiving address for an x402 payment.
2259
+ *
2260
+ * @param params - Wallet inquiry parameters
2261
+ * @param options - Optional request options
2262
+ * @returns API response with wallet data
2263
+ * @throws WaffoUnknownStatusError for network errors
2264
+ */
2265
+ inquiry(params: WalletInquiryParams, options?: RequestOptions): Promise<ApiResponse<WalletInquiryData>>;
2266
+ }
2267
+
2107
2268
  /**
2108
2269
  * Main entry point for the Waffo SDK.
2109
2270
  *
@@ -2152,6 +2313,7 @@ declare class Waffo {
2152
2313
  private _refund?;
2153
2314
  private _merchantConfig?;
2154
2315
  private _payMethodConfig?;
2316
+ private _wallet?;
2155
2317
  /**
2156
2318
  * Creates a new Waffo SDK instance.
2157
2319
  *
@@ -2205,6 +2367,12 @@ declare class Waffo {
2205
2367
  * @returns Pay method config resource
2206
2368
  */
2207
2369
  payMethodConfig(): PayMethodConfigResource;
2370
+ /**
2371
+ * Returns the wallet resource for x402 stablecoin receiving-address inquiry.
2372
+ *
2373
+ * @returns Wallet resource
2374
+ */
2375
+ wallet(): WalletResource;
2208
2376
  /**
2209
2377
  * Creates a webhook handler for processing Waffo webhook notifications.
2210
2378
  *
@@ -2347,7 +2515,7 @@ declare class WaffoUnknownStatusError extends Error {
2347
2515
  * Result of key pair generation.
2348
2516
  */
2349
2517
  interface KeyPairResult {
2350
- /** Base64 encoded PKCS8 private key */
2518
+ /** Base64 encoded PKCS8 DER private key */
2351
2519
  privateKey: string;
2352
2520
  /** Base64 encoded X509 public key */
2353
2521
  publicKey: string;
@@ -2356,16 +2524,16 @@ interface KeyPairResult {
2356
2524
  * Signs data using RSA-SHA256.
2357
2525
  *
2358
2526
  * @param data - The data to sign (UTF-8 string)
2359
- * @param base64PrivateKey - Base64 encoded PKCS8 private key
2527
+ * @param privateKeyInput - Base64 encoded PKCS8 DER private key or unencrypted PKCS8 PEM private key
2360
2528
  * @returns Base64 encoded signature
2361
- * @throws WaffoError if signing fails (S0003)
2529
+ * @throws WaffoError if the private key is invalid (S0007) or signing fails (S0003)
2362
2530
  *
2363
2531
  * @example
2364
2532
  * ```typescript
2365
2533
  * const signature = sign('{"amount":"100.00"}', privateKey);
2366
2534
  * ```
2367
2535
  */
2368
- declare function sign(data: string, base64PrivateKey: string): string;
2536
+ declare function sign(data: string, privateKeyInput: string): string;
2369
2537
  /**
2370
2538
  * Verifies a signature using RSA-SHA256.
2371
2539
  *
@@ -2384,12 +2552,12 @@ declare function sign(data: string, base64PrivateKey: string): string;
2384
2552
  */
2385
2553
  declare function verify(data: string, base64Signature: string, base64PublicKey: string): boolean;
2386
2554
  /**
2387
- * Validates a Base64 encoded PKCS8 private key.
2555
+ * Validates a Base64 encoded PKCS8 DER private key or unencrypted PKCS8 PEM private key.
2388
2556
  *
2389
2557
  * This method attempts to parse the key to ensure it's a valid RSA private key.
2390
2558
  * Use this at startup to fail fast if the private key is invalid.
2391
2559
  *
2392
- * @param base64PrivateKey - Base64 encoded PKCS8 private key
2560
+ * @param base64PrivateKey - Base64 encoded PKCS8 DER private key or unencrypted PKCS8 PEM private key
2393
2561
  * @throws WaffoError if the key is invalid (S0007)
2394
2562
  *
2395
2563
  * @example
@@ -2440,4 +2608,4 @@ declare const RsaUtils: {
2440
2608
  generateKeyPair: typeof generateKeyPair;
2441
2609
  };
2442
2610
 
2443
- export { type AddressInfo, ApiResponse, type BaseNotification, type CancelOrderData, type CancelOrderParams, type CancelSubscriptionData, type CancelSubscriptionParams, type CaptureOrderData, type CaptureOrderParams, type CardInfo, type CreateOrderData, type CreateOrderParams, type CreateSubscriptionData, type CreateSubscriptionParams, Environment, EnvironmentBaseUrl, type GoodsInfo, type HttpRequest, type HttpResponse, type HttpTransport, type InquiryMerchantConfigData, type InquiryMerchantConfigParams, type InquiryOrderData, type InquiryOrderParams, type InquiryPayMethodConfigData, type InquiryPayMethodConfigParams, type InquiryRefundData, type InquiryRefundParams, type InquirySubscriptionData, type InquirySubscriptionParams, type ManageSubscriptionData, type ManageSubscriptionParams, MerchantConfigResource, type MerchantInfo, OrderResource, type OrderStatus, PayMethodConfigResource, type PayMethodInfo, type PaymentInfo, type PaymentNotification, type PaymentNotificationResult, type PeriodType, type ProductInfo, type RefundNotification, type RefundNotificationResult, type RefundOrderData, type RefundOrderParams, RefundResource, type RefundStatus$1 as RefundStatus, type RefundUserInfo, type RequestOptions, type RiskData, RsaUtils, type SubscriptionChangeData, type SubscriptionChangeInquiryData, type SubscriptionChangeInquiryParams, type SubscriptionChangeParams, type SubscriptionChangeProductInfo, type SubscriptionChangeStatus, type SubscriptionInfo, type SubscriptionManageAction, type SubscriptionMerchantInfo, type SubscriptionNotificationResult, type SubscriptionPaymentDetail, type SubscriptionPaymentInfo, type SubscriptionPeriodChangedNotification, SubscriptionResource, type SubscriptionScheduledAmount, type SubscriptionStatus, type SubscriptionStatusNotification, type SubscriptionUpdateProductInfo, type SubscriptionUserInfo, type UpdateSubscriptionData, type UpdateSubscriptionParams, type UserInfo, Waffo, type WaffoConfig, WaffoConfigDefaults, WaffoError, WaffoErrorCode, WaffoHttpClient, type WaffoLogger, WaffoUnknownStatusError, WebhookEventType, WebhookHandler, type WebhookResult };
2611
+ export { type AddressInfo, ApiResponse, type BaseNotification, type CancelOrderData, type CancelOrderParams, type CancelSubscriptionData, type CancelSubscriptionParams, type CaptureOrderData, type CaptureOrderParams, type CardInfo, type CreateOrderData, type CreateOrderParams, type CreateSubscriptionData, type CreateSubscriptionParams, Environment, EnvironmentBaseUrl, type FixedMaintenanceRule, type GoodsInfo, type HttpRequest, type HttpResponse, type HttpTransport, type InquiryMerchantConfigData, type InquiryMerchantConfigParams, type InquiryOrderData, type InquiryOrderParams, type InquiryPayMethodConfigData, type InquiryPayMethodConfigParams, type InquiryRefundData, type InquiryRefundParams, type InquirySubscriptionData, type InquirySubscriptionParams, type ManageSubscriptionData, type ManageSubscriptionParams, MerchantConfigResource, type MerchantInfo, OrderResource, type OrderStatus, PayMethodConfigResource, type PayMethodDetail, type PayMethodInfo, type PaymentInfo, type PaymentNotification, type PaymentNotificationResult, type PeriodType, type ProductInfo, type PromotionInfo, type RefundNotification, type RefundNotificationResult, type RefundOrderData, type RefundOrderParams, RefundResource, type RefundStatus$1 as RefundStatus, type RefundUserInfo, type RequestOptions, type RiskData, RsaUtils, type SubscriptionChangeData, type SubscriptionChangeInquiryData, type SubscriptionChangeInquiryParams, type SubscriptionChangeParams, type SubscriptionChangeProductInfo, type SubscriptionChangeStatus, type SubscriptionInfo, type SubscriptionManageAction, type SubscriptionMerchantInfo, type SubscriptionNotificationResult, type SubscriptionPaymentDetail, type SubscriptionPaymentInfo, type SubscriptionPeriodChangedNotification, type SubscriptionPromotionInfo, SubscriptionResource, type SubscriptionScheduledAmount, type SubscriptionStatus, type SubscriptionStatusNotification, type SubscriptionUpdateProductInfo, type SubscriptionUserInfo, type UpdateSubscriptionData, type UpdateSubscriptionParams, type UserInfo, Waffo, type WaffoConfig, WaffoConfigDefaults, WaffoError, WaffoErrorCode, WaffoHttpClient, type WaffoLogger, WaffoUnknownStatusError, type WalletInquiryData, type WalletInquiryParams, WalletResource, WebhookEventType, WebhookHandler, type WebhookResult, type X402Info };