chargebee 3.28.1 → 3.30.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.
Files changed (97) hide show
  1. package/CHANGELOG.md +140 -0
  2. package/cjs/chargebee.cjs.js +1 -1
  3. package/cjs/environment.js +1 -1
  4. package/cjs/resources/api_endpoints.js +126 -0
  5. package/cjs/resources/webhook/eventType.js +5 -0
  6. package/cjs/schema/alert.schema.js +11 -5
  7. package/cjs/schema/coupon.schema.js +1 -1
  8. package/cjs/schema/credit_note.schema.js +13 -0
  9. package/cjs/schema/credit_unit.schema.js +38 -0
  10. package/cjs/schema/customer.schema.js +39 -0
  11. package/cjs/schema/entitlement.schema.js +4 -4
  12. package/cjs/schema/estimate.schema.js +18 -0
  13. package/cjs/schema/event.schema.js +20 -0
  14. package/cjs/schema/export.schema.js +33 -1
  15. package/cjs/schema/feature.schema.js +0 -1
  16. package/cjs/schema/gift.schema.js +14 -0
  17. package/cjs/schema/grant_block.schema.js +4 -0
  18. package/cjs/schema/index.js +1 -0
  19. package/cjs/schema/invoice.schema.js +63 -3
  20. package/cjs/schema/ledger_operation.schema.js +14 -4
  21. package/cjs/schema/meter.schema.js +10 -0
  22. package/cjs/schema/omnichannel_subscription.schema.js +2 -2
  23. package/cjs/schema/payment_intent.schema.js +14 -0
  24. package/cjs/schema/payment_source.schema.js +49 -0
  25. package/cjs/schema/purchase.schema.js +7 -0
  26. package/cjs/schema/ramp.schema.js +4 -2
  27. package/cjs/schema/recorded_purchase.schema.js +3 -0
  28. package/cjs/schema/subscription.schema.js +94 -0
  29. package/cjs/schema/transaction.schema.js +32 -0
  30. package/cjs/schema/webhook_endpoint.schema.js +10 -0
  31. package/cjs/telemetry/TelemetryAdapter.js +12 -7
  32. package/esm/environment.js +1 -1
  33. package/esm/resources/api_endpoints.js +126 -0
  34. package/esm/resources/webhook/eventType.js +5 -0
  35. package/esm/schema/alert.schema.js +11 -5
  36. package/esm/schema/coupon.schema.js +1 -1
  37. package/esm/schema/credit_note.schema.js +13 -0
  38. package/esm/schema/credit_unit.schema.js +35 -0
  39. package/esm/schema/customer.schema.js +39 -0
  40. package/esm/schema/entitlement.schema.js +4 -4
  41. package/esm/schema/estimate.schema.js +18 -0
  42. package/esm/schema/event.schema.js +20 -0
  43. package/esm/schema/export.schema.js +33 -1
  44. package/esm/schema/feature.schema.js +0 -1
  45. package/esm/schema/gift.schema.js +14 -0
  46. package/esm/schema/grant_block.schema.js +4 -0
  47. package/esm/schema/index.js +1 -0
  48. package/esm/schema/invoice.schema.js +63 -3
  49. package/esm/schema/ledger_operation.schema.js +13 -3
  50. package/esm/schema/meter.schema.js +10 -0
  51. package/esm/schema/omnichannel_subscription.schema.js +2 -2
  52. package/esm/schema/payment_intent.schema.js +14 -0
  53. package/esm/schema/payment_source.schema.js +49 -0
  54. package/esm/schema/purchase.schema.js +7 -0
  55. package/esm/schema/ramp.schema.js +4 -2
  56. package/esm/schema/recorded_purchase.schema.js +3 -0
  57. package/esm/schema/subscription.schema.js +94 -0
  58. package/esm/schema/transaction.schema.js +32 -0
  59. package/esm/schema/webhook_endpoint.schema.js +10 -0
  60. package/esm/telemetry/TelemetryAdapter.js +12 -7
  61. package/package.json +1 -1
  62. package/types/core.d.ts +65 -6
  63. package/types/index.d.ts +15 -8
  64. package/types/resources/Alert.d.ts +18 -3
  65. package/types/resources/AsyncResponse.d.ts +35 -0
  66. package/types/resources/AsyncResponseList.d.ts +8 -0
  67. package/types/resources/AttachedItem.d.ts +2 -2
  68. package/types/resources/ColumnDefinition.d.ts +9 -0
  69. package/types/resources/Content.d.ts +7 -0
  70. package/types/resources/CreditNote.d.ts +15 -0
  71. package/types/resources/CreditNoteEstimate.d.ts +5 -0
  72. package/types/resources/CreditUnit.d.ts +90 -0
  73. package/types/resources/Customer.d.ts +16 -2
  74. package/types/resources/Estimate.d.ts +20 -2
  75. package/types/resources/Event.d.ts +5 -0
  76. package/types/resources/Export.d.ts +1 -0
  77. package/types/resources/Feature.d.ts +2 -0
  78. package/types/resources/Gift.d.ts +16 -2
  79. package/types/resources/GrantBlock.d.ts +12 -6
  80. package/types/resources/Invoice.d.ts +41 -3
  81. package/types/resources/InvoiceEstimate.d.ts +5 -0
  82. package/types/resources/LedgerAccountBalance.d.ts +3 -1
  83. package/types/resources/LedgerEntry.d.ts +22 -0
  84. package/types/resources/LedgerOperation.d.ts +34 -9
  85. package/types/resources/Meter.d.ts +42 -0
  86. package/types/resources/MeteredFeature.d.ts +70 -0
  87. package/types/resources/PaymentIntent.d.ts +57 -5
  88. package/types/resources/PaymentSource.d.ts +8 -1
  89. package/types/resources/PromotionalGrant.d.ts +1 -1
  90. package/types/resources/Purchase.d.ts +8 -1
  91. package/types/resources/Quote.d.ts +5 -0
  92. package/types/resources/QuoteLineGroup.d.ts +5 -0
  93. package/types/resources/QuotedCharge.d.ts +3 -0
  94. package/types/resources/Ramp.d.ts +4 -1
  95. package/types/resources/RecordedPurchase.d.ts +3 -0
  96. package/types/resources/Subscription.d.ts +58 -7
  97. package/types/resources/WebhookEvent.d.ts +33 -0
@@ -55,6 +55,13 @@ const CreateUsingTempTokenPaymentSourceBodySchema = z.looseObject({
55
55
  'paypay',
56
56
  'gcash',
57
57
  'south_korean_cards',
58
+ 'paynow',
59
+ 'bizum',
60
+ 'promptpay',
61
+ 'dana',
62
+ 'touch_n_go',
63
+ 'tamara',
64
+ 'qpay',
58
65
  ]),
59
66
  tmp_token: z.string().max(65000),
60
67
  issuing_country: z.string().max(50).optional(),
@@ -160,6 +167,13 @@ const CreateUsingPermanentTokenPaymentSourceBodySchema = z.looseObject({
160
167
  'paypay',
161
168
  'gcash',
162
169
  'south_korean_cards',
170
+ 'paynow',
171
+ 'bizum',
172
+ 'promptpay',
173
+ 'dana',
174
+ 'touch_n_go',
175
+ 'tamara',
176
+ 'qpay',
163
177
  ]),
164
178
  gateway_account_id: z.string().max(50).optional(),
165
179
  reference_id: z.string().max(200).optional(),
@@ -236,6 +250,13 @@ const CreateUsingPaymentIntentPaymentSourcePaymentIntentSchema = z.object({
236
250
  'paypay',
237
251
  'gcash',
238
252
  'south_korean_cards',
253
+ 'paynow',
254
+ 'bizum',
255
+ 'promptpay',
256
+ 'dana',
257
+ 'touch_n_go',
258
+ 'tamara',
259
+ 'qpay',
239
260
  ])
240
261
  .optional(),
241
262
  reference_id: z.string().max(65000).optional(),
@@ -416,6 +437,13 @@ const ListPaymentSourceTypeSchema = z.object({
416
437
  'paypay',
417
438
  'gcash',
418
439
  'south_korean_cards',
440
+ 'paynow',
441
+ 'bizum',
442
+ 'promptpay',
443
+ 'dana',
444
+ 'touch_n_go',
445
+ 'tamara',
446
+ 'qpay',
419
447
  ])
420
448
  .optional(),
421
449
  is_not: z
@@ -467,6 +495,13 @@ const ListPaymentSourceTypeSchema = z.object({
467
495
  'paypay',
468
496
  'gcash',
469
497
  'south_korean_cards',
498
+ 'paynow',
499
+ 'bizum',
500
+ 'promptpay',
501
+ 'dana',
502
+ 'touch_n_go',
503
+ 'tamara',
504
+ 'qpay',
470
505
  ])
471
506
  .optional(),
472
507
  in: z
@@ -518,6 +553,13 @@ const ListPaymentSourceTypeSchema = z.object({
518
553
  'paypay',
519
554
  'gcash',
520
555
  'south_korean_cards',
556
+ 'paynow',
557
+ 'bizum',
558
+ 'promptpay',
559
+ 'dana',
560
+ 'touch_n_go',
561
+ 'tamara',
562
+ 'qpay',
521
563
  ])
522
564
  .optional(),
523
565
  not_in: z
@@ -569,6 +611,13 @@ const ListPaymentSourceTypeSchema = z.object({
569
611
  'paypay',
570
612
  'gcash',
571
613
  'south_korean_cards',
614
+ 'paynow',
615
+ 'bizum',
616
+ 'promptpay',
617
+ 'dana',
618
+ 'touch_n_go',
619
+ 'tamara',
620
+ 'qpay',
572
621
  ])
573
622
  .optional(),
574
623
  });
@@ -66,6 +66,13 @@ const CreatePurchasePaymentIntentSchema = z.object({
66
66
  'paypay',
67
67
  'gcash',
68
68
  'south_korean_cards',
69
+ 'paynow',
70
+ 'bizum',
71
+ 'promptpay',
72
+ 'dana',
73
+ 'touch_n_go',
74
+ 'tamara',
75
+ 'qpay',
69
76
  ])
70
77
  .optional(),
71
78
  reference_id: z.string().max(65000).optional(),
@@ -82,6 +82,7 @@ const CreateForSubscriptionRampDiscountsToAddSchema = z.object({
82
82
  duration_type: z.array(z.enum(['one_time', 'forever', 'limited_period']).optional()),
83
83
  percentage: z.array(z.number().min(0.01).max(100).optional()).optional(),
84
84
  amount: z.array(z.number().int().min(0).optional()).optional(),
85
+ quantity: z.array(z.number().int().min(1).optional()).optional(),
85
86
  period: z.array(z.number().int().min(1).optional()).optional(),
86
87
  period_unit: z
87
88
  .array(z.enum(['day', 'week', 'month', 'year']).optional())
@@ -183,6 +184,7 @@ const UpdateRampDiscountsToAddSchema = z.object({
183
184
  duration_type: z.array(z.enum(['one_time', 'forever', 'limited_period']).optional()),
184
185
  percentage: z.array(z.number().min(0.01).max(100).optional()).optional(),
185
186
  amount: z.array(z.number().int().min(0).optional()).optional(),
187
+ quantity: z.array(z.number().int().min(1).optional()).optional(),
186
188
  period: z.array(z.number().int().min(1).optional()).optional(),
187
189
  period_unit: z
188
190
  .array(z.enum(['day', 'week', 'month', 'year']).optional())
@@ -206,12 +208,12 @@ const UpdateRampBodySchema = z.looseObject({
206
208
  export { UpdateRampBodySchema };
207
209
  //Ramp.list
208
210
  const ListRampStatusSchema = z.object({
209
- is: z.enum(['scheduled', 'succeeded', 'failed', 'draft']).optional(),
210
211
  in: z.enum(['scheduled', 'succeeded', 'failed', 'draft']).optional(),
212
+ is: z.enum(['scheduled', 'succeeded', 'failed', 'draft']).optional(),
211
213
  });
212
214
  const ListRampSubscriptionIdSchema = z.object({
213
- is: z.string().min(1).optional(),
214
215
  in: z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
216
+ is: z.string().min(1).optional(),
215
217
  });
216
218
  const ListRampEffectiveFromSchema = z.object({
217
219
  after: z.string().regex(RegExp('^\\d{10}$')).optional(),
@@ -5,6 +5,9 @@ import { z } from 'zod';
5
5
  //RecordedPurchase.create
6
6
  const CreateRecordedPurchaseCustomerSchema = z.object({
7
7
  id: z.string().max(50),
8
+ email: z.string().email().max(70).optional(),
9
+ first_name: z.string().max(150).optional(),
10
+ last_name: z.string().max(150).optional(),
8
11
  });
9
12
  const CreateRecordedPurchaseAppleAppStoreSchema = z.object({
10
13
  transaction_id: z.string().max(100).optional(),
@@ -232,6 +232,13 @@ const CreateSubscriptionPaymentMethodSchema = z.object({
232
232
  'paypay',
233
233
  'gcash',
234
234
  'south_korean_cards',
235
+ 'paynow',
236
+ 'bizum',
237
+ 'promptpay',
238
+ 'dana',
239
+ 'touch_n_go',
240
+ 'tamara',
241
+ 'qpay',
235
242
  ])
236
243
  .optional(),
237
244
  gateway: z
@@ -354,6 +361,13 @@ const CreateSubscriptionPaymentIntentSchema = z.object({
354
361
  'paypay',
355
362
  'gcash',
356
363
  'south_korean_cards',
364
+ 'paynow',
365
+ 'bizum',
366
+ 'promptpay',
367
+ 'dana',
368
+ 'touch_n_go',
369
+ 'tamara',
370
+ 'qpay',
357
371
  ])
358
372
  .optional(),
359
373
  reference_id: z.string().max(65000).optional(),
@@ -585,6 +599,13 @@ const CreateForCustomerSubscriptionPaymentIntentSchema = z.object({
585
599
  'paypay',
586
600
  'gcash',
587
601
  'south_korean_cards',
602
+ 'paynow',
603
+ 'bizum',
604
+ 'promptpay',
605
+ 'dana',
606
+ 'touch_n_go',
607
+ 'tamara',
608
+ 'qpay',
588
609
  ])
589
610
  .optional(),
590
611
  reference_id: z.string().max(65000).optional(),
@@ -776,6 +797,13 @@ const CreateWithItemsSubscriptionPaymentIntentSchema = z.object({
776
797
  'paypay',
777
798
  'gcash',
778
799
  'south_korean_cards',
800
+ 'paynow',
801
+ 'bizum',
802
+ 'promptpay',
803
+ 'dana',
804
+ 'touch_n_go',
805
+ 'tamara',
806
+ 'qpay',
779
807
  ])
780
808
  .optional(),
781
809
  reference_id: z.string().max(65000).optional(),
@@ -1186,6 +1214,9 @@ const ListSubscriptionChannelSchema = z.object({
1186
1214
  in: z.enum(['web', 'app_store', 'play_store']).optional(),
1187
1215
  not_in: z.enum(['web', 'app_store', 'play_store']).optional(),
1188
1216
  });
1217
+ const ListSubscriptionDecommissionedSchema = z.object({
1218
+ is: z.enum(['true', 'false']).optional(),
1219
+ });
1189
1220
  const ListSubscriptionPlanIdSchema = z.object({
1190
1221
  is: z.string().min(1).optional(),
1191
1222
  is_not: z.string().min(1).optional(),
@@ -1217,6 +1248,7 @@ const ListSubscriptionBodySchema = z.looseObject({
1217
1248
  sort_by: ListSubscriptionSortBySchema.optional(),
1218
1249
  business_entity_id: ListSubscriptionBusinessEntityIdSchema.optional(),
1219
1250
  channel: ListSubscriptionChannelSchema.optional(),
1251
+ decommissioned: ListSubscriptionDecommissionedSchema.optional(),
1220
1252
  plan_id: ListSubscriptionPlanIdSchema.optional(),
1221
1253
  });
1222
1254
  export { ListSubscriptionBodySchema };
@@ -1402,6 +1434,13 @@ const UpdateSubscriptionPaymentMethodSchema = z.object({
1402
1434
  'paypay',
1403
1435
  'gcash',
1404
1436
  'south_korean_cards',
1437
+ 'paynow',
1438
+ 'bizum',
1439
+ 'promptpay',
1440
+ 'dana',
1441
+ 'touch_n_go',
1442
+ 'tamara',
1443
+ 'qpay',
1405
1444
  ])
1406
1445
  .optional(),
1407
1446
  gateway: z
@@ -1524,6 +1563,13 @@ const UpdateSubscriptionPaymentIntentSchema = z.object({
1524
1563
  'paypay',
1525
1564
  'gcash',
1526
1565
  'south_korean_cards',
1566
+ 'paynow',
1567
+ 'bizum',
1568
+ 'promptpay',
1569
+ 'dana',
1570
+ 'touch_n_go',
1571
+ 'tamara',
1572
+ 'qpay',
1527
1573
  ])
1528
1574
  .optional(),
1529
1575
  reference_id: z.string().max(65000).optional(),
@@ -1844,6 +1890,13 @@ const UpdateForItemsSubscriptionPaymentMethodSchema = z.object({
1844
1890
  'paypay',
1845
1891
  'gcash',
1846
1892
  'south_korean_cards',
1893
+ 'paynow',
1894
+ 'bizum',
1895
+ 'promptpay',
1896
+ 'dana',
1897
+ 'touch_n_go',
1898
+ 'tamara',
1899
+ 'qpay',
1847
1900
  ])
1848
1901
  .optional(),
1849
1902
  gateway: z
@@ -1966,6 +2019,13 @@ const UpdateForItemsSubscriptionPaymentIntentSchema = z.object({
1966
2019
  'paypay',
1967
2020
  'gcash',
1968
2021
  'south_korean_cards',
2022
+ 'paynow',
2023
+ 'bizum',
2024
+ 'promptpay',
2025
+ 'dana',
2026
+ 'touch_n_go',
2027
+ 'tamara',
2028
+ 'qpay',
1969
2029
  ])
1970
2030
  .optional(),
1971
2031
  reference_id: z.string().max(65000).optional(),
@@ -2249,6 +2309,13 @@ const ReactivateSubscriptionPaymentIntentSchema = z.object({
2249
2309
  'paypay',
2250
2310
  'gcash',
2251
2311
  'south_korean_cards',
2312
+ 'paynow',
2313
+ 'bizum',
2314
+ 'promptpay',
2315
+ 'dana',
2316
+ 'touch_n_go',
2317
+ 'tamara',
2318
+ 'qpay',
2252
2319
  ])
2253
2320
  .optional(),
2254
2321
  reference_id: z.string().max(65000).optional(),
@@ -2555,6 +2622,13 @@ const ImportSubscriptionSubscriptionPaymentMethodSchema = z.object({
2555
2622
  'paypay',
2556
2623
  'gcash',
2557
2624
  'south_korean_cards',
2625
+ 'paynow',
2626
+ 'bizum',
2627
+ 'promptpay',
2628
+ 'dana',
2629
+ 'touch_n_go',
2630
+ 'tamara',
2631
+ 'qpay',
2558
2632
  ])
2559
2633
  .optional(),
2560
2634
  gateway: z
@@ -2672,6 +2746,10 @@ const ImportSubscriptionSubscriptionTransactionSchema = z.object({
2672
2746
  'app_store',
2673
2747
  'play_store',
2674
2748
  'custom',
2749
+ 'dana',
2750
+ 'touch_n_go',
2751
+ 'tamara',
2752
+ 'qpay',
2675
2753
  ])
2676
2754
  .optional(),
2677
2755
  reference_number: z.string().max(100).optional(),
@@ -2795,6 +2873,10 @@ const ImportForCustomerSubscriptionTransactionSchema = z.object({
2795
2873
  'app_store',
2796
2874
  'play_store',
2797
2875
  'custom',
2876
+ 'dana',
2877
+ 'touch_n_go',
2878
+ 'tamara',
2879
+ 'qpay',
2798
2880
  ])
2799
2881
  .optional(),
2800
2882
  reference_number: z.string().max(100).optional(),
@@ -3019,6 +3101,10 @@ const ImportForItemsSubscriptionTransactionSchema = z.object({
3019
3101
  'app_store',
3020
3102
  'play_store',
3021
3103
  'custom',
3104
+ 'dana',
3105
+ 'touch_n_go',
3106
+ 'tamara',
3107
+ 'qpay',
3022
3108
  ])
3023
3109
  .optional(),
3024
3110
  reference_number: z.string().max(100).optional(),
@@ -3256,6 +3342,7 @@ const CancelForItemsSubscriptionBodySchema = z.looseObject({
3256
3342
  ])
3257
3343
  .optional(),
3258
3344
  invoice_date: z.number().int().optional(),
3345
+ include_cancellation_day_in_billing: z.boolean().optional(),
3259
3346
  cancel_reason_code: z.string().max(100).optional(),
3260
3347
  decommissioned: z.boolean().default(false).optional(),
3261
3348
  subscription_items: CancelForItemsSubscriptionSubscriptionItemsSchema.optional(),
@@ -3314,6 +3401,13 @@ const ResumeSubscriptionPaymentIntentSchema = z.object({
3314
3401
  'paypay',
3315
3402
  'gcash',
3316
3403
  'south_korean_cards',
3404
+ 'paynow',
3405
+ 'bizum',
3406
+ 'promptpay',
3407
+ 'dana',
3408
+ 'touch_n_go',
3409
+ 'tamara',
3410
+ 'qpay',
3317
3411
  ])
3318
3412
  .optional(),
3319
3413
  reference_id: z.string().max(65000).optional(),
@@ -22,6 +22,10 @@ const RecordRefundTransactionBodySchema = z.looseObject({
22
22
  'app_store',
23
23
  'play_store',
24
24
  'custom',
25
+ 'dana',
26
+ 'touch_n_go',
27
+ 'tamara',
28
+ 'qpay',
25
29
  ]),
26
30
  date: z.number().int(),
27
31
  reference_number: z.string().max(100).optional(),
@@ -134,6 +138,13 @@ const ListTransactionPaymentMethodSchema = z.object({
134
138
  'paypay',
135
139
  'gcash',
136
140
  'south_korean_cards',
141
+ 'paynow',
142
+ 'bizum',
143
+ 'promptpay',
144
+ 'dana',
145
+ 'touch_n_go',
146
+ 'tamara',
147
+ 'qpay',
137
148
  ])
138
149
  .optional(),
139
150
  is_not: z
@@ -195,6 +206,13 @@ const ListTransactionPaymentMethodSchema = z.object({
195
206
  'paypay',
196
207
  'gcash',
197
208
  'south_korean_cards',
209
+ 'paynow',
210
+ 'bizum',
211
+ 'promptpay',
212
+ 'dana',
213
+ 'touch_n_go',
214
+ 'tamara',
215
+ 'qpay',
198
216
  ])
199
217
  .optional(),
200
218
  in: z
@@ -256,6 +274,13 @@ const ListTransactionPaymentMethodSchema = z.object({
256
274
  'paypay',
257
275
  'gcash',
258
276
  'south_korean_cards',
277
+ 'paynow',
278
+ 'bizum',
279
+ 'promptpay',
280
+ 'dana',
281
+ 'touch_n_go',
282
+ 'tamara',
283
+ 'qpay',
259
284
  ])
260
285
  .optional(),
261
286
  not_in: z
@@ -317,6 +342,13 @@ const ListTransactionPaymentMethodSchema = z.object({
317
342
  'paypay',
318
343
  'gcash',
319
344
  'south_korean_cards',
345
+ 'paynow',
346
+ 'bizum',
347
+ 'promptpay',
348
+ 'dana',
349
+ 'touch_n_go',
350
+ 'tamara',
351
+ 'qpay',
320
352
  ])
321
353
  .optional(),
322
354
  });
@@ -179,6 +179,7 @@ const CreateWebhookEndpointBodySchema = z.looseObject({
179
179
  'business_entity_deleted',
180
180
  'customer_business_entity_changed',
181
181
  'subscription_business_entity_changed',
182
+ 'payment_source_business_entity_changed',
182
183
  'purchase_created',
183
184
  'voucher_created',
184
185
  'voucher_expired',
@@ -240,6 +241,10 @@ const CreateWebhookEndpointBodySchema = z.looseObject({
240
241
  'alert_status_changed',
241
242
  'omnichannel_subscription_item_updated',
242
243
  'omnichannel_subscription_item_recovered',
244
+ 'ledger_account_balance_updated',
245
+ 'grant_blocks_created',
246
+ 'grant_blocks_updated',
247
+ 'ledger_updated',
243
248
  'plan_created',
244
249
  'plan_updated',
245
250
  'plan_deleted',
@@ -425,6 +430,7 @@ const UpdateWebhookEndpointBodySchema = z.looseObject({
425
430
  'business_entity_deleted',
426
431
  'customer_business_entity_changed',
427
432
  'subscription_business_entity_changed',
433
+ 'payment_source_business_entity_changed',
428
434
  'purchase_created',
429
435
  'voucher_created',
430
436
  'voucher_expired',
@@ -486,6 +492,10 @@ const UpdateWebhookEndpointBodySchema = z.looseObject({
486
492
  'alert_status_changed',
487
493
  'omnichannel_subscription_item_updated',
488
494
  'omnichannel_subscription_item_recovered',
495
+ 'ledger_account_balance_updated',
496
+ 'grant_blocks_created',
497
+ 'grant_blocks_updated',
498
+ 'ledger_updated',
489
499
  'plan_created',
490
500
  'plan_updated',
491
501
  'plan_deleted',
@@ -57,16 +57,16 @@ export function buildRequestEndSpanAttributes(result) {
57
57
  [TelemetryAttributeKeys.HTTP_RESPONSE_STATUS_CODE]: result.httpStatusCode,
58
58
  };
59
59
  if (result.error) {
60
- // error.type is the status code on failed requests
61
- attributes[TelemetryAttributeKeys.ERROR_TYPE] = String(result.httpStatusCode);
62
- if (result.error.chargebeeErrorCode) {
63
- attributes[TelemetryAttributeKeys.CHARGEBEE_ERROR_CODE] =
64
- result.error.chargebeeErrorCode;
65
- }
66
60
  if (result.error.chargebeeApiErrorType) {
61
+ attributes[TelemetryAttributeKeys.ERROR_TYPE] =
62
+ result.error.chargebeeApiErrorType;
67
63
  attributes[TelemetryAttributeKeys.CHARGEBEE_ERROR_TYPE] =
68
64
  result.error.chargebeeApiErrorType;
69
65
  }
66
+ if (result.error.chargebeeErrorCode) {
67
+ attributes[TelemetryAttributeKeys.CHARGEBEE_ERROR_CODE] =
68
+ result.error.chargebeeErrorCode;
69
+ }
70
70
  if (result.error.chargebeeErrorParam) {
71
71
  attributes[TelemetryAttributeKeys.CHARGEBEE_ERROR_PARAM] =
72
72
  result.error.chargebeeErrorParam;
@@ -94,12 +94,17 @@ export function buildRequestTelemetryResult(result) {
94
94
  }
95
95
  export function extractRequestTelemetryError(err) {
96
96
  if (err == null || typeof err !== 'object') {
97
+ if (err instanceof Error) {
98
+ return { message: err.message };
99
+ }
97
100
  return undefined;
98
101
  }
99
102
  const errorObj = err;
100
103
  const message = typeof errorObj.message === 'string'
101
104
  ? errorObj.message
102
- : 'Chargebee API request failed';
105
+ : err instanceof Error
106
+ ? err.message
107
+ : 'Chargebee API request failed';
103
108
  const result = { message };
104
109
  if (typeof errorObj.api_error_code === 'string') {
105
110
  result.chargebeeErrorCode = errorObj.api_error_code;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chargebee",
3
- "version": "3.28.1",
3
+ "version": "3.30.0",
4
4
  "description": "A library for integrating with Chargebee.",
5
5
  "scripts": {
6
6
  "prepack": "npm install && npm run build",
package/types/core.d.ts CHANGED
@@ -86,7 +86,11 @@ declare module 'chargebee' {
86
86
  | 'not_applicable';
87
87
  type DiscountTypeEnum = 'fixed_amount' | 'percentage' | 'price';
88
88
  type DispositionTypeEnum = 'attachment' | 'inline';
89
- type DunningTypeEnum = 'auto_collect' | 'offline' | 'direct_debit';
89
+ type DunningTypeEnum =
90
+ | 'auto_collect'
91
+ | 'offline'
92
+ | 'direct_debit'
93
+ | 'real_time_payments';
90
94
  type DurationTypeEnum = 'one_time' | 'forever' | 'limited_period';
91
95
  type EcheckTypeEnum = 'web' | 'ppd' | 'ccd';
92
96
  type EinvoicingMethodEnum = 'automatic' | 'manual' | 'site_default';
@@ -319,6 +323,7 @@ declare module 'chargebee' {
319
323
  | 'business_entity_deleted'
320
324
  | 'customer_business_entity_changed'
321
325
  | 'subscription_business_entity_changed'
326
+ | 'payment_source_business_entity_changed'
322
327
  | 'purchase_created'
323
328
  | 'voucher_created'
324
329
  | 'voucher_expired'
@@ -372,6 +377,10 @@ declare module 'chargebee' {
372
377
  | 'alert_status_changed'
373
378
  | 'omnichannel_subscription_item_updated'
374
379
  | 'omnichannel_subscription_item_recovered'
380
+ | 'ledger_account_balance_updated'
381
+ | 'grant_blocks_created'
382
+ | 'grant_blocks_updated'
383
+ | 'ledger_updated'
375
384
  | 'plan_created'
376
385
  | 'plan_updated'
377
386
  | 'plan_deleted'
@@ -490,6 +499,10 @@ declare module 'chargebee' {
490
499
  | 'bank_transfer'
491
500
  | 'other'
492
501
  | 'custom'
502
+ | 'dana'
503
+ | 'touch_n_go'
504
+ | 'tamara'
505
+ | 'qpay'
493
506
  | 'chargeback'
494
507
  | 'card'
495
508
  | 'amazon_payments'
@@ -539,7 +552,10 @@ declare module 'chargebee' {
539
552
  | 'alipay_hk'
540
553
  | 'paypay'
541
554
  | 'gcash'
542
- | 'south_korean_cards';
555
+ | 'south_korean_cards'
556
+ | 'paynow'
557
+ | 'bizum'
558
+ | 'promptpay';
543
559
  type PaymentMethodSavePolicyEnum = 'always' | 'ask' | 'never';
544
560
  type PaymentMethodTypeEnum =
545
561
  | 'card'
@@ -588,7 +604,14 @@ declare module 'chargebee' {
588
604
  | 'alipay_hk'
589
605
  | 'paypay'
590
606
  | 'gcash'
591
- | 'south_korean_cards';
607
+ | 'south_korean_cards'
608
+ | 'paynow'
609
+ | 'bizum'
610
+ | 'promptpay'
611
+ | 'dana'
612
+ | 'touch_n_go'
613
+ | 'tamara'
614
+ | 'qpay';
592
615
  type PaymentVoucherTypeEnum = 'boleto';
593
616
  type PeriodUnitEnum = 'day' | 'week' | 'month' | 'year';
594
617
  type PriceTypeEnum = 'tax_exclusive' | 'tax_inclusive';
@@ -628,7 +651,14 @@ declare module 'chargebee' {
628
651
  | 'js_api'
629
652
  | 'migration'
630
653
  | 'external_service';
631
- type StatusEnum = 'available' | 'exhausted' | 'scheduled' | 'in_grace_period';
654
+ type StatusEnum =
655
+ | 'active'
656
+ | 'archived'
657
+ | 'deleted'
658
+ | 'available'
659
+ | 'exhausted'
660
+ | 'scheduled'
661
+ | 'in_grace_period';
632
662
  type TaxExemptReasonEnum =
633
663
  | 'tax_not_configured'
634
664
  | 'region_non_taxable'
@@ -649,7 +679,16 @@ declare module 'chargebee' {
649
679
  | 'special'
650
680
  | 'unincorporated'
651
681
  | 'other';
652
- type TaxOverrideReasonEnum = 'id_exempt' | 'customer_exempt' | 'export';
682
+ type TaxOverrideReasonEnum =
683
+ | 'zero_rated'
684
+ | 'id_exempt'
685
+ | 'customer_exempt'
686
+ | 'region_non_taxable'
687
+ | 'product_exempt'
688
+ | 'export'
689
+ | 'high_value_physical_goods'
690
+ | 'zero_value_item'
691
+ | 'tax_not_configured_external_provider';
653
692
  type TaxabilityEnum = 'taxable' | 'exempt';
654
693
  type TaxjarExemptionCategoryEnum = 'wholesale' | 'government' | 'other';
655
694
  type TrialEndActionEnum =
@@ -705,10 +744,25 @@ declare module 'chargebee' {
705
744
  | 'paypay'
706
745
  | 'gcash'
707
746
  | 'south_korean_cards'
747
+ | 'paynow'
748
+ | 'bizum'
749
+ | 'promptpay'
750
+ | 'dana'
751
+ | 'touch_n_go'
752
+ | 'tamara'
753
+ | 'qpay'
708
754
  | 'free_trial'
709
755
  | 'pay_up_front'
710
756
  | 'pay_as_you_go'
711
- | 'usage_exceeded';
757
+ | 'simple'
758
+ | 'compound'
759
+ | 'usage_exceeded'
760
+ | 'spend_exceeded'
761
+ | 'credit_balance_dropped'
762
+ | 'credit'
763
+ | 'debit'
764
+ | 'hold'
765
+ | 'unhold';
712
766
  type UnbilledChargesHandlingEnum = 'no_action' | 'invoice';
713
767
  type UnbilledChargesOptionEnum = 'invoice' | 'delete';
714
768
  type UnpaidInvoicesHandlingEnum = 'no_action' | 'schedule_payment_collection';
@@ -884,6 +938,7 @@ declare module 'chargebee' {
884
938
  | 'business_entity_deleted'
885
939
  | 'customer_business_entity_changed'
886
940
  | 'subscription_business_entity_changed'
941
+ | 'payment_source_business_entity_changed'
887
942
  | 'purchase_created'
888
943
  | 'voucher_created'
889
944
  | 'voucher_expired'
@@ -937,6 +992,10 @@ declare module 'chargebee' {
937
992
  | 'alert_status_changed'
938
993
  | 'omnichannel_subscription_item_updated'
939
994
  | 'omnichannel_subscription_item_recovered'
995
+ | 'ledger_account_balance_updated'
996
+ | 'grant_blocks_created'
997
+ | 'grant_blocks_updated'
998
+ | 'ledger_updated'
940
999
  | 'plan_created'
941
1000
  | 'plan_updated'
942
1001
  | 'plan_deleted'