@waffo/waffo-node 2.4.0 → 2.5.1
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 +12 -6
- package/dist/index.d.mts +252 -24
- package/dist/index.d.ts +252 -24
- package/dist/index.js +63 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +63 -25
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
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 c23c86f -->
|
|
4
4
|
|
|
5
5
|
**English** | [中文](README_CN.md)
|
|
6
6
|
|
|
@@ -10,6 +10,12 @@
|
|
|
10
10
|
|
|
11
11
|
Official Node.js/TypeScript SDK for [Waffo Payment Platform](https://www.waffo.com), providing one-stop global payment solutions for AI products, SaaS services, and more.
|
|
12
12
|
|
|
13
|
+
## Latest Release Highlights
|
|
14
|
+
|
|
15
|
+
- **Subscription update API**: Added `subscription().update()` with `amount`, `trialPeriodAmount`, and `scheduledAmounts` support.
|
|
16
|
+
- **Scheduled amount coverage**: Added `scheduledAmounts` fields across subscription create, change, update, and inquiry product info types.
|
|
17
|
+
- **E2E and contract hardening**: Added subscription update E2E coverage, auto-injected `captureRequestedAt` for `order.capture()`, and expanded nested schema field validation.
|
|
18
|
+
|
|
13
19
|
## Introduction
|
|
14
20
|
|
|
15
21
|
### Core Features
|
|
@@ -30,6 +36,7 @@ Official Node.js/TypeScript SDK for [Waffo Payment Platform](https://www.waffo.c
|
|
|
30
36
|
|
|
31
37
|
## Table of Contents
|
|
32
38
|
|
|
39
|
+
- [Latest Release Highlights](#latest-release-highlights)
|
|
33
40
|
- [Requirements](#requirements)
|
|
34
41
|
- [Installation](#installation)
|
|
35
42
|
- [Quick Start](#quick-start)
|
|
@@ -544,9 +551,9 @@ try {
|
|
|
544
551
|
notifyUrl: 'https://your-site.com/webhook/subscription',
|
|
545
552
|
productInfoList: [
|
|
546
553
|
{
|
|
547
|
-
description: '
|
|
548
|
-
periodType: '
|
|
549
|
-
periodInterval: '
|
|
554
|
+
description: 'Annual Premium Subscription (12 months)',
|
|
555
|
+
periodType: 'MONTHLY',
|
|
556
|
+
periodInterval: '12',
|
|
550
557
|
amount: '999.00',
|
|
551
558
|
},
|
|
552
559
|
],
|
|
@@ -1287,7 +1294,7 @@ Error codes are classified by first letter:
|
|
|
1287
1294
|
| `S0004` | Response Signature Verification Failed | `ApiResponse.error()` | Check Waffo public key config, contact Waffo |
|
|
1288
1295
|
| `S0005` | Request Serialization Failed | `ApiResponse.error()` | Check request parameter format |
|
|
1289
1296
|
| `S0006` | SDK Unknown Error | `ApiResponse.error()` | Check logs, contact technical support |
|
|
1290
|
-
| `S0007` | Invalid Private Key | `WaffoError` | Check if private key is valid Base64
|
|
1297
|
+
| `S0007` | Invalid Private Key | `WaffoError` | Check if private key is valid Base64 PKCS8 DER or unencrypted PKCS8 PEM format |
|
|
1291
1298
|
|
|
1292
1299
|
> **Important**: `S0001` and `E0001` (returned by server) indicate **unknown status**. Do not close order directly! Should call query API or wait for webhook to confirm actual status.
|
|
1293
1300
|
|
|
@@ -1421,4 +1428,3 @@ npm run test:vectors
|
|
|
1421
1428
|
## License
|
|
1422
1429
|
|
|
1423
1430
|
MIT License - See [LICENSE](LICENSE) file for details.
|
|
1424
|
-
|
package/dist/index.d.mts
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
|
|
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;
|
|
@@ -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
|
/**
|
|
@@ -390,9 +504,11 @@ interface ProductInfo {
|
|
|
390
504
|
interface SubscriptionUserInfo {
|
|
391
505
|
userId: string;
|
|
392
506
|
userEmail: string;
|
|
507
|
+
userTerminal?: string;
|
|
393
508
|
userPhone?: string;
|
|
394
509
|
userFirstName?: string;
|
|
395
510
|
userLastName?: string;
|
|
511
|
+
userCreatedAt?: string;
|
|
396
512
|
userCountryCode?: string;
|
|
397
513
|
userBrowserIp?: string;
|
|
398
514
|
userAgent?: string;
|
|
@@ -405,12 +521,23 @@ interface SubscriptionPaymentInfo {
|
|
|
405
521
|
productName: string;
|
|
406
522
|
payMethodType?: string;
|
|
407
523
|
payMethodName?: string;
|
|
524
|
+
payMethodProperties?: string;
|
|
525
|
+
payMethodUserAccountType?: string;
|
|
526
|
+
payMethodUserAccountNo?: string;
|
|
527
|
+
payMethodUserAccessToken?: string;
|
|
528
|
+
cashierLanguage?: string;
|
|
529
|
+
cashierAppearance?: string;
|
|
408
530
|
[key: string]: unknown;
|
|
409
531
|
}
|
|
410
532
|
/**
|
|
411
533
|
* Address information for subscription.
|
|
412
534
|
*/
|
|
413
535
|
interface SubscriptionAddressInfo {
|
|
536
|
+
address?: string;
|
|
537
|
+
city?: string;
|
|
538
|
+
region?: string;
|
|
539
|
+
postcode?: string;
|
|
540
|
+
addressCountryCode?: string;
|
|
414
541
|
shippingAddress?: {
|
|
415
542
|
country?: string;
|
|
416
543
|
state?: string;
|
|
@@ -435,11 +562,28 @@ interface SubscriptionAddressInfo {
|
|
|
435
562
|
* Risk data for subscription.
|
|
436
563
|
*/
|
|
437
564
|
interface SubscriptionRiskData {
|
|
565
|
+
userType?: string;
|
|
566
|
+
userCategory?: string;
|
|
567
|
+
userLegalName?: string;
|
|
568
|
+
userDisplayName?: string;
|
|
569
|
+
userRegistrationIp?: string;
|
|
570
|
+
userLastSeenIp?: string;
|
|
571
|
+
userIsNew?: string;
|
|
572
|
+
userIsFirstPurchase?: string;
|
|
438
573
|
deviceType?: string;
|
|
439
574
|
deviceId?: string;
|
|
440
575
|
deviceTokenId?: string;
|
|
441
576
|
[key: string]: unknown;
|
|
442
577
|
}
|
|
578
|
+
/**
|
|
579
|
+
* Brand display information for cashier.
|
|
580
|
+
*/
|
|
581
|
+
interface SubscriptionBrandInfo {
|
|
582
|
+
cashierLogoUrl?: string;
|
|
583
|
+
cashierDisplayName?: string;
|
|
584
|
+
cashierProductImageUrl?: string;
|
|
585
|
+
[key: string]: unknown;
|
|
586
|
+
}
|
|
443
587
|
/**
|
|
444
588
|
* Merchant information for subscription.
|
|
445
589
|
*/
|
|
@@ -517,6 +661,10 @@ interface SubscriptionChangeProductInfo {
|
|
|
517
661
|
* Trial period interval (max 12 characters).
|
|
518
662
|
*/
|
|
519
663
|
trialPeriodInterval?: string;
|
|
664
|
+
/**
|
|
665
|
+
* Scheduled amount list for each period.
|
|
666
|
+
*/
|
|
667
|
+
scheduledAmounts?: SubscriptionScheduledAmount[];
|
|
520
668
|
[key: string]: unknown;
|
|
521
669
|
}
|
|
522
670
|
/**
|
|
@@ -634,6 +782,10 @@ interface SubscriptionChangeParams {
|
|
|
634
782
|
userIsFirstPurchase?: string;
|
|
635
783
|
[key: string]: unknown;
|
|
636
784
|
};
|
|
785
|
+
/**
|
|
786
|
+
* Brand display information for cashier.
|
|
787
|
+
*/
|
|
788
|
+
brandInfo?: SubscriptionBrandInfo;
|
|
637
789
|
[key: string]: unknown;
|
|
638
790
|
}
|
|
639
791
|
/**
|
|
@@ -1231,6 +1383,11 @@ interface CreateOrderParams {
|
|
|
1231
1383
|
cardInfo?: CardInfo;
|
|
1232
1384
|
riskData?: RiskData;
|
|
1233
1385
|
paymentTokenData?: PaymentTokenData;
|
|
1386
|
+
brandInfo?: BrandInfo;
|
|
1387
|
+
productDetail?: ProductDetail;
|
|
1388
|
+
acqOrderExtSubscriptionInfo?: AcqOrderExtSubscriptionInfo;
|
|
1389
|
+
channelId?: string;
|
|
1390
|
+
innerCardData?: WaffoTokenCardData;
|
|
1234
1391
|
userCurrency?: string;
|
|
1235
1392
|
successRedirectUrl?: string;
|
|
1236
1393
|
failedRedirectUrl?: string;
|
|
@@ -1356,9 +1513,9 @@ interface RefundOrderData {
|
|
|
1356
1513
|
interface CaptureOrderParams {
|
|
1357
1514
|
paymentRequestId?: string;
|
|
1358
1515
|
acquiringOrderId?: string;
|
|
1359
|
-
merchantId
|
|
1516
|
+
merchantId?: string;
|
|
1360
1517
|
captureRequestedAt?: string;
|
|
1361
|
-
captureAmount
|
|
1518
|
+
captureAmount: string;
|
|
1362
1519
|
[key: string]: unknown;
|
|
1363
1520
|
}
|
|
1364
1521
|
/**
|
|
@@ -1407,7 +1564,16 @@ interface PaymentInfo {
|
|
|
1407
1564
|
payMethodType?: string;
|
|
1408
1565
|
payMethodName?: string;
|
|
1409
1566
|
payMethodProperties?: string;
|
|
1567
|
+
payMethodResponse?: string;
|
|
1568
|
+
userPaymentAccessToken?: string;
|
|
1569
|
+
payMethodUserAccountNo?: string;
|
|
1570
|
+
payMethodUserAccountType?: string;
|
|
1571
|
+
payOption?: string;
|
|
1572
|
+
cashierLanguage?: string;
|
|
1573
|
+
cashierAppearance?: string;
|
|
1574
|
+
payMethodCountry?: string;
|
|
1410
1575
|
captureMode?: string;
|
|
1576
|
+
merchantInitiatedMode?: string;
|
|
1411
1577
|
[key: string]: unknown;
|
|
1412
1578
|
}
|
|
1413
1579
|
/**
|
|
@@ -1476,6 +1642,42 @@ interface PaymentTokenData {
|
|
|
1476
1642
|
tokenId?: string;
|
|
1477
1643
|
[key: string]: unknown;
|
|
1478
1644
|
}
|
|
1645
|
+
/**
|
|
1646
|
+
* Brand display information for cashier.
|
|
1647
|
+
*/
|
|
1648
|
+
interface BrandInfo {
|
|
1649
|
+
cashierLogoUrl?: string;
|
|
1650
|
+
cashierDisplayName?: string;
|
|
1651
|
+
cashierProductImageUrl?: string;
|
|
1652
|
+
[key: string]: unknown;
|
|
1653
|
+
}
|
|
1654
|
+
/**
|
|
1655
|
+
* Product detail extension payload.
|
|
1656
|
+
*/
|
|
1657
|
+
interface ProductDetail {
|
|
1658
|
+
subscriptionInfo?: SubscriptionInfo;
|
|
1659
|
+
[key: string]: unknown;
|
|
1660
|
+
}
|
|
1661
|
+
/**
|
|
1662
|
+
* Subscription extension information for an acquiring order.
|
|
1663
|
+
*/
|
|
1664
|
+
interface AcqOrderExtSubscriptionInfo {
|
|
1665
|
+
subscriptionId?: string;
|
|
1666
|
+
periodNo?: number;
|
|
1667
|
+
merchantRequest?: string;
|
|
1668
|
+
subscriptionEvent?: string;
|
|
1669
|
+
[key: string]: unknown;
|
|
1670
|
+
}
|
|
1671
|
+
/**
|
|
1672
|
+
* Tokenized card data used for direct card payment flows.
|
|
1673
|
+
*/
|
|
1674
|
+
interface WaffoTokenCardData {
|
|
1675
|
+
cardBinDataList?: Record<string, unknown>[];
|
|
1676
|
+
maskedCardInfo?: string;
|
|
1677
|
+
cardBin?: string;
|
|
1678
|
+
cardExpiry?: string;
|
|
1679
|
+
[key: string]: unknown;
|
|
1680
|
+
}
|
|
1479
1681
|
/**
|
|
1480
1682
|
* Refund user information.
|
|
1481
1683
|
*/
|
|
@@ -1622,6 +1824,7 @@ declare class SubscriptionResource extends BaseResource {
|
|
|
1622
1824
|
private static readonly PATH_INQUIRY;
|
|
1623
1825
|
private static readonly PATH_CANCEL;
|
|
1624
1826
|
private static readonly PATH_MANAGE;
|
|
1827
|
+
private static readonly PATH_UPDATE;
|
|
1625
1828
|
private static readonly PATH_CHANGE;
|
|
1626
1829
|
private static readonly PATH_CHANGE_INQUIRY;
|
|
1627
1830
|
/**
|
|
@@ -1660,6 +1863,18 @@ declare class SubscriptionResource extends BaseResource {
|
|
|
1660
1863
|
* @throws WaffoUnknownStatusError for network errors
|
|
1661
1864
|
*/
|
|
1662
1865
|
manage(params: ManageSubscriptionParams, options?: RequestOptions): Promise<ApiResponse<ManageSubscriptionData>>;
|
|
1866
|
+
/**
|
|
1867
|
+
* Updates an existing subscription amount or scheduled period amounts.
|
|
1868
|
+
*
|
|
1869
|
+
* Provide either subscriptionRequest or subscriptionId. At least one of amount
|
|
1870
|
+
* or productInfo.scheduledAmounts must be provided.
|
|
1871
|
+
*
|
|
1872
|
+
* @param params - Subscription update parameters
|
|
1873
|
+
* @param options - Optional request options
|
|
1874
|
+
* @returns API response with update result
|
|
1875
|
+
* @throws WaffoUnknownStatusError for network errors
|
|
1876
|
+
*/
|
|
1877
|
+
update(params: UpdateSubscriptionParams, options?: RequestOptions): Promise<ApiResponse<UpdateSubscriptionData>>;
|
|
1663
1878
|
/**
|
|
1664
1879
|
* Changes (upgrades/downgrades) an existing subscription.
|
|
1665
1880
|
*
|
|
@@ -1763,6 +1978,8 @@ interface InquiryRefundData {
|
|
|
1763
1978
|
userCurrency?: string;
|
|
1764
1979
|
finalDealAmount?: string;
|
|
1765
1980
|
remainingRefundAmount?: string;
|
|
1981
|
+
merchantUserId?: string;
|
|
1982
|
+
subscriptionInfo?: SubscriptionInfo;
|
|
1766
1983
|
userInfo?: RefundUserInfo;
|
|
1767
1984
|
refundCompletedAt?: string;
|
|
1768
1985
|
refundSource?: string;
|
|
@@ -1832,7 +2049,6 @@ interface InquiryMerchantConfigData {
|
|
|
1832
2049
|
*/
|
|
1833
2050
|
interface InquiryPayMethodConfigParams {
|
|
1834
2051
|
merchantId: string;
|
|
1835
|
-
payMethodType?: string;
|
|
1836
2052
|
[key: string]: unknown;
|
|
1837
2053
|
}
|
|
1838
2054
|
/**
|
|
@@ -1840,21 +2056,33 @@ interface InquiryPayMethodConfigParams {
|
|
|
1840
2056
|
*/
|
|
1841
2057
|
interface InquiryPayMethodConfigData {
|
|
1842
2058
|
merchantId?: string;
|
|
1843
|
-
|
|
2059
|
+
payMethodDetails?: PayMethodDetail[];
|
|
1844
2060
|
[key: string]: unknown;
|
|
1845
2061
|
}
|
|
1846
2062
|
/**
|
|
1847
|
-
* Pay method
|
|
2063
|
+
* Pay method detail.
|
|
1848
2064
|
*/
|
|
1849
|
-
interface
|
|
1850
|
-
|
|
2065
|
+
interface PayMethodDetail {
|
|
2066
|
+
productName?: string;
|
|
1851
2067
|
payMethodName?: string;
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
2068
|
+
country?: string;
|
|
2069
|
+
currentStatus?: string;
|
|
2070
|
+
fixedMaintenanceRules?: FixedMaintenanceRule[];
|
|
2071
|
+
fixedMaintenanceTimezone?: string;
|
|
2072
|
+
[key: string]: unknown;
|
|
2073
|
+
}
|
|
2074
|
+
/**
|
|
2075
|
+
* Fixed maintenance rule for a payment method.
|
|
2076
|
+
*/
|
|
2077
|
+
interface FixedMaintenanceRule {
|
|
2078
|
+
startRule?: string;
|
|
2079
|
+
endRule?: string;
|
|
1856
2080
|
[key: string]: unknown;
|
|
1857
2081
|
}
|
|
2082
|
+
/**
|
|
2083
|
+
* @deprecated Use PayMethodDetail.
|
|
2084
|
+
*/
|
|
2085
|
+
type PayMethodInfo = PayMethodDetail;
|
|
1858
2086
|
|
|
1859
2087
|
/**
|
|
1860
2088
|
* Merchant config resource for querying merchant configuration.
|
|
@@ -1898,8 +2126,8 @@ declare class MerchantConfigResource extends BaseResource {
|
|
|
1898
2126
|
*
|
|
1899
2127
|
* if (response.isSuccess()) {
|
|
1900
2128
|
* const data = response.getData();
|
|
1901
|
-
* data?.
|
|
1902
|
-
* console.log(`${method.payMethodName}: ${method.
|
|
2129
|
+
* data?.payMethodDetails?.forEach(method => {
|
|
2130
|
+
* console.log(`${method.payMethodName}: ${method.currentStatus}`);
|
|
1903
2131
|
* });
|
|
1904
2132
|
* }
|
|
1905
2133
|
* ```
|
|
@@ -2160,7 +2388,7 @@ declare class WaffoUnknownStatusError extends Error {
|
|
|
2160
2388
|
* Result of key pair generation.
|
|
2161
2389
|
*/
|
|
2162
2390
|
interface KeyPairResult {
|
|
2163
|
-
/** Base64 encoded PKCS8 private key */
|
|
2391
|
+
/** Base64 encoded PKCS8 DER private key */
|
|
2164
2392
|
privateKey: string;
|
|
2165
2393
|
/** Base64 encoded X509 public key */
|
|
2166
2394
|
publicKey: string;
|
|
@@ -2169,16 +2397,16 @@ interface KeyPairResult {
|
|
|
2169
2397
|
* Signs data using RSA-SHA256.
|
|
2170
2398
|
*
|
|
2171
2399
|
* @param data - The data to sign (UTF-8 string)
|
|
2172
|
-
* @param
|
|
2400
|
+
* @param privateKeyInput - Base64 encoded PKCS8 DER private key or unencrypted PKCS8 PEM private key
|
|
2173
2401
|
* @returns Base64 encoded signature
|
|
2174
|
-
* @throws WaffoError if signing fails (S0003)
|
|
2402
|
+
* @throws WaffoError if the private key is invalid (S0007) or signing fails (S0003)
|
|
2175
2403
|
*
|
|
2176
2404
|
* @example
|
|
2177
2405
|
* ```typescript
|
|
2178
2406
|
* const signature = sign('{"amount":"100.00"}', privateKey);
|
|
2179
2407
|
* ```
|
|
2180
2408
|
*/
|
|
2181
|
-
declare function sign(data: string,
|
|
2409
|
+
declare function sign(data: string, privateKeyInput: string): string;
|
|
2182
2410
|
/**
|
|
2183
2411
|
* Verifies a signature using RSA-SHA256.
|
|
2184
2412
|
*
|
|
@@ -2197,12 +2425,12 @@ declare function sign(data: string, base64PrivateKey: string): string;
|
|
|
2197
2425
|
*/
|
|
2198
2426
|
declare function verify(data: string, base64Signature: string, base64PublicKey: string): boolean;
|
|
2199
2427
|
/**
|
|
2200
|
-
* Validates a Base64 encoded PKCS8 private key.
|
|
2428
|
+
* Validates a Base64 encoded PKCS8 DER private key or unencrypted PKCS8 PEM private key.
|
|
2201
2429
|
*
|
|
2202
2430
|
* This method attempts to parse the key to ensure it's a valid RSA private key.
|
|
2203
2431
|
* Use this at startup to fail fast if the private key is invalid.
|
|
2204
2432
|
*
|
|
2205
|
-
* @param base64PrivateKey - Base64 encoded PKCS8 private key
|
|
2433
|
+
* @param base64PrivateKey - Base64 encoded PKCS8 DER private key or unencrypted PKCS8 PEM private key
|
|
2206
2434
|
* @throws WaffoError if the key is invalid (S0007)
|
|
2207
2435
|
*
|
|
2208
2436
|
* @example
|
|
@@ -2253,4 +2481,4 @@ declare const RsaUtils: {
|
|
|
2253
2481
|
generateKeyPair: typeof generateKeyPair;
|
|
2254
2482
|
};
|
|
2255
2483
|
|
|
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 };
|
|
2484
|
+
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 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 };
|