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
@@ -6,6 +6,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.ListPriceVariantBodySchema = exports.UpdatePriceVariantBodySchema = exports.CreatePriceVariantBodySchema = void 0;
7
7
  const zod_1 = require("zod");
8
8
  //PriceVariant.create
9
+ const CreatePriceVariantAttributesItemSchema = zod_1.z.object({
10
+ name: zod_1.z.string().max(100),
11
+ value: zod_1.z.string().max(100),
12
+ });
9
13
  const CreatePriceVariantAttributesSchema = zod_1.z.object({
10
14
  name: zod_1.z.array(zod_1.z.string().max(100).optional()),
11
15
  value: zod_1.z.array(zod_1.z.string().max(100).optional()),
@@ -17,10 +21,19 @@ const CreatePriceVariantBodySchema = zod_1.z.looseObject({
17
21
  description: zod_1.z.string().max(500).optional(),
18
22
  variant_group: zod_1.z.string().max(100).optional(),
19
23
  business_entity_id: zod_1.z.string().max(50).optional(),
20
- attributes: CreatePriceVariantAttributesSchema.optional(),
24
+ attributes: zod_1.z
25
+ .union([
26
+ zod_1.z.array(CreatePriceVariantAttributesItemSchema.optional()),
27
+ CreatePriceVariantAttributesSchema,
28
+ ])
29
+ .optional(),
21
30
  });
22
31
  exports.CreatePriceVariantBodySchema = CreatePriceVariantBodySchema;
23
32
  //PriceVariant.update
33
+ const UpdatePriceVariantAttributesItemSchema = zod_1.z.object({
34
+ name: zod_1.z.string().max(100),
35
+ value: zod_1.z.string().max(100),
36
+ });
24
37
  const UpdatePriceVariantAttributesSchema = zod_1.z.object({
25
38
  name: zod_1.z.array(zod_1.z.string().max(100).optional()),
26
39
  value: zod_1.z.array(zod_1.z.string().max(100).optional()),
@@ -31,7 +44,12 @@ const UpdatePriceVariantBodySchema = zod_1.z.looseObject({
31
44
  description: zod_1.z.string().max(500).optional(),
32
45
  variant_group: zod_1.z.string().max(100).optional(),
33
46
  status: zod_1.z.enum(['active', 'archived']).optional(),
34
- attributes: UpdatePriceVariantAttributesSchema.optional(),
47
+ attributes: zod_1.z
48
+ .union([
49
+ zod_1.z.array(UpdatePriceVariantAttributesItemSchema.optional()),
50
+ UpdatePriceVariantAttributesSchema,
51
+ ])
52
+ .optional(),
35
53
  });
36
54
  exports.UpdatePriceVariantBodySchema = UpdatePriceVariantBodySchema;
37
55
  //PriceVariant.list
@@ -39,40 +57,92 @@ const ListPriceVariantIdSchema = zod_1.z.object({
39
57
  is: zod_1.z.string().min(1).optional(),
40
58
  is_not: zod_1.z.string().min(1).optional(),
41
59
  starts_with: zod_1.z.string().min(1).optional(),
42
- in: zod_1.z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
43
- not_in: zod_1.z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
60
+ in: zod_1.z
61
+ .union([
62
+ zod_1.z.array(zod_1.z.string().optional()),
63
+ zod_1.z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')),
64
+ ])
65
+ .optional(),
66
+ not_in: zod_1.z
67
+ .union([
68
+ zod_1.z.array(zod_1.z.string().optional()),
69
+ zod_1.z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')),
70
+ ])
71
+ .optional(),
44
72
  });
45
73
  const ListPriceVariantNameSchema = zod_1.z.object({
46
74
  is: zod_1.z.string().min(1).optional(),
47
75
  is_not: zod_1.z.string().min(1).optional(),
48
76
  starts_with: zod_1.z.string().min(1).optional(),
49
- in: zod_1.z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
50
- not_in: zod_1.z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
77
+ in: zod_1.z
78
+ .union([
79
+ zod_1.z.array(zod_1.z.string().optional()),
80
+ zod_1.z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')),
81
+ ])
82
+ .optional(),
83
+ not_in: zod_1.z
84
+ .union([
85
+ zod_1.z.array(zod_1.z.string().optional()),
86
+ zod_1.z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')),
87
+ ])
88
+ .optional(),
51
89
  });
52
90
  const ListPriceVariantStatusSchema = zod_1.z.object({
53
91
  is: zod_1.z.enum(['active', 'archived']).optional(),
54
92
  is_not: zod_1.z.enum(['active', 'archived']).optional(),
55
- in: zod_1.z.enum(['active', 'archived']).optional(),
56
- not_in: zod_1.z.enum(['active', 'archived']).optional(),
93
+ in: zod_1.z
94
+ .union([
95
+ zod_1.z.array(zod_1.z.enum(['active', 'archived']).optional()),
96
+ zod_1.z.enum(['active', 'archived']),
97
+ ])
98
+ .optional(),
99
+ not_in: zod_1.z
100
+ .union([
101
+ zod_1.z.array(zod_1.z.enum(['active', 'archived']).optional()),
102
+ zod_1.z.enum(['active', 'archived']),
103
+ ])
104
+ .optional(),
57
105
  });
58
106
  const ListPriceVariantUpdatedAtSchema = zod_1.z.object({
59
- after: zod_1.z.string().regex(RegExp('^\\d{10}$')).optional(),
60
- before: zod_1.z.string().regex(RegExp('^\\d{10}$')).optional(),
61
- on: zod_1.z.string().regex(RegExp('^\\d{10}$')).optional(),
62
- between: zod_1.z.string().regex(RegExp('^\\[\\d{10},\\d{10}\\]$')).optional(),
107
+ after: zod_1.z
108
+ .union([zod_1.z.number().int(), zod_1.z.string().regex(RegExp('^\\d{10}$'))])
109
+ .optional(),
110
+ before: zod_1.z
111
+ .union([zod_1.z.number().int(), zod_1.z.string().regex(RegExp('^\\d{10}$'))])
112
+ .optional(),
113
+ on: zod_1.z
114
+ .union([zod_1.z.number().int(), zod_1.z.string().regex(RegExp('^\\d{10}$'))])
115
+ .optional(),
116
+ between: zod_1.z
117
+ .union([
118
+ zod_1.z.array(zod_1.z.number().int().optional()).min(2).max(2),
119
+ zod_1.z.string().regex(RegExp('^\\[\\d{10},\\d{10}\\]$')),
120
+ ])
121
+ .optional(),
63
122
  });
64
123
  const ListPriceVariantCreatedAtSchema = zod_1.z.object({
65
- after: zod_1.z.string().regex(RegExp('^\\d{10}$')).optional(),
66
- before: zod_1.z.string().regex(RegExp('^\\d{10}$')).optional(),
67
- on: zod_1.z.string().regex(RegExp('^\\d{10}$')).optional(),
68
- between: zod_1.z.string().regex(RegExp('^\\[\\d{10},\\d{10}\\]$')).optional(),
124
+ after: zod_1.z
125
+ .union([zod_1.z.number().int(), zod_1.z.string().regex(RegExp('^\\d{10}$'))])
126
+ .optional(),
127
+ before: zod_1.z
128
+ .union([zod_1.z.number().int(), zod_1.z.string().regex(RegExp('^\\d{10}$'))])
129
+ .optional(),
130
+ on: zod_1.z
131
+ .union([zod_1.z.number().int(), zod_1.z.string().regex(RegExp('^\\d{10}$'))])
132
+ .optional(),
133
+ between: zod_1.z
134
+ .union([
135
+ zod_1.z.array(zod_1.z.number().int().optional()).min(2).max(2),
136
+ zod_1.z.string().regex(RegExp('^\\[\\d{10},\\d{10}\\]$')),
137
+ ])
138
+ .optional(),
69
139
  });
70
140
  const ListPriceVariantBusinessEntityIdSchema = zod_1.z.object({
71
- is_present: zod_1.z.enum(['true', 'false']).optional(),
72
141
  is: zod_1.z.string().min(1).optional(),
142
+ is_present: zod_1.z.union([zod_1.z.boolean(), zod_1.z.enum(['true', 'false'])]).optional(),
73
143
  });
74
144
  const ListPriceVariantIncludeSiteLevelResourcesSchema = zod_1.z.object({
75
- is: zod_1.z.enum(['true', 'false']).optional(),
145
+ is: zod_1.z.union([zod_1.z.boolean(), zod_1.z.enum(['true', 'false'])]).optional(),
76
146
  });
77
147
  const ListPriceVariantSortBySchema = zod_1.z.looseObject({
78
148
  asc: zod_1.z.enum(['name', 'id', 'status', 'created_at', 'updated_at']).optional(),
@@ -64,6 +64,18 @@ const CreateForNewSubscriptionPricingPageSessionContractTermSchema = zod_1.z.obj
64
64
  .optional(),
65
65
  cancellation_cutoff_period: zod_1.z.number().int().optional(),
66
66
  });
67
+ const CreateForNewSubscriptionPricingPageSessionDiscountsItemSchema = zod_1.z.object({
68
+ apply_on: zod_1.z.enum(['invoice_amount', 'specific_item_price']).optional(),
69
+ duration_type: zod_1.z.enum(['one_time', 'forever', 'limited_period']),
70
+ percentage: zod_1.z.number().min(0.01).max(100).optional(),
71
+ amount: zod_1.z.number().int().min(0).optional(),
72
+ period: zod_1.z.number().int().min(1).optional(),
73
+ period_unit: zod_1.z.enum(['day', 'week', 'month', 'year']).optional(),
74
+ included_in_mrr: zod_1.z.boolean().optional(),
75
+ item_price_id: zod_1.z.string().max(100).optional(),
76
+ quantity: zod_1.z.number().int().min(1).optional(),
77
+ label: zod_1.z.string().max(100).optional(),
78
+ });
67
79
  const CreateForNewSubscriptionPricingPageSessionDiscountsSchema = zod_1.z.object({
68
80
  apply_on: zod_1.z
69
81
  .array(zod_1.z.enum(['invoice_amount', 'specific_item_price']).optional())
@@ -92,7 +104,12 @@ const CreateForNewSubscriptionPricingPageSessionBodySchema = zod_1.z.looseObject
92
104
  billing_address: CreateForNewSubscriptionPricingPageSessionBillingAddressSchema.optional(),
93
105
  shipping_address: CreateForNewSubscriptionPricingPageSessionShippingAddressSchema.optional(),
94
106
  contract_term: CreateForNewSubscriptionPricingPageSessionContractTermSchema.optional(),
95
- discounts: CreateForNewSubscriptionPricingPageSessionDiscountsSchema.optional(),
107
+ discounts: zod_1.z
108
+ .union([
109
+ zod_1.z.array(CreateForNewSubscriptionPricingPageSessionDiscountsItemSchema.optional()),
110
+ CreateForNewSubscriptionPricingPageSessionDiscountsSchema,
111
+ ])
112
+ .optional(),
96
113
  });
97
114
  exports.CreateForNewSubscriptionPricingPageSessionBodySchema = CreateForNewSubscriptionPricingPageSessionBodySchema;
98
115
  //PricingPageSession.createForExistingSubscription
@@ -109,6 +126,18 @@ const CreateForExistingSubscriptionPricingPageSessionContractTermSchema = zod_1.
109
126
  .optional(),
110
127
  cancellation_cutoff_period: zod_1.z.number().int().optional(),
111
128
  });
129
+ const CreateForExistingSubscriptionPricingPageSessionDiscountsItemSchema = zod_1.z.object({
130
+ apply_on: zod_1.z.enum(['invoice_amount', 'specific_item_price']).optional(),
131
+ duration_type: zod_1.z.enum(['one_time', 'forever', 'limited_period']),
132
+ percentage: zod_1.z.number().min(0.01).max(100).optional(),
133
+ amount: zod_1.z.number().int().min(0).optional(),
134
+ period: zod_1.z.number().int().min(1).optional(),
135
+ period_unit: zod_1.z.enum(['day', 'week', 'month', 'year']).optional(),
136
+ included_in_mrr: zod_1.z.boolean().optional(),
137
+ item_price_id: zod_1.z.string().max(100).optional(),
138
+ quantity: zod_1.z.number().int().min(1).optional(),
139
+ label: zod_1.z.string().max(100).optional(),
140
+ });
112
141
  const CreateForExistingSubscriptionPricingPageSessionDiscountsSchema = zod_1.z.object({
113
142
  apply_on: zod_1.z
114
143
  .array(zod_1.z.enum(['invoice_amount', 'specific_item_price']).optional())
@@ -131,6 +160,11 @@ const CreateForExistingSubscriptionPricingPageSessionBodySchema = zod_1.z.looseO
131
160
  pricing_page: CreateForExistingSubscriptionPricingPageSessionPricingPageSchema.optional(),
132
161
  subscription: CreateForExistingSubscriptionPricingPageSessionSubscriptionSchema.optional(),
133
162
  contract_term: CreateForExistingSubscriptionPricingPageSessionContractTermSchema.optional(),
134
- discounts: CreateForExistingSubscriptionPricingPageSessionDiscountsSchema.optional(),
163
+ discounts: zod_1.z
164
+ .union([
165
+ zod_1.z.array(CreateForExistingSubscriptionPricingPageSessionDiscountsItemSchema.optional()),
166
+ CreateForExistingSubscriptionPricingPageSessionDiscountsSchema,
167
+ ])
168
+ .optional(),
135
169
  });
136
170
  exports.CreateForExistingSubscriptionPricingPageSessionBodySchema = CreateForExistingSubscriptionPricingPageSessionBodySchema;
@@ -51,16 +51,37 @@ const ListPromotionalCreditIdSchema = zod_1.z.object({
51
51
  starts_with: zod_1.z.string().min(1).optional(),
52
52
  });
53
53
  const ListPromotionalCreditCreatedAtSchema = zod_1.z.object({
54
- after: zod_1.z.string().regex(RegExp('^\\d{10}$')).optional(),
55
- before: zod_1.z.string().regex(RegExp('^\\d{10}$')).optional(),
56
- on: zod_1.z.string().regex(RegExp('^\\d{10}$')).optional(),
57
- between: zod_1.z.string().regex(RegExp('^\\[\\d{10},\\d{10}\\]$')).optional(),
54
+ after: zod_1.z
55
+ .union([zod_1.z.number().int(), zod_1.z.string().regex(RegExp('^\\d{10}$'))])
56
+ .optional(),
57
+ before: zod_1.z
58
+ .union([zod_1.z.number().int(), zod_1.z.string().regex(RegExp('^\\d{10}$'))])
59
+ .optional(),
60
+ on: zod_1.z
61
+ .union([zod_1.z.number().int(), zod_1.z.string().regex(RegExp('^\\d{10}$'))])
62
+ .optional(),
63
+ between: zod_1.z
64
+ .union([
65
+ zod_1.z.array(zod_1.z.number().int().optional()).min(2).max(2),
66
+ zod_1.z.string().regex(RegExp('^\\[\\d{10},\\d{10}\\]$')),
67
+ ])
68
+ .optional(),
58
69
  });
59
70
  const ListPromotionalCreditTypeSchema = zod_1.z.object({
60
71
  is: zod_1.z.enum(['increment', 'decrement']).optional(),
61
72
  is_not: zod_1.z.enum(['increment', 'decrement']).optional(),
62
- in: zod_1.z.enum(['increment', 'decrement']).optional(),
63
- not_in: zod_1.z.enum(['increment', 'decrement']).optional(),
73
+ in: zod_1.z
74
+ .union([
75
+ zod_1.z.array(zod_1.z.enum(['increment', 'decrement']).optional()),
76
+ zod_1.z.enum(['increment', 'decrement']),
77
+ ])
78
+ .optional(),
79
+ not_in: zod_1.z
80
+ .union([
81
+ zod_1.z.array(zod_1.z.enum(['increment', 'decrement']).optional()),
82
+ zod_1.z.enum(['increment', 'decrement']),
83
+ ])
84
+ .optional(),
64
85
  });
65
86
  const ListPromotionalCreditCustomerIdSchema = zod_1.z.object({
66
87
  is: zod_1.z.string().min(1).optional(),
@@ -95,6 +95,15 @@ const CreatePurchasePaymentIntentSchema = zod_1.z.object({
95
95
  gw_payment_method_id: zod_1.z.string().max(65000).optional(),
96
96
  additional_information: CreatePurchaseAdditionalInformationSchema.optional(),
97
97
  });
98
+ const CreatePurchasePurchaseItemsItemSchema = zod_1.z.object({
99
+ index: zod_1.z.number().int().min(0),
100
+ item_price_id: zod_1.z.string().max(100),
101
+ quantity: zod_1.z.number().int().min(1).optional(),
102
+ unit_amount: zod_1.z.number().int().min(0).optional(),
103
+ unit_amount_in_decimal: zod_1.z.string().max(39).optional(),
104
+ quantity_in_decimal: zod_1.z.string().max(33).optional(),
105
+ trial_end: zod_1.z.number().int().optional(),
106
+ });
98
107
  const CreatePurchasePurchaseItemsSchema = zod_1.z.object({
99
108
  index: zod_1.z.array(zod_1.z.number().int().min(0).optional()),
100
109
  item_price_id: zod_1.z.array(zod_1.z.string().max(100).optional()),
@@ -104,6 +113,16 @@ const CreatePurchasePurchaseItemsSchema = zod_1.z.object({
104
113
  quantity_in_decimal: zod_1.z.array(zod_1.z.string().max(33).optional()).optional(),
105
114
  trial_end: zod_1.z.array(zod_1.z.number().int().optional()).optional(),
106
115
  });
116
+ const CreatePurchaseItemTiersItemSchema = zod_1.z.object({
117
+ index: zod_1.z.number().int().min(0),
118
+ item_price_id: zod_1.z.string().max(100).optional(),
119
+ starting_unit: zod_1.z.number().int().min(1).optional(),
120
+ ending_unit: zod_1.z.number().int().optional(),
121
+ price: zod_1.z.number().int().min(0).optional(),
122
+ starting_unit_in_decimal: zod_1.z.string().max(33).optional(),
123
+ ending_unit_in_decimal: zod_1.z.string().max(33).optional(),
124
+ price_in_decimal: zod_1.z.string().max(39).optional(),
125
+ });
107
126
  const CreatePurchaseItemTiersSchema = zod_1.z.object({
108
127
  index: zod_1.z.array(zod_1.z.number().int().min(0).optional()),
109
128
  item_price_id: zod_1.z.array(zod_1.z.string().max(100).optional()).optional(),
@@ -114,6 +133,24 @@ const CreatePurchaseItemTiersSchema = zod_1.z.object({
114
133
  ending_unit_in_decimal: zod_1.z.array(zod_1.z.string().max(33).optional()).optional(),
115
134
  price_in_decimal: zod_1.z.array(zod_1.z.string().max(39).optional()).optional(),
116
135
  });
136
+ const CreatePurchaseShippingAddressesItemSchema = zod_1.z.object({
137
+ first_name: zod_1.z.string().max(150).optional(),
138
+ last_name: zod_1.z.string().max(150).optional(),
139
+ email: zod_1.z.string().email().max(70).optional(),
140
+ company: zod_1.z.string().max(250).optional(),
141
+ phone: zod_1.z.string().max(50).optional(),
142
+ line1: zod_1.z.string().max(150).optional(),
143
+ line2: zod_1.z.string().max(150).optional(),
144
+ line3: zod_1.z.string().max(150).optional(),
145
+ city: zod_1.z.string().max(50).optional(),
146
+ state: zod_1.z.string().max(50).optional(),
147
+ state_code: zod_1.z.string().max(50).optional(),
148
+ country: zod_1.z.string().max(50).optional(),
149
+ zip: zod_1.z.string().max(20).optional(),
150
+ validation_status: zod_1.z
151
+ .enum(['not_validated', 'valid', 'partially_valid', 'invalid'])
152
+ .optional(),
153
+ });
117
154
  const CreatePurchaseShippingAddressesSchema = zod_1.z.object({
118
155
  first_name: zod_1.z.array(zod_1.z.string().max(150).optional()).optional(),
119
156
  last_name: zod_1.z.array(zod_1.z.string().max(150).optional()).optional(),
@@ -134,6 +171,14 @@ const CreatePurchaseShippingAddressesSchema = zod_1.z.object({
134
171
  .optional())
135
172
  .optional(),
136
173
  });
174
+ const CreatePurchaseDiscountsItemSchema = zod_1.z.object({
175
+ index: zod_1.z.number().int().min(0).optional(),
176
+ coupon_id: zod_1.z.string().max(100).optional(),
177
+ percentage: zod_1.z.number().min(0.01).max(100).optional(),
178
+ quantity: zod_1.z.number().int().min(1).optional(),
179
+ amount: zod_1.z.number().int().min(0).optional(),
180
+ included_in_mrr: zod_1.z.boolean().optional(),
181
+ });
137
182
  const CreatePurchaseDiscountsSchema = zod_1.z.object({
138
183
  index: zod_1.z.array(zod_1.z.number().int().min(0).optional()).optional(),
139
184
  coupon_id: zod_1.z.array(zod_1.z.string().max(100).optional()).optional(),
@@ -142,6 +187,21 @@ const CreatePurchaseDiscountsSchema = zod_1.z.object({
142
187
  amount: zod_1.z.array(zod_1.z.number().int().min(0).optional()).optional(),
143
188
  included_in_mrr: zod_1.z.array(zod_1.z.boolean().optional()).optional(),
144
189
  });
190
+ const CreatePurchaseMetaDataSchema = zod_1.z.looseObject({});
191
+ const CreatePurchaseSubscriptionInfoItemSchema = zod_1.z.object({
192
+ index: zod_1.z.number().int().min(0),
193
+ subscription_id: zod_1.z.string().max(50).optional(),
194
+ billing_cycles: zod_1.z.number().int().min(0).optional(),
195
+ contract_term_billing_cycle_on_renewal: zod_1.z
196
+ .number()
197
+ .int()
198
+ .min(1)
199
+ .max(100)
200
+ .optional(),
201
+ trial_end: zod_1.z.number().int().optional(),
202
+ start_date: zod_1.z.number().int().optional(),
203
+ meta_data: CreatePurchaseMetaDataSchema.optional(),
204
+ });
145
205
  const CreatePurchaseMetaDataItemSchema = zod_1.z.looseObject({});
146
206
  const CreatePurchaseSubscriptionInfoSchema = zod_1.z.object({
147
207
  index: zod_1.z.array(zod_1.z.number().int().min(0).optional()),
@@ -154,6 +214,13 @@ const CreatePurchaseSubscriptionInfoSchema = zod_1.z.object({
154
214
  start_date: zod_1.z.array(zod_1.z.number().int().optional()).optional(),
155
215
  meta_data: zod_1.z.array(CreatePurchaseMetaDataItemSchema.optional()).optional(),
156
216
  });
217
+ const CreatePurchaseContractTermsItemSchema = zod_1.z.object({
218
+ index: zod_1.z.number().int().min(0),
219
+ action_at_term_end: zod_1.z
220
+ .enum(['renew', 'evergreen', 'cancel', 'renew_once'])
221
+ .optional(),
222
+ cancellation_cutoff_period: zod_1.z.number().int().optional(),
223
+ });
157
224
  const CreatePurchaseContractTermsSchema = zod_1.z.object({
158
225
  index: zod_1.z.array(zod_1.z.number().int().min(0).optional()),
159
226
  action_at_term_end: zod_1.z
@@ -169,12 +236,42 @@ const CreatePurchaseBodySchema = zod_1.z.looseObject({
169
236
  payment_schedule: CreatePurchasePaymentScheduleSchema.optional(),
170
237
  statement_descriptor: CreatePurchaseStatementDescriptorSchema.optional(),
171
238
  payment_intent: CreatePurchasePaymentIntentSchema.optional(),
172
- purchase_items: CreatePurchasePurchaseItemsSchema.optional(),
173
- item_tiers: CreatePurchaseItemTiersSchema.optional(),
174
- shipping_addresses: CreatePurchaseShippingAddressesSchema.optional(),
175
- discounts: CreatePurchaseDiscountsSchema.optional(),
176
- subscription_info: CreatePurchaseSubscriptionInfoSchema.optional(),
177
- contract_terms: CreatePurchaseContractTermsSchema.optional(),
239
+ purchase_items: zod_1.z
240
+ .union([
241
+ zod_1.z.array(CreatePurchasePurchaseItemsItemSchema.optional()),
242
+ CreatePurchasePurchaseItemsSchema,
243
+ ])
244
+ .optional(),
245
+ item_tiers: zod_1.z
246
+ .union([
247
+ zod_1.z.array(CreatePurchaseItemTiersItemSchema.optional()),
248
+ CreatePurchaseItemTiersSchema,
249
+ ])
250
+ .optional(),
251
+ shipping_addresses: zod_1.z
252
+ .union([
253
+ zod_1.z.array(CreatePurchaseShippingAddressesItemSchema.optional()),
254
+ CreatePurchaseShippingAddressesSchema,
255
+ ])
256
+ .optional(),
257
+ discounts: zod_1.z
258
+ .union([
259
+ zod_1.z.array(CreatePurchaseDiscountsItemSchema.optional()),
260
+ CreatePurchaseDiscountsSchema,
261
+ ])
262
+ .optional(),
263
+ subscription_info: zod_1.z
264
+ .union([
265
+ zod_1.z.array(CreatePurchaseSubscriptionInfoItemSchema.optional()),
266
+ CreatePurchaseSubscriptionInfoSchema,
267
+ ])
268
+ .optional(),
269
+ contract_terms: zod_1.z
270
+ .union([
271
+ zod_1.z.array(CreatePurchaseContractTermsItemSchema.optional()),
272
+ CreatePurchaseContractTermsSchema,
273
+ ])
274
+ .optional(),
178
275
  });
179
276
  exports.CreatePurchaseBodySchema = CreatePurchaseBodySchema;
180
277
  //Purchase.estimate
@@ -224,6 +321,15 @@ const EstimatePurchaseBillingAddressSchema = zod_1.z.object({
224
321
  .enum(['not_validated', 'valid', 'partially_valid', 'invalid'])
225
322
  .optional(),
226
323
  });
324
+ const EstimatePurchasePurchaseItemsItemSchema = zod_1.z.object({
325
+ index: zod_1.z.number().int().min(0),
326
+ item_price_id: zod_1.z.string().max(100),
327
+ quantity: zod_1.z.number().int().min(1).optional(),
328
+ unit_amount: zod_1.z.number().int().min(0).optional(),
329
+ unit_amount_in_decimal: zod_1.z.string().max(39).optional(),
330
+ quantity_in_decimal: zod_1.z.string().max(33).optional(),
331
+ trial_end: zod_1.z.number().int().optional(),
332
+ });
227
333
  const EstimatePurchasePurchaseItemsSchema = zod_1.z.object({
228
334
  index: zod_1.z.array(zod_1.z.number().int().min(0).optional()),
229
335
  item_price_id: zod_1.z.array(zod_1.z.string().max(100).optional()),
@@ -233,6 +339,16 @@ const EstimatePurchasePurchaseItemsSchema = zod_1.z.object({
233
339
  quantity_in_decimal: zod_1.z.array(zod_1.z.string().max(33).optional()).optional(),
234
340
  trial_end: zod_1.z.array(zod_1.z.number().int().optional()).optional(),
235
341
  });
342
+ const EstimatePurchaseItemTiersItemSchema = zod_1.z.object({
343
+ index: zod_1.z.number().int().min(0),
344
+ item_price_id: zod_1.z.string().max(100).optional(),
345
+ starting_unit: zod_1.z.number().int().min(1).optional(),
346
+ ending_unit: zod_1.z.number().int().optional(),
347
+ price: zod_1.z.number().int().min(0).optional(),
348
+ starting_unit_in_decimal: zod_1.z.string().max(33).optional(),
349
+ ending_unit_in_decimal: zod_1.z.string().max(33).optional(),
350
+ price_in_decimal: zod_1.z.string().max(39).optional(),
351
+ });
236
352
  const EstimatePurchaseItemTiersSchema = zod_1.z.object({
237
353
  index: zod_1.z.array(zod_1.z.number().int().min(0).optional()),
238
354
  item_price_id: zod_1.z.array(zod_1.z.string().max(100).optional()).optional(),
@@ -243,6 +359,24 @@ const EstimatePurchaseItemTiersSchema = zod_1.z.object({
243
359
  ending_unit_in_decimal: zod_1.z.array(zod_1.z.string().max(33).optional()).optional(),
244
360
  price_in_decimal: zod_1.z.array(zod_1.z.string().max(39).optional()).optional(),
245
361
  });
362
+ const EstimatePurchaseShippingAddressesItemSchema = zod_1.z.object({
363
+ first_name: zod_1.z.string().max(150).optional(),
364
+ last_name: zod_1.z.string().max(150).optional(),
365
+ email: zod_1.z.string().email().max(70).optional(),
366
+ company: zod_1.z.string().max(250).optional(),
367
+ phone: zod_1.z.string().max(50).optional(),
368
+ line1: zod_1.z.string().max(150).optional(),
369
+ line2: zod_1.z.string().max(150).optional(),
370
+ line3: zod_1.z.string().max(150).optional(),
371
+ city: zod_1.z.string().max(50).optional(),
372
+ state: zod_1.z.string().max(50).optional(),
373
+ state_code: zod_1.z.string().max(50).optional(),
374
+ country: zod_1.z.string().max(50).optional(),
375
+ zip: zod_1.z.string().max(20).optional(),
376
+ validation_status: zod_1.z
377
+ .enum(['not_validated', 'valid', 'partially_valid', 'invalid'])
378
+ .optional(),
379
+ });
246
380
  const EstimatePurchaseShippingAddressesSchema = zod_1.z.object({
247
381
  first_name: zod_1.z.array(zod_1.z.string().max(150).optional()).optional(),
248
382
  last_name: zod_1.z.array(zod_1.z.string().max(150).optional()).optional(),
@@ -263,6 +397,14 @@ const EstimatePurchaseShippingAddressesSchema = zod_1.z.object({
263
397
  .optional())
264
398
  .optional(),
265
399
  });
400
+ const EstimatePurchaseDiscountsItemSchema = zod_1.z.object({
401
+ index: zod_1.z.number().int().min(0).optional(),
402
+ coupon_id: zod_1.z.string().max(100).optional(),
403
+ percentage: zod_1.z.number().min(0.01).max(100).optional(),
404
+ quantity: zod_1.z.number().int().min(1).optional(),
405
+ amount: zod_1.z.number().int().min(0).optional(),
406
+ included_in_mrr: zod_1.z.boolean().optional(),
407
+ });
266
408
  const EstimatePurchaseDiscountsSchema = zod_1.z.object({
267
409
  index: zod_1.z.array(zod_1.z.number().int().min(0).optional()).optional(),
268
410
  coupon_id: zod_1.z.array(zod_1.z.string().max(100).optional()).optional(),
@@ -271,6 +413,19 @@ const EstimatePurchaseDiscountsSchema = zod_1.z.object({
271
413
  amount: zod_1.z.array(zod_1.z.number().int().min(0).optional()).optional(),
272
414
  included_in_mrr: zod_1.z.array(zod_1.z.boolean().optional()).optional(),
273
415
  });
416
+ const EstimatePurchaseSubscriptionInfoItemSchema = zod_1.z.object({
417
+ index: zod_1.z.number().int().min(0),
418
+ subscription_id: zod_1.z.string().max(50).optional(),
419
+ billing_cycles: zod_1.z.number().int().min(0).optional(),
420
+ contract_term_billing_cycle_on_renewal: zod_1.z
421
+ .number()
422
+ .int()
423
+ .min(1)
424
+ .max(100)
425
+ .optional(),
426
+ trial_end: zod_1.z.number().int().optional(),
427
+ start_date: zod_1.z.number().int().optional(),
428
+ });
274
429
  const EstimatePurchaseSubscriptionInfoSchema = zod_1.z.object({
275
430
  index: zod_1.z.array(zod_1.z.number().int().min(0).optional()),
276
431
  subscription_id: zod_1.z.array(zod_1.z.string().max(50).optional()).optional(),
@@ -281,6 +436,13 @@ const EstimatePurchaseSubscriptionInfoSchema = zod_1.z.object({
281
436
  trial_end: zod_1.z.array(zod_1.z.number().int().optional()).optional(),
282
437
  start_date: zod_1.z.array(zod_1.z.number().int().optional()).optional(),
283
438
  });
439
+ const EstimatePurchaseContractTermsItemSchema = zod_1.z.object({
440
+ index: zod_1.z.number().int().min(0),
441
+ action_at_term_end: zod_1.z
442
+ .enum(['renew', 'evergreen', 'cancel', 'renew_once'])
443
+ .optional(),
444
+ cancellation_cutoff_period: zod_1.z.number().int().optional(),
445
+ });
284
446
  const EstimatePurchaseContractTermsSchema = zod_1.z.object({
285
447
  index: zod_1.z.array(zod_1.z.number().int().min(0).optional()),
286
448
  action_at_term_end: zod_1.z
@@ -293,11 +455,41 @@ const EstimatePurchaseBodySchema = zod_1.z.looseObject({
293
455
  customer_id: zod_1.z.string().max(50).optional(),
294
456
  customer: EstimatePurchaseCustomerSchema.optional(),
295
457
  billing_address: EstimatePurchaseBillingAddressSchema.optional(),
296
- purchase_items: EstimatePurchasePurchaseItemsSchema.optional(),
297
- item_tiers: EstimatePurchaseItemTiersSchema.optional(),
298
- shipping_addresses: EstimatePurchaseShippingAddressesSchema.optional(),
299
- discounts: EstimatePurchaseDiscountsSchema.optional(),
300
- subscription_info: EstimatePurchaseSubscriptionInfoSchema.optional(),
301
- contract_terms: EstimatePurchaseContractTermsSchema.optional(),
458
+ purchase_items: zod_1.z
459
+ .union([
460
+ zod_1.z.array(EstimatePurchasePurchaseItemsItemSchema.optional()),
461
+ EstimatePurchasePurchaseItemsSchema,
462
+ ])
463
+ .optional(),
464
+ item_tiers: zod_1.z
465
+ .union([
466
+ zod_1.z.array(EstimatePurchaseItemTiersItemSchema.optional()),
467
+ EstimatePurchaseItemTiersSchema,
468
+ ])
469
+ .optional(),
470
+ shipping_addresses: zod_1.z
471
+ .union([
472
+ zod_1.z.array(EstimatePurchaseShippingAddressesItemSchema.optional()),
473
+ EstimatePurchaseShippingAddressesSchema,
474
+ ])
475
+ .optional(),
476
+ discounts: zod_1.z
477
+ .union([
478
+ zod_1.z.array(EstimatePurchaseDiscountsItemSchema.optional()),
479
+ EstimatePurchaseDiscountsSchema,
480
+ ])
481
+ .optional(),
482
+ subscription_info: zod_1.z
483
+ .union([
484
+ zod_1.z.array(EstimatePurchaseSubscriptionInfoItemSchema.optional()),
485
+ EstimatePurchaseSubscriptionInfoSchema,
486
+ ])
487
+ .optional(),
488
+ contract_terms: zod_1.z
489
+ .union([
490
+ zod_1.z.array(EstimatePurchaseContractTermsItemSchema.optional()),
491
+ EstimatePurchaseContractTermsSchema,
492
+ ])
493
+ .optional(),
302
494
  });
303
495
  exports.EstimatePurchaseBodySchema = EstimatePurchaseBodySchema;