chargebee 3.35.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 (152) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/cjs/environment.js +1 -1
  3. package/cjs/resources/api_endpoints.js +56 -0
  4. package/cjs/resources/webhook/eventType.js +2 -0
  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 +16 -5
  10. package/cjs/schema/business_rule.schema.js +2 -2
  11. package/cjs/schema/business_ruleset.schema.js +2 -2
  12. package/cjs/schema/comment.schema.js +15 -4
  13. package/cjs/schema/coupon.schema.js +218 -37
  14. package/cjs/schema/coupon_code.schema.js +36 -6
  15. package/cjs/schema/coupon_set.schema.js +108 -27
  16. package/cjs/schema/credit_note.schema.js +496 -105
  17. package/cjs/schema/credit_unit.schema.js +12 -2
  18. package/cjs/schema/customer.schema.js +212 -62
  19. package/cjs/schema/differential_price.schema.js +100 -12
  20. package/cjs/schema/dispute.schema.js +125 -33
  21. package/cjs/schema/einvoice.schema.js +27 -6
  22. package/cjs/schema/email_log.schema.js +15 -4
  23. package/cjs/schema/entitlement.schema.js +33 -4
  24. package/cjs/schema/entitlement_override.schema.js +17 -1
  25. package/cjs/schema/estimate.schema.js +581 -36
  26. package/cjs/schema/event.schema.js +1282 -633
  27. package/cjs/schema/export.schema.js +4459 -1412
  28. package/cjs/schema/feature.schema.js +73 -11
  29. package/cjs/schema/gateway_request_log.schema.js +309 -0
  30. package/cjs/schema/gateway_webhook_log.schema.js +257 -0
  31. package/cjs/schema/gift.schema.js +51 -5
  32. package/cjs/schema/grant_block.schema.js +45 -12
  33. package/cjs/schema/hosted_page.schema.js +562 -66
  34. package/cjs/schema/index.js +3 -0
  35. package/cjs/schema/invoice.schema.js +821 -121
  36. package/cjs/schema/item.schema.js +151 -28
  37. package/cjs/schema/item_entitlement.schema.js +23 -2
  38. package/cjs/schema/item_family.schema.js +29 -8
  39. package/cjs/schema/item_price.schema.js +263 -48
  40. package/cjs/schema/ledger_operation.schema.js +42 -15
  41. package/cjs/schema/metered_feature.schema.js +10 -1
  42. package/cjs/schema/omnichannel_one_time_order.schema.js +32 -2
  43. package/cjs/schema/omnichannel_subscription.schema.js +136 -30
  44. package/cjs/schema/order.schema.js +233 -61
  45. package/cjs/schema/organization_detail.schema.js +36 -0
  46. package/cjs/schema/payment_schedule.schema.js +39 -8
  47. package/cjs/schema/payment_schedule_scheme.schema.js +37 -7
  48. package/cjs/schema/payment_source.schema.js +360 -148
  49. package/cjs/schema/payment_voucher.schema.js +33 -5
  50. package/cjs/schema/plan.schema.js +345 -57
  51. package/cjs/schema/price_ramp.schema.js +79 -14
  52. package/cjs/schema/price_variant.schema.js +88 -18
  53. package/cjs/schema/pricing_page_session.schema.js +36 -2
  54. package/cjs/schema/promotional_credit.schema.js +27 -6
  55. package/cjs/schema/purchase.schema.js +204 -12
  56. package/cjs/schema/quote.schema.js +901 -81
  57. package/cjs/schema/quote_entitlement.schema.js +6 -2
  58. package/cjs/schema/ramp.schema.js +238 -24
  59. package/cjs/schema/site_migration_detail.schema.js +50 -16
  60. package/cjs/schema/subscription.schema.js +998 -169
  61. package/cjs/schema/subscription_entitlement.schema.js +9 -1
  62. package/cjs/schema/transaction.schema.js +780 -342
  63. package/cjs/schema/unbilled_charge.schema.js +141 -13
  64. package/cjs/schema/usage.schema.js +55 -12
  65. package/cjs/schema/usage_event.schema.js +13 -1
  66. package/cjs/schema/virtual_bank_account.schema.js +42 -10
  67. package/cjs/schema/webhook_endpoint.schema.js +4 -0
  68. package/esm/environment.js +1 -1
  69. package/esm/resources/api_endpoints.js +56 -0
  70. package/esm/resources/webhook/eventType.js +2 -0
  71. package/esm/schema/addon.schema.js +221 -40
  72. package/esm/schema/alert.schema.js +17 -2
  73. package/esm/schema/alert_status.schema.js +6 -1
  74. package/esm/schema/attached_item.schema.js +101 -26
  75. package/esm/schema/business_entity.schema.js +16 -5
  76. package/esm/schema/business_rule.schema.js +2 -2
  77. package/esm/schema/business_ruleset.schema.js +2 -2
  78. package/esm/schema/comment.schema.js +15 -4
  79. package/esm/schema/coupon.schema.js +218 -37
  80. package/esm/schema/coupon_code.schema.js +36 -6
  81. package/esm/schema/coupon_set.schema.js +108 -27
  82. package/esm/schema/credit_note.schema.js +496 -105
  83. package/esm/schema/credit_unit.schema.js +12 -2
  84. package/esm/schema/customer.schema.js +212 -62
  85. package/esm/schema/differential_price.schema.js +100 -12
  86. package/esm/schema/dispute.schema.js +125 -33
  87. package/esm/schema/einvoice.schema.js +27 -6
  88. package/esm/schema/email_log.schema.js +15 -4
  89. package/esm/schema/entitlement.schema.js +33 -4
  90. package/esm/schema/entitlement_override.schema.js +17 -1
  91. package/esm/schema/estimate.schema.js +581 -36
  92. package/esm/schema/event.schema.js +1282 -633
  93. package/esm/schema/export.schema.js +4459 -1412
  94. package/esm/schema/feature.schema.js +73 -11
  95. package/esm/schema/gateway_request_log.schema.js +306 -0
  96. package/esm/schema/gateway_webhook_log.schema.js +254 -0
  97. package/esm/schema/gift.schema.js +51 -5
  98. package/esm/schema/grant_block.schema.js +45 -12
  99. package/esm/schema/hosted_page.schema.js +562 -66
  100. package/esm/schema/index.js +3 -0
  101. package/esm/schema/invoice.schema.js +821 -121
  102. package/esm/schema/item.schema.js +151 -28
  103. package/esm/schema/item_entitlement.schema.js +23 -2
  104. package/esm/schema/item_family.schema.js +29 -8
  105. package/esm/schema/item_price.schema.js +263 -48
  106. package/esm/schema/ledger_operation.schema.js +42 -15
  107. package/esm/schema/metered_feature.schema.js +10 -1
  108. package/esm/schema/omnichannel_one_time_order.schema.js +32 -2
  109. package/esm/schema/omnichannel_subscription.schema.js +136 -30
  110. package/esm/schema/order.schema.js +233 -61
  111. package/esm/schema/organization_detail.schema.js +33 -0
  112. package/esm/schema/payment_schedule.schema.js +39 -8
  113. package/esm/schema/payment_schedule_scheme.schema.js +37 -7
  114. package/esm/schema/payment_source.schema.js +360 -148
  115. package/esm/schema/payment_voucher.schema.js +33 -5
  116. package/esm/schema/plan.schema.js +345 -57
  117. package/esm/schema/price_ramp.schema.js +79 -14
  118. package/esm/schema/price_variant.schema.js +88 -18
  119. package/esm/schema/pricing_page_session.schema.js +36 -2
  120. package/esm/schema/promotional_credit.schema.js +27 -6
  121. package/esm/schema/purchase.schema.js +204 -12
  122. package/esm/schema/quote.schema.js +901 -81
  123. package/esm/schema/quote_entitlement.schema.js +6 -2
  124. package/esm/schema/ramp.schema.js +238 -24
  125. package/esm/schema/site_migration_detail.schema.js +50 -16
  126. package/esm/schema/subscription.schema.js +998 -169
  127. package/esm/schema/subscription_entitlement.schema.js +9 -1
  128. package/esm/schema/transaction.schema.js +780 -342
  129. package/esm/schema/unbilled_charge.schema.js +141 -13
  130. package/esm/schema/usage.schema.js +55 -12
  131. package/esm/schema/usage_event.schema.js +13 -1
  132. package/esm/schema/virtual_bank_account.schema.js +42 -10
  133. package/esm/schema/webhook_endpoint.schema.js +4 -0
  134. package/package.json +1 -1
  135. package/types/core.d.ts +10 -6
  136. package/types/index.d.ts +8 -1
  137. package/types/resources/BillingLineItem.d.ts +10 -0
  138. package/types/resources/BillingMetadata.d.ts +9 -0
  139. package/types/resources/Content.d.ts +5 -0
  140. package/types/resources/Discount.d.ts +1 -0
  141. package/types/resources/DraftRequest.d.ts +1 -1
  142. package/types/resources/Estimate.d.ts +3 -0
  143. package/types/resources/Event.d.ts +2 -0
  144. package/types/resources/GatewayRequestLog.d.ts +82 -0
  145. package/types/resources/GatewayWebhookLog.d.ts +74 -0
  146. package/types/resources/GrantBlock.d.ts +5 -0
  147. package/types/resources/HostedPage.d.ts +18 -0
  148. package/types/resources/Invoice.d.ts +4 -0
  149. package/types/resources/OrganizationDetail.d.ts +84 -0
  150. package/types/resources/Subscription.d.ts +3 -0
  151. package/types/resources/Usage.d.ts +1 -0
  152. package/types/resources/WebhookEvent.d.ts +10 -0
@@ -3,6 +3,10 @@
3
3
  // Do not edit manually – regenerate via sdk-generator
4
4
  import { z } from 'zod';
5
5
  //PriceVariant.create
6
+ const CreatePriceVariantAttributesItemSchema = z.object({
7
+ name: z.string().max(100),
8
+ value: z.string().max(100),
9
+ });
6
10
  const CreatePriceVariantAttributesSchema = z.object({
7
11
  name: z.array(z.string().max(100).optional()),
8
12
  value: z.array(z.string().max(100).optional()),
@@ -14,10 +18,19 @@ const CreatePriceVariantBodySchema = z.looseObject({
14
18
  description: z.string().max(500).optional(),
15
19
  variant_group: z.string().max(100).optional(),
16
20
  business_entity_id: z.string().max(50).optional(),
17
- attributes: CreatePriceVariantAttributesSchema.optional(),
21
+ attributes: z
22
+ .union([
23
+ z.array(CreatePriceVariantAttributesItemSchema.optional()),
24
+ CreatePriceVariantAttributesSchema,
25
+ ])
26
+ .optional(),
18
27
  });
19
28
  export { CreatePriceVariantBodySchema };
20
29
  //PriceVariant.update
30
+ const UpdatePriceVariantAttributesItemSchema = z.object({
31
+ name: z.string().max(100),
32
+ value: z.string().max(100),
33
+ });
21
34
  const UpdatePriceVariantAttributesSchema = z.object({
22
35
  name: z.array(z.string().max(100).optional()),
23
36
  value: z.array(z.string().max(100).optional()),
@@ -28,7 +41,12 @@ const UpdatePriceVariantBodySchema = z.looseObject({
28
41
  description: z.string().max(500).optional(),
29
42
  variant_group: z.string().max(100).optional(),
30
43
  status: z.enum(['active', 'archived']).optional(),
31
- attributes: UpdatePriceVariantAttributesSchema.optional(),
44
+ attributes: z
45
+ .union([
46
+ z.array(UpdatePriceVariantAttributesItemSchema.optional()),
47
+ UpdatePriceVariantAttributesSchema,
48
+ ])
49
+ .optional(),
32
50
  });
33
51
  export { UpdatePriceVariantBodySchema };
34
52
  //PriceVariant.list
@@ -36,40 +54,92 @@ const ListPriceVariantIdSchema = z.object({
36
54
  is: z.string().min(1).optional(),
37
55
  is_not: z.string().min(1).optional(),
38
56
  starts_with: z.string().min(1).optional(),
39
- in: z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
40
- not_in: z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
57
+ in: z
58
+ .union([
59
+ z.array(z.string().optional()),
60
+ z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')),
61
+ ])
62
+ .optional(),
63
+ not_in: z
64
+ .union([
65
+ z.array(z.string().optional()),
66
+ z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')),
67
+ ])
68
+ .optional(),
41
69
  });
42
70
  const ListPriceVariantNameSchema = z.object({
43
71
  is: z.string().min(1).optional(),
44
72
  is_not: z.string().min(1).optional(),
45
73
  starts_with: z.string().min(1).optional(),
46
- in: z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
47
- not_in: z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
74
+ in: z
75
+ .union([
76
+ z.array(z.string().optional()),
77
+ z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')),
78
+ ])
79
+ .optional(),
80
+ not_in: z
81
+ .union([
82
+ z.array(z.string().optional()),
83
+ z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')),
84
+ ])
85
+ .optional(),
48
86
  });
49
87
  const ListPriceVariantStatusSchema = z.object({
50
88
  is: z.enum(['active', 'archived']).optional(),
51
89
  is_not: z.enum(['active', 'archived']).optional(),
52
- in: z.enum(['active', 'archived']).optional(),
53
- not_in: z.enum(['active', 'archived']).optional(),
90
+ in: z
91
+ .union([
92
+ z.array(z.enum(['active', 'archived']).optional()),
93
+ z.enum(['active', 'archived']),
94
+ ])
95
+ .optional(),
96
+ not_in: z
97
+ .union([
98
+ z.array(z.enum(['active', 'archived']).optional()),
99
+ z.enum(['active', 'archived']),
100
+ ])
101
+ .optional(),
54
102
  });
55
103
  const ListPriceVariantUpdatedAtSchema = z.object({
56
- after: z.string().regex(RegExp('^\\d{10}$')).optional(),
57
- before: z.string().regex(RegExp('^\\d{10}$')).optional(),
58
- on: z.string().regex(RegExp('^\\d{10}$')).optional(),
59
- between: z.string().regex(RegExp('^\\[\\d{10},\\d{10}\\]$')).optional(),
104
+ after: z
105
+ .union([z.number().int(), z.string().regex(RegExp('^\\d{10}$'))])
106
+ .optional(),
107
+ before: z
108
+ .union([z.number().int(), z.string().regex(RegExp('^\\d{10}$'))])
109
+ .optional(),
110
+ on: z
111
+ .union([z.number().int(), z.string().regex(RegExp('^\\d{10}$'))])
112
+ .optional(),
113
+ between: z
114
+ .union([
115
+ z.array(z.number().int().optional()).min(2).max(2),
116
+ z.string().regex(RegExp('^\\[\\d{10},\\d{10}\\]$')),
117
+ ])
118
+ .optional(),
60
119
  });
61
120
  const ListPriceVariantCreatedAtSchema = z.object({
62
- after: z.string().regex(RegExp('^\\d{10}$')).optional(),
63
- before: z.string().regex(RegExp('^\\d{10}$')).optional(),
64
- on: z.string().regex(RegExp('^\\d{10}$')).optional(),
65
- between: z.string().regex(RegExp('^\\[\\d{10},\\d{10}\\]$')).optional(),
121
+ after: z
122
+ .union([z.number().int(), z.string().regex(RegExp('^\\d{10}$'))])
123
+ .optional(),
124
+ before: z
125
+ .union([z.number().int(), z.string().regex(RegExp('^\\d{10}$'))])
126
+ .optional(),
127
+ on: z
128
+ .union([z.number().int(), z.string().regex(RegExp('^\\d{10}$'))])
129
+ .optional(),
130
+ between: z
131
+ .union([
132
+ z.array(z.number().int().optional()).min(2).max(2),
133
+ z.string().regex(RegExp('^\\[\\d{10},\\d{10}\\]$')),
134
+ ])
135
+ .optional(),
66
136
  });
67
137
  const ListPriceVariantBusinessEntityIdSchema = z.object({
68
- is_present: z.enum(['true', 'false']).optional(),
69
138
  is: z.string().min(1).optional(),
139
+ is_present: z.union([z.boolean(), z.enum(['true', 'false'])]).optional(),
70
140
  });
71
141
  const ListPriceVariantIncludeSiteLevelResourcesSchema = z.object({
72
- is: z.enum(['true', 'false']).optional(),
142
+ is: z.union([z.boolean(), z.enum(['true', 'false'])]).optional(),
73
143
  });
74
144
  const ListPriceVariantSortBySchema = z.looseObject({
75
145
  asc: z.enum(['name', 'id', 'status', 'created_at', 'updated_at']).optional(),
@@ -61,6 +61,18 @@ const CreateForNewSubscriptionPricingPageSessionContractTermSchema = z.object({
61
61
  .optional(),
62
62
  cancellation_cutoff_period: z.number().int().optional(),
63
63
  });
64
+ const CreateForNewSubscriptionPricingPageSessionDiscountsItemSchema = z.object({
65
+ apply_on: z.enum(['invoice_amount', 'specific_item_price']).optional(),
66
+ duration_type: z.enum(['one_time', 'forever', 'limited_period']),
67
+ percentage: z.number().min(0.01).max(100).optional(),
68
+ amount: z.number().int().min(0).optional(),
69
+ period: z.number().int().min(1).optional(),
70
+ period_unit: z.enum(['day', 'week', 'month', 'year']).optional(),
71
+ included_in_mrr: z.boolean().optional(),
72
+ item_price_id: z.string().max(100).optional(),
73
+ quantity: z.number().int().min(1).optional(),
74
+ label: z.string().max(100).optional(),
75
+ });
64
76
  const CreateForNewSubscriptionPricingPageSessionDiscountsSchema = z.object({
65
77
  apply_on: z
66
78
  .array(z.enum(['invoice_amount', 'specific_item_price']).optional())
@@ -89,7 +101,12 @@ const CreateForNewSubscriptionPricingPageSessionBodySchema = z.looseObject({
89
101
  billing_address: CreateForNewSubscriptionPricingPageSessionBillingAddressSchema.optional(),
90
102
  shipping_address: CreateForNewSubscriptionPricingPageSessionShippingAddressSchema.optional(),
91
103
  contract_term: CreateForNewSubscriptionPricingPageSessionContractTermSchema.optional(),
92
- discounts: CreateForNewSubscriptionPricingPageSessionDiscountsSchema.optional(),
104
+ discounts: z
105
+ .union([
106
+ z.array(CreateForNewSubscriptionPricingPageSessionDiscountsItemSchema.optional()),
107
+ CreateForNewSubscriptionPricingPageSessionDiscountsSchema,
108
+ ])
109
+ .optional(),
93
110
  });
94
111
  export { CreateForNewSubscriptionPricingPageSessionBodySchema };
95
112
  //PricingPageSession.createForExistingSubscription
@@ -106,6 +123,18 @@ const CreateForExistingSubscriptionPricingPageSessionContractTermSchema = z.obje
106
123
  .optional(),
107
124
  cancellation_cutoff_period: z.number().int().optional(),
108
125
  });
126
+ const CreateForExistingSubscriptionPricingPageSessionDiscountsItemSchema = z.object({
127
+ apply_on: z.enum(['invoice_amount', 'specific_item_price']).optional(),
128
+ duration_type: z.enum(['one_time', 'forever', 'limited_period']),
129
+ percentage: z.number().min(0.01).max(100).optional(),
130
+ amount: z.number().int().min(0).optional(),
131
+ period: z.number().int().min(1).optional(),
132
+ period_unit: z.enum(['day', 'week', 'month', 'year']).optional(),
133
+ included_in_mrr: z.boolean().optional(),
134
+ item_price_id: z.string().max(100).optional(),
135
+ quantity: z.number().int().min(1).optional(),
136
+ label: z.string().max(100).optional(),
137
+ });
109
138
  const CreateForExistingSubscriptionPricingPageSessionDiscountsSchema = z.object({
110
139
  apply_on: z
111
140
  .array(z.enum(['invoice_amount', 'specific_item_price']).optional())
@@ -128,6 +157,11 @@ const CreateForExistingSubscriptionPricingPageSessionBodySchema = z.looseObject(
128
157
  pricing_page: CreateForExistingSubscriptionPricingPageSessionPricingPageSchema.optional(),
129
158
  subscription: CreateForExistingSubscriptionPricingPageSessionSubscriptionSchema.optional(),
130
159
  contract_term: CreateForExistingSubscriptionPricingPageSessionContractTermSchema.optional(),
131
- discounts: CreateForExistingSubscriptionPricingPageSessionDiscountsSchema.optional(),
160
+ discounts: z
161
+ .union([
162
+ z.array(CreateForExistingSubscriptionPricingPageSessionDiscountsItemSchema.optional()),
163
+ CreateForExistingSubscriptionPricingPageSessionDiscountsSchema,
164
+ ])
165
+ .optional(),
132
166
  });
133
167
  export { CreateForExistingSubscriptionPricingPageSessionBodySchema };
@@ -48,16 +48,37 @@ const ListPromotionalCreditIdSchema = z.object({
48
48
  starts_with: z.string().min(1).optional(),
49
49
  });
50
50
  const ListPromotionalCreditCreatedAtSchema = z.object({
51
- after: z.string().regex(RegExp('^\\d{10}$')).optional(),
52
- before: z.string().regex(RegExp('^\\d{10}$')).optional(),
53
- on: z.string().regex(RegExp('^\\d{10}$')).optional(),
54
- between: z.string().regex(RegExp('^\\[\\d{10},\\d{10}\\]$')).optional(),
51
+ after: z
52
+ .union([z.number().int(), z.string().regex(RegExp('^\\d{10}$'))])
53
+ .optional(),
54
+ before: z
55
+ .union([z.number().int(), z.string().regex(RegExp('^\\d{10}$'))])
56
+ .optional(),
57
+ on: z
58
+ .union([z.number().int(), z.string().regex(RegExp('^\\d{10}$'))])
59
+ .optional(),
60
+ between: z
61
+ .union([
62
+ z.array(z.number().int().optional()).min(2).max(2),
63
+ z.string().regex(RegExp('^\\[\\d{10},\\d{10}\\]$')),
64
+ ])
65
+ .optional(),
55
66
  });
56
67
  const ListPromotionalCreditTypeSchema = z.object({
57
68
  is: z.enum(['increment', 'decrement']).optional(),
58
69
  is_not: z.enum(['increment', 'decrement']).optional(),
59
- in: z.enum(['increment', 'decrement']).optional(),
60
- not_in: z.enum(['increment', 'decrement']).optional(),
70
+ in: z
71
+ .union([
72
+ z.array(z.enum(['increment', 'decrement']).optional()),
73
+ z.enum(['increment', 'decrement']),
74
+ ])
75
+ .optional(),
76
+ not_in: z
77
+ .union([
78
+ z.array(z.enum(['increment', 'decrement']).optional()),
79
+ z.enum(['increment', 'decrement']),
80
+ ])
81
+ .optional(),
61
82
  });
62
83
  const ListPromotionalCreditCustomerIdSchema = z.object({
63
84
  is: z.string().min(1).optional(),
@@ -92,6 +92,15 @@ const CreatePurchasePaymentIntentSchema = z.object({
92
92
  gw_payment_method_id: z.string().max(65000).optional(),
93
93
  additional_information: CreatePurchaseAdditionalInformationSchema.optional(),
94
94
  });
95
+ const CreatePurchasePurchaseItemsItemSchema = z.object({
96
+ index: z.number().int().min(0),
97
+ item_price_id: z.string().max(100),
98
+ quantity: z.number().int().min(1).optional(),
99
+ unit_amount: z.number().int().min(0).optional(),
100
+ unit_amount_in_decimal: z.string().max(39).optional(),
101
+ quantity_in_decimal: z.string().max(33).optional(),
102
+ trial_end: z.number().int().optional(),
103
+ });
95
104
  const CreatePurchasePurchaseItemsSchema = z.object({
96
105
  index: z.array(z.number().int().min(0).optional()),
97
106
  item_price_id: z.array(z.string().max(100).optional()),
@@ -101,6 +110,16 @@ const CreatePurchasePurchaseItemsSchema = z.object({
101
110
  quantity_in_decimal: z.array(z.string().max(33).optional()).optional(),
102
111
  trial_end: z.array(z.number().int().optional()).optional(),
103
112
  });
113
+ const CreatePurchaseItemTiersItemSchema = z.object({
114
+ index: z.number().int().min(0),
115
+ item_price_id: z.string().max(100).optional(),
116
+ starting_unit: z.number().int().min(1).optional(),
117
+ ending_unit: z.number().int().optional(),
118
+ price: z.number().int().min(0).optional(),
119
+ starting_unit_in_decimal: z.string().max(33).optional(),
120
+ ending_unit_in_decimal: z.string().max(33).optional(),
121
+ price_in_decimal: z.string().max(39).optional(),
122
+ });
104
123
  const CreatePurchaseItemTiersSchema = z.object({
105
124
  index: z.array(z.number().int().min(0).optional()),
106
125
  item_price_id: z.array(z.string().max(100).optional()).optional(),
@@ -111,6 +130,24 @@ const CreatePurchaseItemTiersSchema = z.object({
111
130
  ending_unit_in_decimal: z.array(z.string().max(33).optional()).optional(),
112
131
  price_in_decimal: z.array(z.string().max(39).optional()).optional(),
113
132
  });
133
+ const CreatePurchaseShippingAddressesItemSchema = z.object({
134
+ first_name: z.string().max(150).optional(),
135
+ last_name: z.string().max(150).optional(),
136
+ email: z.string().email().max(70).optional(),
137
+ company: z.string().max(250).optional(),
138
+ phone: z.string().max(50).optional(),
139
+ line1: z.string().max(150).optional(),
140
+ line2: z.string().max(150).optional(),
141
+ line3: z.string().max(150).optional(),
142
+ city: z.string().max(50).optional(),
143
+ state: z.string().max(50).optional(),
144
+ state_code: z.string().max(50).optional(),
145
+ country: z.string().max(50).optional(),
146
+ zip: z.string().max(20).optional(),
147
+ validation_status: z
148
+ .enum(['not_validated', 'valid', 'partially_valid', 'invalid'])
149
+ .optional(),
150
+ });
114
151
  const CreatePurchaseShippingAddressesSchema = z.object({
115
152
  first_name: z.array(z.string().max(150).optional()).optional(),
116
153
  last_name: z.array(z.string().max(150).optional()).optional(),
@@ -131,6 +168,14 @@ const CreatePurchaseShippingAddressesSchema = z.object({
131
168
  .optional())
132
169
  .optional(),
133
170
  });
171
+ const CreatePurchaseDiscountsItemSchema = z.object({
172
+ index: z.number().int().min(0).optional(),
173
+ coupon_id: z.string().max(100).optional(),
174
+ percentage: z.number().min(0.01).max(100).optional(),
175
+ quantity: z.number().int().min(1).optional(),
176
+ amount: z.number().int().min(0).optional(),
177
+ included_in_mrr: z.boolean().optional(),
178
+ });
134
179
  const CreatePurchaseDiscountsSchema = z.object({
135
180
  index: z.array(z.number().int().min(0).optional()).optional(),
136
181
  coupon_id: z.array(z.string().max(100).optional()).optional(),
@@ -139,6 +184,21 @@ const CreatePurchaseDiscountsSchema = z.object({
139
184
  amount: z.array(z.number().int().min(0).optional()).optional(),
140
185
  included_in_mrr: z.array(z.boolean().optional()).optional(),
141
186
  });
187
+ const CreatePurchaseMetaDataSchema = z.looseObject({});
188
+ const CreatePurchaseSubscriptionInfoItemSchema = z.object({
189
+ index: z.number().int().min(0),
190
+ subscription_id: z.string().max(50).optional(),
191
+ billing_cycles: z.number().int().min(0).optional(),
192
+ contract_term_billing_cycle_on_renewal: z
193
+ .number()
194
+ .int()
195
+ .min(1)
196
+ .max(100)
197
+ .optional(),
198
+ trial_end: z.number().int().optional(),
199
+ start_date: z.number().int().optional(),
200
+ meta_data: CreatePurchaseMetaDataSchema.optional(),
201
+ });
142
202
  const CreatePurchaseMetaDataItemSchema = z.looseObject({});
143
203
  const CreatePurchaseSubscriptionInfoSchema = z.object({
144
204
  index: z.array(z.number().int().min(0).optional()),
@@ -151,6 +211,13 @@ const CreatePurchaseSubscriptionInfoSchema = z.object({
151
211
  start_date: z.array(z.number().int().optional()).optional(),
152
212
  meta_data: z.array(CreatePurchaseMetaDataItemSchema.optional()).optional(),
153
213
  });
214
+ const CreatePurchaseContractTermsItemSchema = z.object({
215
+ index: z.number().int().min(0),
216
+ action_at_term_end: z
217
+ .enum(['renew', 'evergreen', 'cancel', 'renew_once'])
218
+ .optional(),
219
+ cancellation_cutoff_period: z.number().int().optional(),
220
+ });
154
221
  const CreatePurchaseContractTermsSchema = z.object({
155
222
  index: z.array(z.number().int().min(0).optional()),
156
223
  action_at_term_end: z
@@ -166,12 +233,42 @@ const CreatePurchaseBodySchema = z.looseObject({
166
233
  payment_schedule: CreatePurchasePaymentScheduleSchema.optional(),
167
234
  statement_descriptor: CreatePurchaseStatementDescriptorSchema.optional(),
168
235
  payment_intent: CreatePurchasePaymentIntentSchema.optional(),
169
- purchase_items: CreatePurchasePurchaseItemsSchema.optional(),
170
- item_tiers: CreatePurchaseItemTiersSchema.optional(),
171
- shipping_addresses: CreatePurchaseShippingAddressesSchema.optional(),
172
- discounts: CreatePurchaseDiscountsSchema.optional(),
173
- subscription_info: CreatePurchaseSubscriptionInfoSchema.optional(),
174
- contract_terms: CreatePurchaseContractTermsSchema.optional(),
236
+ purchase_items: z
237
+ .union([
238
+ z.array(CreatePurchasePurchaseItemsItemSchema.optional()),
239
+ CreatePurchasePurchaseItemsSchema,
240
+ ])
241
+ .optional(),
242
+ item_tiers: z
243
+ .union([
244
+ z.array(CreatePurchaseItemTiersItemSchema.optional()),
245
+ CreatePurchaseItemTiersSchema,
246
+ ])
247
+ .optional(),
248
+ shipping_addresses: z
249
+ .union([
250
+ z.array(CreatePurchaseShippingAddressesItemSchema.optional()),
251
+ CreatePurchaseShippingAddressesSchema,
252
+ ])
253
+ .optional(),
254
+ discounts: z
255
+ .union([
256
+ z.array(CreatePurchaseDiscountsItemSchema.optional()),
257
+ CreatePurchaseDiscountsSchema,
258
+ ])
259
+ .optional(),
260
+ subscription_info: z
261
+ .union([
262
+ z.array(CreatePurchaseSubscriptionInfoItemSchema.optional()),
263
+ CreatePurchaseSubscriptionInfoSchema,
264
+ ])
265
+ .optional(),
266
+ contract_terms: z
267
+ .union([
268
+ z.array(CreatePurchaseContractTermsItemSchema.optional()),
269
+ CreatePurchaseContractTermsSchema,
270
+ ])
271
+ .optional(),
175
272
  });
176
273
  export { CreatePurchaseBodySchema };
177
274
  //Purchase.estimate
@@ -221,6 +318,15 @@ const EstimatePurchaseBillingAddressSchema = z.object({
221
318
  .enum(['not_validated', 'valid', 'partially_valid', 'invalid'])
222
319
  .optional(),
223
320
  });
321
+ const EstimatePurchasePurchaseItemsItemSchema = z.object({
322
+ index: z.number().int().min(0),
323
+ item_price_id: z.string().max(100),
324
+ quantity: z.number().int().min(1).optional(),
325
+ unit_amount: z.number().int().min(0).optional(),
326
+ unit_amount_in_decimal: z.string().max(39).optional(),
327
+ quantity_in_decimal: z.string().max(33).optional(),
328
+ trial_end: z.number().int().optional(),
329
+ });
224
330
  const EstimatePurchasePurchaseItemsSchema = z.object({
225
331
  index: z.array(z.number().int().min(0).optional()),
226
332
  item_price_id: z.array(z.string().max(100).optional()),
@@ -230,6 +336,16 @@ const EstimatePurchasePurchaseItemsSchema = z.object({
230
336
  quantity_in_decimal: z.array(z.string().max(33).optional()).optional(),
231
337
  trial_end: z.array(z.number().int().optional()).optional(),
232
338
  });
339
+ const EstimatePurchaseItemTiersItemSchema = z.object({
340
+ index: z.number().int().min(0),
341
+ item_price_id: z.string().max(100).optional(),
342
+ starting_unit: z.number().int().min(1).optional(),
343
+ ending_unit: z.number().int().optional(),
344
+ price: z.number().int().min(0).optional(),
345
+ starting_unit_in_decimal: z.string().max(33).optional(),
346
+ ending_unit_in_decimal: z.string().max(33).optional(),
347
+ price_in_decimal: z.string().max(39).optional(),
348
+ });
233
349
  const EstimatePurchaseItemTiersSchema = z.object({
234
350
  index: z.array(z.number().int().min(0).optional()),
235
351
  item_price_id: z.array(z.string().max(100).optional()).optional(),
@@ -240,6 +356,24 @@ const EstimatePurchaseItemTiersSchema = z.object({
240
356
  ending_unit_in_decimal: z.array(z.string().max(33).optional()).optional(),
241
357
  price_in_decimal: z.array(z.string().max(39).optional()).optional(),
242
358
  });
359
+ const EstimatePurchaseShippingAddressesItemSchema = z.object({
360
+ first_name: z.string().max(150).optional(),
361
+ last_name: z.string().max(150).optional(),
362
+ email: z.string().email().max(70).optional(),
363
+ company: z.string().max(250).optional(),
364
+ phone: z.string().max(50).optional(),
365
+ line1: z.string().max(150).optional(),
366
+ line2: z.string().max(150).optional(),
367
+ line3: z.string().max(150).optional(),
368
+ city: z.string().max(50).optional(),
369
+ state: z.string().max(50).optional(),
370
+ state_code: z.string().max(50).optional(),
371
+ country: z.string().max(50).optional(),
372
+ zip: z.string().max(20).optional(),
373
+ validation_status: z
374
+ .enum(['not_validated', 'valid', 'partially_valid', 'invalid'])
375
+ .optional(),
376
+ });
243
377
  const EstimatePurchaseShippingAddressesSchema = z.object({
244
378
  first_name: z.array(z.string().max(150).optional()).optional(),
245
379
  last_name: z.array(z.string().max(150).optional()).optional(),
@@ -260,6 +394,14 @@ const EstimatePurchaseShippingAddressesSchema = z.object({
260
394
  .optional())
261
395
  .optional(),
262
396
  });
397
+ const EstimatePurchaseDiscountsItemSchema = z.object({
398
+ index: z.number().int().min(0).optional(),
399
+ coupon_id: z.string().max(100).optional(),
400
+ percentage: z.number().min(0.01).max(100).optional(),
401
+ quantity: z.number().int().min(1).optional(),
402
+ amount: z.number().int().min(0).optional(),
403
+ included_in_mrr: z.boolean().optional(),
404
+ });
263
405
  const EstimatePurchaseDiscountsSchema = z.object({
264
406
  index: z.array(z.number().int().min(0).optional()).optional(),
265
407
  coupon_id: z.array(z.string().max(100).optional()).optional(),
@@ -268,6 +410,19 @@ const EstimatePurchaseDiscountsSchema = z.object({
268
410
  amount: z.array(z.number().int().min(0).optional()).optional(),
269
411
  included_in_mrr: z.array(z.boolean().optional()).optional(),
270
412
  });
413
+ const EstimatePurchaseSubscriptionInfoItemSchema = z.object({
414
+ index: z.number().int().min(0),
415
+ subscription_id: z.string().max(50).optional(),
416
+ billing_cycles: z.number().int().min(0).optional(),
417
+ contract_term_billing_cycle_on_renewal: z
418
+ .number()
419
+ .int()
420
+ .min(1)
421
+ .max(100)
422
+ .optional(),
423
+ trial_end: z.number().int().optional(),
424
+ start_date: z.number().int().optional(),
425
+ });
271
426
  const EstimatePurchaseSubscriptionInfoSchema = z.object({
272
427
  index: z.array(z.number().int().min(0).optional()),
273
428
  subscription_id: z.array(z.string().max(50).optional()).optional(),
@@ -278,6 +433,13 @@ const EstimatePurchaseSubscriptionInfoSchema = z.object({
278
433
  trial_end: z.array(z.number().int().optional()).optional(),
279
434
  start_date: z.array(z.number().int().optional()).optional(),
280
435
  });
436
+ const EstimatePurchaseContractTermsItemSchema = z.object({
437
+ index: z.number().int().min(0),
438
+ action_at_term_end: z
439
+ .enum(['renew', 'evergreen', 'cancel', 'renew_once'])
440
+ .optional(),
441
+ cancellation_cutoff_period: z.number().int().optional(),
442
+ });
281
443
  const EstimatePurchaseContractTermsSchema = z.object({
282
444
  index: z.array(z.number().int().min(0).optional()),
283
445
  action_at_term_end: z
@@ -290,11 +452,41 @@ const EstimatePurchaseBodySchema = z.looseObject({
290
452
  customer_id: z.string().max(50).optional(),
291
453
  customer: EstimatePurchaseCustomerSchema.optional(),
292
454
  billing_address: EstimatePurchaseBillingAddressSchema.optional(),
293
- purchase_items: EstimatePurchasePurchaseItemsSchema.optional(),
294
- item_tiers: EstimatePurchaseItemTiersSchema.optional(),
295
- shipping_addresses: EstimatePurchaseShippingAddressesSchema.optional(),
296
- discounts: EstimatePurchaseDiscountsSchema.optional(),
297
- subscription_info: EstimatePurchaseSubscriptionInfoSchema.optional(),
298
- contract_terms: EstimatePurchaseContractTermsSchema.optional(),
455
+ purchase_items: z
456
+ .union([
457
+ z.array(EstimatePurchasePurchaseItemsItemSchema.optional()),
458
+ EstimatePurchasePurchaseItemsSchema,
459
+ ])
460
+ .optional(),
461
+ item_tiers: z
462
+ .union([
463
+ z.array(EstimatePurchaseItemTiersItemSchema.optional()),
464
+ EstimatePurchaseItemTiersSchema,
465
+ ])
466
+ .optional(),
467
+ shipping_addresses: z
468
+ .union([
469
+ z.array(EstimatePurchaseShippingAddressesItemSchema.optional()),
470
+ EstimatePurchaseShippingAddressesSchema,
471
+ ])
472
+ .optional(),
473
+ discounts: z
474
+ .union([
475
+ z.array(EstimatePurchaseDiscountsItemSchema.optional()),
476
+ EstimatePurchaseDiscountsSchema,
477
+ ])
478
+ .optional(),
479
+ subscription_info: z
480
+ .union([
481
+ z.array(EstimatePurchaseSubscriptionInfoItemSchema.optional()),
482
+ EstimatePurchaseSubscriptionInfoSchema,
483
+ ])
484
+ .optional(),
485
+ contract_terms: z
486
+ .union([
487
+ z.array(EstimatePurchaseContractTermsItemSchema.optional()),
488
+ EstimatePurchaseContractTermsSchema,
489
+ ])
490
+ .optional(),
299
491
  });
300
492
  export { EstimatePurchaseBodySchema };