chargebee 3.24.0 → 3.25.0-beta.1

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 (147) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +39 -0
  3. package/cjs/RequestWrapper.js +27 -0
  4. package/cjs/chargebee.cjs.js +3 -0
  5. package/cjs/chargebee.cjs.worker.js +2 -0
  6. package/cjs/chargebeeZodValidationError.js +18 -0
  7. package/cjs/createChargebee.js +5 -0
  8. package/cjs/environment.js +1 -1
  9. package/cjs/schema/addon.schema.js +153 -0
  10. package/cjs/schema/address.schema.js +35 -0
  11. package/cjs/schema/alert.schema.js +38 -0
  12. package/cjs/schema/attached_item.schema.js +58 -0
  13. package/cjs/schema/business_entity.schema.js +46 -0
  14. package/cjs/schema/card.schema.js +165 -0
  15. package/cjs/schema/comment.schema.js +69 -0
  16. package/cjs/schema/coupon.schema.js +209 -0
  17. package/cjs/schema/coupon_code.schema.js +14 -0
  18. package/cjs/schema/coupon_set.schema.js +28 -0
  19. package/cjs/schema/credit_note.schema.js +288 -0
  20. package/cjs/schema/currency.schema.js +32 -0
  21. package/cjs/schema/customer.schema.js +986 -0
  22. package/cjs/schema/customer_entitlement.schema.js +14 -0
  23. package/cjs/schema/differential_price.schema.js +68 -0
  24. package/cjs/schema/entitlement.schema.js +27 -0
  25. package/cjs/schema/entitlement_override.schema.js +33 -0
  26. package/cjs/schema/estimate.schema.js +1525 -0
  27. package/cjs/schema/export.schema.js +1545 -0
  28. package/cjs/schema/feature.schema.js +37 -0
  29. package/cjs/schema/gift.schema.js +277 -0
  30. package/cjs/schema/hosted_page.schema.js +1649 -0
  31. package/cjs/schema/in_app_subscription.schema.js +68 -0
  32. package/cjs/schema/index.js +80 -0
  33. package/cjs/schema/invoice.schema.js +1467 -0
  34. package/cjs/schema/item.schema.js +91 -0
  35. package/cjs/schema/item_entitlement.schema.js +45 -0
  36. package/cjs/schema/item_family.schema.js +21 -0
  37. package/cjs/schema/item_price.schema.js +190 -0
  38. package/cjs/schema/non_subscription.schema.js +28 -0
  39. package/cjs/schema/offer_event.schema.js +13 -0
  40. package/cjs/schema/offer_fulfillment.schema.js +20 -0
  41. package/cjs/schema/omnichannel_one_time_order.schema.js +26 -0
  42. package/cjs/schema/omnichannel_subscription.schema.js +89 -0
  43. package/cjs/schema/omnichannel_subscription_item.schema.js +13 -0
  44. package/cjs/schema/order.schema.js +273 -0
  45. package/cjs/schema/payment_intent.schema.js +117 -0
  46. package/cjs/schema/payment_schedule_scheme.schema.js +20 -0
  47. package/cjs/schema/payment_source.schema.js +358 -0
  48. package/cjs/schema/payment_voucher.schema.js +57 -0
  49. package/cjs/schema/personalized_offer.schema.js +28 -0
  50. package/cjs/schema/plan.schema.js +225 -0
  51. package/cjs/schema/portal_session.schema.js +22 -0
  52. package/cjs/schema/price_variant.schema.js +36 -0
  53. package/cjs/schema/pricing_page_session.schema.js +135 -0
  54. package/cjs/schema/promotional_credit.schema.js +78 -0
  55. package/cjs/schema/purchase.schema.js +272 -0
  56. package/cjs/schema/quote.schema.js +1557 -0
  57. package/cjs/schema/ramp.schema.js +209 -0
  58. package/cjs/schema/recorded_purchase.schema.js +32 -0
  59. package/cjs/schema/resource_migration.schema.js +14 -0
  60. package/cjs/schema/site_migration_detail.schema.js +81 -0
  61. package/cjs/schema/subscription.schema.js +2993 -0
  62. package/cjs/schema/subscription_entitlement.schema.js +25 -0
  63. package/cjs/schema/time_machine.schema.js +17 -0
  64. package/cjs/schema/transaction.schema.js +70 -0
  65. package/cjs/schema/unbilled_charge.schema.js +113 -0
  66. package/cjs/schema/usage.schema.js +93 -0
  67. package/cjs/schema/usage_charge.schema.js +17 -0
  68. package/cjs/schema/usage_event.schema.js +28 -0
  69. package/cjs/schema/usage_file.schema.js +13 -0
  70. package/cjs/schema/usage_summary.schema.js +17 -0
  71. package/cjs/schema/virtual_bank_account.schema.js +43 -0
  72. package/cjs/schema/webhook_endpoint.schema.js +504 -0
  73. package/cjs/validationLoader.js +59 -0
  74. package/esm/RequestWrapper.js +27 -0
  75. package/esm/chargebee.esm.js +2 -0
  76. package/esm/chargebee.esm.worker.js +1 -0
  77. package/esm/chargebeeZodValidationError.js +14 -0
  78. package/esm/createChargebee.js +5 -0
  79. package/esm/environment.js +1 -1
  80. package/esm/schema/addon.schema.js +150 -0
  81. package/esm/schema/address.schema.js +32 -0
  82. package/esm/schema/alert.schema.js +35 -0
  83. package/esm/schema/attached_item.schema.js +55 -0
  84. package/esm/schema/business_entity.schema.js +43 -0
  85. package/esm/schema/card.schema.js +162 -0
  86. package/esm/schema/comment.schema.js +66 -0
  87. package/esm/schema/coupon.schema.js +206 -0
  88. package/esm/schema/coupon_code.schema.js +11 -0
  89. package/esm/schema/coupon_set.schema.js +25 -0
  90. package/esm/schema/credit_note.schema.js +285 -0
  91. package/esm/schema/currency.schema.js +29 -0
  92. package/esm/schema/customer.schema.js +983 -0
  93. package/esm/schema/customer_entitlement.schema.js +11 -0
  94. package/esm/schema/differential_price.schema.js +65 -0
  95. package/esm/schema/entitlement.schema.js +24 -0
  96. package/esm/schema/entitlement_override.schema.js +30 -0
  97. package/esm/schema/estimate.schema.js +1522 -0
  98. package/esm/schema/export.schema.js +1542 -0
  99. package/esm/schema/feature.schema.js +34 -0
  100. package/esm/schema/gift.schema.js +274 -0
  101. package/esm/schema/hosted_page.schema.js +1646 -0
  102. package/esm/schema/in_app_subscription.schema.js +65 -0
  103. package/esm/schema/index.js +64 -0
  104. package/esm/schema/invoice.schema.js +1464 -0
  105. package/esm/schema/item.schema.js +88 -0
  106. package/esm/schema/item_entitlement.schema.js +42 -0
  107. package/esm/schema/item_family.schema.js +18 -0
  108. package/esm/schema/item_price.schema.js +187 -0
  109. package/esm/schema/non_subscription.schema.js +25 -0
  110. package/esm/schema/offer_event.schema.js +10 -0
  111. package/esm/schema/offer_fulfillment.schema.js +17 -0
  112. package/esm/schema/omnichannel_one_time_order.schema.js +23 -0
  113. package/esm/schema/omnichannel_subscription.schema.js +86 -0
  114. package/esm/schema/omnichannel_subscription_item.schema.js +10 -0
  115. package/esm/schema/order.schema.js +270 -0
  116. package/esm/schema/payment_intent.schema.js +114 -0
  117. package/esm/schema/payment_schedule_scheme.schema.js +17 -0
  118. package/esm/schema/payment_source.schema.js +355 -0
  119. package/esm/schema/payment_voucher.schema.js +54 -0
  120. package/esm/schema/personalized_offer.schema.js +25 -0
  121. package/esm/schema/plan.schema.js +222 -0
  122. package/esm/schema/portal_session.schema.js +19 -0
  123. package/esm/schema/price_variant.schema.js +33 -0
  124. package/esm/schema/pricing_page_session.schema.js +132 -0
  125. package/esm/schema/promotional_credit.schema.js +75 -0
  126. package/esm/schema/purchase.schema.js +269 -0
  127. package/esm/schema/quote.schema.js +1554 -0
  128. package/esm/schema/ramp.schema.js +206 -0
  129. package/esm/schema/recorded_purchase.schema.js +29 -0
  130. package/esm/schema/resource_migration.schema.js +11 -0
  131. package/esm/schema/site_migration_detail.schema.js +78 -0
  132. package/esm/schema/subscription.schema.js +2990 -0
  133. package/esm/schema/subscription_entitlement.schema.js +22 -0
  134. package/esm/schema/time_machine.schema.js +14 -0
  135. package/esm/schema/transaction.schema.js +67 -0
  136. package/esm/schema/unbilled_charge.schema.js +110 -0
  137. package/esm/schema/usage.schema.js +90 -0
  138. package/esm/schema/usage_charge.schema.js +14 -0
  139. package/esm/schema/usage_event.schema.js +25 -0
  140. package/esm/schema/usage_file.schema.js +10 -0
  141. package/esm/schema/usage_summary.schema.js +14 -0
  142. package/esm/schema/virtual_bank_account.schema.js +40 -0
  143. package/esm/schema/webhook_endpoint.schema.js +501 -0
  144. package/esm/validationLoader.js +56 -0
  145. package/package.json +4 -1
  146. package/types/core.d.ts +2 -0
  147. package/types/index.d.ts +16 -0
@@ -0,0 +1,1522 @@
1
+ // Generated Zod schemas: Estimate
2
+ // Actions: createSubscription, createSubItemEstimate, createSubForCustomerEstimate, createSubItemForCustomerEstimate, updateSubscription, updateSubscriptionForItems, renewalEstimate, advanceInvoiceEstimate, regenerateInvoiceEstimate, upcomingInvoicesEstimate, changeTermEnd, cancelSubscription, cancelSubscriptionForItems, pauseSubscription, resumeSubscription, giftSubscription, giftSubscriptionForItems, createInvoice, createInvoiceForItems, paymentSchedules
3
+ // Do not edit manually – regenerate via sdk-generator
4
+ import { z } from 'zod';
5
+ //Estimate.createSubscription
6
+ const CreateSubscriptionEstimateSubscriptionSchema = z.object({
7
+ id: z.string().max(50).optional(),
8
+ plan_id: z.string().max(100),
9
+ plan_quantity: z.number().int().min(1).optional(),
10
+ plan_quantity_in_decimal: z.string().max(33).optional(),
11
+ plan_unit_price: z.number().int().min(0).optional(),
12
+ plan_unit_price_in_decimal: z.string().max(39).optional(),
13
+ setup_fee: z.number().int().min(0).optional(),
14
+ trial_end: z.number().int().optional(),
15
+ start_date: z.number().int().optional(),
16
+ coupon: z.string().max(100).optional(),
17
+ offline_payment_method: z
18
+ .enum([
19
+ 'no_preference',
20
+ 'cash',
21
+ 'check',
22
+ 'bank_transfer',
23
+ 'ach_credit',
24
+ 'sepa_credit',
25
+ 'boleto',
26
+ 'us_automated_bank_transfer',
27
+ 'eu_automated_bank_transfer',
28
+ 'uk_automated_bank_transfer',
29
+ 'jp_automated_bank_transfer',
30
+ 'mx_automated_bank_transfer',
31
+ 'custom',
32
+ ])
33
+ .optional(),
34
+ free_period: z.number().int().min(1).optional(),
35
+ free_period_unit: z.enum(['day', 'week', 'month', 'year']).optional(),
36
+ contract_term_billing_cycle_on_renewal: z
37
+ .number()
38
+ .int()
39
+ .min(1)
40
+ .max(100)
41
+ .optional(),
42
+ trial_end_action: z
43
+ .enum([
44
+ 'site_default',
45
+ 'plan_default',
46
+ 'activate_subscription',
47
+ 'cancel_subscription',
48
+ ])
49
+ .optional(),
50
+ });
51
+ const CreateSubscriptionEstimateBillingAddressSchema = z.object({
52
+ line1: z.string().max(150).optional(),
53
+ line2: z.string().max(150).optional(),
54
+ line3: z.string().max(150).optional(),
55
+ city: z.string().max(50).optional(),
56
+ state_code: z.string().max(50).optional(),
57
+ zip: z.string().max(20).optional(),
58
+ country: z.string().max(50).optional(),
59
+ validation_status: z
60
+ .enum(['not_validated', 'valid', 'partially_valid', 'invalid'])
61
+ .optional(),
62
+ });
63
+ const CreateSubscriptionEstimateShippingAddressSchema = z.object({
64
+ line1: z.string().max(150).optional(),
65
+ line2: z.string().max(150).optional(),
66
+ line3: z.string().max(150).optional(),
67
+ city: z.string().max(50).optional(),
68
+ state_code: z.string().max(50).optional(),
69
+ zip: z.string().max(20).optional(),
70
+ country: z.string().max(50).optional(),
71
+ validation_status: z
72
+ .enum(['not_validated', 'valid', 'partially_valid', 'invalid'])
73
+ .optional(),
74
+ });
75
+ const CreateSubscriptionEstimateCustomerSchema = z.object({
76
+ vat_number: z.string().max(20).optional(),
77
+ vat_number_prefix: z.string().max(10).optional(),
78
+ registered_for_gst: z.boolean().optional(),
79
+ taxability: z.enum(['taxable', 'exempt']).optional(),
80
+ entity_code: z
81
+ .enum([
82
+ 'a',
83
+ 'b',
84
+ 'c',
85
+ 'd',
86
+ 'e',
87
+ 'f',
88
+ 'g',
89
+ 'h',
90
+ 'i',
91
+ 'j',
92
+ 'k',
93
+ 'l',
94
+ 'm',
95
+ 'n',
96
+ 'p',
97
+ 'q',
98
+ 'r',
99
+ 'med1',
100
+ 'med2',
101
+ ])
102
+ .optional(),
103
+ exempt_number: z.string().max(100).optional(),
104
+ exemption_details: z.array(z.string().optional()).optional(),
105
+ customer_type: z
106
+ .enum(['residential', 'business', 'senior_citizen', 'industrial'])
107
+ .optional(),
108
+ });
109
+ const CreateSubscriptionEstimateContractTermSchema = z.object({
110
+ action_at_term_end: z.enum(['renew', 'evergreen', 'cancel']).optional(),
111
+ cancellation_cutoff_period: z.number().int().optional(),
112
+ });
113
+ const CreateSubscriptionEstimateAddonsSchema = z.object({
114
+ id: z.array(z.string().max(100).optional()).optional(),
115
+ quantity: z.array(z.number().int().min(1).optional()).optional(),
116
+ quantity_in_decimal: z.array(z.string().max(33).optional()).optional(),
117
+ unit_price: z.array(z.number().int().min(0).optional()).optional(),
118
+ unit_price_in_decimal: z.array(z.string().max(39).optional()).optional(),
119
+ billing_cycles: z.array(z.number().int().min(0).optional()).optional(),
120
+ trial_end: z.array(z.number().int().optional()).optional(),
121
+ });
122
+ const CreateSubscriptionEstimateEventBasedAddonsSchema = z.object({
123
+ id: z.array(z.string().max(100).optional()).optional(),
124
+ quantity: z.array(z.number().int().min(1).optional()).optional(),
125
+ unit_price: z.array(z.number().int().min(0).optional()).optional(),
126
+ quantity_in_decimal: z.array(z.string().max(33).optional()).optional(),
127
+ unit_price_in_decimal: z.array(z.string().max(39).optional()).optional(),
128
+ service_period_in_days: z
129
+ .array(z.number().int().min(1).max(4000).optional())
130
+ .optional(),
131
+ on_event: z
132
+ .array(z
133
+ .enum([
134
+ 'subscription_creation',
135
+ 'subscription_trial_start',
136
+ 'plan_activation',
137
+ 'subscription_activation',
138
+ 'contract_termination',
139
+ ])
140
+ .optional())
141
+ .optional(),
142
+ charge_once: z.array(z.boolean().default(true).optional()).optional(),
143
+ charge_on: z.array(z.enum(['immediately', 'on_event']).optional()).optional(),
144
+ });
145
+ const CreateSubscriptionEstimateTaxProvidersFieldsSchema = z.object({
146
+ provider_name: z.array(z.string().max(50).optional()).optional(),
147
+ field_id: z.array(z.string().max(50).optional()).optional(),
148
+ field_value: z.array(z.string().max(50).optional()).optional(),
149
+ });
150
+ const CreateSubscriptionEstimateBodySchema = z.looseObject({
151
+ billing_cycles: z.number().int().min(0).optional(),
152
+ mandatory_addons_to_remove: z
153
+ .array(z.string().max(100).optional())
154
+ .optional(),
155
+ terms_to_charge: z.number().int().min(1).optional(),
156
+ billing_alignment_mode: z.enum(['immediate', 'delayed']).optional(),
157
+ coupon_ids: z.array(z.string().max(100).optional()).optional(),
158
+ invoice_immediately: z.boolean().optional(),
159
+ invoice_date: z.number().int().optional(),
160
+ client_profile_id: z.string().max(50).optional(),
161
+ subscription: CreateSubscriptionEstimateSubscriptionSchema.optional(),
162
+ billing_address: CreateSubscriptionEstimateBillingAddressSchema.optional(),
163
+ shipping_address: CreateSubscriptionEstimateShippingAddressSchema.optional(),
164
+ customer: CreateSubscriptionEstimateCustomerSchema.optional(),
165
+ contract_term: CreateSubscriptionEstimateContractTermSchema.optional(),
166
+ addons: CreateSubscriptionEstimateAddonsSchema.optional(),
167
+ event_based_addons: CreateSubscriptionEstimateEventBasedAddonsSchema.optional(),
168
+ tax_providers_fields: CreateSubscriptionEstimateTaxProvidersFieldsSchema.optional(),
169
+ });
170
+ export { CreateSubscriptionEstimateBodySchema };
171
+ //Estimate.createSubItemEstimate
172
+ const CreateSubItemEstimateEstimateSubscriptionSchema = z.object({
173
+ id: z.string().max(50).optional(),
174
+ trial_end: z.number().int().optional(),
175
+ setup_fee: z.number().int().min(0).optional(),
176
+ start_date: z.number().int().optional(),
177
+ coupon: z.string().max(100).optional(),
178
+ offline_payment_method: z
179
+ .enum([
180
+ 'no_preference',
181
+ 'cash',
182
+ 'check',
183
+ 'bank_transfer',
184
+ 'ach_credit',
185
+ 'sepa_credit',
186
+ 'boleto',
187
+ 'us_automated_bank_transfer',
188
+ 'eu_automated_bank_transfer',
189
+ 'uk_automated_bank_transfer',
190
+ 'jp_automated_bank_transfer',
191
+ 'mx_automated_bank_transfer',
192
+ 'custom',
193
+ ])
194
+ .optional(),
195
+ free_period: z.number().int().min(1).optional(),
196
+ free_period_unit: z.enum(['day', 'week', 'month', 'year']).optional(),
197
+ contract_term_billing_cycle_on_renewal: z
198
+ .number()
199
+ .int()
200
+ .min(1)
201
+ .max(100)
202
+ .optional(),
203
+ trial_end_action: z
204
+ .enum([
205
+ 'site_default',
206
+ 'plan_default',
207
+ 'activate_subscription',
208
+ 'cancel_subscription',
209
+ ])
210
+ .optional(),
211
+ });
212
+ const CreateSubItemEstimateEstimateBillingAddressSchema = z.object({
213
+ line1: z.string().max(150).optional(),
214
+ line2: z.string().max(150).optional(),
215
+ line3: z.string().max(150).optional(),
216
+ city: z.string().max(50).optional(),
217
+ state_code: z.string().max(50).optional(),
218
+ zip: z.string().max(20).optional(),
219
+ country: z.string().max(50).optional(),
220
+ validation_status: z
221
+ .enum(['not_validated', 'valid', 'partially_valid', 'invalid'])
222
+ .optional(),
223
+ });
224
+ const CreateSubItemEstimateEstimateShippingAddressSchema = z.object({
225
+ line1: z.string().max(150).optional(),
226
+ line2: z.string().max(150).optional(),
227
+ line3: z.string().max(150).optional(),
228
+ city: z.string().max(50).optional(),
229
+ state_code: z.string().max(50).optional(),
230
+ zip: z.string().max(20).optional(),
231
+ country: z.string().max(50).optional(),
232
+ validation_status: z
233
+ .enum(['not_validated', 'valid', 'partially_valid', 'invalid'])
234
+ .optional(),
235
+ });
236
+ const CreateSubItemEstimateEstimateCustomerSchema = z.object({
237
+ vat_number: z.string().max(20).optional(),
238
+ vat_number_prefix: z.string().max(10).optional(),
239
+ registered_for_gst: z.boolean().optional(),
240
+ taxability: z.enum(['taxable', 'exempt']).optional(),
241
+ entity_code: z
242
+ .enum([
243
+ 'a',
244
+ 'b',
245
+ 'c',
246
+ 'd',
247
+ 'e',
248
+ 'f',
249
+ 'g',
250
+ 'h',
251
+ 'i',
252
+ 'j',
253
+ 'k',
254
+ 'l',
255
+ 'm',
256
+ 'n',
257
+ 'p',
258
+ 'q',
259
+ 'r',
260
+ 'med1',
261
+ 'med2',
262
+ ])
263
+ .optional(),
264
+ exempt_number: z.string().max(100).optional(),
265
+ exemption_details: z.array(z.string().optional()).optional(),
266
+ customer_type: z
267
+ .enum(['residential', 'business', 'senior_citizen', 'industrial'])
268
+ .optional(),
269
+ });
270
+ const CreateSubItemEstimateEstimateContractTermSchema = z.object({
271
+ action_at_term_end: z.enum(['renew', 'evergreen', 'cancel']).optional(),
272
+ contract_start: z.number().int().optional(),
273
+ cancellation_cutoff_period: z.number().int().optional(),
274
+ });
275
+ const CreateSubItemEstimateEstimateSubscriptionItemsSchema = z.object({
276
+ item_price_id: z.array(z.string().max(100).optional()),
277
+ quantity: z.array(z.number().int().min(1).optional()).optional(),
278
+ quantity_in_decimal: z.array(z.string().max(33).optional()).optional(),
279
+ unit_price: z.array(z.number().int().min(0).optional()).optional(),
280
+ unit_price_in_decimal: z.array(z.string().max(39).optional()).optional(),
281
+ billing_cycles: z.array(z.number().int().min(0).optional()).optional(),
282
+ trial_end: z.array(z.number().int().optional()).optional(),
283
+ service_period_days: z
284
+ .array(z.number().int().min(1).max(730).optional())
285
+ .optional(),
286
+ charge_on_event: z
287
+ .array(z
288
+ .enum([
289
+ 'subscription_creation',
290
+ 'subscription_trial_start',
291
+ 'plan_activation',
292
+ 'subscription_activation',
293
+ 'contract_termination',
294
+ ])
295
+ .optional())
296
+ .optional(),
297
+ charge_once: z.array(z.boolean().optional()).optional(),
298
+ item_type: z.array(z.enum(['plan', 'addon', 'charge']).optional()).optional(),
299
+ charge_on_option: z
300
+ .array(z.enum(['immediately', 'on_event']).optional())
301
+ .optional(),
302
+ });
303
+ const CreateSubItemEstimateEstimateDiscountsSchema = z.object({
304
+ apply_on: z
305
+ .array(z.enum(['invoice_amount', 'specific_item_price']).optional())
306
+ .optional(),
307
+ duration_type: z.array(z.enum(['one_time', 'forever', 'limited_period']).optional()),
308
+ percentage: z.array(z.number().min(0.01).max(100).optional()).optional(),
309
+ amount: z.array(z.number().int().min(0).optional()).optional(),
310
+ period: z.array(z.number().int().min(1).optional()).optional(),
311
+ period_unit: z
312
+ .array(z.enum(['day', 'week', 'month', 'year']).optional())
313
+ .optional(),
314
+ included_in_mrr: z.array(z.boolean().optional()).optional(),
315
+ item_price_id: z.array(z.string().max(100).optional()).optional(),
316
+ quantity: z.array(z.number().int().min(1).optional()).optional(),
317
+ });
318
+ const CreateSubItemEstimateEstimateItemTiersSchema = z.object({
319
+ item_price_id: z.array(z.string().max(100).optional()).optional(),
320
+ starting_unit: z.array(z.number().int().min(1).optional()).optional(),
321
+ ending_unit: z.array(z.number().int().optional()).optional(),
322
+ price: z.array(z.number().int().min(0).optional()).optional(),
323
+ starting_unit_in_decimal: z.array(z.string().max(33).optional()).optional(),
324
+ ending_unit_in_decimal: z.array(z.string().max(33).optional()).optional(),
325
+ price_in_decimal: z.array(z.string().max(39).optional()).optional(),
326
+ pricing_type: z
327
+ .array(z.enum(['per_unit', 'flat_fee', 'package']).optional())
328
+ .optional(),
329
+ package_size: z.array(z.number().int().min(1).optional()).optional(),
330
+ });
331
+ const CreateSubItemEstimateEstimateTaxProvidersFieldsSchema = z.object({
332
+ provider_name: z.array(z.string().max(50).optional()).optional(),
333
+ field_id: z.array(z.string().max(50).optional()).optional(),
334
+ field_value: z.array(z.string().max(50).optional()).optional(),
335
+ });
336
+ const CreateSubItemEstimateEstimateBodySchema = z.looseObject({
337
+ billing_cycles: z.number().int().min(0).optional(),
338
+ mandatory_items_to_remove: z.array(z.string().max(100).optional()).optional(),
339
+ terms_to_charge: z.number().int().min(1).optional(),
340
+ billing_alignment_mode: z.enum(['immediate', 'delayed']).optional(),
341
+ coupon_ids: z.array(z.string().max(100).optional()).optional(),
342
+ invoice_immediately: z.boolean().optional(),
343
+ invoice_date: z.number().int().optional(),
344
+ client_profile_id: z.string().max(50).optional(),
345
+ subscription: CreateSubItemEstimateEstimateSubscriptionSchema.optional(),
346
+ billing_address: CreateSubItemEstimateEstimateBillingAddressSchema.optional(),
347
+ shipping_address: CreateSubItemEstimateEstimateShippingAddressSchema.optional(),
348
+ customer: CreateSubItemEstimateEstimateCustomerSchema.optional(),
349
+ contract_term: CreateSubItemEstimateEstimateContractTermSchema.optional(),
350
+ subscription_items: CreateSubItemEstimateEstimateSubscriptionItemsSchema.optional(),
351
+ discounts: CreateSubItemEstimateEstimateDiscountsSchema.optional(),
352
+ item_tiers: CreateSubItemEstimateEstimateItemTiersSchema.optional(),
353
+ tax_providers_fields: CreateSubItemEstimateEstimateTaxProvidersFieldsSchema.optional(),
354
+ });
355
+ export { CreateSubItemEstimateEstimateBodySchema };
356
+ //Estimate.createSubForCustomerEstimate
357
+ const CreateSubForCustomerEstimateEstimateSubscriptionSchema = z.object({
358
+ id: z.string().max(50).optional(),
359
+ plan_id: z.string().max(100),
360
+ plan_quantity: z.number().int().min(1).optional(),
361
+ plan_quantity_in_decimal: z.string().max(33).optional(),
362
+ plan_unit_price: z.number().int().min(0).optional(),
363
+ plan_unit_price_in_decimal: z.string().max(39).optional(),
364
+ setup_fee: z.number().int().min(0).optional(),
365
+ trial_end: z.number().int().optional(),
366
+ start_date: z.number().int().optional(),
367
+ offline_payment_method: z
368
+ .enum([
369
+ 'no_preference',
370
+ 'cash',
371
+ 'check',
372
+ 'bank_transfer',
373
+ 'ach_credit',
374
+ 'sepa_credit',
375
+ 'boleto',
376
+ 'us_automated_bank_transfer',
377
+ 'eu_automated_bank_transfer',
378
+ 'uk_automated_bank_transfer',
379
+ 'jp_automated_bank_transfer',
380
+ 'mx_automated_bank_transfer',
381
+ 'custom',
382
+ ])
383
+ .optional(),
384
+ free_period: z.number().int().min(1).optional(),
385
+ free_period_unit: z.enum(['day', 'week', 'month', 'year']).optional(),
386
+ contract_term_billing_cycle_on_renewal: z
387
+ .number()
388
+ .int()
389
+ .min(1)
390
+ .max(100)
391
+ .optional(),
392
+ trial_end_action: z
393
+ .enum([
394
+ 'site_default',
395
+ 'plan_default',
396
+ 'activate_subscription',
397
+ 'cancel_subscription',
398
+ ])
399
+ .optional(),
400
+ });
401
+ const CreateSubForCustomerEstimateEstimateShippingAddressSchema = z.object({
402
+ line1: z.string().max(150).optional(),
403
+ line2: z.string().max(150).optional(),
404
+ line3: z.string().max(150).optional(),
405
+ city: z.string().max(50).optional(),
406
+ state_code: z.string().max(50).optional(),
407
+ zip: z.string().max(20).optional(),
408
+ country: z.string().max(50).optional(),
409
+ validation_status: z
410
+ .enum(['not_validated', 'valid', 'partially_valid', 'invalid'])
411
+ .optional(),
412
+ });
413
+ const CreateSubForCustomerEstimateEstimateContractTermSchema = z.object({
414
+ action_at_term_end: z.enum(['renew', 'evergreen', 'cancel']).optional(),
415
+ cancellation_cutoff_period: z.number().int().optional(),
416
+ });
417
+ const CreateSubForCustomerEstimateEstimateAddonsSchema = z.object({
418
+ id: z.array(z.string().max(100).optional()).optional(),
419
+ quantity: z.array(z.number().int().min(1).optional()).optional(),
420
+ quantity_in_decimal: z.array(z.string().max(33).optional()).optional(),
421
+ unit_price: z.array(z.number().int().min(0).optional()).optional(),
422
+ unit_price_in_decimal: z.array(z.string().max(39).optional()).optional(),
423
+ billing_cycles: z.array(z.number().int().min(0).optional()).optional(),
424
+ trial_end: z.array(z.number().int().optional()).optional(),
425
+ });
426
+ const CreateSubForCustomerEstimateEstimateEventBasedAddonsSchema = z.object({
427
+ id: z.array(z.string().max(100).optional()).optional(),
428
+ quantity: z.array(z.number().int().min(1).optional()).optional(),
429
+ unit_price: z.array(z.number().int().min(0).optional()).optional(),
430
+ quantity_in_decimal: z.array(z.string().max(33).optional()).optional(),
431
+ unit_price_in_decimal: z.array(z.string().max(39).optional()).optional(),
432
+ service_period_in_days: z
433
+ .array(z.number().int().min(1).max(4000).optional())
434
+ .optional(),
435
+ on_event: z
436
+ .array(z
437
+ .enum([
438
+ 'subscription_creation',
439
+ 'subscription_trial_start',
440
+ 'plan_activation',
441
+ 'subscription_activation',
442
+ 'contract_termination',
443
+ ])
444
+ .optional())
445
+ .optional(),
446
+ charge_once: z.array(z.boolean().default(true).optional()).optional(),
447
+ charge_on: z.array(z.enum(['immediately', 'on_event']).optional()).optional(),
448
+ });
449
+ const CreateSubForCustomerEstimateEstimateBodySchema = z.looseObject({
450
+ use_existing_balances: z.boolean().default(true).optional(),
451
+ invoice_immediately: z.boolean().optional(),
452
+ billing_cycles: z.number().int().min(0).optional(),
453
+ mandatory_addons_to_remove: z
454
+ .array(z.string().max(100).optional())
455
+ .optional(),
456
+ terms_to_charge: z.number().int().min(1).optional(),
457
+ billing_alignment_mode: z.enum(['immediate', 'delayed']).optional(),
458
+ invoice_date: z.number().int().optional(),
459
+ coupon_ids: z.array(z.string().max(100).optional()).optional(),
460
+ subscription: CreateSubForCustomerEstimateEstimateSubscriptionSchema.optional(),
461
+ shipping_address: CreateSubForCustomerEstimateEstimateShippingAddressSchema.optional(),
462
+ contract_term: CreateSubForCustomerEstimateEstimateContractTermSchema.optional(),
463
+ addons: CreateSubForCustomerEstimateEstimateAddonsSchema.optional(),
464
+ event_based_addons: CreateSubForCustomerEstimateEstimateEventBasedAddonsSchema.optional(),
465
+ });
466
+ export { CreateSubForCustomerEstimateEstimateBodySchema };
467
+ //Estimate.createSubItemForCustomerEstimate
468
+ const CreateSubItemForCustomerEstimateEstimateSubscriptionSchema = z.object({
469
+ id: z.string().max(50).optional(),
470
+ trial_end: z.number().int().optional(),
471
+ setup_fee: z.number().int().min(0).optional(),
472
+ start_date: z.number().int().optional(),
473
+ offline_payment_method: z
474
+ .enum([
475
+ 'no_preference',
476
+ 'cash',
477
+ 'check',
478
+ 'bank_transfer',
479
+ 'ach_credit',
480
+ 'sepa_credit',
481
+ 'boleto',
482
+ 'us_automated_bank_transfer',
483
+ 'eu_automated_bank_transfer',
484
+ 'uk_automated_bank_transfer',
485
+ 'jp_automated_bank_transfer',
486
+ 'mx_automated_bank_transfer',
487
+ 'custom',
488
+ ])
489
+ .optional(),
490
+ free_period: z.number().int().min(1).optional(),
491
+ free_period_unit: z.enum(['day', 'week', 'month', 'year']).optional(),
492
+ contract_term_billing_cycle_on_renewal: z
493
+ .number()
494
+ .int()
495
+ .min(1)
496
+ .max(100)
497
+ .optional(),
498
+ trial_end_action: z
499
+ .enum([
500
+ 'site_default',
501
+ 'plan_default',
502
+ 'activate_subscription',
503
+ 'cancel_subscription',
504
+ ])
505
+ .optional(),
506
+ });
507
+ const CreateSubItemForCustomerEstimateEstimateShippingAddressSchema = z.object({
508
+ line1: z.string().max(150).optional(),
509
+ line2: z.string().max(150).optional(),
510
+ line3: z.string().max(150).optional(),
511
+ city: z.string().max(50).optional(),
512
+ state_code: z.string().max(50).optional(),
513
+ zip: z.string().max(20).optional(),
514
+ country: z.string().max(50).optional(),
515
+ validation_status: z
516
+ .enum(['not_validated', 'valid', 'partially_valid', 'invalid'])
517
+ .optional(),
518
+ });
519
+ const CreateSubItemForCustomerEstimateEstimateBillingAddressSchema = z.object({
520
+ line1: z.string().max(150).optional(),
521
+ line2: z.string().max(150).optional(),
522
+ line3: z.string().max(150).optional(),
523
+ city: z.string().max(50).optional(),
524
+ state_code: z.string().max(50).optional(),
525
+ zip: z.string().max(20).optional(),
526
+ country: z.string().max(50).optional(),
527
+ validation_status: z
528
+ .enum(['not_validated', 'valid', 'partially_valid', 'invalid'])
529
+ .optional(),
530
+ });
531
+ const CreateSubItemForCustomerEstimateEstimateContractTermSchema = z.object({
532
+ action_at_term_end: z.enum(['renew', 'evergreen', 'cancel']).optional(),
533
+ contract_start: z.number().int().optional(),
534
+ cancellation_cutoff_period: z.number().int().optional(),
535
+ });
536
+ const CreateSubItemForCustomerEstimateEstimateBillingOverrideSchema = z.object({
537
+ max_excess_payment_usage: z.number().int().min(-1).optional(),
538
+ max_refundable_credits_usage: z.number().int().min(-1).optional(),
539
+ });
540
+ const CreateSubItemForCustomerEstimateEstimateSubscriptionItemsSchema = z.object({
541
+ item_price_id: z.array(z.string().max(100).optional()),
542
+ quantity: z.array(z.number().int().min(1).optional()).optional(),
543
+ quantity_in_decimal: z.array(z.string().max(33).optional()).optional(),
544
+ unit_price: z.array(z.number().int().min(0).optional()).optional(),
545
+ unit_price_in_decimal: z.array(z.string().max(39).optional()).optional(),
546
+ billing_cycles: z.array(z.number().int().min(0).optional()).optional(),
547
+ trial_end: z.array(z.number().int().optional()).optional(),
548
+ service_period_days: z
549
+ .array(z.number().int().min(1).max(730).optional())
550
+ .optional(),
551
+ charge_on_event: z
552
+ .array(z
553
+ .enum([
554
+ 'subscription_creation',
555
+ 'subscription_trial_start',
556
+ 'plan_activation',
557
+ 'subscription_activation',
558
+ 'contract_termination',
559
+ ])
560
+ .optional())
561
+ .optional(),
562
+ charge_once: z.array(z.boolean().optional()).optional(),
563
+ item_type: z
564
+ .array(z.enum(['plan', 'addon', 'charge']).optional())
565
+ .optional(),
566
+ charge_on_option: z
567
+ .array(z.enum(['immediately', 'on_event']).optional())
568
+ .optional(),
569
+ });
570
+ const CreateSubItemForCustomerEstimateEstimateDiscountsSchema = z.object({
571
+ apply_on: z
572
+ .array(z.enum(['invoice_amount', 'specific_item_price']).optional())
573
+ .optional(),
574
+ duration_type: z.array(z.enum(['one_time', 'forever', 'limited_period']).optional()),
575
+ percentage: z.array(z.number().min(0.01).max(100).optional()).optional(),
576
+ amount: z.array(z.number().int().min(0).optional()).optional(),
577
+ period: z.array(z.number().int().min(1).optional()).optional(),
578
+ period_unit: z
579
+ .array(z.enum(['day', 'week', 'month', 'year']).optional())
580
+ .optional(),
581
+ included_in_mrr: z.array(z.boolean().optional()).optional(),
582
+ item_price_id: z.array(z.string().max(100).optional()).optional(),
583
+ quantity: z.array(z.number().int().min(1).optional()).optional(),
584
+ });
585
+ const CreateSubItemForCustomerEstimateEstimateItemTiersSchema = z.object({
586
+ item_price_id: z.array(z.string().max(100).optional()).optional(),
587
+ starting_unit: z.array(z.number().int().min(1).optional()).optional(),
588
+ ending_unit: z.array(z.number().int().optional()).optional(),
589
+ price: z.array(z.number().int().min(0).optional()).optional(),
590
+ starting_unit_in_decimal: z.array(z.string().max(33).optional()).optional(),
591
+ ending_unit_in_decimal: z.array(z.string().max(33).optional()).optional(),
592
+ price_in_decimal: z.array(z.string().max(39).optional()).optional(),
593
+ pricing_type: z
594
+ .array(z.enum(['per_unit', 'flat_fee', 'package']).optional())
595
+ .optional(),
596
+ package_size: z.array(z.number().int().min(1).optional()).optional(),
597
+ });
598
+ const CreateSubItemForCustomerEstimateEstimateBodySchema = z.looseObject({
599
+ use_existing_balances: z.boolean().default(true).optional(),
600
+ invoice_immediately: z.boolean().optional(),
601
+ billing_cycles: z.number().int().min(0).optional(),
602
+ mandatory_items_to_remove: z.array(z.string().max(100).optional()).optional(),
603
+ terms_to_charge: z.number().int().min(1).optional(),
604
+ billing_alignment_mode: z.enum(['immediate', 'delayed']).optional(),
605
+ invoice_date: z.number().int().optional(),
606
+ coupon_ids: z.array(z.string().max(100).optional()).optional(),
607
+ subscription: CreateSubItemForCustomerEstimateEstimateSubscriptionSchema.optional(),
608
+ shipping_address: CreateSubItemForCustomerEstimateEstimateShippingAddressSchema.optional(),
609
+ billing_address: CreateSubItemForCustomerEstimateEstimateBillingAddressSchema.optional(),
610
+ contract_term: CreateSubItemForCustomerEstimateEstimateContractTermSchema.optional(),
611
+ billing_override: CreateSubItemForCustomerEstimateEstimateBillingOverrideSchema.optional(),
612
+ subscription_items: CreateSubItemForCustomerEstimateEstimateSubscriptionItemsSchema.optional(),
613
+ discounts: CreateSubItemForCustomerEstimateEstimateDiscountsSchema.optional(),
614
+ item_tiers: CreateSubItemForCustomerEstimateEstimateItemTiersSchema.optional(),
615
+ });
616
+ export { CreateSubItemForCustomerEstimateEstimateBodySchema };
617
+ //Estimate.updateSubscription
618
+ const UpdateSubscriptionEstimateSubscriptionSchema = z.object({
619
+ id: z.string().max(50),
620
+ plan_id: z.string().max(100).optional(),
621
+ plan_quantity: z.number().int().min(1).optional(),
622
+ plan_unit_price: z.number().int().min(0).optional(),
623
+ setup_fee: z.number().int().min(0).optional(),
624
+ plan_quantity_in_decimal: z.string().max(33).optional(),
625
+ plan_unit_price_in_decimal: z.string().max(39).optional(),
626
+ start_date: z.number().int().optional(),
627
+ trial_end: z.number().int().optional(),
628
+ coupon: z.string().max(100).optional(),
629
+ auto_collection: z.enum(['on', 'off']).optional(),
630
+ offline_payment_method: z
631
+ .enum([
632
+ 'no_preference',
633
+ 'cash',
634
+ 'check',
635
+ 'bank_transfer',
636
+ 'ach_credit',
637
+ 'sepa_credit',
638
+ 'boleto',
639
+ 'us_automated_bank_transfer',
640
+ 'eu_automated_bank_transfer',
641
+ 'uk_automated_bank_transfer',
642
+ 'jp_automated_bank_transfer',
643
+ 'mx_automated_bank_transfer',
644
+ 'custom',
645
+ ])
646
+ .optional(),
647
+ free_period: z.number().int().min(1).optional(),
648
+ free_period_unit: z.enum(['day', 'week', 'month', 'year']).optional(),
649
+ trial_end_action: z
650
+ .enum([
651
+ 'site_default',
652
+ 'plan_default',
653
+ 'activate_subscription',
654
+ 'cancel_subscription',
655
+ ])
656
+ .optional(),
657
+ });
658
+ const UpdateSubscriptionEstimateBillingAddressSchema = z.object({
659
+ line1: z.string().max(150).optional(),
660
+ line2: z.string().max(150).optional(),
661
+ line3: z.string().max(150).optional(),
662
+ city: z.string().max(50).optional(),
663
+ state_code: z.string().max(50).optional(),
664
+ zip: z.string().max(20).optional(),
665
+ country: z.string().max(50).optional(),
666
+ validation_status: z
667
+ .enum(['not_validated', 'valid', 'partially_valid', 'invalid'])
668
+ .optional(),
669
+ });
670
+ const UpdateSubscriptionEstimateShippingAddressSchema = z.object({
671
+ line1: z.string().max(150).optional(),
672
+ line2: z.string().max(150).optional(),
673
+ line3: z.string().max(150).optional(),
674
+ city: z.string().max(50).optional(),
675
+ state_code: z.string().max(50).optional(),
676
+ zip: z.string().max(20).optional(),
677
+ country: z.string().max(50).optional(),
678
+ validation_status: z
679
+ .enum(['not_validated', 'valid', 'partially_valid', 'invalid'])
680
+ .optional(),
681
+ });
682
+ const UpdateSubscriptionEstimateCustomerSchema = z.object({
683
+ vat_number: z.string().max(20).optional(),
684
+ vat_number_prefix: z.string().max(10).optional(),
685
+ registered_for_gst: z.boolean().optional(),
686
+ taxability: z.enum(['taxable', 'exempt']).optional(),
687
+ });
688
+ const UpdateSubscriptionEstimateAddonsSchema = z.object({
689
+ id: z.array(z.string().max(100).optional()).optional(),
690
+ quantity: z.array(z.number().int().min(1).optional()).optional(),
691
+ unit_price: z.array(z.number().int().min(0).optional()).optional(),
692
+ billing_cycles: z.array(z.number().int().min(0).optional()).optional(),
693
+ quantity_in_decimal: z.array(z.string().max(33).optional()).optional(),
694
+ unit_price_in_decimal: z.array(z.string().max(39).optional()).optional(),
695
+ trial_end: z.array(z.number().int().optional()).optional(),
696
+ proration_type: z
697
+ .array(z.enum(['full_term', 'partial_term', 'none']).optional())
698
+ .optional(),
699
+ });
700
+ const UpdateSubscriptionEstimateEventBasedAddonsSchema = z.object({
701
+ id: z.array(z.string().max(100).optional()).optional(),
702
+ quantity: z.array(z.number().int().min(1).optional()).optional(),
703
+ unit_price: z.array(z.number().int().min(0).optional()).optional(),
704
+ service_period_in_days: z
705
+ .array(z.number().int().min(1).max(4000).optional())
706
+ .optional(),
707
+ charge_on: z.array(z.enum(['immediately', 'on_event']).optional()).optional(),
708
+ on_event: z
709
+ .array(z
710
+ .enum([
711
+ 'subscription_creation',
712
+ 'subscription_trial_start',
713
+ 'plan_activation',
714
+ 'subscription_activation',
715
+ 'contract_termination',
716
+ ])
717
+ .optional())
718
+ .optional(),
719
+ charge_once: z.array(z.boolean().default(true).optional()).optional(),
720
+ quantity_in_decimal: z.array(z.string().max(33).optional()).optional(),
721
+ unit_price_in_decimal: z.array(z.string().max(39).optional()).optional(),
722
+ });
723
+ const UpdateSubscriptionEstimateBodySchema = z.looseObject({
724
+ changes_scheduled_at: z.number().int().optional(),
725
+ change_option: z
726
+ .enum(['immediately', 'end_of_term', 'specific_date'])
727
+ .optional(),
728
+ replace_addon_list: z.boolean().default(false).optional(),
729
+ mandatory_addons_to_remove: z
730
+ .array(z.string().max(100).optional())
731
+ .optional(),
732
+ invoice_date: z.number().int().optional(),
733
+ billing_cycles: z.number().int().min(0).optional(),
734
+ terms_to_charge: z.number().int().min(1).optional(),
735
+ reactivate_from: z.number().int().optional(),
736
+ billing_alignment_mode: z.enum(['immediate', 'delayed']).optional(),
737
+ coupon_ids: z.array(z.string().max(100).optional()).optional(),
738
+ replace_coupon_list: z.boolean().default(false).optional(),
739
+ prorate: z.boolean().optional(),
740
+ end_of_term: z.boolean().default(false).optional(),
741
+ force_term_reset: z.boolean().default(false).optional(),
742
+ reactivate: z.boolean().optional(),
743
+ include_delayed_charges: z.boolean().default(false).optional(),
744
+ use_existing_balances: z.boolean().default(true).optional(),
745
+ invoice_immediately: z.boolean().optional(),
746
+ subscription: UpdateSubscriptionEstimateSubscriptionSchema.optional(),
747
+ billing_address: UpdateSubscriptionEstimateBillingAddressSchema.optional(),
748
+ shipping_address: UpdateSubscriptionEstimateShippingAddressSchema.optional(),
749
+ customer: UpdateSubscriptionEstimateCustomerSchema.optional(),
750
+ addons: UpdateSubscriptionEstimateAddonsSchema.optional(),
751
+ event_based_addons: UpdateSubscriptionEstimateEventBasedAddonsSchema.optional(),
752
+ });
753
+ export { UpdateSubscriptionEstimateBodySchema };
754
+ //Estimate.updateSubscriptionForItems
755
+ const UpdateSubscriptionForItemsEstimateSubscriptionSchema = z.object({
756
+ id: z.string().max(50),
757
+ setup_fee: z.number().int().min(0).optional(),
758
+ start_date: z.number().int().optional(),
759
+ trial_end: z.number().int().optional(),
760
+ coupon: z.string().max(100).optional(),
761
+ auto_collection: z.enum(['on', 'off']).optional(),
762
+ offline_payment_method: z
763
+ .enum([
764
+ 'no_preference',
765
+ 'cash',
766
+ 'check',
767
+ 'bank_transfer',
768
+ 'ach_credit',
769
+ 'sepa_credit',
770
+ 'boleto',
771
+ 'us_automated_bank_transfer',
772
+ 'eu_automated_bank_transfer',
773
+ 'uk_automated_bank_transfer',
774
+ 'jp_automated_bank_transfer',
775
+ 'mx_automated_bank_transfer',
776
+ 'custom',
777
+ ])
778
+ .optional(),
779
+ free_period: z.number().int().min(1).optional(),
780
+ free_period_unit: z.enum(['day', 'week', 'month', 'year']).optional(),
781
+ trial_end_action: z
782
+ .enum([
783
+ 'site_default',
784
+ 'plan_default',
785
+ 'activate_subscription',
786
+ 'cancel_subscription',
787
+ ])
788
+ .optional(),
789
+ });
790
+ const UpdateSubscriptionForItemsEstimateBillingAddressSchema = z.object({
791
+ line1: z.string().max(150).optional(),
792
+ line2: z.string().max(150).optional(),
793
+ line3: z.string().max(150).optional(),
794
+ city: z.string().max(50).optional(),
795
+ state_code: z.string().max(50).optional(),
796
+ zip: z.string().max(20).optional(),
797
+ country: z.string().max(50).optional(),
798
+ validation_status: z
799
+ .enum(['not_validated', 'valid', 'partially_valid', 'invalid'])
800
+ .optional(),
801
+ });
802
+ const UpdateSubscriptionForItemsEstimateShippingAddressSchema = z.object({
803
+ line1: z.string().max(150).optional(),
804
+ line2: z.string().max(150).optional(),
805
+ line3: z.string().max(150).optional(),
806
+ city: z.string().max(50).optional(),
807
+ state_code: z.string().max(50).optional(),
808
+ zip: z.string().max(20).optional(),
809
+ country: z.string().max(50).optional(),
810
+ validation_status: z
811
+ .enum(['not_validated', 'valid', 'partially_valid', 'invalid'])
812
+ .optional(),
813
+ });
814
+ const UpdateSubscriptionForItemsEstimateCustomerSchema = z.object({
815
+ vat_number: z.string().max(20).optional(),
816
+ vat_number_prefix: z.string().max(10).optional(),
817
+ registered_for_gst: z.boolean().optional(),
818
+ taxability: z.enum(['taxable', 'exempt']).optional(),
819
+ });
820
+ const UpdateSubscriptionForItemsEstimateBillingOverrideSchema = z.object({
821
+ max_excess_payment_usage: z.number().int().min(-1).optional(),
822
+ max_refundable_credits_usage: z.number().int().min(-1).optional(),
823
+ });
824
+ const UpdateSubscriptionForItemsEstimateSubscriptionItemsSchema = z.object({
825
+ item_price_id: z.array(z.string().max(100).optional()),
826
+ quantity: z.array(z.number().int().min(1).optional()).optional(),
827
+ quantity_in_decimal: z.array(z.string().max(33).optional()).optional(),
828
+ unit_price: z.array(z.number().int().min(0).optional()).optional(),
829
+ unit_price_in_decimal: z.array(z.string().max(39).optional()).optional(),
830
+ billing_cycles: z.array(z.number().int().min(0).optional()).optional(),
831
+ trial_end: z.array(z.number().int().optional()).optional(),
832
+ service_period_days: z
833
+ .array(z.number().int().min(1).max(730).optional())
834
+ .optional(),
835
+ charge_on_event: z
836
+ .array(z
837
+ .enum([
838
+ 'subscription_creation',
839
+ 'subscription_trial_start',
840
+ 'plan_activation',
841
+ 'subscription_activation',
842
+ 'contract_termination',
843
+ ])
844
+ .optional())
845
+ .optional(),
846
+ charge_once: z.array(z.boolean().optional()).optional(),
847
+ charge_on_option: z
848
+ .array(z.enum(['immediately', 'on_event']).optional())
849
+ .optional(),
850
+ item_type: z.array(z.enum(['plan', 'addon', 'charge']).optional()).optional(),
851
+ proration_type: z
852
+ .array(z.enum(['full_term', 'partial_term', 'none']).optional())
853
+ .optional(),
854
+ });
855
+ const UpdateSubscriptionForItemsEstimateDiscountsSchema = z.object({
856
+ apply_on: z
857
+ .array(z.enum(['invoice_amount', 'specific_item_price']).optional())
858
+ .optional(),
859
+ duration_type: z.array(z.enum(['one_time', 'forever', 'limited_period']).optional()),
860
+ percentage: z.array(z.number().min(0.01).max(100).optional()).optional(),
861
+ amount: z.array(z.number().int().min(0).optional()).optional(),
862
+ period: z.array(z.number().int().min(1).optional()).optional(),
863
+ period_unit: z
864
+ .array(z.enum(['day', 'week', 'month', 'year']).optional())
865
+ .optional(),
866
+ included_in_mrr: z.array(z.boolean().optional()).optional(),
867
+ item_price_id: z.array(z.string().max(100).optional()).optional(),
868
+ quantity: z.array(z.number().int().min(1).optional()).optional(),
869
+ operation_type: z.array(z.enum(['add', 'remove']).optional()),
870
+ id: z.array(z.string().max(50).optional()).optional(),
871
+ });
872
+ const UpdateSubscriptionForItemsEstimateItemTiersSchema = z.object({
873
+ item_price_id: z.array(z.string().max(100).optional()).optional(),
874
+ starting_unit: z.array(z.number().int().min(1).optional()).optional(),
875
+ ending_unit: z.array(z.number().int().optional()).optional(),
876
+ price: z.array(z.number().int().min(0).optional()).optional(),
877
+ starting_unit_in_decimal: z.array(z.string().max(33).optional()).optional(),
878
+ ending_unit_in_decimal: z.array(z.string().max(33).optional()).optional(),
879
+ price_in_decimal: z.array(z.string().max(39).optional()).optional(),
880
+ pricing_type: z
881
+ .array(z.enum(['per_unit', 'flat_fee', 'package']).optional())
882
+ .optional(),
883
+ package_size: z.array(z.number().int().min(1).optional()).optional(),
884
+ });
885
+ const UpdateSubscriptionForItemsEstimateBodySchema = z.looseObject({
886
+ changes_scheduled_at: z.number().int().optional(),
887
+ change_option: z
888
+ .enum(['immediately', 'end_of_term', 'specific_date'])
889
+ .optional(),
890
+ mandatory_items_to_remove: z.array(z.string().max(100).optional()).optional(),
891
+ replace_items_list: z.boolean().default(false).optional(),
892
+ invoice_date: z.number().int().optional(),
893
+ billing_cycles: z.number().int().min(0).optional(),
894
+ terms_to_charge: z.number().int().min(1).optional(),
895
+ reactivate_from: z.number().int().optional(),
896
+ billing_alignment_mode: z.enum(['immediate', 'delayed']).optional(),
897
+ coupon_ids: z.array(z.string().max(100).optional()).optional(),
898
+ replace_coupon_list: z.boolean().default(false).optional(),
899
+ prorate: z.boolean().optional(),
900
+ end_of_term: z.boolean().default(false).optional(),
901
+ force_term_reset: z.boolean().default(false).optional(),
902
+ reactivate: z.boolean().optional(),
903
+ include_delayed_charges: z.boolean().default(false).optional(),
904
+ use_existing_balances: z.boolean().default(true).optional(),
905
+ invoice_immediately: z.boolean().optional(),
906
+ invoice_usages: z.boolean().default(false).optional(),
907
+ subscription: UpdateSubscriptionForItemsEstimateSubscriptionSchema.optional(),
908
+ billing_address: UpdateSubscriptionForItemsEstimateBillingAddressSchema.optional(),
909
+ shipping_address: UpdateSubscriptionForItemsEstimateShippingAddressSchema.optional(),
910
+ customer: UpdateSubscriptionForItemsEstimateCustomerSchema.optional(),
911
+ billing_override: UpdateSubscriptionForItemsEstimateBillingOverrideSchema.optional(),
912
+ subscription_items: UpdateSubscriptionForItemsEstimateSubscriptionItemsSchema.optional(),
913
+ discounts: UpdateSubscriptionForItemsEstimateDiscountsSchema.optional(),
914
+ item_tiers: UpdateSubscriptionForItemsEstimateItemTiersSchema.optional(),
915
+ });
916
+ export { UpdateSubscriptionForItemsEstimateBodySchema };
917
+ //Estimate.renewalEstimate
918
+ const RenewalEstimateEstimateBodySchema = z.looseObject({
919
+ include_delayed_charges: z.boolean().default(true).optional(),
920
+ use_existing_balances: z.boolean().default(true).optional(),
921
+ ignore_scheduled_cancellation: z.boolean().default(false).optional(),
922
+ ignore_scheduled_changes: z.boolean().default(false).optional(),
923
+ exclude_tax_type: z.enum(['exclusive', 'none']).optional(),
924
+ });
925
+ export { RenewalEstimateEstimateBodySchema };
926
+ //Estimate.advanceInvoiceEstimate
927
+ const AdvanceInvoiceEstimateEstimateFixedIntervalScheduleSchema = z.object({
928
+ number_of_occurrences: z.number().int().min(1).optional(),
929
+ days_before_renewal: z.number().int().min(1).optional(),
930
+ end_schedule_on: z
931
+ .enum(['after_number_of_intervals', 'specific_date', 'subscription_end'])
932
+ .optional(),
933
+ end_date: z.number().int().optional(),
934
+ });
935
+ const AdvanceInvoiceEstimateEstimateSpecificDatesScheduleSchema = z.object({
936
+ terms_to_charge: z.array(z.number().int().optional()).optional(),
937
+ date: z.array(z.number().int().optional()).optional(),
938
+ });
939
+ const AdvanceInvoiceEstimateEstimateBodySchema = z.looseObject({
940
+ terms_to_charge: z.number().int().min(1).optional(),
941
+ invoice_immediately: z.boolean().optional(),
942
+ schedule_type: z
943
+ .enum(['immediate', 'specific_dates', 'fixed_intervals'])
944
+ .optional(),
945
+ fixed_interval_schedule: AdvanceInvoiceEstimateEstimateFixedIntervalScheduleSchema.optional(),
946
+ specific_dates_schedule: AdvanceInvoiceEstimateEstimateSpecificDatesScheduleSchema.optional(),
947
+ });
948
+ export { AdvanceInvoiceEstimateEstimateBodySchema };
949
+ //Estimate.regenerateInvoiceEstimate
950
+ const RegenerateInvoiceEstimateEstimateBodySchema = z.looseObject({
951
+ date_from: z.number().int().optional(),
952
+ date_to: z.number().int().optional(),
953
+ prorate: z.boolean().optional(),
954
+ invoice_immediately: z.boolean().optional(),
955
+ });
956
+ export { RegenerateInvoiceEstimateEstimateBodySchema };
957
+ //Estimate.upcomingInvoicesEstimate
958
+ const UpcomingInvoicesEstimateEstimateBodySchema = z.looseObject({
959
+ include_usage_charges: z.boolean().default(false).optional(),
960
+ });
961
+ export { UpcomingInvoicesEstimateEstimateBodySchema };
962
+ //Estimate.changeTermEnd
963
+ const ChangeTermEndEstimateBodySchema = z.looseObject({
964
+ term_ends_at: z.number().int(),
965
+ prorate: z.boolean().optional(),
966
+ invoice_immediately: z.boolean().optional(),
967
+ });
968
+ export { ChangeTermEndEstimateBodySchema };
969
+ //Estimate.cancelSubscription
970
+ const CancelSubscriptionEstimateEventBasedAddonsSchema = z.object({
971
+ id: z.array(z.string().max(100).optional()).optional(),
972
+ quantity: z.array(z.number().int().min(1).optional()).optional(),
973
+ unit_price: z.array(z.number().int().min(0).optional()).optional(),
974
+ service_period_in_days: z
975
+ .array(z.number().int().min(1).max(4000).optional())
976
+ .optional(),
977
+ });
978
+ const CancelSubscriptionEstimateBodySchema = z.looseObject({
979
+ cancel_option: z
980
+ .enum([
981
+ 'immediately',
982
+ 'end_of_term',
983
+ 'specific_date',
984
+ 'end_of_billing_term',
985
+ ])
986
+ .optional(),
987
+ end_of_term: z.boolean().default(false).optional(),
988
+ cancel_at: z.number().int().optional(),
989
+ credit_option_for_current_term_charges: z
990
+ .enum(['none', 'prorate', 'full'])
991
+ .optional(),
992
+ unbilled_charges_option: z.enum(['invoice', 'delete']).optional(),
993
+ account_receivables_handling: z
994
+ .enum(['no_action', 'schedule_payment_collection', 'write_off'])
995
+ .optional(),
996
+ refundable_credits_handling: z
997
+ .enum(['no_action', 'schedule_refund'])
998
+ .optional(),
999
+ contract_term_cancel_option: z
1000
+ .enum([
1001
+ 'terminate_immediately',
1002
+ 'end_of_contract_term',
1003
+ 'specific_date',
1004
+ 'end_of_subscription_billing_term',
1005
+ ])
1006
+ .optional(),
1007
+ invoice_date: z.number().int().optional(),
1008
+ cancel_reason_code: z.string().max(100).optional(),
1009
+ event_based_addons: CancelSubscriptionEstimateEventBasedAddonsSchema.optional(),
1010
+ });
1011
+ export { CancelSubscriptionEstimateBodySchema };
1012
+ //Estimate.cancelSubscriptionForItems
1013
+ const CancelSubscriptionForItemsEstimateSubscriptionItemsSchema = z.object({
1014
+ item_price_id: z.array(z.string().max(100).optional()).optional(),
1015
+ quantity: z.array(z.number().int().min(1).optional()).optional(),
1016
+ quantity_in_decimal: z.array(z.string().max(33).optional()).optional(),
1017
+ unit_price: z.array(z.number().int().min(0).optional()).optional(),
1018
+ unit_price_in_decimal: z.array(z.string().max(39).optional()).optional(),
1019
+ service_period_days: z
1020
+ .array(z.number().int().min(1).max(730).optional())
1021
+ .optional(),
1022
+ });
1023
+ const CancelSubscriptionForItemsEstimateBodySchema = z.looseObject({
1024
+ cancel_option: z
1025
+ .enum([
1026
+ 'immediately',
1027
+ 'end_of_term',
1028
+ 'specific_date',
1029
+ 'end_of_billing_term',
1030
+ ])
1031
+ .optional(),
1032
+ end_of_term: z.boolean().default(false).optional(),
1033
+ cancel_at: z.number().int().optional(),
1034
+ credit_option_for_current_term_charges: z
1035
+ .enum(['none', 'prorate', 'full'])
1036
+ .optional(),
1037
+ unbilled_charges_option: z.enum(['invoice', 'delete']).optional(),
1038
+ account_receivables_handling: z
1039
+ .enum(['no_action', 'schedule_payment_collection', 'write_off'])
1040
+ .optional(),
1041
+ refundable_credits_handling: z
1042
+ .enum(['no_action', 'schedule_refund'])
1043
+ .optional(),
1044
+ contract_term_cancel_option: z
1045
+ .enum([
1046
+ 'terminate_immediately',
1047
+ 'end_of_contract_term',
1048
+ 'specific_date',
1049
+ 'end_of_subscription_billing_term',
1050
+ ])
1051
+ .optional(),
1052
+ invoice_date: z.number().int().optional(),
1053
+ cancel_reason_code: z.string().max(100).optional(),
1054
+ subscription_items: CancelSubscriptionForItemsEstimateSubscriptionItemsSchema.optional(),
1055
+ });
1056
+ export { CancelSubscriptionForItemsEstimateBodySchema };
1057
+ //Estimate.pauseSubscription
1058
+ const PauseSubscriptionEstimateSubscriptionSchema = z.object({
1059
+ pause_date: z.number().int().optional(),
1060
+ resume_date: z.number().int().optional(),
1061
+ skip_billing_cycles: z.number().int().min(1).optional(),
1062
+ });
1063
+ const PauseSubscriptionEstimateBodySchema = z.looseObject({
1064
+ pause_option: z
1065
+ .enum(['immediately', 'end_of_term', 'specific_date', 'billing_cycles'])
1066
+ .optional(),
1067
+ unbilled_charges_handling: z.enum(['no_action', 'invoice']).optional(),
1068
+ subscription: PauseSubscriptionEstimateSubscriptionSchema.optional(),
1069
+ });
1070
+ export { PauseSubscriptionEstimateBodySchema };
1071
+ //Estimate.resumeSubscription
1072
+ const ResumeSubscriptionEstimateSubscriptionSchema = z.object({
1073
+ resume_date: z.number().int().optional(),
1074
+ });
1075
+ const ResumeSubscriptionEstimateBodySchema = z.looseObject({
1076
+ resume_option: z.enum(['immediately', 'specific_date']).optional(),
1077
+ charges_handling: z
1078
+ .enum(['invoice_immediately', 'add_to_unbilled_charges'])
1079
+ .optional(),
1080
+ subscription: ResumeSubscriptionEstimateSubscriptionSchema.optional(),
1081
+ });
1082
+ export { ResumeSubscriptionEstimateBodySchema };
1083
+ //Estimate.giftSubscription
1084
+ const GiftSubscriptionEstimateGiftSchema = z.object({
1085
+ scheduled_at: z.number().int().optional(),
1086
+ auto_claim: z.boolean().default(false).optional(),
1087
+ no_expiry: z.boolean().optional(),
1088
+ claim_expiry_date: z.number().int().optional(),
1089
+ });
1090
+ const GiftSubscriptionEstimateGifterSchema = z.object({
1091
+ customer_id: z.string().max(50),
1092
+ signature: z.string().max(50),
1093
+ note: z.string().max(500).optional(),
1094
+ payment_src_id: z.string().max(40).optional(),
1095
+ });
1096
+ const GiftSubscriptionEstimateGiftReceiverSchema = z.object({
1097
+ customer_id: z.string().max(50),
1098
+ first_name: z.string().max(150),
1099
+ last_name: z.string().max(150),
1100
+ email: z.string().email().max(70),
1101
+ });
1102
+ const GiftSubscriptionEstimateAdditionalInformationSchema = z.looseObject({});
1103
+ const GiftSubscriptionEstimatePaymentIntentSchema = z.object({
1104
+ id: z.string().max(150).optional(),
1105
+ gateway_account_id: z.string().max(50).optional(),
1106
+ gw_token: z.string().max(65000).optional(),
1107
+ payment_method_type: z
1108
+ .enum([
1109
+ 'card',
1110
+ 'ideal',
1111
+ 'sofort',
1112
+ 'bancontact',
1113
+ 'google_pay',
1114
+ 'dotpay',
1115
+ 'giropay',
1116
+ 'apple_pay',
1117
+ 'upi',
1118
+ 'netbanking_emandates',
1119
+ 'paypal_express_checkout',
1120
+ 'direct_debit',
1121
+ 'boleto',
1122
+ 'venmo',
1123
+ 'amazon_payments',
1124
+ 'pay_to',
1125
+ 'faster_payments',
1126
+ 'sepa_instant_transfer',
1127
+ 'klarna_pay_now',
1128
+ 'online_banking_poland',
1129
+ 'payconiq_by_bancontact',
1130
+ 'electronic_payment_standard',
1131
+ 'kbc_payment_button',
1132
+ 'pay_by_bank',
1133
+ 'trustly',
1134
+ 'stablecoin',
1135
+ 'kakao_pay',
1136
+ 'naver_pay',
1137
+ 'revolut_pay',
1138
+ 'cash_app_pay',
1139
+ 'wechat_pay',
1140
+ 'alipay',
1141
+ 'pix',
1142
+ 'twint',
1143
+ 'go_pay',
1144
+ 'grab_pay',
1145
+ 'pay_co',
1146
+ 'after_pay',
1147
+ 'swish',
1148
+ 'payme',
1149
+ ])
1150
+ .optional(),
1151
+ reference_id: z.string().max(65000).optional(),
1152
+ gw_payment_method_id: z.string().max(65000).optional(),
1153
+ additional_information: GiftSubscriptionEstimateAdditionalInformationSchema.optional(),
1154
+ });
1155
+ const GiftSubscriptionEstimateShippingAddressSchema = z.object({
1156
+ first_name: z.string().max(150).optional(),
1157
+ last_name: z.string().max(150).optional(),
1158
+ email: z.string().email().max(70).optional(),
1159
+ company: z.string().max(250).optional(),
1160
+ phone: z.string().max(50).optional(),
1161
+ line1: z.string().max(150).optional(),
1162
+ line2: z.string().max(150).optional(),
1163
+ line3: z.string().max(150).optional(),
1164
+ city: z.string().max(50).optional(),
1165
+ state_code: z.string().max(50).optional(),
1166
+ state: z.string().max(50).optional(),
1167
+ zip: z.string().max(20).optional(),
1168
+ country: z.string().max(50).optional(),
1169
+ validation_status: z
1170
+ .enum(['not_validated', 'valid', 'partially_valid', 'invalid'])
1171
+ .optional(),
1172
+ });
1173
+ const GiftSubscriptionEstimateSubscriptionSchema = z.object({
1174
+ plan_id: z.string().max(100),
1175
+ plan_quantity: z.number().int().min(1).optional(),
1176
+ plan_quantity_in_decimal: z.string().max(33).optional(),
1177
+ });
1178
+ const GiftSubscriptionEstimateAddonsSchema = z.object({
1179
+ id: z.array(z.string().max(100).optional()).optional(),
1180
+ quantity: z.array(z.number().int().min(1).optional()).optional(),
1181
+ quantity_in_decimal: z.array(z.string().max(33).optional()).optional(),
1182
+ });
1183
+ const GiftSubscriptionEstimateBodySchema = z.looseObject({
1184
+ coupon_ids: z.array(z.string().max(100).optional()).optional(),
1185
+ gift: GiftSubscriptionEstimateGiftSchema.optional(),
1186
+ gifter: GiftSubscriptionEstimateGifterSchema.optional(),
1187
+ gift_receiver: GiftSubscriptionEstimateGiftReceiverSchema.optional(),
1188
+ payment_intent: GiftSubscriptionEstimatePaymentIntentSchema.optional(),
1189
+ shipping_address: GiftSubscriptionEstimateShippingAddressSchema.optional(),
1190
+ subscription: GiftSubscriptionEstimateSubscriptionSchema.optional(),
1191
+ addons: GiftSubscriptionEstimateAddonsSchema.optional(),
1192
+ });
1193
+ export { GiftSubscriptionEstimateBodySchema };
1194
+ //Estimate.giftSubscriptionForItems
1195
+ const GiftSubscriptionForItemsEstimateGiftSchema = z.object({
1196
+ scheduled_at: z.number().int().optional(),
1197
+ auto_claim: z.boolean().default(false).optional(),
1198
+ no_expiry: z.boolean().optional(),
1199
+ claim_expiry_date: z.number().int().optional(),
1200
+ });
1201
+ const GiftSubscriptionForItemsEstimateGifterSchema = z.object({
1202
+ customer_id: z.string().max(50),
1203
+ signature: z.string().max(50),
1204
+ note: z.string().max(500).optional(),
1205
+ payment_src_id: z.string().max(40).optional(),
1206
+ });
1207
+ const GiftSubscriptionForItemsEstimateGiftReceiverSchema = z.object({
1208
+ customer_id: z.string().max(50),
1209
+ first_name: z.string().max(150),
1210
+ last_name: z.string().max(150),
1211
+ email: z.string().email().max(70),
1212
+ });
1213
+ const GiftSubscriptionForItemsEstimateAdditionalInformationSchema = z.looseObject({});
1214
+ const GiftSubscriptionForItemsEstimatePaymentIntentSchema = z.object({
1215
+ id: z.string().max(150).optional(),
1216
+ gateway_account_id: z.string().max(50).optional(),
1217
+ gw_token: z.string().max(65000).optional(),
1218
+ payment_method_type: z
1219
+ .enum([
1220
+ 'card',
1221
+ 'ideal',
1222
+ 'sofort',
1223
+ 'bancontact',
1224
+ 'google_pay',
1225
+ 'dotpay',
1226
+ 'giropay',
1227
+ 'apple_pay',
1228
+ 'upi',
1229
+ 'netbanking_emandates',
1230
+ 'paypal_express_checkout',
1231
+ 'direct_debit',
1232
+ 'boleto',
1233
+ 'venmo',
1234
+ 'amazon_payments',
1235
+ 'pay_to',
1236
+ 'faster_payments',
1237
+ 'sepa_instant_transfer',
1238
+ 'klarna_pay_now',
1239
+ 'online_banking_poland',
1240
+ 'payconiq_by_bancontact',
1241
+ 'electronic_payment_standard',
1242
+ 'kbc_payment_button',
1243
+ 'pay_by_bank',
1244
+ 'trustly',
1245
+ 'stablecoin',
1246
+ 'kakao_pay',
1247
+ 'naver_pay',
1248
+ 'revolut_pay',
1249
+ 'cash_app_pay',
1250
+ 'wechat_pay',
1251
+ 'alipay',
1252
+ 'pix',
1253
+ 'twint',
1254
+ 'go_pay',
1255
+ 'grab_pay',
1256
+ 'pay_co',
1257
+ 'after_pay',
1258
+ 'swish',
1259
+ 'payme',
1260
+ ])
1261
+ .optional(),
1262
+ reference_id: z.string().max(65000).optional(),
1263
+ gw_payment_method_id: z.string().max(65000).optional(),
1264
+ additional_information: GiftSubscriptionForItemsEstimateAdditionalInformationSchema.optional(),
1265
+ });
1266
+ const GiftSubscriptionForItemsEstimateShippingAddressSchema = z.object({
1267
+ first_name: z.string().max(150).optional(),
1268
+ last_name: z.string().max(150).optional(),
1269
+ email: z.string().email().max(70).optional(),
1270
+ company: z.string().max(250).optional(),
1271
+ phone: z.string().max(50).optional(),
1272
+ line1: z.string().max(150).optional(),
1273
+ line2: z.string().max(150).optional(),
1274
+ line3: z.string().max(150).optional(),
1275
+ city: z.string().max(50).optional(),
1276
+ state_code: z.string().max(50).optional(),
1277
+ state: z.string().max(50).optional(),
1278
+ zip: z.string().max(20).optional(),
1279
+ country: z.string().max(50).optional(),
1280
+ validation_status: z
1281
+ .enum(['not_validated', 'valid', 'partially_valid', 'invalid'])
1282
+ .optional(),
1283
+ });
1284
+ const GiftSubscriptionForItemsEstimateSubscriptionItemsSchema = z.object({
1285
+ item_price_id: z.array(z.string().max(100).optional()).optional(),
1286
+ quantity: z.array(z.number().int().min(1).optional()).optional(),
1287
+ quantity_in_decimal: z.array(z.string().max(33).optional()).optional(),
1288
+ unit_price: z.array(z.number().int().min(0).optional()).optional(),
1289
+ unit_price_in_decimal: z.array(z.string().max(39).optional()).optional(),
1290
+ });
1291
+ const GiftSubscriptionForItemsEstimateItemTiersSchema = z.object({
1292
+ item_price_id: z.array(z.string().max(100).optional()).optional(),
1293
+ starting_unit: z.array(z.number().int().min(1).optional()).optional(),
1294
+ ending_unit: z.array(z.number().int().optional()).optional(),
1295
+ price: z.array(z.number().int().min(0).optional()).optional(),
1296
+ starting_unit_in_decimal: z.array(z.string().max(33).optional()).optional(),
1297
+ ending_unit_in_decimal: z.array(z.string().max(33).optional()).optional(),
1298
+ price_in_decimal: z.array(z.string().max(39).optional()).optional(),
1299
+ });
1300
+ const GiftSubscriptionForItemsEstimateBodySchema = z.looseObject({
1301
+ coupon_ids: z.array(z.string().max(100).optional()).optional(),
1302
+ gift: GiftSubscriptionForItemsEstimateGiftSchema.optional(),
1303
+ gifter: GiftSubscriptionForItemsEstimateGifterSchema.optional(),
1304
+ gift_receiver: GiftSubscriptionForItemsEstimateGiftReceiverSchema.optional(),
1305
+ payment_intent: GiftSubscriptionForItemsEstimatePaymentIntentSchema.optional(),
1306
+ shipping_address: GiftSubscriptionForItemsEstimateShippingAddressSchema.optional(),
1307
+ subscription_items: GiftSubscriptionForItemsEstimateSubscriptionItemsSchema.optional(),
1308
+ item_tiers: GiftSubscriptionForItemsEstimateItemTiersSchema.optional(),
1309
+ });
1310
+ export { GiftSubscriptionForItemsEstimateBodySchema };
1311
+ //Estimate.createInvoice
1312
+ const CreateInvoiceEstimateInvoiceSchema = z.object({
1313
+ customer_id: z.string().max(50).optional(),
1314
+ subscription_id: z.string().max(50).optional(),
1315
+ po_number: z.string().max(100).optional(),
1316
+ });
1317
+ const CreateInvoiceEstimateShippingAddressSchema = z.object({
1318
+ first_name: z.string().max(150).optional(),
1319
+ last_name: z.string().max(150).optional(),
1320
+ email: z.string().email().max(70).optional(),
1321
+ company: z.string().max(250).optional(),
1322
+ phone: z.string().max(50).optional(),
1323
+ line1: z.string().max(150).optional(),
1324
+ line2: z.string().max(150).optional(),
1325
+ line3: z.string().max(150).optional(),
1326
+ city: z.string().max(50).optional(),
1327
+ state_code: z.string().max(50).optional(),
1328
+ state: z.string().max(50).optional(),
1329
+ zip: z.string().max(20).optional(),
1330
+ country: z.string().max(50).optional(),
1331
+ validation_status: z
1332
+ .enum(['not_validated', 'valid', 'partially_valid', 'invalid'])
1333
+ .optional(),
1334
+ });
1335
+ const CreateInvoiceEstimateAddonsSchema = z.object({
1336
+ id: z.array(z.string().max(100).optional()).optional(),
1337
+ quantity: z.array(z.number().int().min(1).optional()).optional(),
1338
+ quantity_in_decimal: z.array(z.string().max(33).optional()).optional(),
1339
+ unit_price: z.array(z.number().int().min(0).optional()).optional(),
1340
+ unit_price_in_decimal: z.array(z.string().max(39).optional()).optional(),
1341
+ date_from: z.array(z.number().int().optional()).optional(),
1342
+ date_to: z.array(z.number().int().optional()).optional(),
1343
+ });
1344
+ const CreateInvoiceEstimateChargesSchema = z.object({
1345
+ amount: z.array(z.number().int().min(1).optional()).optional(),
1346
+ amount_in_decimal: z.array(z.string().max(39).optional()).optional(),
1347
+ description: z.array(z.string().max(250).optional()).optional(),
1348
+ taxable: z.array(z.boolean().default(true).optional()).optional(),
1349
+ tax_profile_id: z.array(z.string().max(50).optional()).optional(),
1350
+ avalara_tax_code: z.array(z.string().max(50).optional()).optional(),
1351
+ hsn_code: z.array(z.string().max(50).optional()).optional(),
1352
+ taxjar_product_code: z.array(z.string().max(50).optional()).optional(),
1353
+ avalara_sale_type: z
1354
+ .array(z.enum(['wholesale', 'retail', 'consumed', 'vendor_use']).optional())
1355
+ .optional(),
1356
+ avalara_transaction_type: z.array(z.number().int().optional()).optional(),
1357
+ avalara_service_type: z.array(z.number().int().optional()).optional(),
1358
+ date_from: z.array(z.number().int().optional()).optional(),
1359
+ date_to: z.array(z.number().int().optional()).optional(),
1360
+ });
1361
+ const CreateInvoiceEstimateNotesToRemoveSchema = z.object({
1362
+ entity_type: z
1363
+ .array(z
1364
+ .enum(['plan', 'addon', 'customer', 'subscription', 'coupon'])
1365
+ .optional())
1366
+ .optional(),
1367
+ entity_id: z.array(z.string().max(100).optional()).optional(),
1368
+ });
1369
+ const CreateInvoiceEstimateTaxProvidersFieldsSchema = z.object({
1370
+ provider_name: z.array(z.string().max(50).optional()).optional(),
1371
+ field_id: z.array(z.string().max(50).optional()).optional(),
1372
+ field_value: z.array(z.string().max(50).optional()).optional(),
1373
+ });
1374
+ const CreateInvoiceEstimateBodySchema = z.looseObject({
1375
+ currency_code: z.string().max(3).optional(),
1376
+ invoice_note: z.string().max(2000).optional(),
1377
+ remove_general_note: z.boolean().default(false).optional(),
1378
+ coupon: z.string().max(100).optional(),
1379
+ coupon_ids: z.array(z.string().max(100).optional()).optional(),
1380
+ authorization_transaction_id: z.string().max(40).optional(),
1381
+ payment_source_id: z.string().max(40).optional(),
1382
+ auto_collection: z.enum(['on', 'off']).optional(),
1383
+ invoice_date: z.number().int().optional(),
1384
+ invoice: CreateInvoiceEstimateInvoiceSchema.optional(),
1385
+ shipping_address: CreateInvoiceEstimateShippingAddressSchema.optional(),
1386
+ addons: CreateInvoiceEstimateAddonsSchema.optional(),
1387
+ charges: CreateInvoiceEstimateChargesSchema.optional(),
1388
+ notes_to_remove: CreateInvoiceEstimateNotesToRemoveSchema.optional(),
1389
+ tax_providers_fields: CreateInvoiceEstimateTaxProvidersFieldsSchema.optional(),
1390
+ });
1391
+ export { CreateInvoiceEstimateBodySchema };
1392
+ //Estimate.createInvoiceForItems
1393
+ const CreateInvoiceForItemsEstimateInvoiceSchema = z.object({
1394
+ customer_id: z.string().max(50).optional(),
1395
+ subscription_id: z.string().max(50).optional(),
1396
+ po_number: z.string().max(100).optional(),
1397
+ });
1398
+ const CreateInvoiceForItemsEstimateShippingAddressSchema = z.object({
1399
+ first_name: z.string().max(150).optional(),
1400
+ last_name: z.string().max(150).optional(),
1401
+ email: z.string().email().max(70).optional(),
1402
+ company: z.string().max(250).optional(),
1403
+ phone: z.string().max(50).optional(),
1404
+ line1: z.string().max(150).optional(),
1405
+ line2: z.string().max(150).optional(),
1406
+ line3: z.string().max(150).optional(),
1407
+ city: z.string().max(50).optional(),
1408
+ state_code: z.string().max(50).optional(),
1409
+ state: z.string().max(50).optional(),
1410
+ zip: z.string().max(20).optional(),
1411
+ country: z.string().max(50).optional(),
1412
+ validation_status: z
1413
+ .enum(['not_validated', 'valid', 'partially_valid', 'invalid'])
1414
+ .optional(),
1415
+ });
1416
+ const CreateInvoiceForItemsEstimateBillingAddressSchema = z.object({
1417
+ line1: z.string().max(150).optional(),
1418
+ line2: z.string().max(150).optional(),
1419
+ line3: z.string().max(150).optional(),
1420
+ city: z.string().max(50).optional(),
1421
+ state_code: z.string().max(50).optional(),
1422
+ zip: z.string().max(20).optional(),
1423
+ country: z.string().max(50).optional(),
1424
+ validation_status: z
1425
+ .enum(['not_validated', 'valid', 'partially_valid', 'invalid'])
1426
+ .optional(),
1427
+ });
1428
+ const CreateInvoiceForItemsEstimateItemPricesSchema = z.object({
1429
+ item_price_id: z.array(z.string().max(100).optional()).optional(),
1430
+ quantity: z.array(z.number().int().min(1).optional()).optional(),
1431
+ quantity_in_decimal: z.array(z.string().max(33).optional()).optional(),
1432
+ unit_price: z.array(z.number().int().min(0).optional()).optional(),
1433
+ unit_price_in_decimal: z.array(z.string().max(39).optional()).optional(),
1434
+ date_from: z.array(z.number().int().optional()).optional(),
1435
+ date_to: z.array(z.number().int().optional()).optional(),
1436
+ });
1437
+ const CreateInvoiceForItemsEstimateItemTiersSchema = z.object({
1438
+ item_price_id: z.array(z.string().max(100).optional()).optional(),
1439
+ starting_unit: z.array(z.number().int().min(1).optional()).optional(),
1440
+ ending_unit: z.array(z.number().int().optional()).optional(),
1441
+ price: z.array(z.number().int().min(0).optional()).optional(),
1442
+ starting_unit_in_decimal: z.array(z.string().max(33).optional()).optional(),
1443
+ ending_unit_in_decimal: z.array(z.string().max(33).optional()).optional(),
1444
+ price_in_decimal: z.array(z.string().max(39).optional()).optional(),
1445
+ pricing_type: z
1446
+ .array(z.enum(['per_unit', 'flat_fee', 'package']).optional())
1447
+ .optional(),
1448
+ package_size: z.array(z.number().int().min(1).optional()).optional(),
1449
+ });
1450
+ const CreateInvoiceForItemsEstimateChargesSchema = z.object({
1451
+ amount: z.array(z.number().int().min(1).optional()).optional(),
1452
+ amount_in_decimal: z.array(z.string().max(39).optional()).optional(),
1453
+ description: z.array(z.string().max(250).optional()).optional(),
1454
+ taxable: z.array(z.boolean().default(true).optional()).optional(),
1455
+ tax_profile_id: z.array(z.string().max(50).optional()).optional(),
1456
+ avalara_tax_code: z.array(z.string().max(50).optional()).optional(),
1457
+ hsn_code: z.array(z.string().max(50).optional()).optional(),
1458
+ taxjar_product_code: z.array(z.string().max(50).optional()).optional(),
1459
+ avalara_sale_type: z
1460
+ .array(z.enum(['wholesale', 'retail', 'consumed', 'vendor_use']).optional())
1461
+ .optional(),
1462
+ avalara_transaction_type: z.array(z.number().int().optional()).optional(),
1463
+ avalara_service_type: z.array(z.number().int().optional()).optional(),
1464
+ date_from: z.array(z.number().int().optional()).optional(),
1465
+ date_to: z.array(z.number().int().optional()).optional(),
1466
+ });
1467
+ const CreateInvoiceForItemsEstimateNotesToRemoveSchema = z.object({
1468
+ entity_type: z
1469
+ .array(z
1470
+ .enum([
1471
+ 'customer',
1472
+ 'subscription',
1473
+ 'coupon',
1474
+ 'plan_item_price',
1475
+ 'addon_item_price',
1476
+ 'charge_item_price',
1477
+ ])
1478
+ .optional())
1479
+ .optional(),
1480
+ entity_id: z.array(z.string().max(100).optional()).optional(),
1481
+ });
1482
+ const CreateInvoiceForItemsEstimateDiscountsSchema = z.object({
1483
+ percentage: z.array(z.number().min(0.01).max(100).optional()).optional(),
1484
+ amount: z.array(z.number().int().min(0).optional()).optional(),
1485
+ quantity: z.array(z.number().int().min(1).optional()).optional(),
1486
+ apply_on: z.array(z.enum(['invoice_amount', 'specific_item_price']).optional()),
1487
+ item_price_id: z.array(z.string().max(100).optional()).optional(),
1488
+ });
1489
+ const CreateInvoiceForItemsEstimateTaxProvidersFieldsSchema = z.object({
1490
+ provider_name: z.array(z.string().max(50).optional()).optional(),
1491
+ field_id: z.array(z.string().max(50).optional()).optional(),
1492
+ field_value: z.array(z.string().max(50).optional()).optional(),
1493
+ });
1494
+ const CreateInvoiceForItemsEstimateBodySchema = z.looseObject({
1495
+ currency_code: z.string().max(3).optional(),
1496
+ invoice_note: z.string().max(2000).optional(),
1497
+ remove_general_note: z.boolean().default(false).optional(),
1498
+ coupon: z.string().max(100).optional(),
1499
+ coupon_ids: z.array(z.string().max(100).optional()).optional(),
1500
+ authorization_transaction_id: z.string().max(40).optional(),
1501
+ payment_source_id: z.string().max(40).optional(),
1502
+ auto_collection: z.enum(['on', 'off']).optional(),
1503
+ invoice_date: z.number().int().optional(),
1504
+ invoice: CreateInvoiceForItemsEstimateInvoiceSchema.optional(),
1505
+ shipping_address: CreateInvoiceForItemsEstimateShippingAddressSchema.optional(),
1506
+ billing_address: CreateInvoiceForItemsEstimateBillingAddressSchema.optional(),
1507
+ item_prices: CreateInvoiceForItemsEstimateItemPricesSchema.optional(),
1508
+ item_tiers: CreateInvoiceForItemsEstimateItemTiersSchema.optional(),
1509
+ charges: CreateInvoiceForItemsEstimateChargesSchema.optional(),
1510
+ notes_to_remove: CreateInvoiceForItemsEstimateNotesToRemoveSchema.optional(),
1511
+ discounts: CreateInvoiceForItemsEstimateDiscountsSchema.optional(),
1512
+ tax_providers_fields: CreateInvoiceForItemsEstimateTaxProvidersFieldsSchema.optional(),
1513
+ });
1514
+ export { CreateInvoiceForItemsEstimateBodySchema };
1515
+ //Estimate.paymentSchedules
1516
+ const PaymentSchedulesEstimateBodySchema = z.looseObject({
1517
+ scheme_id: z.string(),
1518
+ amount: z.number().int().min(0).optional(),
1519
+ invoice_id: z.string().optional(),
1520
+ payment_schedule_start_date: z.number().int().optional(),
1521
+ });
1522
+ export { PaymentSchedulesEstimateBodySchema };