chargebee 3.34.0 → 3.36.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 (198) hide show
  1. package/CHANGELOG.md +237 -0
  2. package/cjs/environment.js +1 -1
  3. package/cjs/resources/api_endpoints.js +230 -2
  4. package/cjs/resources/webhook/eventType.js +25 -1
  5. package/cjs/schema/addon.schema.js +221 -40
  6. package/cjs/schema/alert.schema.js +17 -2
  7. package/cjs/schema/alert_status.schema.js +6 -1
  8. package/cjs/schema/attached_item.schema.js +101 -26
  9. package/cjs/schema/business_entity.schema.js +43 -6
  10. package/cjs/schema/business_rule.schema.js +2 -2
  11. package/cjs/schema/business_ruleset.schema.js +2 -2
  12. package/cjs/schema/collections_payment_promise.schema.js +43 -0
  13. package/cjs/schema/comment.schema.js +17 -4
  14. package/cjs/schema/coupon.schema.js +218 -37
  15. package/cjs/schema/coupon_code.schema.js +36 -6
  16. package/cjs/schema/coupon_set.schema.js +108 -27
  17. package/cjs/schema/credit_note.schema.js +497 -105
  18. package/cjs/schema/credit_unit.schema.js +12 -2
  19. package/cjs/schema/customer.schema.js +212 -62
  20. package/cjs/schema/differential_price.schema.js +100 -12
  21. package/cjs/schema/dispute.schema.js +125 -33
  22. package/cjs/schema/einvoice.schema.js +27 -6
  23. package/cjs/schema/email_log.schema.js +15 -4
  24. package/cjs/schema/entitlement.schema.js +35 -6
  25. package/cjs/schema/entitlement_override.schema.js +17 -1
  26. package/cjs/schema/estimate.schema.js +585 -40
  27. package/cjs/schema/event.schema.js +1334 -585
  28. package/cjs/schema/export.schema.js +4459 -1412
  29. package/cjs/schema/feature.schema.js +73 -11
  30. package/cjs/schema/gateway_request_log.schema.js +309 -0
  31. package/cjs/schema/gateway_webhook_log.schema.js +257 -0
  32. package/cjs/schema/gift.schema.js +51 -5
  33. package/cjs/schema/grant_block.schema.js +45 -12
  34. package/cjs/schema/hosted_page.schema.js +564 -68
  35. package/cjs/schema/index.js +6 -0
  36. package/cjs/schema/invoice.schema.js +843 -123
  37. package/cjs/schema/item.schema.js +151 -28
  38. package/cjs/schema/item_entitlement.schema.js +23 -2
  39. package/cjs/schema/item_family.schema.js +29 -8
  40. package/cjs/schema/item_price.schema.js +263 -48
  41. package/cjs/schema/ledger_account_balance.schema.js +11 -2
  42. package/cjs/schema/ledger_operation.schema.js +44 -17
  43. package/cjs/schema/metered_feature.schema.js +10 -1
  44. package/cjs/schema/omnichannel_one_time_order.schema.js +42 -4
  45. package/cjs/schema/omnichannel_subscription.schema.js +146 -32
  46. package/cjs/schema/order.schema.js +233 -61
  47. package/cjs/schema/organization_detail.schema.js +36 -0
  48. package/cjs/schema/payment_schedule.schema.js +39 -8
  49. package/cjs/schema/payment_schedule_scheme.schema.js +37 -7
  50. package/cjs/schema/payment_source.schema.js +375 -148
  51. package/cjs/schema/payment_voucher.schema.js +33 -5
  52. package/cjs/schema/plan.schema.js +345 -57
  53. package/cjs/schema/price_ramp.schema.js +153 -0
  54. package/cjs/schema/price_variant.schema.js +88 -18
  55. package/cjs/schema/pricing_page_session.schema.js +36 -2
  56. package/cjs/schema/promotional_credit.schema.js +27 -6
  57. package/cjs/schema/purchase.schema.js +210 -12
  58. package/cjs/schema/quote.schema.js +907 -87
  59. package/cjs/schema/quote_entitlement.schema.js +6 -2
  60. package/cjs/schema/ramp.schema.js +242 -24
  61. package/cjs/schema/retry_segment.schema.js +12 -0
  62. package/cjs/schema/site_migration_detail.schema.js +50 -16
  63. package/cjs/schema/subscription.schema.js +1002 -173
  64. package/cjs/schema/subscription_entitlement.schema.js +9 -1
  65. package/cjs/schema/transaction.schema.js +780 -342
  66. package/cjs/schema/unbilled_charge.schema.js +141 -13
  67. package/cjs/schema/usage.schema.js +59 -11
  68. package/cjs/schema/usage_event.schema.js +13 -1
  69. package/cjs/schema/usage_summary.schema.js +1 -0
  70. package/cjs/schema/virtual_bank_account.schema.js +42 -10
  71. package/cjs/schema/webhook_endpoint.schema.js +50 -2
  72. package/esm/environment.js +1 -1
  73. package/esm/resources/api_endpoints.js +230 -2
  74. package/esm/resources/webhook/eventType.js +25 -1
  75. package/esm/schema/addon.schema.js +221 -40
  76. package/esm/schema/alert.schema.js +17 -2
  77. package/esm/schema/alert_status.schema.js +6 -1
  78. package/esm/schema/attached_item.schema.js +101 -26
  79. package/esm/schema/business_entity.schema.js +42 -5
  80. package/esm/schema/business_rule.schema.js +2 -2
  81. package/esm/schema/business_ruleset.schema.js +2 -2
  82. package/esm/schema/collections_payment_promise.schema.js +40 -0
  83. package/esm/schema/comment.schema.js +17 -4
  84. package/esm/schema/coupon.schema.js +218 -37
  85. package/esm/schema/coupon_code.schema.js +36 -6
  86. package/esm/schema/coupon_set.schema.js +108 -27
  87. package/esm/schema/credit_note.schema.js +497 -105
  88. package/esm/schema/credit_unit.schema.js +12 -2
  89. package/esm/schema/customer.schema.js +212 -62
  90. package/esm/schema/differential_price.schema.js +100 -12
  91. package/esm/schema/dispute.schema.js +125 -33
  92. package/esm/schema/einvoice.schema.js +27 -6
  93. package/esm/schema/email_log.schema.js +15 -4
  94. package/esm/schema/entitlement.schema.js +35 -6
  95. package/esm/schema/entitlement_override.schema.js +17 -1
  96. package/esm/schema/estimate.schema.js +585 -40
  97. package/esm/schema/event.schema.js +1334 -585
  98. package/esm/schema/export.schema.js +4459 -1412
  99. package/esm/schema/feature.schema.js +73 -11
  100. package/esm/schema/gateway_request_log.schema.js +306 -0
  101. package/esm/schema/gateway_webhook_log.schema.js +254 -0
  102. package/esm/schema/gift.schema.js +51 -5
  103. package/esm/schema/grant_block.schema.js +45 -12
  104. package/esm/schema/hosted_page.schema.js +564 -68
  105. package/esm/schema/index.js +6 -0
  106. package/esm/schema/invoice.schema.js +842 -122
  107. package/esm/schema/item.schema.js +151 -28
  108. package/esm/schema/item_entitlement.schema.js +23 -2
  109. package/esm/schema/item_family.schema.js +29 -8
  110. package/esm/schema/item_price.schema.js +263 -48
  111. package/esm/schema/ledger_account_balance.schema.js +10 -1
  112. package/esm/schema/ledger_operation.schema.js +44 -17
  113. package/esm/schema/metered_feature.schema.js +10 -1
  114. package/esm/schema/omnichannel_one_time_order.schema.js +42 -4
  115. package/esm/schema/omnichannel_subscription.schema.js +146 -32
  116. package/esm/schema/order.schema.js +233 -61
  117. package/esm/schema/organization_detail.schema.js +33 -0
  118. package/esm/schema/payment_schedule.schema.js +39 -8
  119. package/esm/schema/payment_schedule_scheme.schema.js +37 -7
  120. package/esm/schema/payment_source.schema.js +375 -148
  121. package/esm/schema/payment_voucher.schema.js +33 -5
  122. package/esm/schema/plan.schema.js +345 -57
  123. package/esm/schema/price_ramp.schema.js +150 -0
  124. package/esm/schema/price_variant.schema.js +88 -18
  125. package/esm/schema/pricing_page_session.schema.js +36 -2
  126. package/esm/schema/promotional_credit.schema.js +27 -6
  127. package/esm/schema/purchase.schema.js +210 -12
  128. package/esm/schema/quote.schema.js +907 -87
  129. package/esm/schema/quote_entitlement.schema.js +6 -2
  130. package/esm/schema/ramp.schema.js +242 -24
  131. package/esm/schema/retry_segment.schema.js +9 -0
  132. package/esm/schema/site_migration_detail.schema.js +50 -16
  133. package/esm/schema/subscription.schema.js +1002 -173
  134. package/esm/schema/subscription_entitlement.schema.js +9 -1
  135. package/esm/schema/transaction.schema.js +780 -342
  136. package/esm/schema/unbilled_charge.schema.js +141 -13
  137. package/esm/schema/usage.schema.js +59 -11
  138. package/esm/schema/usage_event.schema.js +13 -1
  139. package/esm/schema/usage_summary.schema.js +1 -0
  140. package/esm/schema/virtual_bank_account.schema.js +42 -10
  141. package/esm/schema/webhook_endpoint.schema.js +50 -2
  142. package/package.json +1 -1
  143. package/types/core.d.ts +63 -74
  144. package/types/index.d.ts +29 -1
  145. package/types/resources/BillingLineItem.d.ts +10 -0
  146. package/types/resources/BillingMetadata.d.ts +9 -0
  147. package/types/resources/BusinessEntity.d.ts +52 -0
  148. package/types/resources/Citation.d.ts +13 -0
  149. package/types/resources/CollectionsDispute.d.ts +24 -0
  150. package/types/resources/CollectionsPaymentPromise.d.ts +93 -0
  151. package/types/resources/CollectionsReminderSequence.d.ts +35 -0
  152. package/types/resources/Comment.d.ts +2 -1
  153. package/types/resources/Content.d.ts +23 -1
  154. package/types/resources/CreditNote.d.ts +1 -0
  155. package/types/resources/CustomData.d.ts +14 -0
  156. package/types/resources/Discount.d.ts +1 -0
  157. package/types/resources/DraftEstimate.d.ts +13 -0
  158. package/types/resources/DraftRequest.d.ts +45 -0
  159. package/types/resources/EmailAttachment.d.ts +16 -0
  160. package/types/resources/EmailConversation.d.ts +18 -0
  161. package/types/resources/EmailLog.d.ts +1 -0
  162. package/types/resources/EmailMessage.d.ts +40 -0
  163. package/types/resources/Estimate.d.ts +3 -0
  164. package/types/resources/Event.d.ts +25 -1
  165. package/types/resources/Execution.d.ts +12 -0
  166. package/types/resources/GatewayPaymentMethodToken.d.ts +2 -2
  167. package/types/resources/GatewayRequestLog.d.ts +82 -0
  168. package/types/resources/GatewayWebhookLog.d.ts +74 -0
  169. package/types/resources/GrantBlock.d.ts +5 -0
  170. package/types/resources/GroupByAttribute.d.ts +15 -0
  171. package/types/resources/GroupByRecommendation.d.ts +10 -0
  172. package/types/resources/HostedPage.d.ts +18 -0
  173. package/types/resources/Invoice.d.ts +19 -0
  174. package/types/resources/ItemPrice.d.ts +1 -0
  175. package/types/resources/LedgerAccountBalance.d.ts +19 -0
  176. package/types/resources/Meter.d.ts +1 -0
  177. package/types/resources/MeteredFeature.d.ts +1 -0
  178. package/types/resources/OmnichannelOneTimeOrder.d.ts +5 -1
  179. package/types/resources/OmnichannelSubscription.d.ts +6 -1
  180. package/types/resources/OmnichannelSubscriptionItem.d.ts +4 -1
  181. package/types/resources/OrganizationDetail.d.ts +84 -0
  182. package/types/resources/PaymentSchedule.d.ts +1 -1
  183. package/types/resources/PaymentScheduleEstimate.d.ts +1 -1
  184. package/types/resources/PaymentSource.d.ts +19 -0
  185. package/types/resources/PreferenceVariant.d.ts +10 -0
  186. package/types/resources/PriceRamp.d.ts +113 -0
  187. package/types/resources/PrivateNote.d.ts +18 -0
  188. package/types/resources/Purchase.d.ts +6 -0
  189. package/types/resources/Ramp.d.ts +6 -0
  190. package/types/resources/RampInterval.d.ts +12 -0
  191. package/types/resources/RecordedPurchase.d.ts +5 -1
  192. package/types/resources/RetrySegment.d.ts +36 -0
  193. package/types/resources/Subscription.d.ts +3 -0
  194. package/types/resources/Transaction.d.ts +4 -0
  195. package/types/resources/Usage.d.ts +7 -0
  196. package/types/resources/UsageSummary.d.ts +2 -0
  197. package/types/resources/WebhookEvent.d.ts +159 -5
  198. package/types/resources/AppliedBusinessRule.d.ts +0 -15
@@ -427,17 +427,37 @@ const CreateSubscriptionContractTermSchema = z.object({
427
427
  action_at_term_end: z.enum(['renew', 'evergreen', 'cancel']).optional(),
428
428
  cancellation_cutoff_period: z.number().int().optional(),
429
429
  });
430
+ const CreateSubscriptionEntityIdentifiersItemSchema = z.object({
431
+ id: z.string().max(40).optional(),
432
+ scheme: z.string().max(50).optional(),
433
+ value: z.string().max(50).optional(),
434
+ standard: z.string().max(50).optional(),
435
+ });
430
436
  const CreateSubscriptionEntityIdentifiersSchema = z.object({
431
437
  id: z.array(z.string().max(40).optional()).optional(),
432
438
  scheme: z.array(z.string().max(50).optional()).optional(),
433
439
  value: z.array(z.string().max(50).optional()).optional(),
434
440
  standard: z.array(z.string().max(50).optional()).optional(),
435
441
  });
442
+ const CreateSubscriptionTaxProvidersFieldsItemSchema = z.object({
443
+ provider_name: z.string().max(50).optional(),
444
+ field_id: z.string().max(50).optional(),
445
+ field_value: z.string().max(50).optional(),
446
+ });
436
447
  const CreateSubscriptionTaxProvidersFieldsSchema = z.object({
437
448
  provider_name: z.array(z.string().max(50).optional()).optional(),
438
449
  field_id: z.array(z.string().max(50).optional()).optional(),
439
450
  field_value: z.array(z.string().max(50).optional()).optional(),
440
451
  });
452
+ const CreateSubscriptionAddonsItemSchema = z.object({
453
+ id: z.string().max(100).optional(),
454
+ quantity: z.number().int().min(1).optional(),
455
+ quantity_in_decimal: z.string().max(33).optional(),
456
+ unit_price: z.number().int().min(0).optional(),
457
+ unit_price_in_decimal: z.string().max(39).optional(),
458
+ billing_cycles: z.number().int().min(0).optional(),
459
+ trial_end: z.number().int().optional(),
460
+ });
441
461
  const CreateSubscriptionAddonsSchema = z.object({
442
462
  id: z.array(z.string().max(100).optional()).optional(),
443
463
  quantity: z.array(z.number().int().min(1).optional()).optional(),
@@ -447,6 +467,25 @@ const CreateSubscriptionAddonsSchema = z.object({
447
467
  billing_cycles: z.array(z.number().int().min(0).optional()).optional(),
448
468
  trial_end: z.array(z.number().int().optional()).optional(),
449
469
  });
470
+ const CreateSubscriptionEventBasedAddonsItemSchema = z.object({
471
+ id: z.string().max(100).optional(),
472
+ quantity: z.number().int().min(1).optional(),
473
+ unit_price: z.number().int().min(0).optional(),
474
+ quantity_in_decimal: z.string().max(33).optional(),
475
+ unit_price_in_decimal: z.string().max(39).optional(),
476
+ service_period_in_days: z.number().int().min(1).max(4000).optional(),
477
+ on_event: z
478
+ .enum([
479
+ 'subscription_creation',
480
+ 'subscription_trial_start',
481
+ 'plan_activation',
482
+ 'subscription_activation',
483
+ 'contract_termination',
484
+ ])
485
+ .optional(),
486
+ charge_once: z.boolean().default(true).optional(),
487
+ charge_on: z.enum(['immediately', 'on_event']).optional(),
488
+ });
450
489
  const CreateSubscriptionEventBasedAddonsSchema = z.object({
451
490
  id: z.array(z.string().max(100).optional()).optional(),
452
491
  quantity: z.array(z.number().int().min(1).optional()).optional(),
@@ -470,6 +509,10 @@ const CreateSubscriptionEventBasedAddonsSchema = z.object({
470
509
  charge_once: z.array(z.boolean().default(true).optional()).optional(),
471
510
  charge_on: z.array(z.enum(['immediately', 'on_event']).optional()).optional(),
472
511
  });
512
+ const CreateSubscriptionCouponsItemSchema = z.object({
513
+ coupon_id: z.string().max(100).optional(),
514
+ apply_till: z.number().int().optional(),
515
+ });
473
516
  const CreateSubscriptionCouponsSchema = z.object({
474
517
  coupon_id: z.array(z.string().max(100).optional()).optional(),
475
518
  apply_till: z.array(z.number().int().optional()).optional(),
@@ -546,11 +589,36 @@ const CreateSubscriptionBodySchema = z.looseObject({
546
589
  shipping_address: CreateSubscriptionShippingAddressSchema.optional(),
547
590
  statement_descriptor: CreateSubscriptionStatementDescriptorSchema.optional(),
548
591
  contract_term: CreateSubscriptionContractTermSchema.optional(),
549
- entity_identifiers: CreateSubscriptionEntityIdentifiersSchema.optional(),
550
- tax_providers_fields: CreateSubscriptionTaxProvidersFieldsSchema.optional(),
551
- addons: CreateSubscriptionAddonsSchema.optional(),
552
- event_based_addons: CreateSubscriptionEventBasedAddonsSchema.optional(),
553
- coupons: CreateSubscriptionCouponsSchema.optional(),
592
+ entity_identifiers: z
593
+ .union([
594
+ z.array(CreateSubscriptionEntityIdentifiersItemSchema.optional()),
595
+ CreateSubscriptionEntityIdentifiersSchema,
596
+ ])
597
+ .optional(),
598
+ tax_providers_fields: z
599
+ .union([
600
+ z.array(CreateSubscriptionTaxProvidersFieldsItemSchema.optional()),
601
+ CreateSubscriptionTaxProvidersFieldsSchema,
602
+ ])
603
+ .optional(),
604
+ addons: z
605
+ .union([
606
+ z.array(CreateSubscriptionAddonsItemSchema.optional()),
607
+ CreateSubscriptionAddonsSchema,
608
+ ])
609
+ .optional(),
610
+ event_based_addons: z
611
+ .union([
612
+ z.array(CreateSubscriptionEventBasedAddonsItemSchema.optional()),
613
+ CreateSubscriptionEventBasedAddonsSchema,
614
+ ])
615
+ .optional(),
616
+ coupons: z
617
+ .union([
618
+ z.array(CreateSubscriptionCouponsItemSchema.optional()),
619
+ CreateSubscriptionCouponsSchema,
620
+ ])
621
+ .optional(),
554
622
  });
555
623
  export { CreateSubscriptionBodySchema };
556
624
  //Subscription.createForCustomer
@@ -658,6 +726,15 @@ const CreateForCustomerSubscriptionContractTermSchema = z.object({
658
726
  action_at_term_end: z.enum(['renew', 'evergreen', 'cancel']).optional(),
659
727
  cancellation_cutoff_period: z.number().int().optional(),
660
728
  });
729
+ const CreateForCustomerSubscriptionAddonsItemSchema = z.object({
730
+ id: z.string().max(100).optional(),
731
+ quantity: z.number().int().min(1).optional(),
732
+ quantity_in_decimal: z.string().max(33).optional(),
733
+ unit_price: z.number().int().min(0).optional(),
734
+ unit_price_in_decimal: z.string().max(39).optional(),
735
+ billing_cycles: z.number().int().min(0).optional(),
736
+ trial_end: z.number().int().optional(),
737
+ });
661
738
  const CreateForCustomerSubscriptionAddonsSchema = z.object({
662
739
  id: z.array(z.string().max(100).optional()).optional(),
663
740
  quantity: z.array(z.number().int().min(1).optional()).optional(),
@@ -667,6 +744,25 @@ const CreateForCustomerSubscriptionAddonsSchema = z.object({
667
744
  billing_cycles: z.array(z.number().int().min(0).optional()).optional(),
668
745
  trial_end: z.array(z.number().int().optional()).optional(),
669
746
  });
747
+ const CreateForCustomerSubscriptionEventBasedAddonsItemSchema = z.object({
748
+ id: z.string().max(100).optional(),
749
+ quantity: z.number().int().min(1).optional(),
750
+ unit_price: z.number().int().min(0).optional(),
751
+ quantity_in_decimal: z.string().max(33).optional(),
752
+ unit_price_in_decimal: z.string().max(39).optional(),
753
+ service_period_in_days: z.number().int().min(1).max(4000).optional(),
754
+ on_event: z
755
+ .enum([
756
+ 'subscription_creation',
757
+ 'subscription_trial_start',
758
+ 'plan_activation',
759
+ 'subscription_activation',
760
+ 'contract_termination',
761
+ ])
762
+ .optional(),
763
+ charge_once: z.boolean().default(true).optional(),
764
+ charge_on: z.enum(['immediately', 'on_event']).optional(),
765
+ });
670
766
  const CreateForCustomerSubscriptionEventBasedAddonsSchema = z.object({
671
767
  id: z.array(z.string().max(100).optional()).optional(),
672
768
  quantity: z.array(z.number().int().min(1).optional()).optional(),
@@ -690,6 +786,10 @@ const CreateForCustomerSubscriptionEventBasedAddonsSchema = z.object({
690
786
  charge_once: z.array(z.boolean().default(true).optional()).optional(),
691
787
  charge_on: z.array(z.enum(['immediately', 'on_event']).optional()).optional(),
692
788
  });
789
+ const CreateForCustomerSubscriptionCouponsItemSchema = z.object({
790
+ coupon_id: z.string().max(100).optional(),
791
+ apply_till: z.number().int().optional(),
792
+ });
693
793
  const CreateForCustomerSubscriptionCouponsSchema = z.object({
694
794
  coupon_id: z.array(z.string().max(100).optional()).optional(),
695
795
  apply_till: z.array(z.number().int().optional()).optional(),
@@ -760,9 +860,24 @@ const CreateForCustomerSubscriptionBodySchema = z.looseObject({
760
860
  statement_descriptor: CreateForCustomerSubscriptionStatementDescriptorSchema.optional(),
761
861
  payment_intent: CreateForCustomerSubscriptionPaymentIntentSchema.optional(),
762
862
  contract_term: CreateForCustomerSubscriptionContractTermSchema.optional(),
763
- addons: CreateForCustomerSubscriptionAddonsSchema.optional(),
764
- event_based_addons: CreateForCustomerSubscriptionEventBasedAddonsSchema.optional(),
765
- coupons: CreateForCustomerSubscriptionCouponsSchema.optional(),
863
+ addons: z
864
+ .union([
865
+ z.array(CreateForCustomerSubscriptionAddonsItemSchema.optional()),
866
+ CreateForCustomerSubscriptionAddonsSchema,
867
+ ])
868
+ .optional(),
869
+ event_based_addons: z
870
+ .union([
871
+ z.array(CreateForCustomerSubscriptionEventBasedAddonsItemSchema.optional()),
872
+ CreateForCustomerSubscriptionEventBasedAddonsSchema,
873
+ ])
874
+ .optional(),
875
+ coupons: z
876
+ .union([
877
+ z.array(CreateForCustomerSubscriptionCouponsItemSchema.optional()),
878
+ CreateForCustomerSubscriptionCouponsSchema,
879
+ ])
880
+ .optional(),
766
881
  });
767
882
  export { CreateForCustomerSubscriptionBodySchema };
768
883
  //Subscription.createWithItems
@@ -875,6 +990,32 @@ const CreateWithItemsSubscriptionBillingOverrideSchema = z.object({
875
990
  max_excess_payment_usage: z.number().int().min(-1).optional(),
876
991
  max_refundable_credits_usage: z.number().int().min(-1).optional(),
877
992
  });
993
+ const CreateWithItemsSubscriptionSubscriptionItemsItemSchema = z.object({
994
+ item_price_id: z.string().max(100),
995
+ quantity: z.number().int().min(1).optional(),
996
+ quantity_in_decimal: z.string().max(33).optional(),
997
+ unit_price: z.number().int().min(0).optional(),
998
+ unit_price_in_decimal: z.string().max(39).optional(),
999
+ billing_cycles: z.number().int().min(0).optional(),
1000
+ trial_end: z.number().int().optional(),
1001
+ service_period_days: z.number().int().min(1).max(4000).optional(),
1002
+ charge_on_event: z
1003
+ .enum([
1004
+ 'subscription_creation',
1005
+ 'subscription_trial_start',
1006
+ 'plan_activation',
1007
+ 'subscription_activation',
1008
+ 'contract_termination',
1009
+ ])
1010
+ .optional(),
1011
+ charge_once: z.boolean().optional(),
1012
+ item_type: z.enum(['plan', 'addon', 'charge']).optional(),
1013
+ description: z.string().max(2000).optional(),
1014
+ charge_on_option: z.enum(['immediately', 'on_event']).optional(),
1015
+ usage_accumulation_reset_frequency: z
1016
+ .enum(['never', 'subscription_billing_frequency'])
1017
+ .optional(),
1018
+ });
878
1019
  const CreateWithItemsSubscriptionSubscriptionItemsSchema = z.object({
879
1020
  item_price_id: z.array(z.string().max(100).optional()),
880
1021
  quantity: z.array(z.number().int().min(1).optional()).optional(),
@@ -884,7 +1025,7 @@ const CreateWithItemsSubscriptionSubscriptionItemsSchema = z.object({
884
1025
  billing_cycles: z.array(z.number().int().min(0).optional()).optional(),
885
1026
  trial_end: z.array(z.number().int().optional()).optional(),
886
1027
  service_period_days: z
887
- .array(z.number().int().min(1).max(730).optional())
1028
+ .array(z.number().int().min(1).max(4000).optional())
888
1029
  .optional(),
889
1030
  charge_on_event: z
890
1031
  .array(z
@@ -899,7 +1040,7 @@ const CreateWithItemsSubscriptionSubscriptionItemsSchema = z.object({
899
1040
  .optional(),
900
1041
  charge_once: z.array(z.boolean().optional()).optional(),
901
1042
  item_type: z.array(z.enum(['plan', 'addon', 'charge']).optional()).optional(),
902
- description: z.array(z.string().max(500).optional()).optional(),
1043
+ description: z.array(z.string().max(2000).optional()).optional(),
903
1044
  charge_on_option: z
904
1045
  .array(z.enum(['immediately', 'on_event']).optional())
905
1046
  .optional(),
@@ -907,6 +1048,18 @@ const CreateWithItemsSubscriptionSubscriptionItemsSchema = z.object({
907
1048
  .array(z.enum(['never', 'subscription_billing_frequency']).optional())
908
1049
  .optional(),
909
1050
  });
1051
+ const CreateWithItemsSubscriptionDiscountsItemSchema = z.object({
1052
+ apply_on: z.enum(['invoice_amount', 'specific_item_price']).optional(),
1053
+ duration_type: z.enum(['one_time', 'forever', 'limited_period']),
1054
+ percentage: z.number().min(0.01).max(100).optional(),
1055
+ amount: z.number().int().min(0).optional(),
1056
+ period: z.number().int().min(1).optional(),
1057
+ period_unit: z.enum(['day', 'week', 'month', 'year']).optional(),
1058
+ included_in_mrr: z.boolean().optional(),
1059
+ item_price_id: z.string().max(100).optional(),
1060
+ quantity: z.number().int().min(1).optional(),
1061
+ description: z.string().max(100).optional(),
1062
+ });
910
1063
  const CreateWithItemsSubscriptionDiscountsSchema = z.object({
911
1064
  apply_on: z
912
1065
  .array(z.enum(['invoice_amount', 'specific_item_price']).optional())
@@ -921,6 +1074,18 @@ const CreateWithItemsSubscriptionDiscountsSchema = z.object({
921
1074
  included_in_mrr: z.array(z.boolean().optional()).optional(),
922
1075
  item_price_id: z.array(z.string().max(100).optional()).optional(),
923
1076
  quantity: z.array(z.number().int().min(1).optional()).optional(),
1077
+ description: z.array(z.string().max(100).optional()).optional(),
1078
+ });
1079
+ const CreateWithItemsSubscriptionItemTiersItemSchema = z.object({
1080
+ item_price_id: z.string().max(100).optional(),
1081
+ starting_unit: z.number().int().min(1).optional(),
1082
+ ending_unit: z.number().int().optional(),
1083
+ price: z.number().int().min(0).optional(),
1084
+ starting_unit_in_decimal: z.string().max(33).optional(),
1085
+ ending_unit_in_decimal: z.string().max(33).optional(),
1086
+ price_in_decimal: z.string().max(39).optional(),
1087
+ pricing_type: z.enum(['per_unit', 'flat_fee', 'package']).optional(),
1088
+ package_size: z.number().int().min(1).optional(),
924
1089
  });
925
1090
  const CreateWithItemsSubscriptionItemTiersSchema = z.object({
926
1091
  item_price_id: z.array(z.string().max(100).optional()).optional(),
@@ -935,6 +1100,10 @@ const CreateWithItemsSubscriptionItemTiersSchema = z.object({
935
1100
  .optional(),
936
1101
  package_size: z.array(z.number().int().min(1).optional()).optional(),
937
1102
  });
1103
+ const CreateWithItemsSubscriptionCouponsItemSchema = z.object({
1104
+ coupon_id: z.string().max(100).optional(),
1105
+ apply_till: z.number().int().optional(),
1106
+ });
938
1107
  const CreateWithItemsSubscriptionCouponsSchema = z.object({
939
1108
  coupon_id: z.array(z.string().max(100).optional()).optional(),
940
1109
  apply_till: z.array(z.number().int().optional()).optional(),
@@ -1004,10 +1173,30 @@ const CreateWithItemsSubscriptionBodySchema = z.looseObject({
1004
1173
  payment_intent: CreateWithItemsSubscriptionPaymentIntentSchema.optional(),
1005
1174
  contract_term: CreateWithItemsSubscriptionContractTermSchema.optional(),
1006
1175
  billing_override: CreateWithItemsSubscriptionBillingOverrideSchema.optional(),
1007
- subscription_items: CreateWithItemsSubscriptionSubscriptionItemsSchema.optional(),
1008
- discounts: CreateWithItemsSubscriptionDiscountsSchema.optional(),
1009
- item_tiers: CreateWithItemsSubscriptionItemTiersSchema.optional(),
1010
- coupons: CreateWithItemsSubscriptionCouponsSchema.optional(),
1176
+ subscription_items: z
1177
+ .union([
1178
+ z.array(CreateWithItemsSubscriptionSubscriptionItemsItemSchema.optional()),
1179
+ CreateWithItemsSubscriptionSubscriptionItemsSchema,
1180
+ ])
1181
+ .optional(),
1182
+ discounts: z
1183
+ .union([
1184
+ z.array(CreateWithItemsSubscriptionDiscountsItemSchema.optional()),
1185
+ CreateWithItemsSubscriptionDiscountsSchema,
1186
+ ])
1187
+ .optional(),
1188
+ item_tiers: z
1189
+ .union([
1190
+ z.array(CreateWithItemsSubscriptionItemTiersItemSchema.optional()),
1191
+ CreateWithItemsSubscriptionItemTiersSchema,
1192
+ ])
1193
+ .optional(),
1194
+ coupons: z
1195
+ .union([
1196
+ z.array(CreateWithItemsSubscriptionCouponsItemSchema.optional()),
1197
+ CreateWithItemsSubscriptionCouponsSchema,
1198
+ ])
1199
+ .optional(),
1011
1200
  });
1012
1201
  export { CreateWithItemsSubscriptionBodySchema };
1013
1202
  //Subscription.list
@@ -1015,29 +1204,69 @@ const ListSubscriptionIdSchema = z.object({
1015
1204
  is: z.string().min(1).optional(),
1016
1205
  is_not: z.string().min(1).optional(),
1017
1206
  starts_with: z.string().min(1).optional(),
1018
- in: z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
1019
- not_in: z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
1207
+ in: z
1208
+ .union([
1209
+ z.array(z.string().optional()),
1210
+ z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')),
1211
+ ])
1212
+ .optional(),
1213
+ not_in: z
1214
+ .union([
1215
+ z.array(z.string().optional()),
1216
+ z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')),
1217
+ ])
1218
+ .optional(),
1020
1219
  });
1021
1220
  const ListSubscriptionCustomerIdSchema = z.object({
1022
1221
  is: z.string().min(1).optional(),
1023
1222
  is_not: z.string().min(1).optional(),
1024
1223
  starts_with: z.string().min(1).optional(),
1025
- in: z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
1026
- not_in: z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
1224
+ in: z
1225
+ .union([
1226
+ z.array(z.string().optional()),
1227
+ z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')),
1228
+ ])
1229
+ .optional(),
1230
+ not_in: z
1231
+ .union([
1232
+ z.array(z.string().optional()),
1233
+ z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')),
1234
+ ])
1235
+ .optional(),
1027
1236
  });
1028
1237
  const ListSubscriptionItemIdSchema = z.object({
1029
1238
  is: z.string().min(1).optional(),
1030
1239
  is_not: z.string().min(1).optional(),
1031
1240
  starts_with: z.string().min(1).optional(),
1032
- in: z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
1033
- not_in: z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
1241
+ in: z
1242
+ .union([
1243
+ z.array(z.string().optional()),
1244
+ z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')),
1245
+ ])
1246
+ .optional(),
1247
+ not_in: z
1248
+ .union([
1249
+ z.array(z.string().optional()),
1250
+ z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')),
1251
+ ])
1252
+ .optional(),
1034
1253
  });
1035
1254
  const ListSubscriptionItemPriceIdSchema = z.object({
1036
1255
  is: z.string().min(1).optional(),
1037
1256
  is_not: z.string().min(1).optional(),
1038
1257
  starts_with: z.string().min(1).optional(),
1039
- in: z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
1040
- not_in: z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
1258
+ in: z
1259
+ .union([
1260
+ z.array(z.string().optional()),
1261
+ z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')),
1262
+ ])
1263
+ .optional(),
1264
+ not_in: z
1265
+ .union([
1266
+ z.array(z.string().optional()),
1267
+ z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')),
1268
+ ])
1269
+ .optional(),
1041
1270
  });
1042
1271
  const ListSubscriptionStatusSchema = z.object({
1043
1272
  is: z
@@ -1063,25 +1292,51 @@ const ListSubscriptionStatusSchema = z.object({
1063
1292
  ])
1064
1293
  .optional(),
1065
1294
  in: z
1066
- .enum([
1067
- 'future',
1068
- 'in_trial',
1069
- 'active',
1070
- 'non_renewing',
1071
- 'paused',
1072
- 'cancelled',
1073
- 'transferred',
1295
+ .union([
1296
+ z.array(z
1297
+ .enum([
1298
+ 'future',
1299
+ 'in_trial',
1300
+ 'active',
1301
+ 'non_renewing',
1302
+ 'paused',
1303
+ 'cancelled',
1304
+ 'transferred',
1305
+ ])
1306
+ .optional()),
1307
+ z.enum([
1308
+ 'future',
1309
+ 'in_trial',
1310
+ 'active',
1311
+ 'non_renewing',
1312
+ 'paused',
1313
+ 'cancelled',
1314
+ 'transferred',
1315
+ ]),
1074
1316
  ])
1075
1317
  .optional(),
1076
1318
  not_in: z
1077
- .enum([
1078
- 'future',
1079
- 'in_trial',
1080
- 'active',
1081
- 'non_renewing',
1082
- 'paused',
1083
- 'cancelled',
1084
- 'transferred',
1319
+ .union([
1320
+ z.array(z
1321
+ .enum([
1322
+ 'future',
1323
+ 'in_trial',
1324
+ 'active',
1325
+ 'non_renewing',
1326
+ 'paused',
1327
+ 'cancelled',
1328
+ 'transferred',
1329
+ ])
1330
+ .optional()),
1331
+ z.enum([
1332
+ 'future',
1333
+ 'in_trial',
1334
+ 'active',
1335
+ 'non_renewing',
1336
+ 'paused',
1337
+ 'cancelled',
1338
+ 'transferred',
1339
+ ]),
1085
1340
  ])
1086
1341
  .optional(),
1087
1342
  });
@@ -1109,79 +1364,187 @@ const ListSubscriptionCancelReasonSchema = z.object({
1109
1364
  ])
1110
1365
  .optional(),
1111
1366
  in: z
1112
- .enum([
1113
- 'not_paid',
1114
- 'no_card',
1115
- 'fraud_review_failed',
1116
- 'non_compliant_eu_customer',
1117
- 'tax_calculation_failed',
1118
- 'currency_incompatible_with_gateway',
1119
- 'non_compliant_customer',
1367
+ .union([
1368
+ z.array(z
1369
+ .enum([
1370
+ 'not_paid',
1371
+ 'no_card',
1372
+ 'fraud_review_failed',
1373
+ 'non_compliant_eu_customer',
1374
+ 'tax_calculation_failed',
1375
+ 'currency_incompatible_with_gateway',
1376
+ 'non_compliant_customer',
1377
+ ])
1378
+ .optional()),
1379
+ z.enum([
1380
+ 'not_paid',
1381
+ 'no_card',
1382
+ 'fraud_review_failed',
1383
+ 'non_compliant_eu_customer',
1384
+ 'tax_calculation_failed',
1385
+ 'currency_incompatible_with_gateway',
1386
+ 'non_compliant_customer',
1387
+ ]),
1120
1388
  ])
1121
1389
  .optional(),
1122
1390
  not_in: z
1123
- .enum([
1124
- 'not_paid',
1125
- 'no_card',
1126
- 'fraud_review_failed',
1127
- 'non_compliant_eu_customer',
1128
- 'tax_calculation_failed',
1129
- 'currency_incompatible_with_gateway',
1130
- 'non_compliant_customer',
1391
+ .union([
1392
+ z.array(z
1393
+ .enum([
1394
+ 'not_paid',
1395
+ 'no_card',
1396
+ 'fraud_review_failed',
1397
+ 'non_compliant_eu_customer',
1398
+ 'tax_calculation_failed',
1399
+ 'currency_incompatible_with_gateway',
1400
+ 'non_compliant_customer',
1401
+ ])
1402
+ .optional()),
1403
+ z.enum([
1404
+ 'not_paid',
1405
+ 'no_card',
1406
+ 'fraud_review_failed',
1407
+ 'non_compliant_eu_customer',
1408
+ 'tax_calculation_failed',
1409
+ 'currency_incompatible_with_gateway',
1410
+ 'non_compliant_customer',
1411
+ ]),
1131
1412
  ])
1132
1413
  .optional(),
1133
- is_present: z.enum(['true', 'false']).optional(),
1414
+ is_present: z.union([z.boolean(), z.enum(['true', 'false'])]).optional(),
1134
1415
  });
1135
1416
  const ListSubscriptionCancelReasonCodeSchema = z.object({
1136
1417
  is: z.string().min(1).optional(),
1137
1418
  is_not: z.string().min(1).optional(),
1138
1419
  starts_with: z.string().min(1).optional(),
1139
- in: z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
1140
- not_in: z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
1420
+ in: z
1421
+ .union([
1422
+ z.array(z.string().optional()),
1423
+ z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')),
1424
+ ])
1425
+ .optional(),
1426
+ not_in: z
1427
+ .union([
1428
+ z.array(z.string().optional()),
1429
+ z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')),
1430
+ ])
1431
+ .optional(),
1141
1432
  });
1142
1433
  const ListSubscriptionRemainingBillingCyclesSchema = z.object({
1143
- is: z.string().regex(RegExp('^-?\\d+$')).optional(),
1144
- is_not: z.string().regex(RegExp('^-?\\d+$')).optional(),
1145
- lt: z.string().regex(RegExp('^-?\\d+$')).optional(),
1146
- lte: z.string().regex(RegExp('^-?\\d+$')).optional(),
1147
- gt: z.string().regex(RegExp('^-?\\d+$')).optional(),
1148
- gte: z.string().regex(RegExp('^-?\\d+$')).optional(),
1149
- between: z.string().regex(RegExp('^\\[-?\\d+,-?\\d+\\]$')).optional(),
1150
- is_present: z.enum(['true', 'false']).optional(),
1434
+ is: z
1435
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
1436
+ .optional(),
1437
+ is_not: z
1438
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
1439
+ .optional(),
1440
+ lt: z
1441
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
1442
+ .optional(),
1443
+ lte: z
1444
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
1445
+ .optional(),
1446
+ gt: z
1447
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
1448
+ .optional(),
1449
+ gte: z
1450
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
1451
+ .optional(),
1452
+ between: z
1453
+ .union([
1454
+ z.array(z.number().int().optional()).min(2).max(2),
1455
+ z.string().regex(RegExp('^\\[-?\\d+,-?\\d+\\]$')),
1456
+ ])
1457
+ .optional(),
1458
+ is_present: z.union([z.boolean(), z.enum(['true', 'false'])]).optional(),
1151
1459
  });
1152
1460
  const ListSubscriptionCreatedAtSchema = z.object({
1153
- after: z.string().regex(RegExp('^\\d{10}$')).optional(),
1154
- before: z.string().regex(RegExp('^\\d{10}$')).optional(),
1155
- on: z.string().regex(RegExp('^\\d{10}$')).optional(),
1156
- between: z.string().regex(RegExp('^\\[\\d{10},\\d{10}\\]$')).optional(),
1461
+ after: z
1462
+ .union([z.number().int(), z.string().regex(RegExp('^\\d{10}$'))])
1463
+ .optional(),
1464
+ before: z
1465
+ .union([z.number().int(), z.string().regex(RegExp('^\\d{10}$'))])
1466
+ .optional(),
1467
+ on: z
1468
+ .union([z.number().int(), z.string().regex(RegExp('^\\d{10}$'))])
1469
+ .optional(),
1470
+ between: z
1471
+ .union([
1472
+ z.array(z.number().int().optional()).min(2).max(2),
1473
+ z.string().regex(RegExp('^\\[\\d{10},\\d{10}\\]$')),
1474
+ ])
1475
+ .optional(),
1157
1476
  });
1158
1477
  const ListSubscriptionActivatedAtSchema = z.object({
1159
- after: z.string().regex(RegExp('^\\d{10}$')).optional(),
1160
- before: z.string().regex(RegExp('^\\d{10}$')).optional(),
1161
- on: z.string().regex(RegExp('^\\d{10}$')).optional(),
1162
- between: z.string().regex(RegExp('^\\[\\d{10},\\d{10}\\]$')).optional(),
1163
- is_present: z.enum(['true', 'false']).optional(),
1478
+ after: z
1479
+ .union([z.number().int(), z.string().regex(RegExp('^\\d{10}$'))])
1480
+ .optional(),
1481
+ before: z
1482
+ .union([z.number().int(), z.string().regex(RegExp('^\\d{10}$'))])
1483
+ .optional(),
1484
+ on: z
1485
+ .union([z.number().int(), z.string().regex(RegExp('^\\d{10}$'))])
1486
+ .optional(),
1487
+ between: z
1488
+ .union([
1489
+ z.array(z.number().int().optional()).min(2).max(2),
1490
+ z.string().regex(RegExp('^\\[\\d{10},\\d{10}\\]$')),
1491
+ ])
1492
+ .optional(),
1493
+ is_present: z.union([z.boolean(), z.enum(['true', 'false'])]).optional(),
1164
1494
  });
1165
1495
  const ListSubscriptionNextBillingAtSchema = z.object({
1166
- after: z.string().regex(RegExp('^\\d{10}$')).optional(),
1167
- before: z.string().regex(RegExp('^\\d{10}$')).optional(),
1168
- on: z.string().regex(RegExp('^\\d{10}$')).optional(),
1169
- between: z.string().regex(RegExp('^\\[\\d{10},\\d{10}\\]$')).optional(),
1496
+ after: z
1497
+ .union([z.number().int(), z.string().regex(RegExp('^\\d{10}$'))])
1498
+ .optional(),
1499
+ before: z
1500
+ .union([z.number().int(), z.string().regex(RegExp('^\\d{10}$'))])
1501
+ .optional(),
1502
+ on: z
1503
+ .union([z.number().int(), z.string().regex(RegExp('^\\d{10}$'))])
1504
+ .optional(),
1505
+ between: z
1506
+ .union([
1507
+ z.array(z.number().int().optional()).min(2).max(2),
1508
+ z.string().regex(RegExp('^\\[\\d{10},\\d{10}\\]$')),
1509
+ ])
1510
+ .optional(),
1170
1511
  });
1171
1512
  const ListSubscriptionCancelledAtSchema = z.object({
1172
- after: z.string().regex(RegExp('^\\d{10}$')).optional(),
1173
- before: z.string().regex(RegExp('^\\d{10}$')).optional(),
1174
- on: z.string().regex(RegExp('^\\d{10}$')).optional(),
1175
- between: z.string().regex(RegExp('^\\[\\d{10},\\d{10}\\]$')).optional(),
1513
+ after: z
1514
+ .union([z.number().int(), z.string().regex(RegExp('^\\d{10}$'))])
1515
+ .optional(),
1516
+ before: z
1517
+ .union([z.number().int(), z.string().regex(RegExp('^\\d{10}$'))])
1518
+ .optional(),
1519
+ on: z
1520
+ .union([z.number().int(), z.string().regex(RegExp('^\\d{10}$'))])
1521
+ .optional(),
1522
+ between: z
1523
+ .union([
1524
+ z.array(z.number().int().optional()).min(2).max(2),
1525
+ z.string().regex(RegExp('^\\[\\d{10},\\d{10}\\]$')),
1526
+ ])
1527
+ .optional(),
1176
1528
  });
1177
1529
  const ListSubscriptionHasScheduledChangesSchema = z.object({
1178
- is: z.enum(['true', 'false']).optional(),
1530
+ is: z.union([z.boolean(), z.enum(['true', 'false'])]).optional(),
1179
1531
  });
1180
1532
  const ListSubscriptionUpdatedAtSchema = z.object({
1181
- after: z.string().regex(RegExp('^\\d{10}$')).optional(),
1182
- before: z.string().regex(RegExp('^\\d{10}$')).optional(),
1183
- on: z.string().regex(RegExp('^\\d{10}$')).optional(),
1184
- between: z.string().regex(RegExp('^\\[\\d{10},\\d{10}\\]$')).optional(),
1533
+ after: z
1534
+ .union([z.number().int(), z.string().regex(RegExp('^\\d{10}$'))])
1535
+ .optional(),
1536
+ before: z
1537
+ .union([z.number().int(), z.string().regex(RegExp('^\\d{10}$'))])
1538
+ .optional(),
1539
+ on: z
1540
+ .union([z.number().int(), z.string().regex(RegExp('^\\d{10}$'))])
1541
+ .optional(),
1542
+ between: z
1543
+ .union([
1544
+ z.array(z.number().int().optional()).min(2).max(2),
1545
+ z.string().regex(RegExp('^\\[\\d{10},\\d{10}\\]$')),
1546
+ ])
1547
+ .optional(),
1185
1548
  });
1186
1549
  const ListSubscriptionOfflinePaymentMethodSchema = z.object({
1187
1550
  is: z
@@ -1219,45 +1582,83 @@ const ListSubscriptionOfflinePaymentMethodSchema = z.object({
1219
1582
  ])
1220
1583
  .optional(),
1221
1584
  in: z
1222
- .enum([
1223
- 'no_preference',
1224
- 'cash',
1225
- 'check',
1226
- 'bank_transfer',
1227
- 'ach_credit',
1228
- 'sepa_credit',
1229
- 'boleto',
1230
- 'us_automated_bank_transfer',
1231
- 'eu_automated_bank_transfer',
1232
- 'uk_automated_bank_transfer',
1233
- 'jp_automated_bank_transfer',
1234
- 'mx_automated_bank_transfer',
1235
- 'custom',
1585
+ .union([
1586
+ z.array(z
1587
+ .enum([
1588
+ 'no_preference',
1589
+ 'cash',
1590
+ 'check',
1591
+ 'bank_transfer',
1592
+ 'ach_credit',
1593
+ 'sepa_credit',
1594
+ 'boleto',
1595
+ 'us_automated_bank_transfer',
1596
+ 'eu_automated_bank_transfer',
1597
+ 'uk_automated_bank_transfer',
1598
+ 'jp_automated_bank_transfer',
1599
+ 'mx_automated_bank_transfer',
1600
+ 'custom',
1601
+ ])
1602
+ .optional()),
1603
+ z.enum([
1604
+ 'no_preference',
1605
+ 'cash',
1606
+ 'check',
1607
+ 'bank_transfer',
1608
+ 'ach_credit',
1609
+ 'sepa_credit',
1610
+ 'boleto',
1611
+ 'us_automated_bank_transfer',
1612
+ 'eu_automated_bank_transfer',
1613
+ 'uk_automated_bank_transfer',
1614
+ 'jp_automated_bank_transfer',
1615
+ 'mx_automated_bank_transfer',
1616
+ 'custom',
1617
+ ]),
1236
1618
  ])
1237
1619
  .optional(),
1238
1620
  not_in: z
1239
- .enum([
1240
- 'no_preference',
1241
- 'cash',
1242
- 'check',
1243
- 'bank_transfer',
1244
- 'ach_credit',
1245
- 'sepa_credit',
1246
- 'boleto',
1247
- 'us_automated_bank_transfer',
1248
- 'eu_automated_bank_transfer',
1249
- 'uk_automated_bank_transfer',
1250
- 'jp_automated_bank_transfer',
1251
- 'mx_automated_bank_transfer',
1252
- 'custom',
1621
+ .union([
1622
+ z.array(z
1623
+ .enum([
1624
+ 'no_preference',
1625
+ 'cash',
1626
+ 'check',
1627
+ 'bank_transfer',
1628
+ 'ach_credit',
1629
+ 'sepa_credit',
1630
+ 'boleto',
1631
+ 'us_automated_bank_transfer',
1632
+ 'eu_automated_bank_transfer',
1633
+ 'uk_automated_bank_transfer',
1634
+ 'jp_automated_bank_transfer',
1635
+ 'mx_automated_bank_transfer',
1636
+ 'custom',
1637
+ ])
1638
+ .optional()),
1639
+ z.enum([
1640
+ 'no_preference',
1641
+ 'cash',
1642
+ 'check',
1643
+ 'bank_transfer',
1644
+ 'ach_credit',
1645
+ 'sepa_credit',
1646
+ 'boleto',
1647
+ 'us_automated_bank_transfer',
1648
+ 'eu_automated_bank_transfer',
1649
+ 'uk_automated_bank_transfer',
1650
+ 'jp_automated_bank_transfer',
1651
+ 'mx_automated_bank_transfer',
1652
+ 'custom',
1653
+ ]),
1253
1654
  ])
1254
1655
  .optional(),
1255
1656
  });
1256
1657
  const ListSubscriptionAutoCloseInvoicesSchema = z.object({
1257
- is: z.enum(['true', 'false']).optional(),
1658
+ is: z.union([z.boolean(), z.enum(['true', 'false'])]).optional(),
1258
1659
  });
1259
1660
  const ListSubscriptionOverrideRelationshipSchema = z.object({
1260
- is: z.enum(['true', 'false']).optional(),
1661
+ is: z.union([z.boolean(), z.enum(['true', 'false'])]).optional(),
1261
1662
  });
1262
1663
  const ListSubscriptionSortBySchema = z.looseObject({
1263
1664
  asc: z.enum(['created_at', 'updated_at']).optional(),
@@ -1269,18 +1670,38 @@ const ListSubscriptionBusinessEntityIdSchema = z.object({
1269
1670
  const ListSubscriptionChannelSchema = z.object({
1270
1671
  is: z.enum(['web', 'app_store', 'play_store']).optional(),
1271
1672
  is_not: z.enum(['web', 'app_store', 'play_store']).optional(),
1272
- in: z.enum(['web', 'app_store', 'play_store']).optional(),
1273
- not_in: z.enum(['web', 'app_store', 'play_store']).optional(),
1673
+ in: z
1674
+ .union([
1675
+ z.array(z.enum(['web', 'app_store', 'play_store']).optional()),
1676
+ z.enum(['web', 'app_store', 'play_store']),
1677
+ ])
1678
+ .optional(),
1679
+ not_in: z
1680
+ .union([
1681
+ z.array(z.enum(['web', 'app_store', 'play_store']).optional()),
1682
+ z.enum(['web', 'app_store', 'play_store']),
1683
+ ])
1684
+ .optional(),
1274
1685
  });
1275
1686
  const ListSubscriptionDecommissionedSchema = z.object({
1276
- is: z.enum(['true', 'false']).optional(),
1687
+ is: z.union([z.boolean(), z.enum(['true', 'false'])]).optional(),
1277
1688
  });
1278
1689
  const ListSubscriptionPlanIdSchema = z.object({
1279
1690
  is: z.string().min(1).optional(),
1280
1691
  is_not: z.string().min(1).optional(),
1281
1692
  starts_with: z.string().min(1).optional(),
1282
- in: z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
1283
- not_in: z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
1693
+ in: z
1694
+ .union([
1695
+ z.array(z.string().optional()),
1696
+ z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')),
1697
+ ])
1698
+ .optional(),
1699
+ not_in: z
1700
+ .union([
1701
+ z.array(z.string().optional()),
1702
+ z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')),
1703
+ ])
1704
+ .optional(),
1284
1705
  });
1285
1706
  const ListSubscriptionBodySchema = z.looseObject({
1286
1707
  limit: z.number().int().min(1).max(100).optional(),
@@ -1717,6 +2138,16 @@ const UpdateSubscriptionContractTermSchema = z.object({
1717
2138
  .optional(),
1718
2139
  cancellation_cutoff_period: z.number().int().optional(),
1719
2140
  });
2141
+ const UpdateSubscriptionAddonsItemSchema = z.object({
2142
+ id: z.string().max(100).optional(),
2143
+ quantity: z.number().int().min(1).optional(),
2144
+ unit_price: z.number().int().min(0).optional(),
2145
+ billing_cycles: z.number().int().min(0).optional(),
2146
+ quantity_in_decimal: z.string().max(33).optional(),
2147
+ unit_price_in_decimal: z.string().max(39).optional(),
2148
+ trial_end: z.number().int().optional(),
2149
+ proration_type: z.enum(['full_term', 'partial_term', 'none']).optional(),
2150
+ });
1720
2151
  const UpdateSubscriptionAddonsSchema = z.object({
1721
2152
  id: z.array(z.string().max(100).optional()).optional(),
1722
2153
  quantity: z.array(z.number().int().min(1).optional()).optional(),
@@ -1729,6 +2160,25 @@ const UpdateSubscriptionAddonsSchema = z.object({
1729
2160
  .array(z.enum(['full_term', 'partial_term', 'none']).optional())
1730
2161
  .optional(),
1731
2162
  });
2163
+ const UpdateSubscriptionEventBasedAddonsItemSchema = z.object({
2164
+ id: z.string().max(100).optional(),
2165
+ quantity: z.number().int().min(1).optional(),
2166
+ unit_price: z.number().int().min(0).optional(),
2167
+ service_period_in_days: z.number().int().min(1).max(4000).optional(),
2168
+ charge_on: z.enum(['immediately', 'on_event']).optional(),
2169
+ on_event: z
2170
+ .enum([
2171
+ 'subscription_creation',
2172
+ 'subscription_trial_start',
2173
+ 'plan_activation',
2174
+ 'subscription_activation',
2175
+ 'contract_termination',
2176
+ ])
2177
+ .optional(),
2178
+ charge_once: z.boolean().default(true).optional(),
2179
+ quantity_in_decimal: z.string().max(33).optional(),
2180
+ unit_price_in_decimal: z.string().max(39).optional(),
2181
+ });
1732
2182
  const UpdateSubscriptionEventBasedAddonsSchema = z.object({
1733
2183
  id: z.array(z.string().max(100).optional()).optional(),
1734
2184
  quantity: z.array(z.number().int().min(1).optional()).optional(),
@@ -1752,6 +2202,10 @@ const UpdateSubscriptionEventBasedAddonsSchema = z.object({
1752
2202
  quantity_in_decimal: z.array(z.string().max(33).optional()).optional(),
1753
2203
  unit_price_in_decimal: z.array(z.string().max(39).optional()).optional(),
1754
2204
  });
2205
+ const UpdateSubscriptionCouponsItemSchema = z.object({
2206
+ coupon_id: z.string().max(100).optional(),
2207
+ apply_till: z.number().int().optional(),
2208
+ });
1755
2209
  const UpdateSubscriptionCouponsSchema = z.object({
1756
2210
  coupon_id: z.array(z.string().max(100).optional()).optional(),
1757
2211
  apply_till: z.array(z.number().int().optional()).optional(),
@@ -1833,9 +2287,24 @@ const UpdateSubscriptionBodySchema = z.looseObject({
1833
2287
  statement_descriptor: UpdateSubscriptionStatementDescriptorSchema.optional(),
1834
2288
  customer: UpdateSubscriptionCustomerSchema.optional(),
1835
2289
  contract_term: UpdateSubscriptionContractTermSchema.optional(),
1836
- addons: UpdateSubscriptionAddonsSchema.optional(),
1837
- event_based_addons: UpdateSubscriptionEventBasedAddonsSchema.optional(),
1838
- coupons: UpdateSubscriptionCouponsSchema.optional(),
2290
+ addons: z
2291
+ .union([
2292
+ z.array(UpdateSubscriptionAddonsItemSchema.optional()),
2293
+ UpdateSubscriptionAddonsSchema,
2294
+ ])
2295
+ .optional(),
2296
+ event_based_addons: z
2297
+ .union([
2298
+ z.array(UpdateSubscriptionEventBasedAddonsItemSchema.optional()),
2299
+ UpdateSubscriptionEventBasedAddonsSchema,
2300
+ ])
2301
+ .optional(),
2302
+ coupons: z
2303
+ .union([
2304
+ z.array(UpdateSubscriptionCouponsItemSchema.optional()),
2305
+ UpdateSubscriptionCouponsSchema,
2306
+ ])
2307
+ .optional(),
1839
2308
  });
1840
2309
  export { UpdateSubscriptionBodySchema };
1841
2310
  //Subscription.updateForItems
@@ -2206,6 +2675,33 @@ const UpdateForItemsSubscriptionBillingOverrideSchema = z.object({
2206
2675
  max_excess_payment_usage: z.number().int().min(-1).optional(),
2207
2676
  max_refundable_credits_usage: z.number().int().min(-1).optional(),
2208
2677
  });
2678
+ const UpdateForItemsSubscriptionSubscriptionItemsItemSchema = z.object({
2679
+ item_price_id: z.string().max(100),
2680
+ quantity: z.number().int().min(1).optional(),
2681
+ quantity_in_decimal: z.string().max(33).optional(),
2682
+ unit_price: z.number().int().min(0).optional(),
2683
+ unit_price_in_decimal: z.string().max(39).optional(),
2684
+ billing_cycles: z.number().int().min(0).optional(),
2685
+ trial_end: z.number().int().optional(),
2686
+ service_period_days: z.number().int().min(1).max(4000).optional(),
2687
+ charge_on_event: z
2688
+ .enum([
2689
+ 'subscription_creation',
2690
+ 'subscription_trial_start',
2691
+ 'plan_activation',
2692
+ 'subscription_activation',
2693
+ 'contract_termination',
2694
+ ])
2695
+ .optional(),
2696
+ charge_once: z.boolean().optional(),
2697
+ charge_on_option: z.enum(['immediately', 'on_event']).optional(),
2698
+ item_type: z.enum(['plan', 'addon', 'charge']).optional(),
2699
+ description: z.string().max(2000).optional(),
2700
+ proration_type: z.enum(['full_term', 'partial_term', 'none']).optional(),
2701
+ usage_accumulation_reset_frequency: z
2702
+ .enum(['never', 'subscription_billing_frequency'])
2703
+ .optional(),
2704
+ });
2209
2705
  const UpdateForItemsSubscriptionSubscriptionItemsSchema = z.object({
2210
2706
  item_price_id: z.array(z.string().max(100).optional()),
2211
2707
  quantity: z.array(z.number().int().min(1).optional()).optional(),
@@ -2215,7 +2711,7 @@ const UpdateForItemsSubscriptionSubscriptionItemsSchema = z.object({
2215
2711
  billing_cycles: z.array(z.number().int().min(0).optional()).optional(),
2216
2712
  trial_end: z.array(z.number().int().optional()).optional(),
2217
2713
  service_period_days: z
2218
- .array(z.number().int().min(1).max(730).optional())
2714
+ .array(z.number().int().min(1).max(4000).optional())
2219
2715
  .optional(),
2220
2716
  charge_on_event: z
2221
2717
  .array(z
@@ -2233,7 +2729,7 @@ const UpdateForItemsSubscriptionSubscriptionItemsSchema = z.object({
2233
2729
  .array(z.enum(['immediately', 'on_event']).optional())
2234
2730
  .optional(),
2235
2731
  item_type: z.array(z.enum(['plan', 'addon', 'charge']).optional()).optional(),
2236
- description: z.array(z.string().max(500).optional()).optional(),
2732
+ description: z.array(z.string().max(2000).optional()).optional(),
2237
2733
  proration_type: z
2238
2734
  .array(z.enum(['full_term', 'partial_term', 'none']).optional())
2239
2735
  .optional(),
@@ -2241,6 +2737,20 @@ const UpdateForItemsSubscriptionSubscriptionItemsSchema = z.object({
2241
2737
  .array(z.enum(['never', 'subscription_billing_frequency']).optional())
2242
2738
  .optional(),
2243
2739
  });
2740
+ const UpdateForItemsSubscriptionDiscountsItemSchema = z.object({
2741
+ apply_on: z.enum(['invoice_amount', 'specific_item_price']).optional(),
2742
+ duration_type: z.enum(['one_time', 'forever', 'limited_period']),
2743
+ percentage: z.number().min(0.01).max(100).optional(),
2744
+ amount: z.number().int().min(0).optional(),
2745
+ period: z.number().int().min(1).optional(),
2746
+ period_unit: z.enum(['day', 'week', 'month', 'year']).optional(),
2747
+ included_in_mrr: z.boolean().optional(),
2748
+ item_price_id: z.string().max(100).optional(),
2749
+ quantity: z.number().int().min(1).optional(),
2750
+ operation_type: z.enum(['add', 'remove']),
2751
+ id: z.string().max(50).optional(),
2752
+ description: z.string().max(100).optional(),
2753
+ });
2244
2754
  const UpdateForItemsSubscriptionDiscountsSchema = z.object({
2245
2755
  apply_on: z
2246
2756
  .array(z.enum(['invoice_amount', 'specific_item_price']).optional())
@@ -2257,6 +2767,18 @@ const UpdateForItemsSubscriptionDiscountsSchema = z.object({
2257
2767
  quantity: z.array(z.number().int().min(1).optional()).optional(),
2258
2768
  operation_type: z.array(z.enum(['add', 'remove']).optional()),
2259
2769
  id: z.array(z.string().max(50).optional()).optional(),
2770
+ description: z.array(z.string().max(100).optional()).optional(),
2771
+ });
2772
+ const UpdateForItemsSubscriptionItemTiersItemSchema = z.object({
2773
+ item_price_id: z.string().max(100).optional(),
2774
+ starting_unit: z.number().int().min(1).optional(),
2775
+ ending_unit: z.number().int().optional(),
2776
+ price: z.number().int().min(0).optional(),
2777
+ starting_unit_in_decimal: z.string().max(33).optional(),
2778
+ ending_unit_in_decimal: z.string().max(33).optional(),
2779
+ price_in_decimal: z.string().max(39).optional(),
2780
+ pricing_type: z.enum(['per_unit', 'flat_fee', 'package']).optional(),
2781
+ package_size: z.number().int().min(1).optional(),
2260
2782
  });
2261
2783
  const UpdateForItemsSubscriptionItemTiersSchema = z.object({
2262
2784
  item_price_id: z.array(z.string().max(100).optional()).optional(),
@@ -2271,6 +2793,10 @@ const UpdateForItemsSubscriptionItemTiersSchema = z.object({
2271
2793
  .optional(),
2272
2794
  package_size: z.array(z.number().int().min(1).optional()).optional(),
2273
2795
  });
2796
+ const UpdateForItemsSubscriptionCouponsItemSchema = z.object({
2797
+ coupon_id: z.string().max(100).optional(),
2798
+ apply_till: z.number().int().optional(),
2799
+ });
2274
2800
  const UpdateForItemsSubscriptionCouponsSchema = z.object({
2275
2801
  coupon_id: z.array(z.string().max(100).optional()).optional(),
2276
2802
  apply_till: z.array(z.number().int().optional()).optional(),
@@ -2351,10 +2877,30 @@ const UpdateForItemsSubscriptionBodySchema = z.looseObject({
2351
2877
  customer: UpdateForItemsSubscriptionCustomerSchema.optional(),
2352
2878
  contract_term: UpdateForItemsSubscriptionContractTermSchema.optional(),
2353
2879
  billing_override: UpdateForItemsSubscriptionBillingOverrideSchema.optional(),
2354
- subscription_items: UpdateForItemsSubscriptionSubscriptionItemsSchema.optional(),
2355
- discounts: UpdateForItemsSubscriptionDiscountsSchema.optional(),
2356
- item_tiers: UpdateForItemsSubscriptionItemTiersSchema.optional(),
2357
- coupons: UpdateForItemsSubscriptionCouponsSchema.optional(),
2880
+ subscription_items: z
2881
+ .union([
2882
+ z.array(UpdateForItemsSubscriptionSubscriptionItemsItemSchema.optional()),
2883
+ UpdateForItemsSubscriptionSubscriptionItemsSchema,
2884
+ ])
2885
+ .optional(),
2886
+ discounts: z
2887
+ .union([
2888
+ z.array(UpdateForItemsSubscriptionDiscountsItemSchema.optional()),
2889
+ UpdateForItemsSubscriptionDiscountsSchema,
2890
+ ])
2891
+ .optional(),
2892
+ item_tiers: z
2893
+ .union([
2894
+ z.array(UpdateForItemsSubscriptionItemTiersItemSchema.optional()),
2895
+ UpdateForItemsSubscriptionItemTiersSchema,
2896
+ ])
2897
+ .optional(),
2898
+ coupons: z
2899
+ .union([
2900
+ z.array(UpdateForItemsSubscriptionCouponsItemSchema.optional()),
2901
+ UpdateForItemsSubscriptionCouponsSchema,
2902
+ ])
2903
+ .optional(),
2358
2904
  });
2359
2905
  export { UpdateForItemsSubscriptionBodySchema };
2360
2906
  //Subscription.changeTermEnd
@@ -2505,6 +3051,10 @@ const ChargeFutureRenewalsSubscriptionFixedIntervalScheduleSchema = z.object({
2505
3051
  .optional(),
2506
3052
  end_date: z.number().int().optional(),
2507
3053
  });
3054
+ const ChargeFutureRenewalsSubscriptionSpecificDatesScheduleItemSchema = z.object({
3055
+ terms_to_charge: z.number().int().optional(),
3056
+ date: z.number().int().optional(),
3057
+ });
2508
3058
  const ChargeFutureRenewalsSubscriptionSpecificDatesScheduleSchema = z.object({
2509
3059
  terms_to_charge: z.array(z.number().int().optional()).optional(),
2510
3060
  date: z.array(z.number().int().optional()).optional(),
@@ -2516,7 +3066,12 @@ const ChargeFutureRenewalsSubscriptionBodySchema = z.looseObject({
2516
3066
  .enum(['immediate', 'specific_dates', 'fixed_intervals'])
2517
3067
  .optional(),
2518
3068
  fixed_interval_schedule: ChargeFutureRenewalsSubscriptionFixedIntervalScheduleSchema.optional(),
2519
- specific_dates_schedule: ChargeFutureRenewalsSubscriptionSpecificDatesScheduleSchema.optional(),
3069
+ specific_dates_schedule: z
3070
+ .union([
3071
+ z.array(ChargeFutureRenewalsSubscriptionSpecificDatesScheduleItemSchema.optional()),
3072
+ ChargeFutureRenewalsSubscriptionSpecificDatesScheduleSchema,
3073
+ ])
3074
+ .optional(),
2520
3075
  });
2521
3076
  export { ChargeFutureRenewalsSubscriptionBodySchema };
2522
3077
  //Subscription.editAdvanceInvoiceSchedule
@@ -2528,6 +3083,11 @@ const EditAdvanceInvoiceScheduleSubscriptionFixedIntervalScheduleSchema = z.obje
2528
3083
  .optional(),
2529
3084
  end_date: z.number().int().optional(),
2530
3085
  });
3086
+ const EditAdvanceInvoiceScheduleSubscriptionSpecificDatesScheduleItemSchema = z.object({
3087
+ id: z.string().max(50).optional(),
3088
+ terms_to_charge: z.number().int().optional(),
3089
+ date: z.number().int().optional(),
3090
+ });
2531
3091
  const EditAdvanceInvoiceScheduleSubscriptionSpecificDatesScheduleSchema = z.object({
2532
3092
  id: z.array(z.string().max(50).optional()).optional(),
2533
3093
  terms_to_charge: z.array(z.number().int().optional()).optional(),
@@ -2537,15 +3097,28 @@ const EditAdvanceInvoiceScheduleSubscriptionBodySchema = z.looseObject({
2537
3097
  terms_to_charge: z.number().int().min(1).optional(),
2538
3098
  schedule_type: z.enum(['specific_dates', 'fixed_intervals']).optional(),
2539
3099
  fixed_interval_schedule: EditAdvanceInvoiceScheduleSubscriptionFixedIntervalScheduleSchema.optional(),
2540
- specific_dates_schedule: EditAdvanceInvoiceScheduleSubscriptionSpecificDatesScheduleSchema.optional(),
3100
+ specific_dates_schedule: z
3101
+ .union([
3102
+ z.array(EditAdvanceInvoiceScheduleSubscriptionSpecificDatesScheduleItemSchema.optional()),
3103
+ EditAdvanceInvoiceScheduleSubscriptionSpecificDatesScheduleSchema,
3104
+ ])
3105
+ .optional(),
2541
3106
  });
2542
3107
  export { EditAdvanceInvoiceScheduleSubscriptionBodySchema };
2543
3108
  //Subscription.removeAdvanceInvoiceSchedule
3109
+ const RemoveAdvanceInvoiceScheduleSubscriptionSpecificDatesScheduleItemSchema = z.object({
3110
+ id: z.string().max(50).optional(),
3111
+ });
2544
3112
  const RemoveAdvanceInvoiceScheduleSubscriptionSpecificDatesScheduleSchema = z.object({
2545
3113
  id: z.array(z.string().max(50).optional()).optional(),
2546
3114
  });
2547
3115
  const RemoveAdvanceInvoiceScheduleSubscriptionBodySchema = z.looseObject({
2548
- specific_dates_schedule: RemoveAdvanceInvoiceScheduleSubscriptionSpecificDatesScheduleSchema.optional(),
3116
+ specific_dates_schedule: z
3117
+ .union([
3118
+ z.array(RemoveAdvanceInvoiceScheduleSubscriptionSpecificDatesScheduleItemSchema.optional()),
3119
+ RemoveAdvanceInvoiceScheduleSubscriptionSpecificDatesScheduleSchema,
3120
+ ])
3121
+ .optional(),
2549
3122
  });
2550
3123
  export { RemoveAdvanceInvoiceScheduleSubscriptionBodySchema };
2551
3124
  //Subscription.regenerateInvoice
@@ -2889,17 +3462,19 @@ const ImportSubscriptionSubscriptionTransactionSchema = z.object({
2889
3462
  'app_store',
2890
3463
  'play_store',
2891
3464
  'custom',
2892
- 'tamara',
2893
- 'qpay',
2894
- 'blik',
2895
- 'fpx',
2896
- 'wero',
2897
- 'p24',
2898
3465
  ])
2899
3466
  .optional(),
2900
3467
  reference_number: z.string().max(100).optional(),
2901
3468
  date: z.number().int().optional(),
2902
3469
  });
3470
+ const ImportSubscriptionSubscriptionAddonsItemSchema = z.object({
3471
+ id: z.string().max(100).optional(),
3472
+ quantity: z.number().int().min(1).optional(),
3473
+ quantity_in_decimal: z.string().max(33).optional(),
3474
+ unit_price: z.number().int().min(0).optional(),
3475
+ unit_price_in_decimal: z.string().max(39).optional(),
3476
+ billing_cycles: z.number().int().min(0).optional(),
3477
+ });
2903
3478
  const ImportSubscriptionSubscriptionAddonsSchema = z.object({
2904
3479
  id: z.array(z.string().max(100).optional()).optional(),
2905
3480
  quantity: z.array(z.number().int().min(1).optional()).optional(),
@@ -2908,6 +3483,24 @@ const ImportSubscriptionSubscriptionAddonsSchema = z.object({
2908
3483
  unit_price_in_decimal: z.array(z.string().max(39).optional()).optional(),
2909
3484
  billing_cycles: z.array(z.number().int().min(0).optional()).optional(),
2910
3485
  });
3486
+ const ImportSubscriptionSubscriptionEventBasedAddonsItemSchema = z.object({
3487
+ id: z.string().max(100).optional(),
3488
+ quantity: z.number().int().min(1).optional(),
3489
+ unit_price: z.number().int().min(0).optional(),
3490
+ quantity_in_decimal: z.string().max(33).optional(),
3491
+ unit_price_in_decimal: z.string().max(39).optional(),
3492
+ service_period_in_days: z.number().int().min(1).max(4000).optional(),
3493
+ on_event: z
3494
+ .enum([
3495
+ 'subscription_creation',
3496
+ 'subscription_trial_start',
3497
+ 'plan_activation',
3498
+ 'subscription_activation',
3499
+ 'contract_termination',
3500
+ ])
3501
+ .optional(),
3502
+ charge_once: z.boolean().default(true).optional(),
3503
+ });
2911
3504
  const ImportSubscriptionSubscriptionEventBasedAddonsSchema = z.object({
2912
3505
  id: z.array(z.string().max(100).optional()).optional(),
2913
3506
  quantity: z.array(z.number().int().min(1).optional()).optional(),
@@ -2930,10 +3523,18 @@ const ImportSubscriptionSubscriptionEventBasedAddonsSchema = z.object({
2930
3523
  .optional(),
2931
3524
  charge_once: z.array(z.boolean().default(true).optional()).optional(),
2932
3525
  });
3526
+ const ImportSubscriptionSubscriptionChargedEventBasedAddonsItemSchema = z.object({
3527
+ id: z.string().max(100).optional(),
3528
+ last_charged_at: z.number().int().optional(),
3529
+ });
2933
3530
  const ImportSubscriptionSubscriptionChargedEventBasedAddonsSchema = z.object({
2934
3531
  id: z.array(z.string().max(100).optional()).optional(),
2935
3532
  last_charged_at: z.array(z.number().int().optional()).optional(),
2936
3533
  });
3534
+ const ImportSubscriptionSubscriptionCouponsItemSchema = z.object({
3535
+ coupon_id: z.string().max(100).optional(),
3536
+ apply_till: z.number().int().optional(),
3537
+ });
2937
3538
  const ImportSubscriptionSubscriptionCouponsSchema = z.object({
2938
3539
  coupon_id: z.array(z.string().max(100).optional()).optional(),
2939
3540
  apply_till: z.array(z.number().int().optional()).optional(),
@@ -2987,10 +3588,30 @@ const ImportSubscriptionSubscriptionBodySchema = z.looseObject({
2987
3588
  billing_address: ImportSubscriptionSubscriptionBillingAddressSchema.optional(),
2988
3589
  shipping_address: ImportSubscriptionSubscriptionShippingAddressSchema.optional(),
2989
3590
  transaction: ImportSubscriptionSubscriptionTransactionSchema.optional(),
2990
- addons: ImportSubscriptionSubscriptionAddonsSchema.optional(),
2991
- event_based_addons: ImportSubscriptionSubscriptionEventBasedAddonsSchema.optional(),
2992
- charged_event_based_addons: ImportSubscriptionSubscriptionChargedEventBasedAddonsSchema.optional(),
2993
- coupons: ImportSubscriptionSubscriptionCouponsSchema.optional(),
3591
+ addons: z
3592
+ .union([
3593
+ z.array(ImportSubscriptionSubscriptionAddonsItemSchema.optional()),
3594
+ ImportSubscriptionSubscriptionAddonsSchema,
3595
+ ])
3596
+ .optional(),
3597
+ event_based_addons: z
3598
+ .union([
3599
+ z.array(ImportSubscriptionSubscriptionEventBasedAddonsItemSchema.optional()),
3600
+ ImportSubscriptionSubscriptionEventBasedAddonsSchema,
3601
+ ])
3602
+ .optional(),
3603
+ charged_event_based_addons: z
3604
+ .union([
3605
+ z.array(ImportSubscriptionSubscriptionChargedEventBasedAddonsItemSchema.optional()),
3606
+ ImportSubscriptionSubscriptionChargedEventBasedAddonsSchema,
3607
+ ])
3608
+ .optional(),
3609
+ coupons: z
3610
+ .union([
3611
+ z.array(ImportSubscriptionSubscriptionCouponsItemSchema.optional()),
3612
+ ImportSubscriptionSubscriptionCouponsSchema,
3613
+ ])
3614
+ .optional(),
2994
3615
  });
2995
3616
  export { ImportSubscriptionSubscriptionBodySchema };
2996
3617
  //Subscription.importForCustomer
@@ -3018,12 +3639,6 @@ const ImportForCustomerSubscriptionTransactionSchema = z.object({
3018
3639
  'app_store',
3019
3640
  'play_store',
3020
3641
  'custom',
3021
- 'tamara',
3022
- 'qpay',
3023
- 'blik',
3024
- 'fpx',
3025
- 'wero',
3026
- 'p24',
3027
3642
  ])
3028
3643
  .optional(),
3029
3644
  reference_number: z.string().max(100).optional(),
@@ -3047,6 +3662,14 @@ const ImportForCustomerSubscriptionShippingAddressSchema = z.object({
3047
3662
  .enum(['not_validated', 'valid', 'partially_valid', 'invalid'])
3048
3663
  .optional(),
3049
3664
  });
3665
+ const ImportForCustomerSubscriptionAddonsItemSchema = z.object({
3666
+ id: z.string().max(100).optional(),
3667
+ quantity: z.number().int().min(1).optional(),
3668
+ quantity_in_decimal: z.string().max(33).optional(),
3669
+ unit_price: z.number().int().min(0).optional(),
3670
+ unit_price_in_decimal: z.string().max(39).optional(),
3671
+ billing_cycles: z.number().int().min(0).optional(),
3672
+ });
3050
3673
  const ImportForCustomerSubscriptionAddonsSchema = z.object({
3051
3674
  id: z.array(z.string().max(100).optional()).optional(),
3052
3675
  quantity: z.array(z.number().int().min(1).optional()).optional(),
@@ -3055,6 +3678,24 @@ const ImportForCustomerSubscriptionAddonsSchema = z.object({
3055
3678
  unit_price_in_decimal: z.array(z.string().max(39).optional()).optional(),
3056
3679
  billing_cycles: z.array(z.number().int().min(0).optional()).optional(),
3057
3680
  });
3681
+ const ImportForCustomerSubscriptionEventBasedAddonsItemSchema = z.object({
3682
+ id: z.string().max(100).optional(),
3683
+ quantity: z.number().int().min(1).optional(),
3684
+ unit_price: z.number().int().min(0).optional(),
3685
+ quantity_in_decimal: z.string().max(33).optional(),
3686
+ unit_price_in_decimal: z.string().max(39).optional(),
3687
+ service_period_in_days: z.number().int().min(1).max(4000).optional(),
3688
+ on_event: z
3689
+ .enum([
3690
+ 'subscription_creation',
3691
+ 'subscription_trial_start',
3692
+ 'plan_activation',
3693
+ 'subscription_activation',
3694
+ 'contract_termination',
3695
+ ])
3696
+ .optional(),
3697
+ charge_once: z.boolean().default(true).optional(),
3698
+ });
3058
3699
  const ImportForCustomerSubscriptionEventBasedAddonsSchema = z.object({
3059
3700
  id: z.array(z.string().max(100).optional()).optional(),
3060
3701
  quantity: z.array(z.number().int().min(1).optional()).optional(),
@@ -3077,10 +3718,18 @@ const ImportForCustomerSubscriptionEventBasedAddonsSchema = z.object({
3077
3718
  .optional(),
3078
3719
  charge_once: z.array(z.boolean().default(true).optional()).optional(),
3079
3720
  });
3721
+ const ImportForCustomerSubscriptionChargedEventBasedAddonsItemSchema = z.object({
3722
+ id: z.string().max(100).optional(),
3723
+ last_charged_at: z.number().int().optional(),
3724
+ });
3080
3725
  const ImportForCustomerSubscriptionChargedEventBasedAddonsSchema = z.object({
3081
3726
  id: z.array(z.string().max(100).optional()).optional(),
3082
3727
  last_charged_at: z.array(z.number().int().optional()).optional(),
3083
3728
  });
3729
+ const ImportForCustomerSubscriptionCouponsItemSchema = z.object({
3730
+ coupon_id: z.string().max(100).optional(),
3731
+ apply_till: z.number().int().optional(),
3732
+ });
3084
3733
  const ImportForCustomerSubscriptionCouponsSchema = z.object({
3085
3734
  coupon_id: z.array(z.string().max(100).optional()).optional(),
3086
3735
  apply_till: z.array(z.number().int().optional()).optional(),
@@ -3129,10 +3778,30 @@ const ImportForCustomerSubscriptionBodySchema = z.looseObject({
3129
3778
  contract_term: ImportForCustomerSubscriptionContractTermSchema.optional(),
3130
3779
  transaction: ImportForCustomerSubscriptionTransactionSchema.optional(),
3131
3780
  shipping_address: ImportForCustomerSubscriptionShippingAddressSchema.optional(),
3132
- addons: ImportForCustomerSubscriptionAddonsSchema.optional(),
3133
- event_based_addons: ImportForCustomerSubscriptionEventBasedAddonsSchema.optional(),
3134
- charged_event_based_addons: ImportForCustomerSubscriptionChargedEventBasedAddonsSchema.optional(),
3135
- coupons: ImportForCustomerSubscriptionCouponsSchema.optional(),
3781
+ addons: z
3782
+ .union([
3783
+ z.array(ImportForCustomerSubscriptionAddonsItemSchema.optional()),
3784
+ ImportForCustomerSubscriptionAddonsSchema,
3785
+ ])
3786
+ .optional(),
3787
+ event_based_addons: z
3788
+ .union([
3789
+ z.array(ImportForCustomerSubscriptionEventBasedAddonsItemSchema.optional()),
3790
+ ImportForCustomerSubscriptionEventBasedAddonsSchema,
3791
+ ])
3792
+ .optional(),
3793
+ charged_event_based_addons: z
3794
+ .union([
3795
+ z.array(ImportForCustomerSubscriptionChargedEventBasedAddonsItemSchema.optional()),
3796
+ ImportForCustomerSubscriptionChargedEventBasedAddonsSchema,
3797
+ ])
3798
+ .optional(),
3799
+ coupons: z
3800
+ .union([
3801
+ z.array(ImportForCustomerSubscriptionCouponsItemSchema.optional()),
3802
+ ImportForCustomerSubscriptionCouponsSchema,
3803
+ ])
3804
+ .optional(),
3136
3805
  });
3137
3806
  export { ImportForCustomerSubscriptionBodySchema };
3138
3807
  //Subscription.importContractTerm
@@ -3163,6 +3832,31 @@ const ImportContractTermSubscriptionBodySchema = z.looseObject({
3163
3832
  });
3164
3833
  export { ImportContractTermSubscriptionBodySchema };
3165
3834
  //Subscription.importUnbilledCharges
3835
+ const ImportUnbilledChargesSubscriptionUnbilledChargesItemSchema = z.object({
3836
+ id: z.string().max(40).optional(),
3837
+ date_from: z.number().int(),
3838
+ date_to: z.number().int(),
3839
+ entity_type: z.enum([
3840
+ 'adhoc',
3841
+ 'plan_item_price',
3842
+ 'addon_item_price',
3843
+ 'charge_item_price',
3844
+ 'plan_setup',
3845
+ 'plan',
3846
+ 'addon',
3847
+ ]),
3848
+ entity_id: z.string().max(100).optional(),
3849
+ description: z.string().max(250).optional(),
3850
+ unit_amount: z.number().int().min(0).optional(),
3851
+ quantity: z.number().int().min(0).optional(),
3852
+ amount: z.number().int().min(0).optional(),
3853
+ unit_amount_in_decimal: z.string().max(39).optional(),
3854
+ quantity_in_decimal: z.string().max(33).optional(),
3855
+ amount_in_decimal: z.string().max(39).optional(),
3856
+ discount_amount: z.number().int().min(0).optional(),
3857
+ use_for_proration: z.boolean().default(false).optional(),
3858
+ is_advance_charge: z.boolean().default(false).optional(),
3859
+ });
3166
3860
  const ImportUnbilledChargesSubscriptionUnbilledChargesSchema = z.object({
3167
3861
  id: z.array(z.string().max(40).optional()).optional(),
3168
3862
  date_from: z.array(z.number().int().optional()),
@@ -3190,6 +3884,20 @@ const ImportUnbilledChargesSubscriptionUnbilledChargesSchema = z.object({
3190
3884
  use_for_proration: z.array(z.boolean().default(false).optional()).optional(),
3191
3885
  is_advance_charge: z.array(z.boolean().default(false).optional()).optional(),
3192
3886
  });
3887
+ const ImportUnbilledChargesSubscriptionDiscountsItemSchema = z.object({
3888
+ unbilled_charge_id: z.string().max(40).optional(),
3889
+ entity_type: z
3890
+ .enum([
3891
+ 'item_level_coupon',
3892
+ 'document_level_coupon',
3893
+ 'item_level_discount',
3894
+ 'document_level_discount',
3895
+ ])
3896
+ .optional(),
3897
+ entity_id: z.string().max(100).optional(),
3898
+ description: z.string().max(250).optional(),
3899
+ amount: z.number().int().min(0),
3900
+ });
3193
3901
  const ImportUnbilledChargesSubscriptionDiscountsSchema = z.object({
3194
3902
  unbilled_charge_id: z.array(z.string().max(40).optional()).optional(),
3195
3903
  entity_type: z
@@ -3206,6 +3914,17 @@ const ImportUnbilledChargesSubscriptionDiscountsSchema = z.object({
3206
3914
  description: z.array(z.string().max(250).optional()).optional(),
3207
3915
  amount: z.array(z.number().int().min(0).optional()),
3208
3916
  });
3917
+ const ImportUnbilledChargesSubscriptionTiersItemSchema = z.object({
3918
+ unbilled_charge_id: z.string().max(40),
3919
+ starting_unit: z.number().int().min(0).optional(),
3920
+ ending_unit: z.number().int().optional(),
3921
+ quantity_used: z.number().int().min(0).optional(),
3922
+ unit_amount: z.number().int().min(0).optional(),
3923
+ starting_unit_in_decimal: z.string().max(33).optional(),
3924
+ ending_unit_in_decimal: z.string().max(33).optional(),
3925
+ quantity_used_in_decimal: z.string().max(33).optional(),
3926
+ unit_amount_in_decimal: z.string().max(40).optional(),
3927
+ });
3209
3928
  const ImportUnbilledChargesSubscriptionTiersSchema = z.object({
3210
3929
  unbilled_charge_id: z.array(z.string().max(40).optional()),
3211
3930
  starting_unit: z.array(z.number().int().min(0).optional()).optional(),
@@ -3218,9 +3937,24 @@ const ImportUnbilledChargesSubscriptionTiersSchema = z.object({
3218
3937
  unit_amount_in_decimal: z.array(z.string().max(40).optional()).optional(),
3219
3938
  });
3220
3939
  const ImportUnbilledChargesSubscriptionBodySchema = z.looseObject({
3221
- unbilled_charges: ImportUnbilledChargesSubscriptionUnbilledChargesSchema.optional(),
3222
- discounts: ImportUnbilledChargesSubscriptionDiscountsSchema.optional(),
3223
- tiers: ImportUnbilledChargesSubscriptionTiersSchema.optional(),
3940
+ unbilled_charges: z
3941
+ .union([
3942
+ z.array(ImportUnbilledChargesSubscriptionUnbilledChargesItemSchema.optional()),
3943
+ ImportUnbilledChargesSubscriptionUnbilledChargesSchema,
3944
+ ])
3945
+ .optional(),
3946
+ discounts: z
3947
+ .union([
3948
+ z.array(ImportUnbilledChargesSubscriptionDiscountsItemSchema.optional()),
3949
+ ImportUnbilledChargesSubscriptionDiscountsSchema,
3950
+ ])
3951
+ .optional(),
3952
+ tiers: z
3953
+ .union([
3954
+ z.array(ImportUnbilledChargesSubscriptionTiersItemSchema.optional()),
3955
+ ImportUnbilledChargesSubscriptionTiersSchema,
3956
+ ])
3957
+ .optional(),
3224
3958
  });
3225
3959
  export { ImportUnbilledChargesSubscriptionBodySchema };
3226
3960
  //Subscription.importForItems
@@ -3248,12 +3982,6 @@ const ImportForItemsSubscriptionTransactionSchema = z.object({
3248
3982
  'app_store',
3249
3983
  'play_store',
3250
3984
  'custom',
3251
- 'tamara',
3252
- 'qpay',
3253
- 'blik',
3254
- 'fpx',
3255
- 'wero',
3256
- 'p24',
3257
3985
  ])
3258
3986
  .optional(),
3259
3987
  reference_number: z.string().max(100).optional(),
@@ -3277,6 +4005,28 @@ const ImportForItemsSubscriptionShippingAddressSchema = z.object({
3277
4005
  .enum(['not_validated', 'valid', 'partially_valid', 'invalid'])
3278
4006
  .optional(),
3279
4007
  });
4008
+ const ImportForItemsSubscriptionSubscriptionItemsItemSchema = z.object({
4009
+ item_price_id: z.string().max(100),
4010
+ quantity: z.number().int().min(1).optional(),
4011
+ quantity_in_decimal: z.string().max(33).optional(),
4012
+ unit_price: z.number().int().min(0).optional(),
4013
+ unit_price_in_decimal: z.string().max(39).optional(),
4014
+ billing_cycles: z.number().int().min(0).optional(),
4015
+ trial_end: z.number().int().optional(),
4016
+ service_period_days: z.number().int().min(1).max(4000).optional(),
4017
+ charge_on_event: z
4018
+ .enum([
4019
+ 'subscription_creation',
4020
+ 'subscription_trial_start',
4021
+ 'plan_activation',
4022
+ 'subscription_activation',
4023
+ 'contract_termination',
4024
+ ])
4025
+ .optional(),
4026
+ charge_once: z.boolean().optional(),
4027
+ item_type: z.enum(['plan', 'addon', 'charge']).optional(),
4028
+ description: z.string().max(2000).optional(),
4029
+ });
3280
4030
  const ImportForItemsSubscriptionSubscriptionItemsSchema = z.object({
3281
4031
  item_price_id: z.array(z.string().max(100).optional()),
3282
4032
  quantity: z.array(z.number().int().min(1).optional()).optional(),
@@ -3286,7 +4036,7 @@ const ImportForItemsSubscriptionSubscriptionItemsSchema = z.object({
3286
4036
  billing_cycles: z.array(z.number().int().min(0).optional()).optional(),
3287
4037
  trial_end: z.array(z.number().int().optional()).optional(),
3288
4038
  service_period_days: z
3289
- .array(z.number().int().min(1).max(730).optional())
4039
+ .array(z.number().int().min(1).max(4000).optional())
3290
4040
  .optional(),
3291
4041
  charge_on_event: z
3292
4042
  .array(z
@@ -3301,7 +4051,18 @@ const ImportForItemsSubscriptionSubscriptionItemsSchema = z.object({
3301
4051
  .optional(),
3302
4052
  charge_once: z.array(z.boolean().optional()).optional(),
3303
4053
  item_type: z.array(z.enum(['plan', 'addon', 'charge']).optional()).optional(),
3304
- description: z.array(z.string().max(500).optional()).optional(),
4054
+ description: z.array(z.string().max(2000).optional()).optional(),
4055
+ });
4056
+ const ImportForItemsSubscriptionDiscountsItemSchema = z.object({
4057
+ apply_on: z.enum(['invoice_amount', 'specific_item_price']).optional(),
4058
+ duration_type: z.enum(['one_time', 'forever', 'limited_period']),
4059
+ percentage: z.number().min(0.01).max(100).optional(),
4060
+ amount: z.number().int().min(0).optional(),
4061
+ period: z.number().int().min(1).optional(),
4062
+ period_unit: z.enum(['day', 'week', 'month', 'year']).optional(),
4063
+ included_in_mrr: z.boolean().optional(),
4064
+ item_price_id: z.string().max(100).optional(),
4065
+ quantity: z.number().int().min(1).optional(),
3305
4066
  });
3306
4067
  const ImportForItemsSubscriptionDiscountsSchema = z.object({
3307
4068
  apply_on: z
@@ -3318,10 +4079,25 @@ const ImportForItemsSubscriptionDiscountsSchema = z.object({
3318
4079
  item_price_id: z.array(z.string().max(100).optional()).optional(),
3319
4080
  quantity: z.array(z.number().int().min(1).optional()).optional(),
3320
4081
  });
4082
+ const ImportForItemsSubscriptionChargedItemsItemSchema = z.object({
4083
+ item_price_id: z.string().max(100).optional(),
4084
+ last_charged_at: z.number().int().optional(),
4085
+ });
3321
4086
  const ImportForItemsSubscriptionChargedItemsSchema = z.object({
3322
4087
  item_price_id: z.array(z.string().max(100).optional()).optional(),
3323
4088
  last_charged_at: z.array(z.number().int().optional()).optional(),
3324
4089
  });
4090
+ const ImportForItemsSubscriptionItemTiersItemSchema = z.object({
4091
+ item_price_id: z.string().max(100).optional(),
4092
+ starting_unit: z.number().int().min(1).optional(),
4093
+ ending_unit: z.number().int().optional(),
4094
+ price: z.number().int().min(0).optional(),
4095
+ starting_unit_in_decimal: z.string().max(33).optional(),
4096
+ ending_unit_in_decimal: z.string().max(33).optional(),
4097
+ price_in_decimal: z.string().max(39).optional(),
4098
+ pricing_type: z.enum(['per_unit', 'flat_fee', 'package']).optional(),
4099
+ package_size: z.number().int().min(1).optional(),
4100
+ });
3325
4101
  const ImportForItemsSubscriptionItemTiersSchema = z.object({
3326
4102
  item_price_id: z.array(z.string().max(100).optional()).optional(),
3327
4103
  starting_unit: z.array(z.number().int().min(1).optional()).optional(),
@@ -3335,6 +4111,10 @@ const ImportForItemsSubscriptionItemTiersSchema = z.object({
3335
4111
  .optional(),
3336
4112
  package_size: z.array(z.number().int().min(1).optional()).optional(),
3337
4113
  });
4114
+ const ImportForItemsSubscriptionCouponsItemSchema = z.object({
4115
+ coupon_id: z.string().max(100).optional(),
4116
+ apply_till: z.number().int().optional(),
4117
+ });
3338
4118
  const ImportForItemsSubscriptionCouponsSchema = z.object({
3339
4119
  coupon_id: z.array(z.string().max(100).optional()).optional(),
3340
4120
  apply_till: z.array(z.number().int().optional()).optional(),
@@ -3383,11 +4163,36 @@ const ImportForItemsSubscriptionBodySchema = z.looseObject({
3383
4163
  contract_term: ImportForItemsSubscriptionContractTermSchema.optional(),
3384
4164
  transaction: ImportForItemsSubscriptionTransactionSchema.optional(),
3385
4165
  shipping_address: ImportForItemsSubscriptionShippingAddressSchema.optional(),
3386
- subscription_items: ImportForItemsSubscriptionSubscriptionItemsSchema.optional(),
3387
- discounts: ImportForItemsSubscriptionDiscountsSchema.optional(),
3388
- charged_items: ImportForItemsSubscriptionChargedItemsSchema.optional(),
3389
- item_tiers: ImportForItemsSubscriptionItemTiersSchema.optional(),
3390
- coupons: ImportForItemsSubscriptionCouponsSchema.optional(),
4166
+ subscription_items: z
4167
+ .union([
4168
+ z.array(ImportForItemsSubscriptionSubscriptionItemsItemSchema.optional()),
4169
+ ImportForItemsSubscriptionSubscriptionItemsSchema,
4170
+ ])
4171
+ .optional(),
4172
+ discounts: z
4173
+ .union([
4174
+ z.array(ImportForItemsSubscriptionDiscountsItemSchema.optional()),
4175
+ ImportForItemsSubscriptionDiscountsSchema,
4176
+ ])
4177
+ .optional(),
4178
+ charged_items: z
4179
+ .union([
4180
+ z.array(ImportForItemsSubscriptionChargedItemsItemSchema.optional()),
4181
+ ImportForItemsSubscriptionChargedItemsSchema,
4182
+ ])
4183
+ .optional(),
4184
+ item_tiers: z
4185
+ .union([
4186
+ z.array(ImportForItemsSubscriptionItemTiersItemSchema.optional()),
4187
+ ImportForItemsSubscriptionItemTiersSchema,
4188
+ ])
4189
+ .optional(),
4190
+ coupons: z
4191
+ .union([
4192
+ z.array(ImportForItemsSubscriptionCouponsItemSchema.optional()),
4193
+ ImportForItemsSubscriptionCouponsSchema,
4194
+ ])
4195
+ .optional(),
3391
4196
  });
3392
4197
  export { ImportForItemsSubscriptionBodySchema };
3393
4198
  //Subscription.overrideBillingProfile
@@ -3409,6 +4214,12 @@ const PauseSubscriptionBodySchema = z.looseObject({
3409
4214
  });
3410
4215
  export { PauseSubscriptionBodySchema };
3411
4216
  //Subscription.cancel
4217
+ const CancelSubscriptionEventBasedAddonsItemSchema = z.object({
4218
+ id: z.string().max(100).optional(),
4219
+ quantity: z.number().int().min(1).optional(),
4220
+ unit_price: z.number().int().min(0).optional(),
4221
+ service_period_in_days: z.number().int().min(1).max(4000).optional(),
4222
+ });
3412
4223
  const CancelSubscriptionEventBasedAddonsSchema = z.object({
3413
4224
  id: z.array(z.string().max(100).optional()).optional(),
3414
4225
  quantity: z.array(z.number().int().min(1).optional()).optional(),
@@ -3448,10 +4259,23 @@ const CancelSubscriptionBodySchema = z.looseObject({
3448
4259
  .optional(),
3449
4260
  invoice_date: z.number().int().optional(),
3450
4261
  cancel_reason_code: z.string().max(100).optional(),
3451
- event_based_addons: CancelSubscriptionEventBasedAddonsSchema.optional(),
4262
+ event_based_addons: z
4263
+ .union([
4264
+ z.array(CancelSubscriptionEventBasedAddonsItemSchema.optional()),
4265
+ CancelSubscriptionEventBasedAddonsSchema,
4266
+ ])
4267
+ .optional(),
3452
4268
  });
3453
4269
  export { CancelSubscriptionBodySchema };
3454
4270
  //Subscription.cancelForItems
4271
+ const CancelForItemsSubscriptionSubscriptionItemsItemSchema = z.object({
4272
+ item_price_id: z.string().max(100).optional(),
4273
+ quantity: z.number().int().min(1).optional(),
4274
+ quantity_in_decimal: z.string().max(33).optional(),
4275
+ unit_price: z.number().int().min(0).optional(),
4276
+ unit_price_in_decimal: z.string().max(39).optional(),
4277
+ service_period_days: z.number().int().min(1).max(4000).optional(),
4278
+ });
3455
4279
  const CancelForItemsSubscriptionSubscriptionItemsSchema = z.object({
3456
4280
  item_price_id: z.array(z.string().max(100).optional()).optional(),
3457
4281
  quantity: z.array(z.number().int().min(1).optional()).optional(),
@@ -3459,7 +4283,7 @@ const CancelForItemsSubscriptionSubscriptionItemsSchema = z.object({
3459
4283
  unit_price: z.array(z.number().int().min(0).optional()).optional(),
3460
4284
  unit_price_in_decimal: z.array(z.string().max(39).optional()).optional(),
3461
4285
  service_period_days: z
3462
- .array(z.number().int().min(1).max(730).optional())
4286
+ .array(z.number().int().min(1).max(4000).optional())
3463
4287
  .optional(),
3464
4288
  });
3465
4289
  const CancelForItemsSubscriptionBodySchema = z.looseObject({
@@ -3495,7 +4319,12 @@ const CancelForItemsSubscriptionBodySchema = z.looseObject({
3495
4319
  include_cancellation_day_in_billing: z.boolean().optional(),
3496
4320
  cancel_reason_code: z.string().max(100).optional(),
3497
4321
  decommissioned: z.boolean().default(false).optional(),
3498
- subscription_items: CancelForItemsSubscriptionSubscriptionItemsSchema.optional(),
4322
+ subscription_items: z
4323
+ .union([
4324
+ z.array(CancelForItemsSubscriptionSubscriptionItemsItemSchema.optional()),
4325
+ CancelForItemsSubscriptionSubscriptionItemsSchema,
4326
+ ])
4327
+ .optional(),
3499
4328
  });
3500
4329
  export { CancelForItemsSubscriptionBodySchema };
3501
4330
  //Subscription.resume