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
@@ -92,6 +92,15 @@ const CreatePurchasePaymentIntentSchema = z.object({
92
92
  gw_payment_method_id: z.string().max(65000).optional(),
93
93
  additional_information: CreatePurchaseAdditionalInformationSchema.optional(),
94
94
  });
95
+ const CreatePurchasePurchaseItemsItemSchema = z.object({
96
+ index: z.number().int().min(0),
97
+ item_price_id: z.string().max(100),
98
+ quantity: z.number().int().min(1).optional(),
99
+ unit_amount: z.number().int().min(0).optional(),
100
+ unit_amount_in_decimal: z.string().max(39).optional(),
101
+ quantity_in_decimal: z.string().max(33).optional(),
102
+ trial_end: z.number().int().optional(),
103
+ });
95
104
  const CreatePurchasePurchaseItemsSchema = z.object({
96
105
  index: z.array(z.number().int().min(0).optional()),
97
106
  item_price_id: z.array(z.string().max(100).optional()),
@@ -99,6 +108,17 @@ const CreatePurchasePurchaseItemsSchema = z.object({
99
108
  unit_amount: z.array(z.number().int().min(0).optional()).optional(),
100
109
  unit_amount_in_decimal: z.array(z.string().max(39).optional()).optional(),
101
110
  quantity_in_decimal: z.array(z.string().max(33).optional()).optional(),
111
+ trial_end: z.array(z.number().int().optional()).optional(),
112
+ });
113
+ const CreatePurchaseItemTiersItemSchema = z.object({
114
+ index: z.number().int().min(0),
115
+ item_price_id: z.string().max(100).optional(),
116
+ starting_unit: z.number().int().min(1).optional(),
117
+ ending_unit: z.number().int().optional(),
118
+ price: z.number().int().min(0).optional(),
119
+ starting_unit_in_decimal: z.string().max(33).optional(),
120
+ ending_unit_in_decimal: z.string().max(33).optional(),
121
+ price_in_decimal: z.string().max(39).optional(),
102
122
  });
103
123
  const CreatePurchaseItemTiersSchema = z.object({
104
124
  index: z.array(z.number().int().min(0).optional()),
@@ -110,6 +130,24 @@ const CreatePurchaseItemTiersSchema = z.object({
110
130
  ending_unit_in_decimal: z.array(z.string().max(33).optional()).optional(),
111
131
  price_in_decimal: z.array(z.string().max(39).optional()).optional(),
112
132
  });
133
+ const CreatePurchaseShippingAddressesItemSchema = z.object({
134
+ first_name: z.string().max(150).optional(),
135
+ last_name: z.string().max(150).optional(),
136
+ email: z.string().email().max(70).optional(),
137
+ company: z.string().max(250).optional(),
138
+ phone: z.string().max(50).optional(),
139
+ line1: z.string().max(150).optional(),
140
+ line2: z.string().max(150).optional(),
141
+ line3: z.string().max(150).optional(),
142
+ city: z.string().max(50).optional(),
143
+ state: z.string().max(50).optional(),
144
+ state_code: z.string().max(50).optional(),
145
+ country: z.string().max(50).optional(),
146
+ zip: z.string().max(20).optional(),
147
+ validation_status: z
148
+ .enum(['not_validated', 'valid', 'partially_valid', 'invalid'])
149
+ .optional(),
150
+ });
113
151
  const CreatePurchaseShippingAddressesSchema = z.object({
114
152
  first_name: z.array(z.string().max(150).optional()).optional(),
115
153
  last_name: z.array(z.string().max(150).optional()).optional(),
@@ -130,6 +168,14 @@ const CreatePurchaseShippingAddressesSchema = z.object({
130
168
  .optional())
131
169
  .optional(),
132
170
  });
171
+ const CreatePurchaseDiscountsItemSchema = z.object({
172
+ index: z.number().int().min(0).optional(),
173
+ coupon_id: z.string().max(100).optional(),
174
+ percentage: z.number().min(0.01).max(100).optional(),
175
+ quantity: z.number().int().min(1).optional(),
176
+ amount: z.number().int().min(0).optional(),
177
+ included_in_mrr: z.boolean().optional(),
178
+ });
133
179
  const CreatePurchaseDiscountsSchema = z.object({
134
180
  index: z.array(z.number().int().min(0).optional()).optional(),
135
181
  coupon_id: z.array(z.string().max(100).optional()).optional(),
@@ -138,6 +184,21 @@ const CreatePurchaseDiscountsSchema = z.object({
138
184
  amount: z.array(z.number().int().min(0).optional()).optional(),
139
185
  included_in_mrr: z.array(z.boolean().optional()).optional(),
140
186
  });
187
+ const CreatePurchaseMetaDataSchema = z.looseObject({});
188
+ const CreatePurchaseSubscriptionInfoItemSchema = z.object({
189
+ index: z.number().int().min(0),
190
+ subscription_id: z.string().max(50).optional(),
191
+ billing_cycles: z.number().int().min(0).optional(),
192
+ contract_term_billing_cycle_on_renewal: z
193
+ .number()
194
+ .int()
195
+ .min(1)
196
+ .max(100)
197
+ .optional(),
198
+ trial_end: z.number().int().optional(),
199
+ start_date: z.number().int().optional(),
200
+ meta_data: CreatePurchaseMetaDataSchema.optional(),
201
+ });
141
202
  const CreatePurchaseMetaDataItemSchema = z.looseObject({});
142
203
  const CreatePurchaseSubscriptionInfoSchema = z.object({
143
204
  index: z.array(z.number().int().min(0).optional()),
@@ -146,8 +207,17 @@ const CreatePurchaseSubscriptionInfoSchema = z.object({
146
207
  contract_term_billing_cycle_on_renewal: z
147
208
  .array(z.number().int().min(1).max(100).optional())
148
209
  .optional(),
210
+ trial_end: z.array(z.number().int().optional()).optional(),
211
+ start_date: z.array(z.number().int().optional()).optional(),
149
212
  meta_data: z.array(CreatePurchaseMetaDataItemSchema.optional()).optional(),
150
213
  });
214
+ const CreatePurchaseContractTermsItemSchema = z.object({
215
+ index: z.number().int().min(0),
216
+ action_at_term_end: z
217
+ .enum(['renew', 'evergreen', 'cancel', 'renew_once'])
218
+ .optional(),
219
+ cancellation_cutoff_period: z.number().int().optional(),
220
+ });
151
221
  const CreatePurchaseContractTermsSchema = z.object({
152
222
  index: z.array(z.number().int().min(0).optional()),
153
223
  action_at_term_end: z
@@ -163,12 +233,42 @@ const CreatePurchaseBodySchema = z.looseObject({
163
233
  payment_schedule: CreatePurchasePaymentScheduleSchema.optional(),
164
234
  statement_descriptor: CreatePurchaseStatementDescriptorSchema.optional(),
165
235
  payment_intent: CreatePurchasePaymentIntentSchema.optional(),
166
- purchase_items: CreatePurchasePurchaseItemsSchema.optional(),
167
- item_tiers: CreatePurchaseItemTiersSchema.optional(),
168
- shipping_addresses: CreatePurchaseShippingAddressesSchema.optional(),
169
- discounts: CreatePurchaseDiscountsSchema.optional(),
170
- subscription_info: CreatePurchaseSubscriptionInfoSchema.optional(),
171
- contract_terms: CreatePurchaseContractTermsSchema.optional(),
236
+ purchase_items: z
237
+ .union([
238
+ z.array(CreatePurchasePurchaseItemsItemSchema.optional()),
239
+ CreatePurchasePurchaseItemsSchema,
240
+ ])
241
+ .optional(),
242
+ item_tiers: z
243
+ .union([
244
+ z.array(CreatePurchaseItemTiersItemSchema.optional()),
245
+ CreatePurchaseItemTiersSchema,
246
+ ])
247
+ .optional(),
248
+ shipping_addresses: z
249
+ .union([
250
+ z.array(CreatePurchaseShippingAddressesItemSchema.optional()),
251
+ CreatePurchaseShippingAddressesSchema,
252
+ ])
253
+ .optional(),
254
+ discounts: z
255
+ .union([
256
+ z.array(CreatePurchaseDiscountsItemSchema.optional()),
257
+ CreatePurchaseDiscountsSchema,
258
+ ])
259
+ .optional(),
260
+ subscription_info: z
261
+ .union([
262
+ z.array(CreatePurchaseSubscriptionInfoItemSchema.optional()),
263
+ CreatePurchaseSubscriptionInfoSchema,
264
+ ])
265
+ .optional(),
266
+ contract_terms: z
267
+ .union([
268
+ z.array(CreatePurchaseContractTermsItemSchema.optional()),
269
+ CreatePurchaseContractTermsSchema,
270
+ ])
271
+ .optional(),
172
272
  });
173
273
  export { CreatePurchaseBodySchema };
174
274
  //Purchase.estimate
@@ -218,6 +318,15 @@ const EstimatePurchaseBillingAddressSchema = z.object({
218
318
  .enum(['not_validated', 'valid', 'partially_valid', 'invalid'])
219
319
  .optional(),
220
320
  });
321
+ const EstimatePurchasePurchaseItemsItemSchema = z.object({
322
+ index: z.number().int().min(0),
323
+ item_price_id: z.string().max(100),
324
+ quantity: z.number().int().min(1).optional(),
325
+ unit_amount: z.number().int().min(0).optional(),
326
+ unit_amount_in_decimal: z.string().max(39).optional(),
327
+ quantity_in_decimal: z.string().max(33).optional(),
328
+ trial_end: z.number().int().optional(),
329
+ });
221
330
  const EstimatePurchasePurchaseItemsSchema = z.object({
222
331
  index: z.array(z.number().int().min(0).optional()),
223
332
  item_price_id: z.array(z.string().max(100).optional()),
@@ -225,6 +334,17 @@ const EstimatePurchasePurchaseItemsSchema = z.object({
225
334
  unit_amount: z.array(z.number().int().min(0).optional()).optional(),
226
335
  unit_amount_in_decimal: z.array(z.string().max(39).optional()).optional(),
227
336
  quantity_in_decimal: z.array(z.string().max(33).optional()).optional(),
337
+ trial_end: z.array(z.number().int().optional()).optional(),
338
+ });
339
+ const EstimatePurchaseItemTiersItemSchema = z.object({
340
+ index: z.number().int().min(0),
341
+ item_price_id: z.string().max(100).optional(),
342
+ starting_unit: z.number().int().min(1).optional(),
343
+ ending_unit: z.number().int().optional(),
344
+ price: z.number().int().min(0).optional(),
345
+ starting_unit_in_decimal: z.string().max(33).optional(),
346
+ ending_unit_in_decimal: z.string().max(33).optional(),
347
+ price_in_decimal: z.string().max(39).optional(),
228
348
  });
229
349
  const EstimatePurchaseItemTiersSchema = z.object({
230
350
  index: z.array(z.number().int().min(0).optional()),
@@ -236,6 +356,24 @@ const EstimatePurchaseItemTiersSchema = z.object({
236
356
  ending_unit_in_decimal: z.array(z.string().max(33).optional()).optional(),
237
357
  price_in_decimal: z.array(z.string().max(39).optional()).optional(),
238
358
  });
359
+ const EstimatePurchaseShippingAddressesItemSchema = z.object({
360
+ first_name: z.string().max(150).optional(),
361
+ last_name: z.string().max(150).optional(),
362
+ email: z.string().email().max(70).optional(),
363
+ company: z.string().max(250).optional(),
364
+ phone: z.string().max(50).optional(),
365
+ line1: z.string().max(150).optional(),
366
+ line2: z.string().max(150).optional(),
367
+ line3: z.string().max(150).optional(),
368
+ city: z.string().max(50).optional(),
369
+ state: z.string().max(50).optional(),
370
+ state_code: z.string().max(50).optional(),
371
+ country: z.string().max(50).optional(),
372
+ zip: z.string().max(20).optional(),
373
+ validation_status: z
374
+ .enum(['not_validated', 'valid', 'partially_valid', 'invalid'])
375
+ .optional(),
376
+ });
239
377
  const EstimatePurchaseShippingAddressesSchema = z.object({
240
378
  first_name: z.array(z.string().max(150).optional()).optional(),
241
379
  last_name: z.array(z.string().max(150).optional()).optional(),
@@ -256,6 +394,14 @@ const EstimatePurchaseShippingAddressesSchema = z.object({
256
394
  .optional())
257
395
  .optional(),
258
396
  });
397
+ const EstimatePurchaseDiscountsItemSchema = z.object({
398
+ index: z.number().int().min(0).optional(),
399
+ coupon_id: z.string().max(100).optional(),
400
+ percentage: z.number().min(0.01).max(100).optional(),
401
+ quantity: z.number().int().min(1).optional(),
402
+ amount: z.number().int().min(0).optional(),
403
+ included_in_mrr: z.boolean().optional(),
404
+ });
259
405
  const EstimatePurchaseDiscountsSchema = z.object({
260
406
  index: z.array(z.number().int().min(0).optional()).optional(),
261
407
  coupon_id: z.array(z.string().max(100).optional()).optional(),
@@ -264,6 +410,19 @@ const EstimatePurchaseDiscountsSchema = z.object({
264
410
  amount: z.array(z.number().int().min(0).optional()).optional(),
265
411
  included_in_mrr: z.array(z.boolean().optional()).optional(),
266
412
  });
413
+ const EstimatePurchaseSubscriptionInfoItemSchema = z.object({
414
+ index: z.number().int().min(0),
415
+ subscription_id: z.string().max(50).optional(),
416
+ billing_cycles: z.number().int().min(0).optional(),
417
+ contract_term_billing_cycle_on_renewal: z
418
+ .number()
419
+ .int()
420
+ .min(1)
421
+ .max(100)
422
+ .optional(),
423
+ trial_end: z.number().int().optional(),
424
+ start_date: z.number().int().optional(),
425
+ });
267
426
  const EstimatePurchaseSubscriptionInfoSchema = z.object({
268
427
  index: z.array(z.number().int().min(0).optional()),
269
428
  subscription_id: z.array(z.string().max(50).optional()).optional(),
@@ -271,6 +430,15 @@ const EstimatePurchaseSubscriptionInfoSchema = z.object({
271
430
  contract_term_billing_cycle_on_renewal: z
272
431
  .array(z.number().int().min(1).max(100).optional())
273
432
  .optional(),
433
+ trial_end: z.array(z.number().int().optional()).optional(),
434
+ start_date: z.array(z.number().int().optional()).optional(),
435
+ });
436
+ const EstimatePurchaseContractTermsItemSchema = z.object({
437
+ index: z.number().int().min(0),
438
+ action_at_term_end: z
439
+ .enum(['renew', 'evergreen', 'cancel', 'renew_once'])
440
+ .optional(),
441
+ cancellation_cutoff_period: z.number().int().optional(),
274
442
  });
275
443
  const EstimatePurchaseContractTermsSchema = z.object({
276
444
  index: z.array(z.number().int().min(0).optional()),
@@ -284,11 +452,41 @@ const EstimatePurchaseBodySchema = z.looseObject({
284
452
  customer_id: z.string().max(50).optional(),
285
453
  customer: EstimatePurchaseCustomerSchema.optional(),
286
454
  billing_address: EstimatePurchaseBillingAddressSchema.optional(),
287
- purchase_items: EstimatePurchasePurchaseItemsSchema.optional(),
288
- item_tiers: EstimatePurchaseItemTiersSchema.optional(),
289
- shipping_addresses: EstimatePurchaseShippingAddressesSchema.optional(),
290
- discounts: EstimatePurchaseDiscountsSchema.optional(),
291
- subscription_info: EstimatePurchaseSubscriptionInfoSchema.optional(),
292
- contract_terms: EstimatePurchaseContractTermsSchema.optional(),
455
+ purchase_items: z
456
+ .union([
457
+ z.array(EstimatePurchasePurchaseItemsItemSchema.optional()),
458
+ EstimatePurchasePurchaseItemsSchema,
459
+ ])
460
+ .optional(),
461
+ item_tiers: z
462
+ .union([
463
+ z.array(EstimatePurchaseItemTiersItemSchema.optional()),
464
+ EstimatePurchaseItemTiersSchema,
465
+ ])
466
+ .optional(),
467
+ shipping_addresses: z
468
+ .union([
469
+ z.array(EstimatePurchaseShippingAddressesItemSchema.optional()),
470
+ EstimatePurchaseShippingAddressesSchema,
471
+ ])
472
+ .optional(),
473
+ discounts: z
474
+ .union([
475
+ z.array(EstimatePurchaseDiscountsItemSchema.optional()),
476
+ EstimatePurchaseDiscountsSchema,
477
+ ])
478
+ .optional(),
479
+ subscription_info: z
480
+ .union([
481
+ z.array(EstimatePurchaseSubscriptionInfoItemSchema.optional()),
482
+ EstimatePurchaseSubscriptionInfoSchema,
483
+ ])
484
+ .optional(),
485
+ contract_terms: z
486
+ .union([
487
+ z.array(EstimatePurchaseContractTermsItemSchema.optional()),
488
+ EstimatePurchaseContractTermsSchema,
489
+ ])
490
+ .optional(),
293
491
  });
294
492
  export { EstimatePurchaseBodySchema };