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
@@ -3,6 +3,28 @@
3
3
  // Do not edit manually – regenerate via sdk-generator
4
4
  import { z } from 'zod';
5
5
  //CreditNote.create
6
+ const CreateCreditNoteLineItemsItemSchema = z.object({
7
+ reference_line_item_id: z.string().max(40).optional(),
8
+ unit_amount: z.number().int().optional(),
9
+ unit_amount_in_decimal: z.string().max(39).optional(),
10
+ quantity: z.number().int().optional(),
11
+ quantity_in_decimal: z.string().max(33).optional(),
12
+ amount: z.number().int().optional(),
13
+ date_from: z.number().int().optional(),
14
+ date_to: z.number().int().optional(),
15
+ description: z.string().max(250).optional(),
16
+ entity_type: z
17
+ .enum([
18
+ 'adhoc',
19
+ 'plan_item_price',
20
+ 'addon_item_price',
21
+ 'charge_item_price',
22
+ 'plan',
23
+ 'addon',
24
+ ])
25
+ .optional(),
26
+ entity_id: z.string().max(100).optional(),
27
+ });
6
28
  const CreateCreditNoteLineItemsSchema = z.object({
7
29
  reference_line_item_id: z.array(z.string().max(40).optional()).optional(),
8
30
  unit_amount: z.array(z.number().int().optional()).optional(),
@@ -47,7 +69,12 @@ const CreateCreditNoteBodySchema = z.looseObject({
47
69
  customer_notes: z.string().max(2000).optional(),
48
70
  currency_code: z.string().max(3).optional(),
49
71
  comment: z.string().max(300).optional(),
50
- line_items: CreateCreditNoteLineItemsSchema.optional(),
72
+ line_items: z
73
+ .union([
74
+ z.array(CreateCreditNoteLineItemsItemSchema.optional()),
75
+ CreateCreditNoteLineItemsSchema,
76
+ ])
77
+ .optional(),
51
78
  });
52
79
  export { CreateCreditNoteBodySchema };
53
80
  //CreditNote.retrieve
@@ -92,12 +119,6 @@ const RecordRefundCreditNoteTransactionSchema = z.object({
92
119
  'app_store',
93
120
  'play_store',
94
121
  'custom',
95
- 'tamara',
96
- 'qpay',
97
- 'blik',
98
- 'fpx',
99
- 'wero',
100
- 'p24',
101
122
  ]),
102
123
  reference_number: z.string().max(100).optional(),
103
124
  custom_payment_method_id: z.string().max(50).optional(),
@@ -119,37 +140,87 @@ const ListCreditNoteIdSchema = z.object({
119
140
  is: z.string().min(1).optional(),
120
141
  is_not: z.string().min(1).optional(),
121
142
  starts_with: z.string().min(1).optional(),
122
- in: z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
123
- not_in: z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
143
+ in: z
144
+ .union([
145
+ z.array(z.string().optional()),
146
+ z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')),
147
+ ])
148
+ .optional(),
149
+ not_in: z
150
+ .union([
151
+ z.array(z.string().optional()),
152
+ z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')),
153
+ ])
154
+ .optional(),
124
155
  });
125
156
  const ListCreditNoteCustomerIdSchema = z.object({
126
157
  is: z.string().min(1).optional(),
127
158
  is_not: z.string().min(1).optional(),
128
159
  starts_with: z.string().min(1).optional(),
129
- in: z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
130
- not_in: z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
160
+ in: z
161
+ .union([
162
+ z.array(z.string().optional()),
163
+ z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')),
164
+ ])
165
+ .optional(),
166
+ not_in: z
167
+ .union([
168
+ z.array(z.string().optional()),
169
+ z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')),
170
+ ])
171
+ .optional(),
131
172
  });
132
173
  const ListCreditNoteSubscriptionIdSchema = z.object({
133
174
  is: z.string().min(1).optional(),
134
175
  is_not: z.string().min(1).optional(),
135
176
  starts_with: z.string().min(1).optional(),
136
- is_present: z.enum(['true', 'false']).optional(),
137
- in: z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
138
- not_in: z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
177
+ is_present: z.union([z.boolean(), z.enum(['true', 'false'])]).optional(),
178
+ in: z
179
+ .union([
180
+ z.array(z.string().optional()),
181
+ z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')),
182
+ ])
183
+ .optional(),
184
+ not_in: z
185
+ .union([
186
+ z.array(z.string().optional()),
187
+ z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')),
188
+ ])
189
+ .optional(),
139
190
  });
140
191
  const ListCreditNoteReferenceInvoiceIdSchema = z.object({
141
192
  is: z.string().min(1).optional(),
142
193
  is_not: z.string().min(1).optional(),
143
194
  starts_with: z.string().min(1).optional(),
144
- is_present: z.enum(['true', 'false']).optional(),
145
- in: z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
146
- not_in: z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
195
+ is_present: z.union([z.boolean(), z.enum(['true', 'false'])]).optional(),
196
+ in: z
197
+ .union([
198
+ z.array(z.string().optional()),
199
+ z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')),
200
+ ])
201
+ .optional(),
202
+ not_in: z
203
+ .union([
204
+ z.array(z.string().optional()),
205
+ z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')),
206
+ ])
207
+ .optional(),
147
208
  });
148
209
  const ListCreditNoteTypeSchema = z.object({
149
210
  is: z.enum(['adjustment', 'refundable', 'store']).optional(),
150
211
  is_not: z.enum(['adjustment', 'refundable', 'store']).optional(),
151
- in: z.enum(['adjustment', 'refundable', 'store']).optional(),
152
- not_in: z.enum(['adjustment', 'refundable', 'store']).optional(),
212
+ in: z
213
+ .union([
214
+ z.array(z.enum(['adjustment', 'refundable', 'store']).optional()),
215
+ z.enum(['adjustment', 'refundable', 'store']),
216
+ ])
217
+ .optional(),
218
+ not_in: z
219
+ .union([
220
+ z.array(z.enum(['adjustment', 'refundable', 'store']).optional()),
221
+ z.enum(['adjustment', 'refundable', 'store']),
222
+ ])
223
+ .optional(),
153
224
  });
154
225
  const ListCreditNoteReasonCodeSchema = z.object({
155
226
  is: z
@@ -185,35 +256,71 @@ const ListCreditNoteReasonCodeSchema = z.object({
185
256
  ])
186
257
  .optional(),
187
258
  in: z
188
- .enum([
189
- 'write_off',
190
- 'subscription_change',
191
- 'subscription_cancellation',
192
- 'subscription_pause',
193
- 'chargeback',
194
- 'product_unsatisfactory',
195
- 'service_unsatisfactory',
196
- 'order_change',
197
- 'order_cancellation',
198
- 'waiver',
199
- 'other',
200
- 'fraudulent',
259
+ .union([
260
+ z.array(z
261
+ .enum([
262
+ 'write_off',
263
+ 'subscription_change',
264
+ 'subscription_cancellation',
265
+ 'subscription_pause',
266
+ 'chargeback',
267
+ 'product_unsatisfactory',
268
+ 'service_unsatisfactory',
269
+ 'order_change',
270
+ 'order_cancellation',
271
+ 'waiver',
272
+ 'other',
273
+ 'fraudulent',
274
+ ])
275
+ .optional()),
276
+ z.enum([
277
+ 'write_off',
278
+ 'subscription_change',
279
+ 'subscription_cancellation',
280
+ 'subscription_pause',
281
+ 'chargeback',
282
+ 'product_unsatisfactory',
283
+ 'service_unsatisfactory',
284
+ 'order_change',
285
+ 'order_cancellation',
286
+ 'waiver',
287
+ 'other',
288
+ 'fraudulent',
289
+ ]),
201
290
  ])
202
291
  .optional(),
203
292
  not_in: z
204
- .enum([
205
- 'write_off',
206
- 'subscription_change',
207
- 'subscription_cancellation',
208
- 'subscription_pause',
209
- 'chargeback',
210
- 'product_unsatisfactory',
211
- 'service_unsatisfactory',
212
- 'order_change',
213
- 'order_cancellation',
214
- 'waiver',
215
- 'other',
216
- 'fraudulent',
293
+ .union([
294
+ z.array(z
295
+ .enum([
296
+ 'write_off',
297
+ 'subscription_change',
298
+ 'subscription_cancellation',
299
+ 'subscription_pause',
300
+ 'chargeback',
301
+ 'product_unsatisfactory',
302
+ 'service_unsatisfactory',
303
+ 'order_change',
304
+ 'order_cancellation',
305
+ 'waiver',
306
+ 'other',
307
+ 'fraudulent',
308
+ ])
309
+ .optional()),
310
+ z.enum([
311
+ 'write_off',
312
+ 'subscription_change',
313
+ 'subscription_cancellation',
314
+ 'subscription_pause',
315
+ 'chargeback',
316
+ 'product_unsatisfactory',
317
+ 'service_unsatisfactory',
318
+ 'order_change',
319
+ 'order_cancellation',
320
+ 'waiver',
321
+ 'other',
322
+ 'fraudulent',
323
+ ]),
217
324
  ])
218
325
  .optional(),
219
326
  });
@@ -221,74 +328,205 @@ const ListCreditNoteCreateReasonCodeSchema = z.object({
221
328
  is: z.string().min(1).optional(),
222
329
  is_not: z.string().min(1).optional(),
223
330
  starts_with: z.string().min(1).optional(),
224
- in: z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
225
- not_in: z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
331
+ in: z
332
+ .union([
333
+ z.array(z.string().optional()),
334
+ z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')),
335
+ ])
336
+ .optional(),
337
+ not_in: z
338
+ .union([
339
+ z.array(z.string().optional()),
340
+ z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')),
341
+ ])
342
+ .optional(),
226
343
  });
227
344
  const ListCreditNoteStatusSchema = z.object({
228
345
  is: z.enum(['adjusted', 'refunded', 'refund_due', 'voided']).optional(),
229
346
  is_not: z.enum(['adjusted', 'refunded', 'refund_due', 'voided']).optional(),
230
- in: z.enum(['adjusted', 'refunded', 'refund_due', 'voided']).optional(),
231
- not_in: z.enum(['adjusted', 'refunded', 'refund_due', 'voided']).optional(),
347
+ in: z
348
+ .union([
349
+ z.array(z.enum(['adjusted', 'refunded', 'refund_due', 'voided']).optional()),
350
+ z.enum(['adjusted', 'refunded', 'refund_due', 'voided']),
351
+ ])
352
+ .optional(),
353
+ not_in: z
354
+ .union([
355
+ z.array(z.enum(['adjusted', 'refunded', 'refund_due', 'voided']).optional()),
356
+ z.enum(['adjusted', 'refunded', 'refund_due', 'voided']),
357
+ ])
358
+ .optional(),
232
359
  });
233
360
  const ListCreditNoteDateSchema = z.object({
234
- after: z.string().regex(RegExp('^\\d{10}$')).optional(),
235
- before: z.string().regex(RegExp('^\\d{10}$')).optional(),
236
- on: z.string().regex(RegExp('^\\d{10}$')).optional(),
237
- between: z.string().regex(RegExp('^\\[\\d{10},\\d{10}\\]$')).optional(),
361
+ after: z
362
+ .union([z.number().int(), z.string().regex(RegExp('^\\d{10}$'))])
363
+ .optional(),
364
+ before: z
365
+ .union([z.number().int(), z.string().regex(RegExp('^\\d{10}$'))])
366
+ .optional(),
367
+ on: z
368
+ .union([z.number().int(), z.string().regex(RegExp('^\\d{10}$'))])
369
+ .optional(),
370
+ between: z
371
+ .union([
372
+ z.array(z.number().int().optional()).min(2).max(2),
373
+ z.string().regex(RegExp('^\\[\\d{10},\\d{10}\\]$')),
374
+ ])
375
+ .optional(),
238
376
  });
239
377
  const ListCreditNoteTotalSchema = z.object({
240
- is: z.string().regex(RegExp('^-?\\d+$')).optional(),
241
- is_not: z.string().regex(RegExp('^-?\\d+$')).optional(),
242
- lt: z.string().regex(RegExp('^-?\\d+$')).optional(),
243
- lte: z.string().regex(RegExp('^-?\\d+$')).optional(),
244
- gt: z.string().regex(RegExp('^-?\\d+$')).optional(),
245
- gte: z.string().regex(RegExp('^-?\\d+$')).optional(),
246
- between: z.string().regex(RegExp('^\\[-?\\d+,-?\\d+\\]$')).optional(),
378
+ is: z
379
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
380
+ .optional(),
381
+ is_not: z
382
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
383
+ .optional(),
384
+ lt: z
385
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
386
+ .optional(),
387
+ lte: z
388
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
389
+ .optional(),
390
+ gt: z
391
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
392
+ .optional(),
393
+ gte: z
394
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
395
+ .optional(),
396
+ between: z
397
+ .union([
398
+ z.array(z.number().int().optional()).min(2).max(2),
399
+ z.string().regex(RegExp('^\\[-?\\d+,-?\\d+\\]$')),
400
+ ])
401
+ .optional(),
247
402
  });
248
403
  const ListCreditNotePriceTypeSchema = z.object({
249
404
  is: z.enum(['tax_exclusive', 'tax_inclusive']).optional(),
250
405
  is_not: z.enum(['tax_exclusive', 'tax_inclusive']).optional(),
251
- in: z.enum(['tax_exclusive', 'tax_inclusive']).optional(),
252
- not_in: z.enum(['tax_exclusive', 'tax_inclusive']).optional(),
406
+ in: z
407
+ .union([
408
+ z.array(z.enum(['tax_exclusive', 'tax_inclusive']).optional()),
409
+ z.enum(['tax_exclusive', 'tax_inclusive']),
410
+ ])
411
+ .optional(),
412
+ not_in: z
413
+ .union([
414
+ z.array(z.enum(['tax_exclusive', 'tax_inclusive']).optional()),
415
+ z.enum(['tax_exclusive', 'tax_inclusive']),
416
+ ])
417
+ .optional(),
253
418
  });
254
419
  const ListCreditNoteAmountAllocatedSchema = z.object({
255
- is: z.string().regex(RegExp('^-?\\d+$')).optional(),
256
- is_not: z.string().regex(RegExp('^-?\\d+$')).optional(),
257
- lt: z.string().regex(RegExp('^-?\\d+$')).optional(),
258
- lte: z.string().regex(RegExp('^-?\\d+$')).optional(),
259
- gt: z.string().regex(RegExp('^-?\\d+$')).optional(),
260
- gte: z.string().regex(RegExp('^-?\\d+$')).optional(),
261
- between: z.string().regex(RegExp('^\\[-?\\d+,-?\\d+\\]$')).optional(),
420
+ is: z
421
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
422
+ .optional(),
423
+ is_not: z
424
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
425
+ .optional(),
426
+ lt: z
427
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
428
+ .optional(),
429
+ lte: z
430
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
431
+ .optional(),
432
+ gt: z
433
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
434
+ .optional(),
435
+ gte: z
436
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
437
+ .optional(),
438
+ between: z
439
+ .union([
440
+ z.array(z.number().int().optional()).min(2).max(2),
441
+ z.string().regex(RegExp('^\\[-?\\d+,-?\\d+\\]$')),
442
+ ])
443
+ .optional(),
262
444
  });
263
445
  const ListCreditNoteAmountRefundedSchema = z.object({
264
- is: z.string().regex(RegExp('^-?\\d+$')).optional(),
265
- is_not: z.string().regex(RegExp('^-?\\d+$')).optional(),
266
- lt: z.string().regex(RegExp('^-?\\d+$')).optional(),
267
- lte: z.string().regex(RegExp('^-?\\d+$')).optional(),
268
- gt: z.string().regex(RegExp('^-?\\d+$')).optional(),
269
- gte: z.string().regex(RegExp('^-?\\d+$')).optional(),
270
- between: z.string().regex(RegExp('^\\[-?\\d+,-?\\d+\\]$')).optional(),
446
+ is: z
447
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
448
+ .optional(),
449
+ is_not: z
450
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
451
+ .optional(),
452
+ lt: z
453
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
454
+ .optional(),
455
+ lte: z
456
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
457
+ .optional(),
458
+ gt: z
459
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
460
+ .optional(),
461
+ gte: z
462
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
463
+ .optional(),
464
+ between: z
465
+ .union([
466
+ z.array(z.number().int().optional()).min(2).max(2),
467
+ z.string().regex(RegExp('^\\[-?\\d+,-?\\d+\\]$')),
468
+ ])
469
+ .optional(),
271
470
  });
272
471
  const ListCreditNoteAmountAvailableSchema = z.object({
273
- is: z.string().regex(RegExp('^-?\\d+$')).optional(),
274
- is_not: z.string().regex(RegExp('^-?\\d+$')).optional(),
275
- lt: z.string().regex(RegExp('^-?\\d+$')).optional(),
276
- lte: z.string().regex(RegExp('^-?\\d+$')).optional(),
277
- gt: z.string().regex(RegExp('^-?\\d+$')).optional(),
278
- gte: z.string().regex(RegExp('^-?\\d+$')).optional(),
279
- between: z.string().regex(RegExp('^\\[-?\\d+,-?\\d+\\]$')).optional(),
472
+ is: z
473
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
474
+ .optional(),
475
+ is_not: z
476
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
477
+ .optional(),
478
+ lt: z
479
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
480
+ .optional(),
481
+ lte: z
482
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
483
+ .optional(),
484
+ gt: z
485
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
486
+ .optional(),
487
+ gte: z
488
+ .union([z.number().int(), z.string().regex(RegExp('^-?\\d+$'))])
489
+ .optional(),
490
+ between: z
491
+ .union([
492
+ z.array(z.number().int().optional()).min(2).max(2),
493
+ z.string().regex(RegExp('^\\[-?\\d+,-?\\d+\\]$')),
494
+ ])
495
+ .optional(),
280
496
  });
281
497
  const ListCreditNoteVoidedAtSchema = z.object({
282
- after: z.string().regex(RegExp('^\\d{10}$')).optional(),
283
- before: z.string().regex(RegExp('^\\d{10}$')).optional(),
284
- on: z.string().regex(RegExp('^\\d{10}$')).optional(),
285
- between: z.string().regex(RegExp('^\\[\\d{10},\\d{10}\\]$')).optional(),
498
+ after: z
499
+ .union([z.number().int(), z.string().regex(RegExp('^\\d{10}$'))])
500
+ .optional(),
501
+ before: z
502
+ .union([z.number().int(), z.string().regex(RegExp('^\\d{10}$'))])
503
+ .optional(),
504
+ on: z
505
+ .union([z.number().int(), z.string().regex(RegExp('^\\d{10}$'))])
506
+ .optional(),
507
+ between: z
508
+ .union([
509
+ z.array(z.number().int().optional()).min(2).max(2),
510
+ z.string().regex(RegExp('^\\[\\d{10},\\d{10}\\]$')),
511
+ ])
512
+ .optional(),
286
513
  });
287
514
  const ListCreditNoteUpdatedAtSchema = z.object({
288
- after: z.string().regex(RegExp('^\\d{10}$')).optional(),
289
- before: z.string().regex(RegExp('^\\d{10}$')).optional(),
290
- on: z.string().regex(RegExp('^\\d{10}$')).optional(),
291
- between: z.string().regex(RegExp('^\\[\\d{10},\\d{10}\\]$')).optional(),
515
+ after: z
516
+ .union([z.number().int(), z.string().regex(RegExp('^\\d{10}$'))])
517
+ .optional(),
518
+ before: z
519
+ .union([z.number().int(), z.string().regex(RegExp('^\\d{10}$'))])
520
+ .optional(),
521
+ on: z
522
+ .union([z.number().int(), z.string().regex(RegExp('^\\d{10}$'))])
523
+ .optional(),
524
+ between: z
525
+ .union([
526
+ z.array(z.number().int().optional()).min(2).max(2),
527
+ z.string().regex(RegExp('^\\[\\d{10},\\d{10}\\]$')),
528
+ ])
529
+ .optional(),
292
530
  });
293
531
  const ListCreditNoteSortBySchema = z.looseObject({
294
532
  asc: z.enum(['date']).optional(),
@@ -297,8 +535,18 @@ const ListCreditNoteSortBySchema = z.looseObject({
297
535
  const ListCreditNoteChannelSchema = z.object({
298
536
  is: z.enum(['web', 'app_store', 'play_store']).optional(),
299
537
  is_not: z.enum(['web', 'app_store', 'play_store']).optional(),
300
- in: z.enum(['web', 'app_store', 'play_store']).optional(),
301
- not_in: z.enum(['web', 'app_store', 'play_store']).optional(),
538
+ in: z
539
+ .union([
540
+ z.array(z.enum(['web', 'app_store', 'play_store']).optional()),
541
+ z.enum(['web', 'app_store', 'play_store']),
542
+ ])
543
+ .optional(),
544
+ not_in: z
545
+ .union([
546
+ z.array(z.enum(['web', 'app_store', 'play_store']).optional()),
547
+ z.enum(['web', 'app_store', 'play_store']),
548
+ ])
549
+ .optional(),
302
550
  });
303
551
  const ListCreditNoteEinvoiceSchema = z.object({
304
552
  status: ListCreditNoteStatusSchema.optional(),
@@ -353,6 +601,61 @@ const RemoveTaxWithheldRefundCreditNoteBodySchema = z.looseObject({
353
601
  });
354
602
  export { RemoveTaxWithheldRefundCreditNoteBodySchema };
355
603
  //CreditNote.importCreditNote
604
+ const ImportCreditNoteCreditNoteLineItemsItemSchema = z.object({
605
+ reference_line_item_id: z.string().max(40).optional(),
606
+ id: z.string().max(40).optional(),
607
+ date_from: z.number().int().optional(),
608
+ date_to: z.number().int().optional(),
609
+ subscription_id: z.string().max(50).optional(),
610
+ description: z.string().max(250),
611
+ unit_amount: z.number().int().optional(),
612
+ quantity: z.number().int().optional(),
613
+ amount: z.number().int().optional(),
614
+ unit_amount_in_decimal: z.string().max(39).optional(),
615
+ quantity_in_decimal: z.string().max(33).optional(),
616
+ amount_in_decimal: z.string().max(39).optional(),
617
+ entity_type: z
618
+ .enum([
619
+ 'adhoc',
620
+ 'plan_item_price',
621
+ 'addon_item_price',
622
+ 'charge_item_price',
623
+ 'plan_setup',
624
+ 'plan',
625
+ 'addon',
626
+ ])
627
+ .optional(),
628
+ entity_id: z.string().max(100).optional(),
629
+ item_level_discount1_entity_id: z.string().max(100).optional(),
630
+ item_level_discount1_amount: z.number().int().min(0).optional(),
631
+ item_level_discount2_entity_id: z.string().max(100).optional(),
632
+ item_level_discount2_amount: z.number().int().min(0).optional(),
633
+ tax1_name: z.string().max(50).optional(),
634
+ tax1_amount: z.number().int().min(0).optional(),
635
+ tax2_name: z.string().max(50).optional(),
636
+ tax2_amount: z.number().int().min(0).optional(),
637
+ tax3_name: z.string().max(50).optional(),
638
+ tax3_amount: z.number().int().min(0).optional(),
639
+ tax4_name: z.string().max(50).optional(),
640
+ tax4_amount: z.number().int().min(0).optional(),
641
+ tax5_name: z.string().max(50).optional(),
642
+ tax5_amount: z.number().int().min(0).optional(),
643
+ tax6_name: z.string().max(50).optional(),
644
+ tax6_amount: z.number().int().min(0).optional(),
645
+ tax7_name: z.string().max(50).optional(),
646
+ tax7_amount: z.number().int().min(0).optional(),
647
+ tax8_name: z.string().max(50).optional(),
648
+ tax8_amount: z.number().int().min(0).optional(),
649
+ tax9_name: z.string().max(50).optional(),
650
+ tax9_amount: z.number().int().min(0).optional(),
651
+ tax10_name: z.string().max(50).optional(),
652
+ tax10_amount: z.number().int().min(0).optional(),
653
+ is_partial_tax_applied: z.boolean().optional(),
654
+ taxable_amount: z.number().int().min(0).optional(),
655
+ proration_mode: z
656
+ .enum(['reset', 'delta', 'service_period_revision', 'adjusted_term'])
657
+ .optional(),
658
+ });
356
659
  const ImportCreditNoteCreditNoteLineItemsSchema = z.object({
357
660
  reference_line_item_id: z.array(z.string().max(40).optional()).optional(),
358
661
  id: z.array(z.string().max(40).optional()).optional(),
@@ -420,6 +723,17 @@ const ImportCreditNoteCreditNoteLineItemsSchema = z.object({
420
723
  .optional())
421
724
  .optional(),
422
725
  });
726
+ const ImportCreditNoteCreditNoteLineItemTiersItemSchema = z.object({
727
+ line_item_id: z.string().max(40),
728
+ starting_unit: z.number().int().min(0).optional(),
729
+ ending_unit: z.number().int().optional(),
730
+ quantity_used: z.number().int().min(0).optional(),
731
+ unit_amount: z.number().int().min(0).optional(),
732
+ starting_unit_in_decimal: z.string().max(33).optional(),
733
+ ending_unit_in_decimal: z.string().max(33).optional(),
734
+ quantity_used_in_decimal: z.string().max(33).optional(),
735
+ unit_amount_in_decimal: z.string().max(40).optional(),
736
+ });
423
737
  const ImportCreditNoteCreditNoteLineItemTiersSchema = z.object({
424
738
  line_item_id: z.array(z.string().max(40).optional()),
425
739
  starting_unit: z.array(z.number().int().min(0).optional()).optional(),
@@ -431,6 +745,19 @@ const ImportCreditNoteCreditNoteLineItemTiersSchema = z.object({
431
745
  quantity_used_in_decimal: z.array(z.string().max(33).optional()).optional(),
432
746
  unit_amount_in_decimal: z.array(z.string().max(40).optional()).optional(),
433
747
  });
748
+ const ImportCreditNoteCreditNoteDiscountsItemSchema = z.object({
749
+ line_item_id: z.string().max(40).optional(),
750
+ entity_type: z.enum([
751
+ 'item_level_coupon',
752
+ 'document_level_coupon',
753
+ 'promotional_credits',
754
+ 'item_level_discount',
755
+ 'document_level_discount',
756
+ ]),
757
+ entity_id: z.string().max(100).optional(),
758
+ description: z.string().max(250).optional(),
759
+ amount: z.number().int().min(0),
760
+ });
434
761
  const ImportCreditNoteCreditNoteDiscountsSchema = z.object({
435
762
  line_item_id: z.array(z.string().max(40).optional()).optional(),
436
763
  entity_type: z.array(z
@@ -446,6 +773,26 @@ const ImportCreditNoteCreditNoteDiscountsSchema = z.object({
446
773
  description: z.array(z.string().max(250).optional()).optional(),
447
774
  amount: z.array(z.number().int().min(0).optional()),
448
775
  });
776
+ const ImportCreditNoteCreditNoteTaxesItemSchema = z.object({
777
+ name: z.string().max(100),
778
+ rate: z.number().min(0).max(100),
779
+ amount: z.number().int().min(0).optional(),
780
+ description: z.string().max(50).optional(),
781
+ juris_type: z
782
+ .enum([
783
+ 'country',
784
+ 'federal',
785
+ 'state',
786
+ 'county',
787
+ 'city',
788
+ 'special',
789
+ 'unincorporated',
790
+ 'other',
791
+ ])
792
+ .optional(),
793
+ juris_name: z.string().max(250).optional(),
794
+ juris_code: z.string().max(250).optional(),
795
+ });
449
796
  const ImportCreditNoteCreditNoteTaxesSchema = z.object({
450
797
  name: z.array(z.string().max(100).optional()),
451
798
  rate: z.array(z.number().min(0).max(100).optional()),
@@ -468,11 +815,31 @@ const ImportCreditNoteCreditNoteTaxesSchema = z.object({
468
815
  juris_name: z.array(z.string().max(250).optional()).optional(),
469
816
  juris_code: z.array(z.string().max(250).optional()).optional(),
470
817
  });
818
+ const ImportCreditNoteCreditNoteAllocationsItemSchema = z.object({
819
+ invoice_id: z.string().max(50),
820
+ allocated_amount: z.number().int().min(1),
821
+ allocated_at: z.number().int(),
822
+ });
471
823
  const ImportCreditNoteCreditNoteAllocationsSchema = z.object({
472
824
  invoice_id: z.array(z.string().max(50).optional()),
473
825
  allocated_amount: z.array(z.number().int().min(1).optional()),
474
826
  allocated_at: z.array(z.number().int().optional()),
475
827
  });
828
+ const ImportCreditNoteCreditNoteLinkedRefundsItemSchema = z.object({
829
+ id: z.string().max(40).optional(),
830
+ amount: z.number().int().min(1),
831
+ payment_method: z.enum([
832
+ 'cash',
833
+ 'check',
834
+ 'bank_transfer',
835
+ 'other',
836
+ 'app_store',
837
+ 'play_store',
838
+ 'custom',
839
+ ]),
840
+ date: z.number().int(),
841
+ reference_number: z.string().max(100).min(1).optional(),
842
+ });
476
843
  const ImportCreditNoteCreditNoteLinkedRefundsSchema = z.object({
477
844
  id: z.array(z.string().max(40).optional()).optional(),
478
845
  amount: z.array(z.number().int().min(1).optional()),
@@ -485,12 +852,6 @@ const ImportCreditNoteCreditNoteLinkedRefundsSchema = z.object({
485
852
  'app_store',
486
853
  'play_store',
487
854
  'custom',
488
- 'tamara',
489
- 'qpay',
490
- 'blik',
491
- 'fpx',
492
- 'wero',
493
- 'p24',
494
855
  ])
495
856
  .optional()),
496
857
  date: z.array(z.number().int().optional()),
@@ -505,6 +866,7 @@ const ImportCreditNoteCreditNoteBodySchema = z.looseObject({
505
866
  currency_code: z.string().max(3).optional(),
506
867
  create_reason_code: z.string().max(100),
507
868
  date: z.number().int(),
869
+ customer_notes: z.string().max(2000).optional(),
508
870
  status: z.enum(['adjusted', 'refunded', 'refund_due', 'voided']).optional(),
509
871
  total: z.number().int().min(0).optional(),
510
872
  refunded_at: z.number().int().optional(),
@@ -513,11 +875,41 @@ const ImportCreditNoteCreditNoteBodySchema = z.looseObject({
513
875
  round_off_amount: z.number().int().min(-99).max(99).optional(),
514
876
  fractional_correction: z.number().int().min(-50000).max(50000).optional(),
515
877
  vat_number_prefix: z.string().max(10).optional(),
516
- line_items: ImportCreditNoteCreditNoteLineItemsSchema.optional(),
517
- line_item_tiers: ImportCreditNoteCreditNoteLineItemTiersSchema.optional(),
518
- discounts: ImportCreditNoteCreditNoteDiscountsSchema.optional(),
519
- taxes: ImportCreditNoteCreditNoteTaxesSchema.optional(),
520
- allocations: ImportCreditNoteCreditNoteAllocationsSchema.optional(),
521
- linked_refunds: ImportCreditNoteCreditNoteLinkedRefundsSchema.optional(),
878
+ line_items: z
879
+ .union([
880
+ z.array(ImportCreditNoteCreditNoteLineItemsItemSchema.optional()),
881
+ ImportCreditNoteCreditNoteLineItemsSchema,
882
+ ])
883
+ .optional(),
884
+ line_item_tiers: z
885
+ .union([
886
+ z.array(ImportCreditNoteCreditNoteLineItemTiersItemSchema.optional()),
887
+ ImportCreditNoteCreditNoteLineItemTiersSchema,
888
+ ])
889
+ .optional(),
890
+ discounts: z
891
+ .union([
892
+ z.array(ImportCreditNoteCreditNoteDiscountsItemSchema.optional()),
893
+ ImportCreditNoteCreditNoteDiscountsSchema,
894
+ ])
895
+ .optional(),
896
+ taxes: z
897
+ .union([
898
+ z.array(ImportCreditNoteCreditNoteTaxesItemSchema.optional()),
899
+ ImportCreditNoteCreditNoteTaxesSchema,
900
+ ])
901
+ .optional(),
902
+ allocations: z
903
+ .union([
904
+ z.array(ImportCreditNoteCreditNoteAllocationsItemSchema.optional()),
905
+ ImportCreditNoteCreditNoteAllocationsSchema,
906
+ ])
907
+ .optional(),
908
+ linked_refunds: z
909
+ .union([
910
+ z.array(ImportCreditNoteCreditNoteLinkedRefundsItemSchema.optional()),
911
+ ImportCreditNoteCreditNoteLinkedRefundsSchema,
912
+ ])
913
+ .optional(),
522
914
  });
523
915
  export { ImportCreditNoteCreditNoteBodySchema };