@waffo/waffo-node 2.4.0 → 2.5.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/README.md +4 -4
- package/dist/index.d.mts +193 -6
- package/dist/index.d.ts +193 -6
- package/dist/index.js +23 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Waffo Node.js SDK
|
|
2
2
|
|
|
3
|
-
<!-- Synced with waffo-sdk/README.md @ commit
|
|
3
|
+
<!-- Synced with waffo-sdk/README.md @ commit d483eba -->
|
|
4
4
|
|
|
5
5
|
**English** | [中文](README_CN.md)
|
|
6
6
|
|
|
@@ -544,9 +544,9 @@ try {
|
|
|
544
544
|
notifyUrl: 'https://your-site.com/webhook/subscription',
|
|
545
545
|
productInfoList: [
|
|
546
546
|
{
|
|
547
|
-
description: '
|
|
548
|
-
periodType: '
|
|
549
|
-
periodInterval: '
|
|
547
|
+
description: 'Annual Premium Subscription (12 months)',
|
|
548
|
+
periodType: 'MONTHLY',
|
|
549
|
+
periodInterval: '12',
|
|
550
550
|
amount: '999.00',
|
|
551
551
|
},
|
|
552
552
|
],
|
package/dist/index.d.mts
CHANGED
|
@@ -213,6 +213,11 @@ interface CreateSubscriptionParams {
|
|
|
213
213
|
orderExpiredAt?: string;
|
|
214
214
|
addressInfo?: SubscriptionAddressInfo;
|
|
215
215
|
riskData?: SubscriptionRiskData;
|
|
216
|
+
brandInfo?: SubscriptionBrandInfo;
|
|
217
|
+
subscriptionMode?: string;
|
|
218
|
+
acqMerchant?: Record<string, unknown>;
|
|
219
|
+
acqProduct?: Record<string, unknown>;
|
|
220
|
+
acqAgreements?: Record<string, unknown>[];
|
|
216
221
|
[key: string]: unknown;
|
|
217
222
|
}
|
|
218
223
|
/**
|
|
@@ -233,7 +238,19 @@ interface CreateSubscriptionData {
|
|
|
233
238
|
interface InquirySubscriptionParams {
|
|
234
239
|
subscriptionRequest?: string;
|
|
235
240
|
subscriptionId?: string;
|
|
236
|
-
paymentDetails?:
|
|
241
|
+
paymentDetails?: 0 | 1 | number;
|
|
242
|
+
[key: string]: unknown;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Subscription payment detail returned when inquiry paymentDetails=1.
|
|
246
|
+
*/
|
|
247
|
+
interface SubscriptionPaymentDetail {
|
|
248
|
+
acquiringOrderId?: string;
|
|
249
|
+
orderCurrency?: string;
|
|
250
|
+
orderAmount?: string;
|
|
251
|
+
orderStatus?: string;
|
|
252
|
+
orderUpdatedAt?: string;
|
|
253
|
+
period?: string;
|
|
237
254
|
[key: string]: unknown;
|
|
238
255
|
}
|
|
239
256
|
/**
|
|
@@ -258,7 +275,7 @@ interface InquirySubscriptionData {
|
|
|
258
275
|
failedReason?: string;
|
|
259
276
|
subscriptionManagementUrl?: string;
|
|
260
277
|
extendInfo?: string;
|
|
261
|
-
paymentDetails?:
|
|
278
|
+
paymentDetails?: SubscriptionPaymentDetail[];
|
|
262
279
|
goodsInfo?: {
|
|
263
280
|
goodsId?: string;
|
|
264
281
|
goodsName?: string;
|
|
@@ -273,7 +290,7 @@ interface InquirySubscriptionData {
|
|
|
273
290
|
* Cancel subscription request parameters.
|
|
274
291
|
*/
|
|
275
292
|
interface CancelSubscriptionParams {
|
|
276
|
-
subscriptionId
|
|
293
|
+
subscriptionId: string;
|
|
277
294
|
merchantId?: string;
|
|
278
295
|
requestedAt?: string;
|
|
279
296
|
[key: string]: unknown;
|
|
@@ -308,6 +325,99 @@ interface ManageSubscriptionData {
|
|
|
308
325
|
subscriptionStatus?: SubscriptionStatus;
|
|
309
326
|
[key: string]: unknown;
|
|
310
327
|
}
|
|
328
|
+
/**
|
|
329
|
+
* Scheduled amount item for a specific subscription period.
|
|
330
|
+
*/
|
|
331
|
+
interface SubscriptionScheduledAmount {
|
|
332
|
+
/**
|
|
333
|
+
* Period number, for example "1".
|
|
334
|
+
*/
|
|
335
|
+
period?: string;
|
|
336
|
+
/**
|
|
337
|
+
* Merchant subscription amount for this period.
|
|
338
|
+
*/
|
|
339
|
+
amount?: string;
|
|
340
|
+
[key: string]: unknown;
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Product information for subscription update operations.
|
|
344
|
+
*/
|
|
345
|
+
interface SubscriptionUpdateProductInfo {
|
|
346
|
+
/**
|
|
347
|
+
* Updated trial period amount. Empty means no trial period.
|
|
348
|
+
*/
|
|
349
|
+
trialPeriodAmount?: string;
|
|
350
|
+
/**
|
|
351
|
+
* Scheduled amount list for each period.
|
|
352
|
+
*/
|
|
353
|
+
scheduledAmounts?: SubscriptionScheduledAmount[];
|
|
354
|
+
[key: string]: unknown;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Update subscription request parameters.
|
|
358
|
+
*/
|
|
359
|
+
interface UpdateSubscriptionParams {
|
|
360
|
+
/**
|
|
361
|
+
* Merchant subscription request ID. Provide subscriptionRequest or subscriptionId.
|
|
362
|
+
*/
|
|
363
|
+
subscriptionRequest?: string;
|
|
364
|
+
/**
|
|
365
|
+
* Waffo subscription ID. Provide subscriptionRequest or subscriptionId.
|
|
366
|
+
*/
|
|
367
|
+
subscriptionId?: string;
|
|
368
|
+
/**
|
|
369
|
+
* New merchant subscription amount. At least one of amount and
|
|
370
|
+
* productInfo.scheduledAmounts must be provided.
|
|
371
|
+
*/
|
|
372
|
+
amount?: string;
|
|
373
|
+
/**
|
|
374
|
+
* Product information containing trial or scheduled amount updates.
|
|
375
|
+
*/
|
|
376
|
+
productInfo?: SubscriptionUpdateProductInfo;
|
|
377
|
+
[key: string]: unknown;
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Update subscription response data.
|
|
381
|
+
*/
|
|
382
|
+
interface UpdateSubscriptionData {
|
|
383
|
+
/**
|
|
384
|
+
* Waffo subscription ID.
|
|
385
|
+
*/
|
|
386
|
+
subscriptionId?: string;
|
|
387
|
+
/**
|
|
388
|
+
* Subscription request ID sent from Merchant.
|
|
389
|
+
*/
|
|
390
|
+
subscriptionRequest?: string;
|
|
391
|
+
/**
|
|
392
|
+
* Previous trial period amount.
|
|
393
|
+
*/
|
|
394
|
+
previousTrialPeriodAmount?: string;
|
|
395
|
+
/**
|
|
396
|
+
* New trial period amount.
|
|
397
|
+
*/
|
|
398
|
+
newTrialPeriodAmount?: string;
|
|
399
|
+
/**
|
|
400
|
+
* Previous merchant subscription amount.
|
|
401
|
+
*/
|
|
402
|
+
previousAmount?: string;
|
|
403
|
+
/**
|
|
404
|
+
* New merchant subscription amount.
|
|
405
|
+
*/
|
|
406
|
+
newAmount?: string;
|
|
407
|
+
/**
|
|
408
|
+
* Previous scheduled amount list for each period.
|
|
409
|
+
*/
|
|
410
|
+
previousScheduledAmounts?: SubscriptionScheduledAmount[];
|
|
411
|
+
/**
|
|
412
|
+
* New scheduled amount list for each period.
|
|
413
|
+
*/
|
|
414
|
+
newScheduledAmounts?: SubscriptionScheduledAmount[];
|
|
415
|
+
/**
|
|
416
|
+
* The next period number when the new amount takes effect.
|
|
417
|
+
*/
|
|
418
|
+
nextEffectivePeriod?: string;
|
|
419
|
+
[key: string]: unknown;
|
|
420
|
+
}
|
|
311
421
|
/**
|
|
312
422
|
* Subscription status enum.
|
|
313
423
|
* Based on openapi.json SubscriptionInquiryResponse.subscriptionStatus.
|
|
@@ -382,6 +492,10 @@ interface ProductInfo {
|
|
|
382
492
|
* Current billing period number.
|
|
383
493
|
*/
|
|
384
494
|
currentPeriod?: string;
|
|
495
|
+
/**
|
|
496
|
+
* Scheduled amount list for each period.
|
|
497
|
+
*/
|
|
498
|
+
scheduledAmounts?: SubscriptionScheduledAmount[];
|
|
385
499
|
[key: string]: unknown;
|
|
386
500
|
}
|
|
387
501
|
/**
|
|
@@ -440,6 +554,15 @@ interface SubscriptionRiskData {
|
|
|
440
554
|
deviceTokenId?: string;
|
|
441
555
|
[key: string]: unknown;
|
|
442
556
|
}
|
|
557
|
+
/**
|
|
558
|
+
* Brand display information for cashier.
|
|
559
|
+
*/
|
|
560
|
+
interface SubscriptionBrandInfo {
|
|
561
|
+
cashierLogoUrl?: string;
|
|
562
|
+
cashierDisplayName?: string;
|
|
563
|
+
cashierProductImageUrl?: string;
|
|
564
|
+
[key: string]: unknown;
|
|
565
|
+
}
|
|
443
566
|
/**
|
|
444
567
|
* Merchant information for subscription.
|
|
445
568
|
*/
|
|
@@ -517,6 +640,10 @@ interface SubscriptionChangeProductInfo {
|
|
|
517
640
|
* Trial period interval (max 12 characters).
|
|
518
641
|
*/
|
|
519
642
|
trialPeriodInterval?: string;
|
|
643
|
+
/**
|
|
644
|
+
* Scheduled amount list for each period.
|
|
645
|
+
*/
|
|
646
|
+
scheduledAmounts?: SubscriptionScheduledAmount[];
|
|
520
647
|
[key: string]: unknown;
|
|
521
648
|
}
|
|
522
649
|
/**
|
|
@@ -634,6 +761,10 @@ interface SubscriptionChangeParams {
|
|
|
634
761
|
userIsFirstPurchase?: string;
|
|
635
762
|
[key: string]: unknown;
|
|
636
763
|
};
|
|
764
|
+
/**
|
|
765
|
+
* Brand display information for cashier.
|
|
766
|
+
*/
|
|
767
|
+
brandInfo?: SubscriptionBrandInfo;
|
|
637
768
|
[key: string]: unknown;
|
|
638
769
|
}
|
|
639
770
|
/**
|
|
@@ -1231,6 +1362,11 @@ interface CreateOrderParams {
|
|
|
1231
1362
|
cardInfo?: CardInfo;
|
|
1232
1363
|
riskData?: RiskData;
|
|
1233
1364
|
paymentTokenData?: PaymentTokenData;
|
|
1365
|
+
brandInfo?: BrandInfo;
|
|
1366
|
+
productDetail?: ProductDetail;
|
|
1367
|
+
acqOrderExtSubscriptionInfo?: AcqOrderExtSubscriptionInfo;
|
|
1368
|
+
channelId?: string;
|
|
1369
|
+
innerCardData?: WaffoTokenCardData;
|
|
1234
1370
|
userCurrency?: string;
|
|
1235
1371
|
successRedirectUrl?: string;
|
|
1236
1372
|
failedRedirectUrl?: string;
|
|
@@ -1356,9 +1492,9 @@ interface RefundOrderData {
|
|
|
1356
1492
|
interface CaptureOrderParams {
|
|
1357
1493
|
paymentRequestId?: string;
|
|
1358
1494
|
acquiringOrderId?: string;
|
|
1359
|
-
merchantId
|
|
1495
|
+
merchantId?: string;
|
|
1360
1496
|
captureRequestedAt?: string;
|
|
1361
|
-
captureAmount
|
|
1497
|
+
captureAmount: string;
|
|
1362
1498
|
[key: string]: unknown;
|
|
1363
1499
|
}
|
|
1364
1500
|
/**
|
|
@@ -1476,6 +1612,42 @@ interface PaymentTokenData {
|
|
|
1476
1612
|
tokenId?: string;
|
|
1477
1613
|
[key: string]: unknown;
|
|
1478
1614
|
}
|
|
1615
|
+
/**
|
|
1616
|
+
* Brand display information for cashier.
|
|
1617
|
+
*/
|
|
1618
|
+
interface BrandInfo {
|
|
1619
|
+
cashierLogoUrl?: string;
|
|
1620
|
+
cashierDisplayName?: string;
|
|
1621
|
+
cashierProductImageUrl?: string;
|
|
1622
|
+
[key: string]: unknown;
|
|
1623
|
+
}
|
|
1624
|
+
/**
|
|
1625
|
+
* Product detail extension payload.
|
|
1626
|
+
*/
|
|
1627
|
+
interface ProductDetail {
|
|
1628
|
+
subscriptionInfo?: SubscriptionInfo;
|
|
1629
|
+
[key: string]: unknown;
|
|
1630
|
+
}
|
|
1631
|
+
/**
|
|
1632
|
+
* Subscription extension information for an acquiring order.
|
|
1633
|
+
*/
|
|
1634
|
+
interface AcqOrderExtSubscriptionInfo {
|
|
1635
|
+
subscriptionId?: string;
|
|
1636
|
+
periodNo?: number;
|
|
1637
|
+
merchantRequest?: string;
|
|
1638
|
+
subscriptionEvent?: string;
|
|
1639
|
+
[key: string]: unknown;
|
|
1640
|
+
}
|
|
1641
|
+
/**
|
|
1642
|
+
* Tokenized card data used for direct card payment flows.
|
|
1643
|
+
*/
|
|
1644
|
+
interface WaffoTokenCardData {
|
|
1645
|
+
cardBinDataList?: Record<string, unknown>[];
|
|
1646
|
+
maskedCardInfo?: string;
|
|
1647
|
+
cardBin?: string;
|
|
1648
|
+
cardExpiry?: string;
|
|
1649
|
+
[key: string]: unknown;
|
|
1650
|
+
}
|
|
1479
1651
|
/**
|
|
1480
1652
|
* Refund user information.
|
|
1481
1653
|
*/
|
|
@@ -1622,6 +1794,7 @@ declare class SubscriptionResource extends BaseResource {
|
|
|
1622
1794
|
private static readonly PATH_INQUIRY;
|
|
1623
1795
|
private static readonly PATH_CANCEL;
|
|
1624
1796
|
private static readonly PATH_MANAGE;
|
|
1797
|
+
private static readonly PATH_UPDATE;
|
|
1625
1798
|
private static readonly PATH_CHANGE;
|
|
1626
1799
|
private static readonly PATH_CHANGE_INQUIRY;
|
|
1627
1800
|
/**
|
|
@@ -1660,6 +1833,18 @@ declare class SubscriptionResource extends BaseResource {
|
|
|
1660
1833
|
* @throws WaffoUnknownStatusError for network errors
|
|
1661
1834
|
*/
|
|
1662
1835
|
manage(params: ManageSubscriptionParams, options?: RequestOptions): Promise<ApiResponse<ManageSubscriptionData>>;
|
|
1836
|
+
/**
|
|
1837
|
+
* Updates an existing subscription amount or scheduled period amounts.
|
|
1838
|
+
*
|
|
1839
|
+
* Provide either subscriptionRequest or subscriptionId. At least one of amount
|
|
1840
|
+
* or productInfo.scheduledAmounts must be provided.
|
|
1841
|
+
*
|
|
1842
|
+
* @param params - Subscription update parameters
|
|
1843
|
+
* @param options - Optional request options
|
|
1844
|
+
* @returns API response with update result
|
|
1845
|
+
* @throws WaffoUnknownStatusError for network errors
|
|
1846
|
+
*/
|
|
1847
|
+
update(params: UpdateSubscriptionParams, options?: RequestOptions): Promise<ApiResponse<UpdateSubscriptionData>>;
|
|
1663
1848
|
/**
|
|
1664
1849
|
* Changes (upgrades/downgrades) an existing subscription.
|
|
1665
1850
|
*
|
|
@@ -1763,6 +1948,8 @@ interface InquiryRefundData {
|
|
|
1763
1948
|
userCurrency?: string;
|
|
1764
1949
|
finalDealAmount?: string;
|
|
1765
1950
|
remainingRefundAmount?: string;
|
|
1951
|
+
merchantUserId?: string;
|
|
1952
|
+
subscriptionInfo?: SubscriptionInfo;
|
|
1766
1953
|
userInfo?: RefundUserInfo;
|
|
1767
1954
|
refundCompletedAt?: string;
|
|
1768
1955
|
refundSource?: string;
|
|
@@ -2253,4 +2440,4 @@ declare const RsaUtils: {
|
|
|
2253
2440
|
generateKeyPair: typeof generateKeyPair;
|
|
2254
2441
|
};
|
|
2255
2442
|
|
|
2256
|
-
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 SubscriptionInfo, type SubscriptionManageAction, type SubscriptionMerchantInfo, type SubscriptionNotificationResult, type SubscriptionPaymentInfo, type SubscriptionPeriodChangedNotification, SubscriptionResource, type SubscriptionStatus, type SubscriptionStatusNotification, type SubscriptionUserInfo, type UserInfo, Waffo, type WaffoConfig, WaffoConfigDefaults, WaffoError, WaffoErrorCode, WaffoHttpClient, type WaffoLogger, WaffoUnknownStatusError, WebhookEventType, WebhookHandler, type WebhookResult };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -213,6 +213,11 @@ interface CreateSubscriptionParams {
|
|
|
213
213
|
orderExpiredAt?: string;
|
|
214
214
|
addressInfo?: SubscriptionAddressInfo;
|
|
215
215
|
riskData?: SubscriptionRiskData;
|
|
216
|
+
brandInfo?: SubscriptionBrandInfo;
|
|
217
|
+
subscriptionMode?: string;
|
|
218
|
+
acqMerchant?: Record<string, unknown>;
|
|
219
|
+
acqProduct?: Record<string, unknown>;
|
|
220
|
+
acqAgreements?: Record<string, unknown>[];
|
|
216
221
|
[key: string]: unknown;
|
|
217
222
|
}
|
|
218
223
|
/**
|
|
@@ -233,7 +238,19 @@ interface CreateSubscriptionData {
|
|
|
233
238
|
interface InquirySubscriptionParams {
|
|
234
239
|
subscriptionRequest?: string;
|
|
235
240
|
subscriptionId?: string;
|
|
236
|
-
paymentDetails?:
|
|
241
|
+
paymentDetails?: 0 | 1 | number;
|
|
242
|
+
[key: string]: unknown;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Subscription payment detail returned when inquiry paymentDetails=1.
|
|
246
|
+
*/
|
|
247
|
+
interface SubscriptionPaymentDetail {
|
|
248
|
+
acquiringOrderId?: string;
|
|
249
|
+
orderCurrency?: string;
|
|
250
|
+
orderAmount?: string;
|
|
251
|
+
orderStatus?: string;
|
|
252
|
+
orderUpdatedAt?: string;
|
|
253
|
+
period?: string;
|
|
237
254
|
[key: string]: unknown;
|
|
238
255
|
}
|
|
239
256
|
/**
|
|
@@ -258,7 +275,7 @@ interface InquirySubscriptionData {
|
|
|
258
275
|
failedReason?: string;
|
|
259
276
|
subscriptionManagementUrl?: string;
|
|
260
277
|
extendInfo?: string;
|
|
261
|
-
paymentDetails?:
|
|
278
|
+
paymentDetails?: SubscriptionPaymentDetail[];
|
|
262
279
|
goodsInfo?: {
|
|
263
280
|
goodsId?: string;
|
|
264
281
|
goodsName?: string;
|
|
@@ -273,7 +290,7 @@ interface InquirySubscriptionData {
|
|
|
273
290
|
* Cancel subscription request parameters.
|
|
274
291
|
*/
|
|
275
292
|
interface CancelSubscriptionParams {
|
|
276
|
-
subscriptionId
|
|
293
|
+
subscriptionId: string;
|
|
277
294
|
merchantId?: string;
|
|
278
295
|
requestedAt?: string;
|
|
279
296
|
[key: string]: unknown;
|
|
@@ -308,6 +325,99 @@ interface ManageSubscriptionData {
|
|
|
308
325
|
subscriptionStatus?: SubscriptionStatus;
|
|
309
326
|
[key: string]: unknown;
|
|
310
327
|
}
|
|
328
|
+
/**
|
|
329
|
+
* Scheduled amount item for a specific subscription period.
|
|
330
|
+
*/
|
|
331
|
+
interface SubscriptionScheduledAmount {
|
|
332
|
+
/**
|
|
333
|
+
* Period number, for example "1".
|
|
334
|
+
*/
|
|
335
|
+
period?: string;
|
|
336
|
+
/**
|
|
337
|
+
* Merchant subscription amount for this period.
|
|
338
|
+
*/
|
|
339
|
+
amount?: string;
|
|
340
|
+
[key: string]: unknown;
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Product information for subscription update operations.
|
|
344
|
+
*/
|
|
345
|
+
interface SubscriptionUpdateProductInfo {
|
|
346
|
+
/**
|
|
347
|
+
* Updated trial period amount. Empty means no trial period.
|
|
348
|
+
*/
|
|
349
|
+
trialPeriodAmount?: string;
|
|
350
|
+
/**
|
|
351
|
+
* Scheduled amount list for each period.
|
|
352
|
+
*/
|
|
353
|
+
scheduledAmounts?: SubscriptionScheduledAmount[];
|
|
354
|
+
[key: string]: unknown;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Update subscription request parameters.
|
|
358
|
+
*/
|
|
359
|
+
interface UpdateSubscriptionParams {
|
|
360
|
+
/**
|
|
361
|
+
* Merchant subscription request ID. Provide subscriptionRequest or subscriptionId.
|
|
362
|
+
*/
|
|
363
|
+
subscriptionRequest?: string;
|
|
364
|
+
/**
|
|
365
|
+
* Waffo subscription ID. Provide subscriptionRequest or subscriptionId.
|
|
366
|
+
*/
|
|
367
|
+
subscriptionId?: string;
|
|
368
|
+
/**
|
|
369
|
+
* New merchant subscription amount. At least one of amount and
|
|
370
|
+
* productInfo.scheduledAmounts must be provided.
|
|
371
|
+
*/
|
|
372
|
+
amount?: string;
|
|
373
|
+
/**
|
|
374
|
+
* Product information containing trial or scheduled amount updates.
|
|
375
|
+
*/
|
|
376
|
+
productInfo?: SubscriptionUpdateProductInfo;
|
|
377
|
+
[key: string]: unknown;
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Update subscription response data.
|
|
381
|
+
*/
|
|
382
|
+
interface UpdateSubscriptionData {
|
|
383
|
+
/**
|
|
384
|
+
* Waffo subscription ID.
|
|
385
|
+
*/
|
|
386
|
+
subscriptionId?: string;
|
|
387
|
+
/**
|
|
388
|
+
* Subscription request ID sent from Merchant.
|
|
389
|
+
*/
|
|
390
|
+
subscriptionRequest?: string;
|
|
391
|
+
/**
|
|
392
|
+
* Previous trial period amount.
|
|
393
|
+
*/
|
|
394
|
+
previousTrialPeriodAmount?: string;
|
|
395
|
+
/**
|
|
396
|
+
* New trial period amount.
|
|
397
|
+
*/
|
|
398
|
+
newTrialPeriodAmount?: string;
|
|
399
|
+
/**
|
|
400
|
+
* Previous merchant subscription amount.
|
|
401
|
+
*/
|
|
402
|
+
previousAmount?: string;
|
|
403
|
+
/**
|
|
404
|
+
* New merchant subscription amount.
|
|
405
|
+
*/
|
|
406
|
+
newAmount?: string;
|
|
407
|
+
/**
|
|
408
|
+
* Previous scheduled amount list for each period.
|
|
409
|
+
*/
|
|
410
|
+
previousScheduledAmounts?: SubscriptionScheduledAmount[];
|
|
411
|
+
/**
|
|
412
|
+
* New scheduled amount list for each period.
|
|
413
|
+
*/
|
|
414
|
+
newScheduledAmounts?: SubscriptionScheduledAmount[];
|
|
415
|
+
/**
|
|
416
|
+
* The next period number when the new amount takes effect.
|
|
417
|
+
*/
|
|
418
|
+
nextEffectivePeriod?: string;
|
|
419
|
+
[key: string]: unknown;
|
|
420
|
+
}
|
|
311
421
|
/**
|
|
312
422
|
* Subscription status enum.
|
|
313
423
|
* Based on openapi.json SubscriptionInquiryResponse.subscriptionStatus.
|
|
@@ -382,6 +492,10 @@ interface ProductInfo {
|
|
|
382
492
|
* Current billing period number.
|
|
383
493
|
*/
|
|
384
494
|
currentPeriod?: string;
|
|
495
|
+
/**
|
|
496
|
+
* Scheduled amount list for each period.
|
|
497
|
+
*/
|
|
498
|
+
scheduledAmounts?: SubscriptionScheduledAmount[];
|
|
385
499
|
[key: string]: unknown;
|
|
386
500
|
}
|
|
387
501
|
/**
|
|
@@ -440,6 +554,15 @@ interface SubscriptionRiskData {
|
|
|
440
554
|
deviceTokenId?: string;
|
|
441
555
|
[key: string]: unknown;
|
|
442
556
|
}
|
|
557
|
+
/**
|
|
558
|
+
* Brand display information for cashier.
|
|
559
|
+
*/
|
|
560
|
+
interface SubscriptionBrandInfo {
|
|
561
|
+
cashierLogoUrl?: string;
|
|
562
|
+
cashierDisplayName?: string;
|
|
563
|
+
cashierProductImageUrl?: string;
|
|
564
|
+
[key: string]: unknown;
|
|
565
|
+
}
|
|
443
566
|
/**
|
|
444
567
|
* Merchant information for subscription.
|
|
445
568
|
*/
|
|
@@ -517,6 +640,10 @@ interface SubscriptionChangeProductInfo {
|
|
|
517
640
|
* Trial period interval (max 12 characters).
|
|
518
641
|
*/
|
|
519
642
|
trialPeriodInterval?: string;
|
|
643
|
+
/**
|
|
644
|
+
* Scheduled amount list for each period.
|
|
645
|
+
*/
|
|
646
|
+
scheduledAmounts?: SubscriptionScheduledAmount[];
|
|
520
647
|
[key: string]: unknown;
|
|
521
648
|
}
|
|
522
649
|
/**
|
|
@@ -634,6 +761,10 @@ interface SubscriptionChangeParams {
|
|
|
634
761
|
userIsFirstPurchase?: string;
|
|
635
762
|
[key: string]: unknown;
|
|
636
763
|
};
|
|
764
|
+
/**
|
|
765
|
+
* Brand display information for cashier.
|
|
766
|
+
*/
|
|
767
|
+
brandInfo?: SubscriptionBrandInfo;
|
|
637
768
|
[key: string]: unknown;
|
|
638
769
|
}
|
|
639
770
|
/**
|
|
@@ -1231,6 +1362,11 @@ interface CreateOrderParams {
|
|
|
1231
1362
|
cardInfo?: CardInfo;
|
|
1232
1363
|
riskData?: RiskData;
|
|
1233
1364
|
paymentTokenData?: PaymentTokenData;
|
|
1365
|
+
brandInfo?: BrandInfo;
|
|
1366
|
+
productDetail?: ProductDetail;
|
|
1367
|
+
acqOrderExtSubscriptionInfo?: AcqOrderExtSubscriptionInfo;
|
|
1368
|
+
channelId?: string;
|
|
1369
|
+
innerCardData?: WaffoTokenCardData;
|
|
1234
1370
|
userCurrency?: string;
|
|
1235
1371
|
successRedirectUrl?: string;
|
|
1236
1372
|
failedRedirectUrl?: string;
|
|
@@ -1356,9 +1492,9 @@ interface RefundOrderData {
|
|
|
1356
1492
|
interface CaptureOrderParams {
|
|
1357
1493
|
paymentRequestId?: string;
|
|
1358
1494
|
acquiringOrderId?: string;
|
|
1359
|
-
merchantId
|
|
1495
|
+
merchantId?: string;
|
|
1360
1496
|
captureRequestedAt?: string;
|
|
1361
|
-
captureAmount
|
|
1497
|
+
captureAmount: string;
|
|
1362
1498
|
[key: string]: unknown;
|
|
1363
1499
|
}
|
|
1364
1500
|
/**
|
|
@@ -1476,6 +1612,42 @@ interface PaymentTokenData {
|
|
|
1476
1612
|
tokenId?: string;
|
|
1477
1613
|
[key: string]: unknown;
|
|
1478
1614
|
}
|
|
1615
|
+
/**
|
|
1616
|
+
* Brand display information for cashier.
|
|
1617
|
+
*/
|
|
1618
|
+
interface BrandInfo {
|
|
1619
|
+
cashierLogoUrl?: string;
|
|
1620
|
+
cashierDisplayName?: string;
|
|
1621
|
+
cashierProductImageUrl?: string;
|
|
1622
|
+
[key: string]: unknown;
|
|
1623
|
+
}
|
|
1624
|
+
/**
|
|
1625
|
+
* Product detail extension payload.
|
|
1626
|
+
*/
|
|
1627
|
+
interface ProductDetail {
|
|
1628
|
+
subscriptionInfo?: SubscriptionInfo;
|
|
1629
|
+
[key: string]: unknown;
|
|
1630
|
+
}
|
|
1631
|
+
/**
|
|
1632
|
+
* Subscription extension information for an acquiring order.
|
|
1633
|
+
*/
|
|
1634
|
+
interface AcqOrderExtSubscriptionInfo {
|
|
1635
|
+
subscriptionId?: string;
|
|
1636
|
+
periodNo?: number;
|
|
1637
|
+
merchantRequest?: string;
|
|
1638
|
+
subscriptionEvent?: string;
|
|
1639
|
+
[key: string]: unknown;
|
|
1640
|
+
}
|
|
1641
|
+
/**
|
|
1642
|
+
* Tokenized card data used for direct card payment flows.
|
|
1643
|
+
*/
|
|
1644
|
+
interface WaffoTokenCardData {
|
|
1645
|
+
cardBinDataList?: Record<string, unknown>[];
|
|
1646
|
+
maskedCardInfo?: string;
|
|
1647
|
+
cardBin?: string;
|
|
1648
|
+
cardExpiry?: string;
|
|
1649
|
+
[key: string]: unknown;
|
|
1650
|
+
}
|
|
1479
1651
|
/**
|
|
1480
1652
|
* Refund user information.
|
|
1481
1653
|
*/
|
|
@@ -1622,6 +1794,7 @@ declare class SubscriptionResource extends BaseResource {
|
|
|
1622
1794
|
private static readonly PATH_INQUIRY;
|
|
1623
1795
|
private static readonly PATH_CANCEL;
|
|
1624
1796
|
private static readonly PATH_MANAGE;
|
|
1797
|
+
private static readonly PATH_UPDATE;
|
|
1625
1798
|
private static readonly PATH_CHANGE;
|
|
1626
1799
|
private static readonly PATH_CHANGE_INQUIRY;
|
|
1627
1800
|
/**
|
|
@@ -1660,6 +1833,18 @@ declare class SubscriptionResource extends BaseResource {
|
|
|
1660
1833
|
* @throws WaffoUnknownStatusError for network errors
|
|
1661
1834
|
*/
|
|
1662
1835
|
manage(params: ManageSubscriptionParams, options?: RequestOptions): Promise<ApiResponse<ManageSubscriptionData>>;
|
|
1836
|
+
/**
|
|
1837
|
+
* Updates an existing subscription amount or scheduled period amounts.
|
|
1838
|
+
*
|
|
1839
|
+
* Provide either subscriptionRequest or subscriptionId. At least one of amount
|
|
1840
|
+
* or productInfo.scheduledAmounts must be provided.
|
|
1841
|
+
*
|
|
1842
|
+
* @param params - Subscription update parameters
|
|
1843
|
+
* @param options - Optional request options
|
|
1844
|
+
* @returns API response with update result
|
|
1845
|
+
* @throws WaffoUnknownStatusError for network errors
|
|
1846
|
+
*/
|
|
1847
|
+
update(params: UpdateSubscriptionParams, options?: RequestOptions): Promise<ApiResponse<UpdateSubscriptionData>>;
|
|
1663
1848
|
/**
|
|
1664
1849
|
* Changes (upgrades/downgrades) an existing subscription.
|
|
1665
1850
|
*
|
|
@@ -1763,6 +1948,8 @@ interface InquiryRefundData {
|
|
|
1763
1948
|
userCurrency?: string;
|
|
1764
1949
|
finalDealAmount?: string;
|
|
1765
1950
|
remainingRefundAmount?: string;
|
|
1951
|
+
merchantUserId?: string;
|
|
1952
|
+
subscriptionInfo?: SubscriptionInfo;
|
|
1766
1953
|
userInfo?: RefundUserInfo;
|
|
1767
1954
|
refundCompletedAt?: string;
|
|
1768
1955
|
refundSource?: string;
|
|
@@ -2253,4 +2440,4 @@ declare const RsaUtils: {
|
|
|
2253
2440
|
generateKeyPair: typeof generateKeyPair;
|
|
2254
2441
|
};
|
|
2255
2442
|
|
|
2256
|
-
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 SubscriptionInfo, type SubscriptionManageAction, type SubscriptionMerchantInfo, type SubscriptionNotificationResult, type SubscriptionPaymentInfo, type SubscriptionPeriodChangedNotification, SubscriptionResource, type SubscriptionStatus, type SubscriptionStatusNotification, type SubscriptionUserInfo, type UserInfo, Waffo, type WaffoConfig, WaffoConfigDefaults, WaffoError, WaffoErrorCode, WaffoHttpClient, type WaffoLogger, WaffoUnknownStatusError, WebhookEventType, WebhookHandler, type WebhookResult };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -463,7 +463,7 @@ var HEADER_SDK_VERSION = "x-sdk-version";
|
|
|
463
463
|
var HEADER_CONTENT_TYPE = "content-type";
|
|
464
464
|
var CONTENT_TYPE_JSON = "application/json";
|
|
465
465
|
var API_VERSION = "1.0.0";
|
|
466
|
-
var SDK_VERSION = "waffo-node/2.
|
|
466
|
+
var SDK_VERSION = "waffo-node/2.5.0";
|
|
467
467
|
var WaffoHttpClient = class {
|
|
468
468
|
baseUrl;
|
|
469
469
|
apiKey;
|
|
@@ -902,6 +902,9 @@ var OrderResource = class _OrderResource extends BaseResource {
|
|
|
902
902
|
* @throws WaffoUnknownStatusError for network errors
|
|
903
903
|
*/
|
|
904
904
|
async capture(params, options) {
|
|
905
|
+
if (!params.captureRequestedAt) {
|
|
906
|
+
params.captureRequestedAt = getCurrentTimestamp();
|
|
907
|
+
}
|
|
905
908
|
return this.httpClient.post(
|
|
906
909
|
this.getPath(_OrderResource.PATH_CAPTURE),
|
|
907
910
|
params,
|
|
@@ -916,6 +919,7 @@ var SubscriptionResource = class _SubscriptionResource extends BaseResource {
|
|
|
916
919
|
static PATH_INQUIRY = "/inquiry";
|
|
917
920
|
static PATH_CANCEL = "/cancel";
|
|
918
921
|
static PATH_MANAGE = "/manage";
|
|
922
|
+
static PATH_UPDATE = "/update";
|
|
919
923
|
static PATH_CHANGE = "/change";
|
|
920
924
|
static PATH_CHANGE_INQUIRY = "/change/inquiry";
|
|
921
925
|
/**
|
|
@@ -984,6 +988,24 @@ var SubscriptionResource = class _SubscriptionResource extends BaseResource {
|
|
|
984
988
|
options
|
|
985
989
|
);
|
|
986
990
|
}
|
|
991
|
+
/**
|
|
992
|
+
* Updates an existing subscription amount or scheduled period amounts.
|
|
993
|
+
*
|
|
994
|
+
* Provide either subscriptionRequest or subscriptionId. At least one of amount
|
|
995
|
+
* or productInfo.scheduledAmounts must be provided.
|
|
996
|
+
*
|
|
997
|
+
* @param params - Subscription update parameters
|
|
998
|
+
* @param options - Optional request options
|
|
999
|
+
* @returns API response with update result
|
|
1000
|
+
* @throws WaffoUnknownStatusError for network errors
|
|
1001
|
+
*/
|
|
1002
|
+
async update(params, options) {
|
|
1003
|
+
return this.httpClient.post(
|
|
1004
|
+
this.getPath(_SubscriptionResource.PATH_UPDATE),
|
|
1005
|
+
params,
|
|
1006
|
+
options
|
|
1007
|
+
);
|
|
1008
|
+
}
|
|
987
1009
|
/**
|
|
988
1010
|
* Changes (upgrades/downgrades) an existing subscription.
|
|
989
1011
|
*
|