chargebee 3.30.0 → 3.31.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 (72) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/cjs/environment.js +1 -1
  3. package/cjs/resources/api_endpoints.js +84 -2
  4. package/cjs/resources/webhook/eventType.js +4 -0
  5. package/cjs/schema/coupon.schema.js +1 -1
  6. package/cjs/schema/credit_note.schema.js +7 -2
  7. package/cjs/schema/credit_unit.schema.js +2 -2
  8. package/cjs/schema/entitlement.schema.js +4 -4
  9. package/cjs/schema/entitlement_override.schema.js +1 -1
  10. package/cjs/schema/estimate.schema.js +2 -2
  11. package/cjs/schema/event.schema.js +16 -0
  12. package/cjs/schema/export.schema.js +35 -3
  13. package/cjs/schema/hosted_page.schema.js +1 -0
  14. package/cjs/schema/index.js +1 -0
  15. package/cjs/schema/invoice.schema.js +11 -4
  16. package/cjs/schema/ledger_operation.schema.js +2 -2
  17. package/cjs/schema/meter.schema.js +1 -1
  18. package/cjs/schema/omnichannel_subscription.schema.js +6 -2
  19. package/cjs/schema/payment_intent.schema.js +4 -0
  20. package/cjs/schema/payment_source.schema.js +9 -2
  21. package/cjs/schema/pricing_page_session.schema.js +1 -1
  22. package/cjs/schema/quote.schema.js +60 -0
  23. package/cjs/schema/quote_entitlement.schema.js +25 -0
  24. package/cjs/schema/ramp.schema.js +2 -2
  25. package/cjs/schema/subscription.schema.js +2 -2
  26. package/cjs/schema/webhook_endpoint.schema.js +8 -0
  27. package/cjs/util.js +12 -2
  28. package/esm/environment.js +1 -1
  29. package/esm/resources/api_endpoints.js +84 -2
  30. package/esm/resources/webhook/eventType.js +4 -0
  31. package/esm/schema/coupon.schema.js +1 -1
  32. package/esm/schema/credit_note.schema.js +6 -1
  33. package/esm/schema/credit_unit.schema.js +2 -2
  34. package/esm/schema/entitlement.schema.js +4 -4
  35. package/esm/schema/entitlement_override.schema.js +1 -1
  36. package/esm/schema/estimate.schema.js +2 -2
  37. package/esm/schema/event.schema.js +16 -0
  38. package/esm/schema/export.schema.js +34 -2
  39. package/esm/schema/hosted_page.schema.js +1 -0
  40. package/esm/schema/index.js +1 -0
  41. package/esm/schema/invoice.schema.js +10 -3
  42. package/esm/schema/ledger_operation.schema.js +2 -2
  43. package/esm/schema/meter.schema.js +1 -1
  44. package/esm/schema/omnichannel_subscription.schema.js +6 -2
  45. package/esm/schema/payment_intent.schema.js +4 -0
  46. package/esm/schema/payment_source.schema.js +8 -1
  47. package/esm/schema/pricing_page_session.schema.js +1 -1
  48. package/esm/schema/quote.schema.js +60 -0
  49. package/esm/schema/quote_entitlement.schema.js +22 -0
  50. package/esm/schema/ramp.schema.js +2 -2
  51. package/esm/schema/subscription.schema.js +2 -2
  52. package/esm/schema/webhook_endpoint.schema.js +8 -0
  53. package/esm/util.js +12 -2
  54. package/package.json +2 -2
  55. package/types/core.d.ts +78 -3
  56. package/types/index.d.ts +6 -0
  57. package/types/resources/Content.d.ts +4 -0
  58. package/types/resources/CreditNote.d.ts +14 -0
  59. package/types/resources/Event.d.ts +4 -0
  60. package/types/resources/Export.d.ts +20 -0
  61. package/types/resources/GatewayPaymentMethodToken.d.ts +15 -0
  62. package/types/resources/HostedPage.d.ts +1 -0
  63. package/types/resources/Invoice.d.ts +17 -1
  64. package/types/resources/OmnichannelSubscriptionItemMetric.d.ts +18 -0
  65. package/types/resources/PaymentIntent.d.ts +14 -11
  66. package/types/resources/PaymentSource.d.ts +17 -0
  67. package/types/resources/PricingPageSession.d.ts +1 -1
  68. package/types/resources/Quote.d.ts +45 -0
  69. package/types/resources/QuoteEntitlement.d.ts +49 -0
  70. package/types/resources/QuotedRamp.d.ts +1 -0
  71. package/types/resources/VaultedPaymentMethod.d.ts +28 -0
  72. package/types/resources/WebhookEvent.d.ts +24 -0
@@ -1,5 +1,5 @@
1
1
  // Generated Zod schemas: Export
2
- // Actions: revenueRecognition, deferredRevenue, plans, addons, coupons, customers, subscriptions, invoices, creditNotes, transactions, orders, itemFamilies, items, itemPrices, attachedItems, differentialPrices, priceVariants
2
+ // Actions: revenueRecognition, deferredRevenue, plans, addons, coupons, customers, subscriptions, invoices, creditNotes, transactions, orders, itemFamilies, items, itemPrices, attachedItems, differentialPrices, priceVariants, ramps
3
3
  // Do not edit manually – regenerate via sdk-generator
4
4
  import { z } from 'zod';
5
5
  //Export.revenueRecognition
@@ -1099,8 +1099,8 @@ const CouponsExportCurrencyCodeSchema = z.object({
1099
1099
  not_in: z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
1100
1100
  });
1101
1101
  const CouponsExportApplicableItemPriceIdsSchema = z.object({
1102
- in: z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
1103
1102
  is: z.string().min(1).optional(),
1103
+ in: z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
1104
1104
  });
1105
1105
  const CouponsExportIdSchema = z.object({
1106
1106
  is: z.string().min(1).optional(),
@@ -3412,3 +3412,35 @@ const PriceVariantsExportBodySchema = z.looseObject({
3412
3412
  .optional(),
3413
3413
  });
3414
3414
  export { PriceVariantsExportBodySchema };
3415
+ //Export.ramps
3416
+ const RampsExportStatusSchema = z.object({
3417
+ is: z.enum(['scheduled', 'succeeded', 'failed', 'draft']).optional(),
3418
+ in: z.enum(['scheduled', 'succeeded', 'failed', 'draft']).optional(),
3419
+ });
3420
+ const RampsExportSubscriptionIdSchema = z.object({
3421
+ is: z.string().min(1).optional(),
3422
+ in: z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
3423
+ });
3424
+ const RampsExportEffectiveFromSchema = z.object({
3425
+ after: z.string().regex(RegExp('^\\d{10}$')).optional(),
3426
+ before: z.string().regex(RegExp('^\\d{10}$')).optional(),
3427
+ on: z.string().regex(RegExp('^\\d{10}$')).optional(),
3428
+ between: z.string().regex(RegExp('^\\[\\d{10},\\d{10}\\]$')).optional(),
3429
+ });
3430
+ const RampsExportUpdatedAtSchema = z.object({
3431
+ after: z.string().regex(RegExp('^\\d{10}$')).optional(),
3432
+ before: z.string().regex(RegExp('^\\d{10}$')).optional(),
3433
+ on: z.string().regex(RegExp('^\\d{10}$')).optional(),
3434
+ between: z.string().regex(RegExp('^\\[\\d{10},\\d{10}\\]$')).optional(),
3435
+ });
3436
+ const RampsExportRampItemSchema = z.object({
3437
+ status: RampsExportStatusSchema.optional(),
3438
+ subscription_id: RampsExportSubscriptionIdSchema.optional(),
3439
+ effective_from: RampsExportEffectiveFromSchema.optional(),
3440
+ updated_at: RampsExportUpdatedAtSchema.optional(),
3441
+ });
3442
+ const RampsExportBodySchema = z.looseObject({
3443
+ export_type: z.enum(['data', 'import_friendly_data']).optional(),
3444
+ ramp: z.array(RampsExportRampItemSchema.optional()).optional(),
3445
+ });
3446
+ export { RampsExportBodySchema };
@@ -1749,6 +1749,7 @@ const PreCancelHostedPageBodySchema = z.looseObject({
1749
1749
  pass_thru_content: z.string().max(2048).optional(),
1750
1750
  cancel_url: z.string().max(250).optional(),
1751
1751
  redirect_url: z.string().max(250).optional(),
1752
+ locale: z.string().max(50).optional(),
1752
1753
  subscription: PreCancelHostedPageSubscriptionSchema.optional(),
1753
1754
  });
1754
1755
  export { PreCancelHostedPageBodySchema };
@@ -55,6 +55,7 @@ export * from './promotional_credit.schema.js';
55
55
  export * from './promotional_grant.schema.js';
56
56
  export * from './purchase.schema.js';
57
57
  export * from './quote.schema.js';
58
+ export * from './quote_entitlement.schema.js';
58
59
  export * from './ramp.schema.js';
59
60
  export * from './recorded_purchase.schema.js';
60
61
  export * from './resource_migration.schema.js';
@@ -1,5 +1,5 @@
1
1
  // Generated Zod schemas: Invoice
2
- // Actions: create, createForChargeItemsAndCharges, charge, chargeAddon, createForChargeItem, stopDunning, pauseDunning, resumeDunning, importInvoice, applyPayments, deleteLineItems, applyCredits, list, invoicesForCustomer, invoicesForSubscription, retrieve, pdf, listPaymentReferenceNumbers, addCharge, addAddonCharge, addChargeItem, close, collectPayment, recordPayment, recordTaxWithheld, removeTaxWithheld, refund, recordRefund, removePayment, removeCreditNote, voidInvoice, writeOff, delete, updateDetails, applyPaymentScheduleScheme
2
+ // Actions: create, createForChargeItemsAndCharges, charge, chargeAddon, createForChargeItem, stopDunning, pauseDunning, resumeDunning, importInvoice, applyPayments, deleteLineItems, applyCredits, list, invoicesForCustomer, invoicesForSubscription, retrieve, pdf, listPaymentReferenceNumbers, addCharge, addAddonCharge, addChargeItem, close, collectPayment, recordPayment, recordTaxWithheld, removeTaxWithheld, refund, recordRefund, removePayment, removeCreditNote, voidInvoice, writeOff, voidBeforeCapture, delete, updateDetails, applyPaymentScheduleScheme
3
3
  // Do not edit manually – regenerate via sdk-generator
4
4
  import { z } from 'zod';
5
5
  //Invoice.create
@@ -1421,12 +1421,12 @@ const PdfInvoiceBodySchema = z.looseObject({
1421
1421
  export { PdfInvoiceBodySchema };
1422
1422
  //Invoice.listPaymentReferenceNumbers
1423
1423
  const ListPaymentReferenceNumbersInvoiceIdSchema = z.object({
1424
- in: z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
1425
1424
  is: z.string().min(1).optional(),
1425
+ in: z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
1426
1426
  });
1427
1427
  const ListPaymentReferenceNumbersInvoiceNumberSchema = z.object({
1428
- in: z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
1429
1428
  is: z.string().min(1).optional(),
1429
+ in: z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
1430
1430
  });
1431
1431
  const ListPaymentReferenceNumbersInvoicePaymentReferenceNumberItemSchema = z.object({
1432
1432
  number: ListPaymentReferenceNumbersInvoiceNumberSchema.optional(),
@@ -1679,6 +1679,13 @@ const WriteOffInvoiceBodySchema = z.looseObject({
1679
1679
  comment: z.string().max(300).optional(),
1680
1680
  });
1681
1681
  export { WriteOffInvoiceBodySchema };
1682
+ //Invoice.voidBeforeCapture
1683
+ const VoidBeforeCaptureInvoiceBodySchema = z.looseObject({
1684
+ comment: z.string().max(300).optional(),
1685
+ void_reason_code: z.string().max(100).optional(),
1686
+ invoice_action: z.enum(['void', 'write_off']).optional(),
1687
+ });
1688
+ export { VoidBeforeCaptureInvoiceBodySchema };
1682
1689
  //Invoice.delete
1683
1690
  const DeleteInvoiceBodySchema = z.looseObject({
1684
1691
  comment: z.string().max(300).optional(),
@@ -16,7 +16,7 @@ const ListLedgerOperationsLedgerOperationCreatedAtSchema = z.object({
16
16
  between: z.string().regex(RegExp('^\\[\\d{10},\\d{10}\\]$')).optional(),
17
17
  });
18
18
  const ListLedgerOperationsLedgerOperationTypeSchema = z.object({
19
- in: z
19
+ is: z
20
20
  .enum([
21
21
  'allocation',
22
22
  'capture',
@@ -29,7 +29,7 @@ const ListLedgerOperationsLedgerOperationTypeSchema = z.object({
29
29
  'adjustment',
30
30
  ])
31
31
  .optional(),
32
- is: z
32
+ in: z
33
33
  .enum([
34
34
  'allocation',
35
35
  'capture',
@@ -4,8 +4,8 @@
4
4
  import { z } from 'zod';
5
5
  //Meter.list
6
6
  const ListMeterNameSchema = z.object({
7
- starts_with: z.string().min(1).optional(),
8
7
  is: z.string().min(1).optional(),
8
+ starts_with: z.string().min(1).optional(),
9
9
  });
10
10
  const ListMeterSortBySchema = z.looseObject({
11
11
  asc: z.enum(['id', 'name', 'created_at', 'updated_at']).optional(),
@@ -31,12 +31,16 @@ const ListOmnichannelSubscriptionIdAtSourceSchema = z.object({
31
31
  not_in: z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
32
32
  });
33
33
  const ListOmnichannelSubscriptionUpdatedAtSchema = z.object({
34
- before: z.string().regex(RegExp('^\\d{10}$')).optional(),
35
34
  after: z.string().regex(RegExp('^\\d{10}$')).optional(),
35
+ on: z.string().regex(RegExp('^\\d{10}$')).optional(),
36
+ before: z.string().regex(RegExp('^\\d{10}$')).optional(),
37
+ between: z.string().regex(RegExp('^\\[\\d{10},\\d{10}\\]$')).optional(),
36
38
  });
37
39
  const ListOmnichannelSubscriptionPurchasedAtSchema = z.object({
38
- before: z.string().regex(RegExp('^\\d{10}$')).optional(),
39
40
  after: z.string().regex(RegExp('^\\d{10}$')).optional(),
41
+ on: z.string().regex(RegExp('^\\d{10}$')).optional(),
42
+ before: z.string().regex(RegExp('^\\d{10}$')).optional(),
43
+ between: z.string().regex(RegExp('^\\[\\d{10},\\d{10}\\]$')).optional(),
40
44
  });
41
45
  const ListOmnichannelSubscriptionSortBySchema = z.looseObject({
42
46
  asc: z.enum(['created_at', 'updated_at']).optional(),
@@ -3,6 +3,7 @@
3
3
  // Do not edit manually – regenerate via sdk-generator
4
4
  import { z } from 'zod';
5
5
  //PaymentIntent.create
6
+ const CreatePaymentIntentPaymentMethodOptionsSchema = z.looseObject({});
6
7
  const CreatePaymentIntentBodySchema = z.looseObject({
7
8
  business_entity_id: z.string().max(50).optional(),
8
9
  customer_id: z.string().max(50).optional(),
@@ -69,9 +70,11 @@ const CreatePaymentIntentBodySchema = z.looseObject({
69
70
  .optional(),
70
71
  success_url: z.string().max(250).optional(),
71
72
  failure_url: z.string().max(250).optional(),
73
+ payment_method_options: CreatePaymentIntentPaymentMethodOptionsSchema.optional(),
72
74
  });
73
75
  export { CreatePaymentIntentBodySchema };
74
76
  //PaymentIntent.update
77
+ const UpdatePaymentIntentPaymentMethodOptionsSchema = z.looseObject({});
75
78
  const UpdatePaymentIntentBodySchema = z.looseObject({
76
79
  amount: z.number().int().min(0).optional(),
77
80
  currency_code: z.string().max(3).optional(),
@@ -134,5 +137,6 @@ const UpdatePaymentIntentBodySchema = z.looseObject({
134
137
  .optional(),
135
138
  success_url: z.string().max(250).optional(),
136
139
  failure_url: z.string().max(250).optional(),
140
+ payment_method_options: UpdatePaymentIntentPaymentMethodOptionsSchema.optional(),
137
141
  });
138
142
  export { UpdatePaymentIntentBodySchema };
@@ -1,5 +1,5 @@
1
1
  // Generated Zod schemas: PaymentSource
2
- // Actions: createUsingTempToken, createUsingPermanentToken, createUsingToken, createUsingPaymentIntent, createVoucherPaymentSource, createCard, createBankAccount, updateCard, updateBankAccount, verifyBankAccount, list, switchGatewayAccount, exportPaymentSource
2
+ // Actions: createUsingTempToken, createUsingPermanentToken, createUsingToken, createUsingPaymentIntent, createVoucherPaymentSource, createCard, createBankAccount, updateCard, updateBankAccount, verifyBankAccount, listGatewayTokensForPaymentSource, list, switchGatewayAccount, exportPaymentSource
3
3
  // Do not edit manually – regenerate via sdk-generator
4
4
  import { z } from 'zod';
5
5
  //PaymentSource.createUsingTempToken
@@ -379,6 +379,13 @@ const VerifyBankAccountPaymentSourceBodySchema = z.looseObject({
379
379
  amount2: z.number().int().min(0),
380
380
  });
381
381
  export { VerifyBankAccountPaymentSourceBodySchema };
382
+ //PaymentSource.listGatewayTokensForPaymentSource
383
+ const ListGatewayTokensForPaymentSourcePaymentSourceBodySchema = z.looseObject({
384
+ limit: z.number().int().min(1).max(100).optional(),
385
+ offset: z.string().max(1000).optional(),
386
+ include_deleted: z.boolean().default(false).optional(),
387
+ });
388
+ export { ListGatewayTokensForPaymentSourcePaymentSourceBodySchema };
382
389
  //PaymentSource.list
383
390
  const ListPaymentSourceCustomerIdSchema = z.object({
384
391
  is: z.string().min(1).optional(),
@@ -5,7 +5,7 @@ import { z } from 'zod';
5
5
  //PricingPageSession.createForNewSubscription
6
6
  const CreateForNewSubscriptionPricingPageSessionCustomSchema = z.looseObject({});
7
7
  const CreateForNewSubscriptionPricingPageSessionPricingPageSchema = z.object({
8
- id: z.string().max(50),
8
+ id: z.string().max(50).optional(),
9
9
  });
10
10
  const CreateForNewSubscriptionPricingPageSessionSubscriptionSchema = z.looseObject({
11
11
  id: z.string().max(50).optional(),
@@ -717,6 +717,7 @@ const CreateSubItemsForCustomerQuoteQuoteSubscriptionItemsSchema = z.object({
717
717
  .optional(),
718
718
  start_date: z.array(z.number().int().optional()).optional(),
719
719
  end_date: z.array(z.number().int().optional()).optional(),
720
+ description: z.array(z.string().max(2000).optional()).optional(),
720
721
  ramp_tier_id: z.array(z.string().max(105).optional()).optional(),
721
722
  });
722
723
  const CreateSubItemsForCustomerQuoteQuoteDiscountsSchema = z.object({
@@ -755,6 +756,19 @@ const CreateSubItemsForCustomerQuoteQuoteCouponsSchema = z.object({
755
756
  start_date: z.array(z.number().int().optional()).optional(),
756
757
  end_date: z.array(z.number().int().optional()).optional(),
757
758
  });
759
+ const CreateSubItemsForCustomerQuoteQuoteEntitlementOverridesSchema = z.object({
760
+ feature_id: z.array(z.string().max(50).optional()).optional(),
761
+ entity_id: z.array(z.string().max(100).optional()).optional(),
762
+ entity_type: z
763
+ .array(z
764
+ .enum(['plan_price', 'addon_price', 'charge_price', 'charge'])
765
+ .optional())
766
+ .optional(),
767
+ value: z.array(z.string().max(50).optional()).optional(),
768
+ is_enabled: z.array(z.boolean().optional()).optional(),
769
+ start_date: z.array(z.number().int().optional()).optional(),
770
+ end_date: z.array(z.number().int().optional()).optional(),
771
+ });
758
772
  const CreateSubItemsForCustomerQuoteQuoteBodySchema = z.looseObject({
759
773
  name: z.string().max(100).optional(),
760
774
  notes: z.string().max(10000).optional(),
@@ -774,6 +788,7 @@ const CreateSubItemsForCustomerQuoteQuoteBodySchema = z.looseObject({
774
788
  discounts: CreateSubItemsForCustomerQuoteQuoteDiscountsSchema.optional(),
775
789
  item_tiers: CreateSubItemsForCustomerQuoteQuoteItemTiersSchema.optional(),
776
790
  coupons: CreateSubItemsForCustomerQuoteQuoteCouponsSchema.optional(),
791
+ entitlement_overrides: CreateSubItemsForCustomerQuoteQuoteEntitlementOverridesSchema.optional(),
777
792
  });
778
793
  export { CreateSubItemsForCustomerQuoteQuoteBodySchema };
779
794
  //Quote.editCreateSubCustomerQuoteForItems
@@ -880,6 +895,7 @@ const EditCreateSubCustomerQuoteForItemsQuoteSubscriptionItemsSchema = z.object(
880
895
  .optional(),
881
896
  start_date: z.array(z.number().int().optional()).optional(),
882
897
  end_date: z.array(z.number().int().optional()).optional(),
898
+ description: z.array(z.string().max(2000).optional()).optional(),
883
899
  ramp_tier_id: z.array(z.string().max(105).optional()).optional(),
884
900
  });
885
901
  const EditCreateSubCustomerQuoteForItemsQuoteDiscountsSchema = z.object({
@@ -918,6 +934,19 @@ const EditCreateSubCustomerQuoteForItemsQuoteCouponsSchema = z.object({
918
934
  start_date: z.array(z.number().int().optional()).optional(),
919
935
  end_date: z.array(z.number().int().optional()).optional(),
920
936
  });
937
+ const EditCreateSubCustomerQuoteForItemsQuoteEntitlementOverridesSchema = z.object({
938
+ feature_id: z.array(z.string().max(50).optional()).optional(),
939
+ entity_id: z.array(z.string().max(100).optional()).optional(),
940
+ entity_type: z
941
+ .array(z
942
+ .enum(['plan_price', 'addon_price', 'charge_price', 'charge'])
943
+ .optional())
944
+ .optional(),
945
+ value: z.array(z.string().max(50).optional()).optional(),
946
+ is_enabled: z.array(z.boolean().optional()).optional(),
947
+ start_date: z.array(z.number().int().optional()).optional(),
948
+ end_date: z.array(z.number().int().optional()).optional(),
949
+ });
921
950
  const EditCreateSubCustomerQuoteForItemsQuoteBodySchema = z.looseObject({
922
951
  notes: z.string().max(10000).optional(),
923
952
  expires_at: z.number().int().optional(),
@@ -936,6 +965,7 @@ const EditCreateSubCustomerQuoteForItemsQuoteBodySchema = z.looseObject({
936
965
  discounts: EditCreateSubCustomerQuoteForItemsQuoteDiscountsSchema.optional(),
937
966
  item_tiers: EditCreateSubCustomerQuoteForItemsQuoteItemTiersSchema.optional(),
938
967
  coupons: EditCreateSubCustomerQuoteForItemsQuoteCouponsSchema.optional(),
968
+ entitlement_overrides: EditCreateSubCustomerQuoteForItemsQuoteEntitlementOverridesSchema.optional(),
939
969
  });
940
970
  export { EditCreateSubCustomerQuoteForItemsQuoteBodySchema };
941
971
  //Quote.updateSubscriptionQuoteForItems
@@ -1046,6 +1076,7 @@ const UpdateSubscriptionQuoteForItemsQuoteSubscriptionItemsSchema = z.object({
1046
1076
  item_type: z.array(z.enum(['plan', 'addon', 'charge']).optional()).optional(),
1047
1077
  start_date: z.array(z.number().int().optional()).optional(),
1048
1078
  end_date: z.array(z.number().int().optional()).optional(),
1079
+ description: z.array(z.string().max(2000).optional()).optional(),
1049
1080
  ramp_tier_id: z.array(z.string().max(105).optional()).optional(),
1050
1081
  });
1051
1082
  const UpdateSubscriptionQuoteForItemsQuoteDiscountsSchema = z.object({
@@ -1086,6 +1117,19 @@ const UpdateSubscriptionQuoteForItemsQuoteCouponsSchema = z.object({
1086
1117
  start_date: z.array(z.number().int().optional()).optional(),
1087
1118
  end_date: z.array(z.number().int().optional()).optional(),
1088
1119
  });
1120
+ const UpdateSubscriptionQuoteForItemsQuoteEntitlementOverridesSchema = z.object({
1121
+ feature_id: z.array(z.string().max(50).optional()).optional(),
1122
+ entity_id: z.array(z.string().max(100).optional()).optional(),
1123
+ entity_type: z
1124
+ .array(z
1125
+ .enum(['plan_price', 'addon_price', 'charge_price', 'charge'])
1126
+ .optional())
1127
+ .optional(),
1128
+ value: z.array(z.string().max(50).optional()).optional(),
1129
+ is_enabled: z.array(z.boolean().optional()).optional(),
1130
+ start_date: z.array(z.number().int().optional()).optional(),
1131
+ end_date: z.array(z.number().int().optional()).optional(),
1132
+ });
1089
1133
  const UpdateSubscriptionQuoteForItemsQuoteBodySchema = z.looseObject({
1090
1134
  name: z.string().max(100).optional(),
1091
1135
  notes: z.string().max(10000).optional(),
@@ -1112,6 +1156,7 @@ const UpdateSubscriptionQuoteForItemsQuoteBodySchema = z.looseObject({
1112
1156
  discounts: UpdateSubscriptionQuoteForItemsQuoteDiscountsSchema.optional(),
1113
1157
  item_tiers: UpdateSubscriptionQuoteForItemsQuoteItemTiersSchema.optional(),
1114
1158
  coupons: UpdateSubscriptionQuoteForItemsQuoteCouponsSchema.optional(),
1159
+ entitlement_overrides: UpdateSubscriptionQuoteForItemsQuoteEntitlementOverridesSchema.optional(),
1115
1160
  });
1116
1161
  export { UpdateSubscriptionQuoteForItemsQuoteBodySchema };
1117
1162
  //Quote.editUpdateSubscriptionQuoteForItems
@@ -1223,6 +1268,7 @@ const EditUpdateSubscriptionQuoteForItemsQuoteSubscriptionItemsSchema = z.object
1223
1268
  .optional(),
1224
1269
  start_date: z.array(z.number().int().optional()).optional(),
1225
1270
  end_date: z.array(z.number().int().optional()).optional(),
1271
+ description: z.array(z.string().max(2000).optional()).optional(),
1226
1272
  ramp_tier_id: z.array(z.string().max(105).optional()).optional(),
1227
1273
  });
1228
1274
  const EditUpdateSubscriptionQuoteForItemsQuoteDiscountsSchema = z.object({
@@ -1263,6 +1309,19 @@ const EditUpdateSubscriptionQuoteForItemsQuoteCouponsSchema = z.object({
1263
1309
  start_date: z.array(z.number().int().optional()).optional(),
1264
1310
  end_date: z.array(z.number().int().optional()).optional(),
1265
1311
  });
1312
+ const EditUpdateSubscriptionQuoteForItemsQuoteEntitlementOverridesSchema = z.object({
1313
+ feature_id: z.array(z.string().max(50).optional()).optional(),
1314
+ entity_id: z.array(z.string().max(100).optional()).optional(),
1315
+ entity_type: z
1316
+ .array(z
1317
+ .enum(['plan_price', 'addon_price', 'charge_price', 'charge'])
1318
+ .optional())
1319
+ .optional(),
1320
+ value: z.array(z.string().max(50).optional()).optional(),
1321
+ is_enabled: z.array(z.boolean().optional()).optional(),
1322
+ start_date: z.array(z.number().int().optional()).optional(),
1323
+ end_date: z.array(z.number().int().optional()).optional(),
1324
+ });
1266
1325
  const EditUpdateSubscriptionQuoteForItemsQuoteBodySchema = z.looseObject({
1267
1326
  notes: z.string().max(10000).optional(),
1268
1327
  expires_at: z.number().int().optional(),
@@ -1288,6 +1347,7 @@ const EditUpdateSubscriptionQuoteForItemsQuoteBodySchema = z.looseObject({
1288
1347
  discounts: EditUpdateSubscriptionQuoteForItemsQuoteDiscountsSchema.optional(),
1289
1348
  item_tiers: EditUpdateSubscriptionQuoteForItemsQuoteItemTiersSchema.optional(),
1290
1349
  coupons: EditUpdateSubscriptionQuoteForItemsQuoteCouponsSchema.optional(),
1350
+ entitlement_overrides: EditUpdateSubscriptionQuoteForItemsQuoteEntitlementOverridesSchema.optional(),
1291
1351
  });
1292
1352
  export { EditUpdateSubscriptionQuoteForItemsQuoteBodySchema };
1293
1353
  //Quote.createForChargeItemsAndCharges
@@ -0,0 +1,22 @@
1
+ // Generated Zod schemas: QuoteEntitlement
2
+ // Actions: listQuoteEntitlements
3
+ // Do not edit manually – regenerate via sdk-generator
4
+ import { z } from 'zod';
5
+ //QuoteEntitlement.listQuoteEntitlements
6
+ const ListQuoteEntitlementsQuoteEntitlementEntityIdSchema = z.object({
7
+ is: z.string().min(1).optional(),
8
+ });
9
+ const ListQuoteEntitlementsQuoteEntitlementStartDateSchema = z.object({
10
+ on: z.string().regex(RegExp('^\\d{10}$')).optional(),
11
+ });
12
+ const ListQuoteEntitlementsQuoteEntitlementEndDateSchema = z.object({
13
+ on: z.string().regex(RegExp('^\\d{10}$')).optional(),
14
+ });
15
+ const ListQuoteEntitlementsQuoteEntitlementBodySchema = z.looseObject({
16
+ limit: z.number().int().min(1).max(100).optional(),
17
+ offset: z.string().max(1000).optional(),
18
+ entity_id: ListQuoteEntitlementsQuoteEntitlementEntityIdSchema.optional(),
19
+ start_date: ListQuoteEntitlementsQuoteEntitlementStartDateSchema.optional(),
20
+ end_date: ListQuoteEntitlementsQuoteEntitlementEndDateSchema.optional(),
21
+ });
22
+ export { ListQuoteEntitlementsQuoteEntitlementBodySchema };
@@ -208,12 +208,12 @@ const UpdateRampBodySchema = z.looseObject({
208
208
  export { UpdateRampBodySchema };
209
209
  //Ramp.list
210
210
  const ListRampStatusSchema = z.object({
211
- in: z.enum(['scheduled', 'succeeded', 'failed', 'draft']).optional(),
212
211
  is: z.enum(['scheduled', 'succeeded', 'failed', 'draft']).optional(),
212
+ in: z.enum(['scheduled', 'succeeded', 'failed', 'draft']).optional(),
213
213
  });
214
214
  const ListRampSubscriptionIdSchema = z.object({
215
- in: z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
216
215
  is: z.string().min(1).optional(),
216
+ in: z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
217
217
  });
218
218
  const ListRampEffectiveFromSchema = z.object({
219
219
  after: z.string().regex(RegExp('^\\d{10}$')).optional(),
@@ -3279,7 +3279,7 @@ const CancelSubscriptionBodySchema = z.looseObject({
3279
3279
  end_of_term: z.boolean().default(false).optional(),
3280
3280
  cancel_at: z.number().int().optional(),
3281
3281
  credit_option_for_current_term_charges: z
3282
- .enum(['none', 'prorate', 'full'])
3282
+ .enum(['none', 'prorate', 'full', 'consumption_based'])
3283
3283
  .optional(),
3284
3284
  unbilled_charges_option: z.enum(['invoice', 'delete']).optional(),
3285
3285
  account_receivables_handling: z
@@ -3324,7 +3324,7 @@ const CancelForItemsSubscriptionBodySchema = z.looseObject({
3324
3324
  end_of_term: z.boolean().default(false).optional(),
3325
3325
  cancel_at: z.number().int().optional(),
3326
3326
  credit_option_for_current_term_charges: z
3327
- .enum(['none', 'prorate', 'full'])
3327
+ .enum(['none', 'prorate', 'full', 'consumption_based'])
3328
3328
  .optional(),
3329
3329
  unbilled_charges_option: z.enum(['invoice', 'delete']).optional(),
3330
3330
  account_receivables_handling: z
@@ -241,10 +241,14 @@ const CreateWebhookEndpointBodySchema = z.looseObject({
241
241
  'alert_status_changed',
242
242
  'omnichannel_subscription_item_updated',
243
243
  'omnichannel_subscription_item_recovered',
244
+ 'omnichannel_subscription_item_mrr_updated',
244
245
  'ledger_account_balance_updated',
245
246
  'grant_blocks_created',
246
247
  'grant_blocks_updated',
247
248
  'ledger_updated',
249
+ 'vault_token_created',
250
+ 'vault_token_updated',
251
+ 'vault_token_deleted',
248
252
  'plan_created',
249
253
  'plan_updated',
250
254
  'plan_deleted',
@@ -492,10 +496,14 @@ const UpdateWebhookEndpointBodySchema = z.looseObject({
492
496
  'alert_status_changed',
493
497
  'omnichannel_subscription_item_updated',
494
498
  'omnichannel_subscription_item_recovered',
499
+ 'omnichannel_subscription_item_mrr_updated',
495
500
  'ledger_account_balance_updated',
496
501
  'grant_blocks_created',
497
502
  'grant_blocks_updated',
498
503
  'ledger_updated',
504
+ 'vault_token_created',
505
+ 'vault_token_updated',
506
+ 'vault_token_deleted',
499
507
  'plan_created',
500
508
  'plan_updated',
501
509
  'plan_deleted',
package/esm/util.js CHANGED
@@ -106,9 +106,11 @@ export function getApiURL(env, urlPrefix, urlSuffix, urlIdParam) {
106
106
  : '') +
107
107
  (urlSuffix !== null ? urlSuffix : ''));
108
108
  }
109
+ // Filter operators whose value is the whole array, sent as a single field
110
+ // (e.g. updated_at[between]=[1704067200,1717199999]).
111
+ const arrayOperators = ['in', 'not_in', 'between'];
109
112
  export function serialize(paramObj) {
110
113
  let key, value;
111
- let array_ops = ['in', 'not_in', 'between'];
112
114
  for (key in paramObj) {
113
115
  value = paramObj[key];
114
116
  if (typeof value === 'object' && isObject(value)) {
@@ -117,7 +119,7 @@ export function serialize(paramObj) {
117
119
  for (child_key in value) {
118
120
  key = key + '[' + child_key + ']';
119
121
  paramObj[key] = value[child_key];
120
- if (array_ops.includes(child_key)) {
122
+ if (arrayOperators.includes(child_key)) {
121
123
  paramObj[key] = JSON.stringify(value[child_key]);
122
124
  }
123
125
  }
@@ -172,6 +174,14 @@ export function encodeParams(paramObj, serialized, scope, index, jsonKeys, level
172
174
  }
173
175
  serialized.push(encodeURIComponent(key) + '=' + attrVal);
174
176
  }
177
+ else if (isArray(value) && arrayOperators.includes(originalKey)) {
178
+ // An empty filter is not a filter, so leave it out of the request.
179
+ if (value.length > 0) {
180
+ serialized.push(encodeURIComponent(key) +
181
+ '=' +
182
+ encodeURIComponent(JSON.stringify(value)));
183
+ }
184
+ }
175
185
  else if (isArray(value) &&
176
186
  !(jsonKeys && jsonKeys[originalKey] === level)) {
177
187
  for (let arrIdx = 0; arrIdx < value.length; arrIdx++) {
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "chargebee",
3
- "version": "3.30.0",
3
+ "version": "3.31.0",
4
4
  "description": "A library for integrating with Chargebee.",
5
5
  "scripts": {
6
- "prepack": "npm install && npm run build",
6
+ "prepack": "npm ci && npm run build",
7
7
  "test": "TS_NODE_PROJECT=./tsconfig.test.json mocha -r ts-node/register 'test/**/*.test.ts'",
8
8
  "build": "npm run build-esm && npm run build-cjs",
9
9
  "build-esm": "rm -rf esm && mkdir -p esm && tsc -p tsconfig.esm.json && echo '{\"type\":\"module\"}' > esm/package.json",
package/types/core.d.ts CHANGED
@@ -67,7 +67,11 @@ declare module 'chargebee' {
67
67
  | 'end_of_contract_term'
68
68
  | 'specific_date'
69
69
  | 'end_of_subscription_billing_term';
70
- type CreditOptionForCurrentTermChargesEnum = 'none' | 'prorate' | 'full';
70
+ type CreditOptionForCurrentTermChargesEnum =
71
+ | 'none'
72
+ | 'prorate'
73
+ | 'full'
74
+ | 'consumption_based';
71
75
  type CreditTypeEnum = 'loyalty_credits' | 'referral_rewards' | 'general';
72
76
  type CustomerTypeEnum =
73
77
  | 'residential'
@@ -128,7 +132,6 @@ declare module 'chargebee' {
128
132
  | 'plan_price'
129
133
  | 'addon_price'
130
134
  | 'charge_price'
131
- | 'charge'
132
135
  | 'invoice'
133
136
  | 'quote'
134
137
  | 'credit_note'
@@ -160,7 +163,8 @@ declare module 'chargebee' {
160
163
  | 'usage_file'
161
164
  | 'business_rule'
162
165
  | 'ruleset'
163
- | 'alert_status';
166
+ | 'alert_status'
167
+ | 'omnichannel_subscription_item_metric';
164
168
  type EventNameEnum = 'cancellation_page_loaded';
165
169
  type EventTypeEnum =
166
170
  | 'coupon_created'
@@ -377,10 +381,14 @@ declare module 'chargebee' {
377
381
  | 'alert_status_changed'
378
382
  | 'omnichannel_subscription_item_updated'
379
383
  | 'omnichannel_subscription_item_recovered'
384
+ | 'omnichannel_subscription_item_mrr_updated'
380
385
  | 'ledger_account_balance_updated'
381
386
  | 'grant_blocks_created'
382
387
  | 'grant_blocks_updated'
383
388
  | 'ledger_updated'
389
+ | 'vault_token_created'
390
+ | 'vault_token_updated'
391
+ | 'vault_token_deleted'
384
392
  | 'plan_created'
385
393
  | 'plan_updated'
386
394
  | 'plan_deleted'
@@ -453,10 +461,73 @@ declare module 'chargebee' {
453
461
  | 'payway'
454
462
  | 'gocardless'
455
463
  | 'not_applicable';
464
+ type GatewayNameEnum =
465
+ | 'chargebee'
466
+ | 'chargebee_payments'
467
+ | 'adyen'
468
+ | 'stripe'
469
+ | 'wepay'
470
+ | 'braintree'
471
+ | 'authorize_net'
472
+ | 'paypal_pro'
473
+ | 'pin'
474
+ | 'eway'
475
+ | 'eway_rapid'
476
+ | 'worldpay'
477
+ | 'balanced_payments'
478
+ | 'beanstream'
479
+ | 'bluepay'
480
+ | 'elavon'
481
+ | 'first_data_global'
482
+ | 'hdfc'
483
+ | 'migs'
484
+ | 'nmi'
485
+ | 'ogone'
486
+ | 'paymill'
487
+ | 'paypal_payflow_pro'
488
+ | 'sage_pay'
489
+ | 'tco'
490
+ | 'wirecard'
491
+ | 'amazon_payments'
492
+ | 'paypal_express_checkout'
493
+ | 'gocardless'
494
+ | 'orbital'
495
+ | 'moneris_us'
496
+ | 'moneris'
497
+ | 'bluesnap'
498
+ | 'cybersource'
499
+ | 'vantiv'
500
+ | 'checkout_com'
501
+ | 'paypal'
502
+ | 'ingenico_direct'
503
+ | 'exact'
504
+ | 'mollie'
505
+ | 'quickbooks'
506
+ | 'razorpay'
507
+ | 'global_payments'
508
+ | 'bank_of_america'
509
+ | 'ecentric'
510
+ | 'metrics_global'
511
+ | 'windcave'
512
+ | 'pay_com'
513
+ | 'ebanx'
514
+ | 'dlocal'
515
+ | 'nuvei'
516
+ | 'solidgate'
517
+ | 'paystack'
518
+ | 'jp_morgan'
519
+ | 'deutsche_bank'
520
+ | 'ezidebit'
521
+ | 'twikey'
522
+ | 'tempus'
523
+ | 'moyasar'
524
+ | 'payway'
525
+ | 'not_applicable';
456
526
  type HierarchyOperationTypeEnum =
457
527
  | 'complete_hierarchy'
458
528
  | 'subordinates'
459
529
  | 'path_to_root';
530
+ type InvoiceActionEnum = 'void' | 'write_off';
460
531
  type InvoiceDunningHandlingEnum = 'continue' | 'stop';
461
532
  type ItemTypeEnum = 'plan' | 'addon' | 'charge';
462
533
  type LayoutEnum = 'in_app' | 'full_page';
@@ -992,10 +1063,14 @@ declare module 'chargebee' {
992
1063
  | 'alert_status_changed'
993
1064
  | 'omnichannel_subscription_item_updated'
994
1065
  | 'omnichannel_subscription_item_recovered'
1066
+ | 'omnichannel_subscription_item_mrr_updated'
995
1067
  | 'ledger_account_balance_updated'
996
1068
  | 'grant_blocks_created'
997
1069
  | 'grant_blocks_updated'
998
1070
  | 'ledger_updated'
1071
+ | 'vault_token_created'
1072
+ | 'vault_token_updated'
1073
+ | 'vault_token_deleted'
999
1074
  | 'plan_created'
1000
1075
  | 'plan_updated'
1001
1076
  | 'plan_deleted'