chargebee 3.28.1 → 3.29.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 (89) hide show
  1. package/CHANGELOG.md +82 -0
  2. package/cjs/chargebee.cjs.js +1 -1
  3. package/cjs/environment.js +1 -1
  4. package/cjs/resources/api_endpoints.js +57 -0
  5. package/cjs/resources/webhook/eventType.js +1 -0
  6. package/cjs/schema/alert.schema.js +6 -5
  7. package/cjs/schema/credit_note.schema.js +5 -0
  8. package/cjs/schema/customer.schema.js +15 -0
  9. package/cjs/schema/estimate.schema.js +9 -0
  10. package/cjs/schema/event.schema.js +4 -0
  11. package/cjs/schema/export.schema.js +20 -4
  12. package/cjs/schema/feature.schema.js +0 -1
  13. package/cjs/schema/gift.schema.js +6 -0
  14. package/cjs/schema/invoice.schema.js +33 -1
  15. package/cjs/schema/item.schema.js +1 -1
  16. package/cjs/schema/item_family.schema.js +1 -1
  17. package/cjs/schema/item_price.schema.js +1 -1
  18. package/cjs/schema/meter.schema.js +10 -0
  19. package/cjs/schema/omnichannel_subscription.schema.js +2 -2
  20. package/cjs/schema/payment_intent.schema.js +6 -0
  21. package/cjs/schema/payment_source.schema.js +21 -0
  22. package/cjs/schema/price_variant.schema.js +1 -1
  23. package/cjs/schema/purchase.schema.js +3 -0
  24. package/cjs/schema/ramp.schema.js +2 -0
  25. package/cjs/schema/recorded_purchase.schema.js +3 -0
  26. package/cjs/schema/subscription.schema.js +37 -0
  27. package/cjs/schema/transaction.schema.js +12 -0
  28. package/cjs/schema/webhook_endpoint.schema.js +2 -0
  29. package/cjs/telemetry/TelemetryAdapter.js +12 -7
  30. package/esm/environment.js +1 -1
  31. package/esm/resources/api_endpoints.js +57 -0
  32. package/esm/resources/webhook/eventType.js +1 -0
  33. package/esm/schema/alert.schema.js +6 -5
  34. package/esm/schema/credit_note.schema.js +5 -0
  35. package/esm/schema/customer.schema.js +15 -0
  36. package/esm/schema/estimate.schema.js +9 -0
  37. package/esm/schema/event.schema.js +4 -0
  38. package/esm/schema/export.schema.js +20 -4
  39. package/esm/schema/feature.schema.js +0 -1
  40. package/esm/schema/gift.schema.js +6 -0
  41. package/esm/schema/invoice.schema.js +33 -1
  42. package/esm/schema/item.schema.js +1 -1
  43. package/esm/schema/item_family.schema.js +1 -1
  44. package/esm/schema/item_price.schema.js +1 -1
  45. package/esm/schema/meter.schema.js +10 -0
  46. package/esm/schema/omnichannel_subscription.schema.js +2 -2
  47. package/esm/schema/payment_intent.schema.js +6 -0
  48. package/esm/schema/payment_source.schema.js +21 -0
  49. package/esm/schema/price_variant.schema.js +1 -1
  50. package/esm/schema/purchase.schema.js +3 -0
  51. package/esm/schema/ramp.schema.js +2 -0
  52. package/esm/schema/recorded_purchase.schema.js +3 -0
  53. package/esm/schema/subscription.schema.js +37 -0
  54. package/esm/schema/transaction.schema.js +12 -0
  55. package/esm/schema/webhook_endpoint.schema.js +2 -0
  56. package/esm/telemetry/TelemetryAdapter.js +12 -7
  57. package/package.json +1 -1
  58. package/types/core.d.ts +40 -6
  59. package/types/index.d.ts +12 -8
  60. package/types/resources/Alert.d.ts +16 -3
  61. package/types/resources/AsyncResponse.d.ts +35 -0
  62. package/types/resources/AsyncResponseList.d.ts +8 -0
  63. package/types/resources/ColumnDefinition.d.ts +9 -0
  64. package/types/resources/Content.d.ts +5 -0
  65. package/types/resources/CreditNote.d.ts +15 -0
  66. package/types/resources/CreditNoteEstimate.d.ts +5 -0
  67. package/types/resources/Customer.d.ts +8 -2
  68. package/types/resources/Estimate.d.ts +11 -2
  69. package/types/resources/Event.d.ts +1 -0
  70. package/types/resources/Export.d.ts +1 -0
  71. package/types/resources/Feature.d.ts +2 -0
  72. package/types/resources/Gift.d.ts +8 -2
  73. package/types/resources/GrantBlock.d.ts +1 -1
  74. package/types/resources/Invoice.d.ts +33 -3
  75. package/types/resources/InvoiceEstimate.d.ts +5 -0
  76. package/types/resources/LedgerOperation.d.ts +1 -3
  77. package/types/resources/Meter.d.ts +42 -0
  78. package/types/resources/MeteredFeature.d.ts +70 -0
  79. package/types/resources/PaymentIntent.d.ts +37 -5
  80. package/types/resources/PaymentSource.d.ts +4 -1
  81. package/types/resources/PromotionalGrant.d.ts +1 -1
  82. package/types/resources/Purchase.d.ts +4 -1
  83. package/types/resources/Quote.d.ts +5 -0
  84. package/types/resources/QuoteLineGroup.d.ts +5 -0
  85. package/types/resources/QuotedCharge.d.ts +3 -0
  86. package/types/resources/Ramp.d.ts +4 -1
  87. package/types/resources/RecordedPurchase.d.ts +3 -0
  88. package/types/resources/Subscription.d.ts +29 -7
  89. package/types/resources/WebhookEvent.d.ts +7 -0
@@ -6,8 +6,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.ListMeterBodySchema = void 0;
7
7
  const zod_1 = require("zod");
8
8
  //Meter.list
9
+ const ListMeterNameSchema = zod_1.z.object({
10
+ is: zod_1.z.string().min(1).optional(),
11
+ starts_with: zod_1.z.string().min(1).optional(),
12
+ });
13
+ const ListMeterSortBySchema = zod_1.z.looseObject({
14
+ asc: zod_1.z.enum(['id', 'name', 'created_at', 'updated_at']).optional(),
15
+ desc: zod_1.z.enum(['id', 'name', 'created_at', 'updated_at']).optional(),
16
+ });
9
17
  const ListMeterBodySchema = zod_1.z.looseObject({
10
18
  limit: zod_1.z.number().int().min(1).max(100).optional(),
11
19
  offset: zod_1.z.string().max(1000).optional(),
20
+ name: ListMeterNameSchema.optional(),
21
+ sort_by: ListMeterSortBySchema.optional(),
12
22
  });
13
23
  exports.ListMeterBodySchema = ListMeterBodySchema;
@@ -34,12 +34,12 @@ const ListOmnichannelSubscriptionIdAtSourceSchema = zod_1.z.object({
34
34
  not_in: zod_1.z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
35
35
  });
36
36
  const ListOmnichannelSubscriptionUpdatedAtSchema = zod_1.z.object({
37
- after: zod_1.z.string().regex(RegExp('^\\d{10}$')).optional(),
38
37
  before: zod_1.z.string().regex(RegExp('^\\d{10}$')).optional(),
38
+ after: zod_1.z.string().regex(RegExp('^\\d{10}$')).optional(),
39
39
  });
40
40
  const ListOmnichannelSubscriptionPurchasedAtSchema = zod_1.z.object({
41
- after: zod_1.z.string().regex(RegExp('^\\d{10}$')).optional(),
42
41
  before: zod_1.z.string().regex(RegExp('^\\d{10}$')).optional(),
42
+ after: zod_1.z.string().regex(RegExp('^\\d{10}$')).optional(),
43
43
  });
44
44
  const ListOmnichannelSubscriptionSortBySchema = zod_1.z.looseObject({
45
45
  asc: zod_1.z.enum(['created_at', 'updated_at']).optional(),
@@ -61,6 +61,9 @@ const CreatePaymentIntentBodySchema = zod_1.z.looseObject({
61
61
  'paypay',
62
62
  'gcash',
63
63
  'south_korean_cards',
64
+ 'paynow',
65
+ 'bizum',
66
+ 'promptpay',
64
67
  ])
65
68
  .optional(),
66
69
  success_url: zod_1.z.string().max(250).optional(),
@@ -119,6 +122,9 @@ const UpdatePaymentIntentBodySchema = zod_1.z.looseObject({
119
122
  'paypay',
120
123
  'gcash',
121
124
  'south_korean_cards',
125
+ 'paynow',
126
+ 'bizum',
127
+ 'promptpay',
122
128
  ])
123
129
  .optional(),
124
130
  success_url: zod_1.z.string().max(250).optional(),
@@ -58,6 +58,9 @@ const CreateUsingTempTokenPaymentSourceBodySchema = zod_1.z.looseObject({
58
58
  'paypay',
59
59
  'gcash',
60
60
  'south_korean_cards',
61
+ 'paynow',
62
+ 'bizum',
63
+ 'promptpay',
61
64
  ]),
62
65
  tmp_token: zod_1.z.string().max(65000),
63
66
  issuing_country: zod_1.z.string().max(50).optional(),
@@ -163,6 +166,9 @@ const CreateUsingPermanentTokenPaymentSourceBodySchema = zod_1.z.looseObject({
163
166
  'paypay',
164
167
  'gcash',
165
168
  'south_korean_cards',
169
+ 'paynow',
170
+ 'bizum',
171
+ 'promptpay',
166
172
  ]),
167
173
  gateway_account_id: zod_1.z.string().max(50).optional(),
168
174
  reference_id: zod_1.z.string().max(200).optional(),
@@ -239,6 +245,9 @@ const CreateUsingPaymentIntentPaymentSourcePaymentIntentSchema = zod_1.z.object(
239
245
  'paypay',
240
246
  'gcash',
241
247
  'south_korean_cards',
248
+ 'paynow',
249
+ 'bizum',
250
+ 'promptpay',
242
251
  ])
243
252
  .optional(),
244
253
  reference_id: zod_1.z.string().max(65000).optional(),
@@ -419,6 +428,9 @@ const ListPaymentSourceTypeSchema = zod_1.z.object({
419
428
  'paypay',
420
429
  'gcash',
421
430
  'south_korean_cards',
431
+ 'paynow',
432
+ 'bizum',
433
+ 'promptpay',
422
434
  ])
423
435
  .optional(),
424
436
  is_not: zod_1.z
@@ -470,6 +482,9 @@ const ListPaymentSourceTypeSchema = zod_1.z.object({
470
482
  'paypay',
471
483
  'gcash',
472
484
  'south_korean_cards',
485
+ 'paynow',
486
+ 'bizum',
487
+ 'promptpay',
473
488
  ])
474
489
  .optional(),
475
490
  in: zod_1.z
@@ -521,6 +536,9 @@ const ListPaymentSourceTypeSchema = zod_1.z.object({
521
536
  'paypay',
522
537
  'gcash',
523
538
  'south_korean_cards',
539
+ 'paynow',
540
+ 'bizum',
541
+ 'promptpay',
524
542
  ])
525
543
  .optional(),
526
544
  not_in: zod_1.z
@@ -572,6 +590,9 @@ const ListPaymentSourceTypeSchema = zod_1.z.object({
572
590
  'paypay',
573
591
  'gcash',
574
592
  'south_korean_cards',
593
+ 'paynow',
594
+ 'bizum',
595
+ 'promptpay',
575
596
  ])
576
597
  .optional(),
577
598
  });
@@ -68,8 +68,8 @@ const ListPriceVariantCreatedAtSchema = zod_1.z.object({
68
68
  between: zod_1.z.string().regex(RegExp('^\\[\\d{10},\\d{10}\\]$')).optional(),
69
69
  });
70
70
  const ListPriceVariantBusinessEntityIdSchema = zod_1.z.object({
71
- is: zod_1.z.string().min(1).optional(),
72
71
  is_present: zod_1.z.enum(['true', 'false']).optional(),
72
+ is: zod_1.z.string().min(1).optional(),
73
73
  });
74
74
  const ListPriceVariantIncludeSiteLevelResourcesSchema = zod_1.z.object({
75
75
  is: zod_1.z.enum(['true', 'false']).optional(),
@@ -69,6 +69,9 @@ const CreatePurchasePaymentIntentSchema = zod_1.z.object({
69
69
  'paypay',
70
70
  'gcash',
71
71
  'south_korean_cards',
72
+ 'paynow',
73
+ 'bizum',
74
+ 'promptpay',
72
75
  ])
73
76
  .optional(),
74
77
  reference_id: zod_1.z.string().max(65000).optional(),
@@ -85,6 +85,7 @@ const CreateForSubscriptionRampDiscountsToAddSchema = zod_1.z.object({
85
85
  duration_type: zod_1.z.array(zod_1.z.enum(['one_time', 'forever', 'limited_period']).optional()),
86
86
  percentage: zod_1.z.array(zod_1.z.number().min(0.01).max(100).optional()).optional(),
87
87
  amount: zod_1.z.array(zod_1.z.number().int().min(0).optional()).optional(),
88
+ quantity: zod_1.z.array(zod_1.z.number().int().min(1).optional()).optional(),
88
89
  period: zod_1.z.array(zod_1.z.number().int().min(1).optional()).optional(),
89
90
  period_unit: zod_1.z
90
91
  .array(zod_1.z.enum(['day', 'week', 'month', 'year']).optional())
@@ -186,6 +187,7 @@ const UpdateRampDiscountsToAddSchema = zod_1.z.object({
186
187
  duration_type: zod_1.z.array(zod_1.z.enum(['one_time', 'forever', 'limited_period']).optional()),
187
188
  percentage: zod_1.z.array(zod_1.z.number().min(0.01).max(100).optional()).optional(),
188
189
  amount: zod_1.z.array(zod_1.z.number().int().min(0).optional()).optional(),
190
+ quantity: zod_1.z.array(zod_1.z.number().int().min(1).optional()).optional(),
189
191
  period: zod_1.z.array(zod_1.z.number().int().min(1).optional()).optional(),
190
192
  period_unit: zod_1.z
191
193
  .array(zod_1.z.enum(['day', 'week', 'month', 'year']).optional())
@@ -8,6 +8,9 @@ const zod_1 = require("zod");
8
8
  //RecordedPurchase.create
9
9
  const CreateRecordedPurchaseCustomerSchema = zod_1.z.object({
10
10
  id: zod_1.z.string().max(50),
11
+ email: zod_1.z.string().email().max(70).optional(),
12
+ first_name: zod_1.z.string().max(150).optional(),
13
+ last_name: zod_1.z.string().max(150).optional(),
11
14
  });
12
15
  const CreateRecordedPurchaseAppleAppStoreSchema = zod_1.z.object({
13
16
  transaction_id: zod_1.z.string().max(100).optional(),
@@ -235,6 +235,9 @@ const CreateSubscriptionPaymentMethodSchema = zod_1.z.object({
235
235
  'paypay',
236
236
  'gcash',
237
237
  'south_korean_cards',
238
+ 'paynow',
239
+ 'bizum',
240
+ 'promptpay',
238
241
  ])
239
242
  .optional(),
240
243
  gateway: zod_1.z
@@ -357,6 +360,9 @@ const CreateSubscriptionPaymentIntentSchema = zod_1.z.object({
357
360
  'paypay',
358
361
  'gcash',
359
362
  'south_korean_cards',
363
+ 'paynow',
364
+ 'bizum',
365
+ 'promptpay',
360
366
  ])
361
367
  .optional(),
362
368
  reference_id: zod_1.z.string().max(65000).optional(),
@@ -588,6 +594,9 @@ const CreateForCustomerSubscriptionPaymentIntentSchema = zod_1.z.object({
588
594
  'paypay',
589
595
  'gcash',
590
596
  'south_korean_cards',
597
+ 'paynow',
598
+ 'bizum',
599
+ 'promptpay',
591
600
  ])
592
601
  .optional(),
593
602
  reference_id: zod_1.z.string().max(65000).optional(),
@@ -779,6 +788,9 @@ const CreateWithItemsSubscriptionPaymentIntentSchema = zod_1.z.object({
779
788
  'paypay',
780
789
  'gcash',
781
790
  'south_korean_cards',
791
+ 'paynow',
792
+ 'bizum',
793
+ 'promptpay',
782
794
  ])
783
795
  .optional(),
784
796
  reference_id: zod_1.z.string().max(65000).optional(),
@@ -1189,6 +1201,9 @@ const ListSubscriptionChannelSchema = zod_1.z.object({
1189
1201
  in: zod_1.z.enum(['web', 'app_store', 'play_store']).optional(),
1190
1202
  not_in: zod_1.z.enum(['web', 'app_store', 'play_store']).optional(),
1191
1203
  });
1204
+ const ListSubscriptionDecommissionedSchema = zod_1.z.object({
1205
+ is: zod_1.z.enum(['true', 'false']).optional(),
1206
+ });
1192
1207
  const ListSubscriptionPlanIdSchema = zod_1.z.object({
1193
1208
  is: zod_1.z.string().min(1).optional(),
1194
1209
  is_not: zod_1.z.string().min(1).optional(),
@@ -1220,6 +1235,7 @@ const ListSubscriptionBodySchema = zod_1.z.looseObject({
1220
1235
  sort_by: ListSubscriptionSortBySchema.optional(),
1221
1236
  business_entity_id: ListSubscriptionBusinessEntityIdSchema.optional(),
1222
1237
  channel: ListSubscriptionChannelSchema.optional(),
1238
+ decommissioned: ListSubscriptionDecommissionedSchema.optional(),
1223
1239
  plan_id: ListSubscriptionPlanIdSchema.optional(),
1224
1240
  });
1225
1241
  exports.ListSubscriptionBodySchema = ListSubscriptionBodySchema;
@@ -1405,6 +1421,9 @@ const UpdateSubscriptionPaymentMethodSchema = zod_1.z.object({
1405
1421
  'paypay',
1406
1422
  'gcash',
1407
1423
  'south_korean_cards',
1424
+ 'paynow',
1425
+ 'bizum',
1426
+ 'promptpay',
1408
1427
  ])
1409
1428
  .optional(),
1410
1429
  gateway: zod_1.z
@@ -1527,6 +1546,9 @@ const UpdateSubscriptionPaymentIntentSchema = zod_1.z.object({
1527
1546
  'paypay',
1528
1547
  'gcash',
1529
1548
  'south_korean_cards',
1549
+ 'paynow',
1550
+ 'bizum',
1551
+ 'promptpay',
1530
1552
  ])
1531
1553
  .optional(),
1532
1554
  reference_id: zod_1.z.string().max(65000).optional(),
@@ -1847,6 +1869,9 @@ const UpdateForItemsSubscriptionPaymentMethodSchema = zod_1.z.object({
1847
1869
  'paypay',
1848
1870
  'gcash',
1849
1871
  'south_korean_cards',
1872
+ 'paynow',
1873
+ 'bizum',
1874
+ 'promptpay',
1850
1875
  ])
1851
1876
  .optional(),
1852
1877
  gateway: zod_1.z
@@ -1969,6 +1994,9 @@ const UpdateForItemsSubscriptionPaymentIntentSchema = zod_1.z.object({
1969
1994
  'paypay',
1970
1995
  'gcash',
1971
1996
  'south_korean_cards',
1997
+ 'paynow',
1998
+ 'bizum',
1999
+ 'promptpay',
1972
2000
  ])
1973
2001
  .optional(),
1974
2002
  reference_id: zod_1.z.string().max(65000).optional(),
@@ -2252,6 +2280,9 @@ const ReactivateSubscriptionPaymentIntentSchema = zod_1.z.object({
2252
2280
  'paypay',
2253
2281
  'gcash',
2254
2282
  'south_korean_cards',
2283
+ 'paynow',
2284
+ 'bizum',
2285
+ 'promptpay',
2255
2286
  ])
2256
2287
  .optional(),
2257
2288
  reference_id: zod_1.z.string().max(65000).optional(),
@@ -2558,6 +2589,9 @@ const ImportSubscriptionSubscriptionPaymentMethodSchema = zod_1.z.object({
2558
2589
  'paypay',
2559
2590
  'gcash',
2560
2591
  'south_korean_cards',
2592
+ 'paynow',
2593
+ 'bizum',
2594
+ 'promptpay',
2561
2595
  ])
2562
2596
  .optional(),
2563
2597
  gateway: zod_1.z
@@ -3317,6 +3351,9 @@ const ResumeSubscriptionPaymentIntentSchema = zod_1.z.object({
3317
3351
  'paypay',
3318
3352
  'gcash',
3319
3353
  'south_korean_cards',
3354
+ 'paynow',
3355
+ 'bizum',
3356
+ 'promptpay',
3320
3357
  ])
3321
3358
  .optional(),
3322
3359
  reference_id: zod_1.z.string().max(65000).optional(),
@@ -137,6 +137,9 @@ const ListTransactionPaymentMethodSchema = zod_1.z.object({
137
137
  'paypay',
138
138
  'gcash',
139
139
  'south_korean_cards',
140
+ 'paynow',
141
+ 'bizum',
142
+ 'promptpay',
140
143
  ])
141
144
  .optional(),
142
145
  is_not: zod_1.z
@@ -198,6 +201,9 @@ const ListTransactionPaymentMethodSchema = zod_1.z.object({
198
201
  'paypay',
199
202
  'gcash',
200
203
  'south_korean_cards',
204
+ 'paynow',
205
+ 'bizum',
206
+ 'promptpay',
201
207
  ])
202
208
  .optional(),
203
209
  in: zod_1.z
@@ -259,6 +265,9 @@ const ListTransactionPaymentMethodSchema = zod_1.z.object({
259
265
  'paypay',
260
266
  'gcash',
261
267
  'south_korean_cards',
268
+ 'paynow',
269
+ 'bizum',
270
+ 'promptpay',
262
271
  ])
263
272
  .optional(),
264
273
  not_in: zod_1.z
@@ -320,6 +329,9 @@ const ListTransactionPaymentMethodSchema = zod_1.z.object({
320
329
  'paypay',
321
330
  'gcash',
322
331
  'south_korean_cards',
332
+ 'paynow',
333
+ 'bizum',
334
+ 'promptpay',
323
335
  ])
324
336
  .optional(),
325
337
  });
@@ -182,6 +182,7 @@ const CreateWebhookEndpointBodySchema = zod_1.z.looseObject({
182
182
  'business_entity_deleted',
183
183
  'customer_business_entity_changed',
184
184
  'subscription_business_entity_changed',
185
+ 'payment_source_business_entity_changed',
185
186
  'purchase_created',
186
187
  'voucher_created',
187
188
  'voucher_expired',
@@ -428,6 +429,7 @@ const UpdateWebhookEndpointBodySchema = zod_1.z.looseObject({
428
429
  'business_entity_deleted',
429
430
  'customer_business_entity_changed',
430
431
  'subscription_business_entity_changed',
432
+ 'payment_source_business_entity_changed',
431
433
  'purchase_created',
432
434
  'voucher_created',
433
435
  'voucher_expired',
@@ -70,16 +70,16 @@ function buildRequestEndSpanAttributes(result) {
70
70
  [types_js_1.TelemetryAttributeKeys.HTTP_RESPONSE_STATUS_CODE]: result.httpStatusCode,
71
71
  };
72
72
  if (result.error) {
73
- // error.type is the status code on failed requests
74
- attributes[types_js_1.TelemetryAttributeKeys.ERROR_TYPE] = String(result.httpStatusCode);
75
- if (result.error.chargebeeErrorCode) {
76
- attributes[types_js_1.TelemetryAttributeKeys.CHARGEBEE_ERROR_CODE] =
77
- result.error.chargebeeErrorCode;
78
- }
79
73
  if (result.error.chargebeeApiErrorType) {
74
+ attributes[types_js_1.TelemetryAttributeKeys.ERROR_TYPE] =
75
+ result.error.chargebeeApiErrorType;
80
76
  attributes[types_js_1.TelemetryAttributeKeys.CHARGEBEE_ERROR_TYPE] =
81
77
  result.error.chargebeeApiErrorType;
82
78
  }
79
+ if (result.error.chargebeeErrorCode) {
80
+ attributes[types_js_1.TelemetryAttributeKeys.CHARGEBEE_ERROR_CODE] =
81
+ result.error.chargebeeErrorCode;
82
+ }
83
83
  if (result.error.chargebeeErrorParam) {
84
84
  attributes[types_js_1.TelemetryAttributeKeys.CHARGEBEE_ERROR_PARAM] =
85
85
  result.error.chargebeeErrorParam;
@@ -107,12 +107,17 @@ function buildRequestTelemetryResult(result) {
107
107
  }
108
108
  function extractRequestTelemetryError(err) {
109
109
  if (err == null || typeof err !== 'object') {
110
+ if (err instanceof Error) {
111
+ return { message: err.message };
112
+ }
110
113
  return undefined;
111
114
  }
112
115
  const errorObj = err;
113
116
  const message = typeof errorObj.message === 'string'
114
117
  ? errorObj.message
115
- : 'Chargebee API request failed';
118
+ : err instanceof Error
119
+ ? err.message
120
+ : 'Chargebee API request failed';
116
121
  const result = { message };
117
122
  if (typeof errorObj.api_error_code === 'string') {
118
123
  result.chargebeeErrorCode = errorObj.api_error_code;
@@ -8,7 +8,7 @@ export const Environment = {
8
8
  hostSuffix: '.chargebee.com',
9
9
  apiPath: '/api/v2',
10
10
  timeout: DEFAULT_TIME_OUT,
11
- clientVersion: 'v3.28.1',
11
+ clientVersion: 'v3.29.0',
12
12
  port: DEFAULT_PORT,
13
13
  timemachineWaitInMillis: DEFAULT_TIME_MACHINE_WAIT,
14
14
  exportWaitInMillis: DEFAULT_EXPORT_WAIT,
@@ -1,4 +1,6 @@
1
1
  export const Endpoints = {
2
+ asyncResponseList: [],
3
+ asyncResponse: [],
2
4
  subscription: [
3
5
  [
4
6
  'create',
@@ -4797,6 +4799,7 @@ export const Endpoints = {
4797
4799
  ],
4798
4800
  omnichannelOneTimeOrderItem: [],
4799
4801
  rule: [['retrieve', 'GET', '/rules', null, true, null, false, {}, {}]],
4802
+ meter: [['list', 'GET', '/meters', null, false, null, false, {}, {}]],
4800
4803
  usageEvent: [
4801
4804
  [
4802
4805
  'create',
@@ -4825,6 +4828,60 @@ export const Endpoints = {
4825
4828
  {},
4826
4829
  ],
4827
4830
  ],
4831
+ meteredFeature: [
4832
+ [
4833
+ 'create',
4834
+ 'POST',
4835
+ '/metered_features',
4836
+ null,
4837
+ false,
4838
+ null,
4839
+ false,
4840
+ {},
4841
+ {
4842
+ isIdempotent: true,
4843
+ },
4844
+ ],
4845
+ [
4846
+ 'archive',
4847
+ 'POST',
4848
+ '/metered_features',
4849
+ '/archive_command',
4850
+ true,
4851
+ null,
4852
+ false,
4853
+ {},
4854
+ {
4855
+ isIdempotent: true,
4856
+ },
4857
+ ],
4858
+ [
4859
+ 'reactivate',
4860
+ 'POST',
4861
+ '/metered_features',
4862
+ '/reactivate_command',
4863
+ true,
4864
+ null,
4865
+ false,
4866
+ {},
4867
+ {
4868
+ isIdempotent: true,
4869
+ },
4870
+ ],
4871
+ [
4872
+ 'delete',
4873
+ 'POST',
4874
+ '/metered_features',
4875
+ '/delete',
4876
+ true,
4877
+ null,
4878
+ false,
4879
+ {},
4880
+ {
4881
+ isIdempotent: true,
4882
+ },
4883
+ ],
4884
+ ],
4828
4885
  usageFile: [
4829
4886
  [
4830
4887
  'uploadUrl',
@@ -136,6 +136,7 @@ export var WebhookEventType;
136
136
  WebhookEventType["PaymentSchedulesCreated"] = "payment_schedules_created";
137
137
  WebhookEventType["PaymentSchedulesUpdated"] = "payment_schedules_updated";
138
138
  WebhookEventType["PaymentSourceAdded"] = "payment_source_added";
139
+ WebhookEventType["PaymentSourceBusinessEntityChanged"] = "payment_source_business_entity_changed";
139
140
  WebhookEventType["PaymentSourceDeleted"] = "payment_source_deleted";
140
141
  WebhookEventType["PaymentSourceExpired"] = "payment_source_expired";
141
142
  WebhookEventType["PaymentSourceExpiring"] = "payment_source_expiring";
@@ -4,7 +4,7 @@
4
4
  import { z } from 'zod';
5
5
  //Alert.create
6
6
  const CreateAlertThresholdSchema = z.object({
7
- mode: z.enum(['absolute', 'percentage']),
7
+ mode: z.enum(['absolute', 'percentage']).optional(),
8
8
  value: z.number(),
9
9
  });
10
10
  const CreateAlertFilterConditionsSchema = z.object({
@@ -13,10 +13,11 @@ const CreateAlertFilterConditionsSchema = z.object({
13
13
  value: z.array(z.string().max(50).optional()).optional(),
14
14
  });
15
15
  const CreateAlertBodySchema = z.looseObject({
16
- type: z.enum(['usage_exceeded']),
16
+ type: z.enum(['usage_exceeded', 'spend_exceeded']),
17
17
  name: z.string().max(50),
18
18
  description: z.string().max(65000).optional(),
19
- metered_feature_id: z.string().max(50),
19
+ metered_feature_id: z.string().max(50).optional(),
20
+ currency_code: z.string().max(3).optional(),
20
21
  subscription_id: z.string().max(50).optional(),
21
22
  meta: z.string().max(65000).optional(),
22
23
  threshold: CreateAlertThresholdSchema.optional(),
@@ -28,7 +29,7 @@ const ListAlertIdSchema = z.object({
28
29
  in: z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
29
30
  });
30
31
  const ListAlertTypeSchema = z.object({
31
- is: z.enum(['usage_exceeded']).optional(),
32
+ is: z.enum(['usage_exceeded', 'spend_exceeded']).optional(),
32
33
  });
33
34
  const ListAlertSubscriptionIdSchema = z.object({
34
35
  is: z.string().min(1).optional(),
@@ -60,7 +61,7 @@ const ApplicationAlertsforsubscriptionAlertStatusSchema = z.object({
60
61
  is: z.enum(['enabled', 'disabled']).optional(),
61
62
  });
62
63
  const ApplicationAlertsforsubscriptionAlertTypeSchema = z.object({
63
- is: z.enum(['usage_exceeded']).optional(),
64
+ is: z.enum(['usage_exceeded', 'spend_exceeded']).optional(),
64
65
  });
65
66
  const ApplicationAlertsforsubscriptionAlertBodySchema = z.looseObject({
66
67
  limit: z.number().int().min(1).max(100).optional(),
@@ -401,6 +401,11 @@ const ImportCreditNoteCreditNoteLineItemsSchema = z.object({
401
401
  tax9_amount: z.array(z.number().int().min(0).optional()).optional(),
402
402
  tax10_name: z.array(z.string().max(50).optional()).optional(),
403
403
  tax10_amount: z.array(z.number().int().min(0).optional()).optional(),
404
+ proration_mode: z
405
+ .array(z
406
+ .enum(['reset', 'delta', 'service_period_revision', 'adjusted_term'])
407
+ .optional())
408
+ .optional(),
404
409
  });
405
410
  const ImportCreditNoteCreditNoteLineItemTiersSchema = z.object({
406
411
  line_item_id: z.array(z.string().max(40).optional()),
@@ -162,6 +162,9 @@ const CreateCustomerPaymentMethodSchema = z.object({
162
162
  'paypay',
163
163
  'gcash',
164
164
  'south_korean_cards',
165
+ 'paynow',
166
+ 'bizum',
167
+ 'promptpay',
165
168
  ])
166
169
  .optional(),
167
170
  gateway: z
@@ -284,6 +287,9 @@ const CreateCustomerPaymentIntentSchema = z.object({
284
287
  'paypay',
285
288
  'gcash',
286
289
  'south_korean_cards',
290
+ 'paynow',
291
+ 'bizum',
292
+ 'promptpay',
287
293
  ])
288
294
  .optional(),
289
295
  reference_id: z.string().max(65000).optional(),
@@ -703,6 +709,9 @@ const UpdatePaymentMethodCustomerPaymentMethodSchema = z.object({
703
709
  'paypay',
704
710
  'gcash',
705
711
  'south_korean_cards',
712
+ 'paynow',
713
+ 'bizum',
714
+ 'promptpay',
706
715
  ]),
707
716
  gateway: z
708
717
  .enum([
@@ -984,6 +993,9 @@ const CollectPaymentCustomerPaymentMethodSchema = z.object({
984
993
  'paypay',
985
994
  'gcash',
986
995
  'south_korean_cards',
996
+ 'paynow',
997
+ 'bizum',
998
+ 'promptpay',
987
999
  ])
988
1000
  .optional(),
989
1001
  gateway_account_id: z.string().max(50).optional(),
@@ -1062,6 +1074,9 @@ const CollectPaymentCustomerPaymentIntentSchema = z.object({
1062
1074
  'paypay',
1063
1075
  'gcash',
1064
1076
  'south_korean_cards',
1077
+ 'paynow',
1078
+ 'bizum',
1079
+ 'promptpay',
1065
1080
  ])
1066
1081
  .optional(),
1067
1082
  gw_payment_method_id: z.string().max(65000).optional(),
@@ -1151,6 +1151,9 @@ const GiftSubscriptionEstimatePaymentIntentSchema = z.object({
1151
1151
  'paypay',
1152
1152
  'gcash',
1153
1153
  'south_korean_cards',
1154
+ 'paynow',
1155
+ 'bizum',
1156
+ 'promptpay',
1154
1157
  ])
1155
1158
  .optional(),
1156
1159
  reference_id: z.string().max(65000).optional(),
@@ -1267,6 +1270,9 @@ const GiftSubscriptionForItemsEstimatePaymentIntentSchema = z.object({
1267
1270
  'paypay',
1268
1271
  'gcash',
1269
1272
  'south_korean_cards',
1273
+ 'paynow',
1274
+ 'bizum',
1275
+ 'promptpay',
1270
1276
  ])
1271
1277
  .optional(),
1272
1278
  reference_id: z.string().max(65000).optional(),
@@ -1443,6 +1449,8 @@ const CreateInvoiceForItemsEstimateItemPricesSchema = z.object({
1443
1449
  unit_price_in_decimal: z.array(z.string().max(39).optional()).optional(),
1444
1450
  date_from: z.array(z.number().int().optional()).optional(),
1445
1451
  date_to: z.array(z.number().int().optional()).optional(),
1452
+ description: z.array(z.string().max(250).optional()).optional(),
1453
+ entity_description: z.array(z.string().max(500).optional()).optional(),
1446
1454
  });
1447
1455
  const CreateInvoiceForItemsEstimateItemTiersSchema = z.object({
1448
1456
  item_price_id: z.array(z.string().max(100).optional()).optional(),
@@ -1473,6 +1481,7 @@ const CreateInvoiceForItemsEstimateChargesSchema = z.object({
1473
1481
  avalara_service_type: z.array(z.number().int().optional()).optional(),
1474
1482
  date_from: z.array(z.number().int().optional()).optional(),
1475
1483
  date_to: z.array(z.number().int().optional()).optional(),
1484
+ entity_description: z.array(z.string().max(500).optional()).optional(),
1476
1485
  });
1477
1486
  const CreateInvoiceForItemsEstimateNotesToRemoveSchema = z.object({
1478
1487
  entity_type: z
@@ -228,6 +228,7 @@ const ListEventEventTypeSchema = z.object({
228
228
  'business_entity_deleted',
229
229
  'customer_business_entity_changed',
230
230
  'subscription_business_entity_changed',
231
+ 'payment_source_business_entity_changed',
231
232
  'purchase_created',
232
233
  'voucher_created',
233
234
  'voucher_expired',
@@ -454,6 +455,7 @@ const ListEventEventTypeSchema = z.object({
454
455
  'business_entity_deleted',
455
456
  'customer_business_entity_changed',
456
457
  'subscription_business_entity_changed',
458
+ 'payment_source_business_entity_changed',
457
459
  'purchase_created',
458
460
  'voucher_created',
459
461
  'voucher_expired',
@@ -680,6 +682,7 @@ const ListEventEventTypeSchema = z.object({
680
682
  'business_entity_deleted',
681
683
  'customer_business_entity_changed',
682
684
  'subscription_business_entity_changed',
685
+ 'payment_source_business_entity_changed',
683
686
  'purchase_created',
684
687
  'voucher_created',
685
688
  'voucher_expired',
@@ -906,6 +909,7 @@ const ListEventEventTypeSchema = z.object({
906
909
  'business_entity_deleted',
907
910
  'customer_business_entity_changed',
908
911
  'subscription_business_entity_changed',
912
+ 'payment_source_business_entity_changed',
909
913
  'purchase_created',
910
914
  'voucher_created',
911
915
  'voucher_expired',