chargebee 3.26.0 → 3.28.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 (172) hide show
  1. package/CHANGELOG.md +14 -1
  2. package/README.md +131 -0
  3. package/cjs/RequestWrapper.js +130 -12
  4. package/cjs/chargebee.cjs.js +5 -0
  5. package/cjs/chargebee.cjs.worker.js +2 -0
  6. package/cjs/chargebeeZodValidationError.js +18 -0
  7. package/cjs/createChargebee.js +23 -2
  8. package/cjs/environment.js +1 -1
  9. package/cjs/schema/addon.schema.js +269 -0
  10. package/cjs/schema/address.schema.js +35 -0
  11. package/cjs/schema/alert.schema.js +74 -0
  12. package/cjs/schema/alert_status.schema.js +31 -0
  13. package/cjs/schema/attached_item.schema.js +144 -0
  14. package/cjs/schema/business_entity.schema.js +46 -0
  15. package/cjs/schema/card.schema.js +165 -0
  16. package/cjs/schema/comment.schema.js +69 -0
  17. package/cjs/schema/coupon.schema.js +323 -0
  18. package/cjs/schema/coupon_code.schema.js +49 -0
  19. package/cjs/schema/coupon_set.schema.js +88 -0
  20. package/cjs/schema/credit_note.schema.js +502 -0
  21. package/cjs/schema/currency.schema.js +32 -0
  22. package/cjs/schema/customer.schema.js +1201 -0
  23. package/cjs/schema/customer_entitlement.schema.js +14 -0
  24. package/cjs/schema/differential_price.schema.js +106 -0
  25. package/cjs/schema/entitlement.schema.js +54 -0
  26. package/cjs/schema/entitlement_override.schema.js +35 -0
  27. package/cjs/schema/estimate.schema.js +1535 -0
  28. package/cjs/schema/event.schema.js +1060 -0
  29. package/cjs/schema/export.schema.js +3385 -0
  30. package/cjs/schema/feature.schema.js +78 -0
  31. package/cjs/schema/gift.schema.js +293 -0
  32. package/cjs/schema/grant_block.schema.js +47 -0
  33. package/cjs/schema/hosted_page.schema.js +1777 -0
  34. package/cjs/schema/in_app_subscription.schema.js +68 -0
  35. package/cjs/schema/index.js +88 -0
  36. package/cjs/schema/invoice.schema.js +1685 -0
  37. package/cjs/schema/item.schema.js +195 -0
  38. package/cjs/schema/item_entitlement.schema.js +45 -0
  39. package/cjs/schema/item_family.schema.js +57 -0
  40. package/cjs/schema/item_price.schema.js +335 -0
  41. package/cjs/schema/ledger_account_balance.schema.js +21 -0
  42. package/cjs/schema/ledger_operation.schema.js +104 -0
  43. package/cjs/schema/meter.schema.js +13 -0
  44. package/cjs/schema/metered_feature.schema.js +20 -0
  45. package/cjs/schema/non_subscription.schema.js +28 -0
  46. package/cjs/schema/offer_event.schema.js +13 -0
  47. package/cjs/schema/offer_fulfillment.schema.js +20 -0
  48. package/cjs/schema/omnichannel_one_time_order.schema.js +26 -0
  49. package/cjs/schema/omnichannel_subscription.schema.js +122 -0
  50. package/cjs/schema/omnichannel_subscription_item.schema.js +13 -0
  51. package/cjs/schema/order.schema.js +441 -0
  52. package/cjs/schema/payment_intent.schema.js +127 -0
  53. package/cjs/schema/payment_schedule_scheme.schema.js +20 -0
  54. package/cjs/schema/payment_source.schema.js +630 -0
  55. package/cjs/schema/payment_voucher.schema.js +57 -0
  56. package/cjs/schema/personalized_offer.schema.js +28 -0
  57. package/cjs/schema/plan.schema.js +363 -0
  58. package/cjs/schema/portal_session.schema.js +22 -0
  59. package/cjs/schema/price_variant.schema.js +93 -0
  60. package/cjs/schema/pricing_page_session.schema.js +135 -0
  61. package/cjs/schema/promotional_credit.schema.js +78 -0
  62. package/cjs/schema/promotional_grant.schema.js +17 -0
  63. package/cjs/schema/purchase.schema.js +277 -0
  64. package/cjs/schema/quote.schema.js +1667 -0
  65. package/cjs/schema/ramp.schema.js +245 -0
  66. package/cjs/schema/recorded_purchase.schema.js +32 -0
  67. package/cjs/schema/resource_migration.schema.js +14 -0
  68. package/cjs/schema/site_migration_detail.schema.js +81 -0
  69. package/cjs/schema/subscription.schema.js +3344 -0
  70. package/cjs/schema/subscription_entitlement.schema.js +25 -0
  71. package/cjs/schema/time_machine.schema.js +17 -0
  72. package/cjs/schema/transaction.schema.js +744 -0
  73. package/cjs/schema/unbilled_charge.schema.js +139 -0
  74. package/cjs/schema/usage.schema.js +93 -0
  75. package/cjs/schema/usage_charge.schema.js +17 -0
  76. package/cjs/schema/usage_event.schema.js +28 -0
  77. package/cjs/schema/usage_file.schema.js +13 -0
  78. package/cjs/schema/usage_summary.schema.js +17 -0
  79. package/cjs/schema/virtual_bank_account.schema.js +71 -0
  80. package/cjs/schema/webhook_endpoint.schema.js +508 -0
  81. package/cjs/telemetry/TelemetryAdapter.js +145 -0
  82. package/cjs/telemetry/index.js +28 -0
  83. package/cjs/telemetry/otel.js +66 -0
  84. package/cjs/telemetry/types.js +47 -0
  85. package/cjs/validationLoader.js +59 -0
  86. package/esm/RequestWrapper.js +130 -12
  87. package/esm/chargebee.esm.js +3 -0
  88. package/esm/chargebee.esm.worker.js +1 -0
  89. package/esm/chargebeeZodValidationError.js +14 -0
  90. package/esm/createChargebee.js +23 -2
  91. package/esm/environment.js +1 -1
  92. package/esm/schema/addon.schema.js +266 -0
  93. package/esm/schema/address.schema.js +32 -0
  94. package/esm/schema/alert.schema.js +71 -0
  95. package/esm/schema/alert_status.schema.js +28 -0
  96. package/esm/schema/attached_item.schema.js +141 -0
  97. package/esm/schema/business_entity.schema.js +43 -0
  98. package/esm/schema/card.schema.js +162 -0
  99. package/esm/schema/comment.schema.js +66 -0
  100. package/esm/schema/coupon.schema.js +320 -0
  101. package/esm/schema/coupon_code.schema.js +46 -0
  102. package/esm/schema/coupon_set.schema.js +85 -0
  103. package/esm/schema/credit_note.schema.js +499 -0
  104. package/esm/schema/currency.schema.js +29 -0
  105. package/esm/schema/customer.schema.js +1198 -0
  106. package/esm/schema/customer_entitlement.schema.js +11 -0
  107. package/esm/schema/differential_price.schema.js +103 -0
  108. package/esm/schema/entitlement.schema.js +51 -0
  109. package/esm/schema/entitlement_override.schema.js +32 -0
  110. package/esm/schema/estimate.schema.js +1532 -0
  111. package/esm/schema/event.schema.js +1057 -0
  112. package/esm/schema/export.schema.js +3382 -0
  113. package/esm/schema/feature.schema.js +75 -0
  114. package/esm/schema/gift.schema.js +290 -0
  115. package/esm/schema/grant_block.schema.js +44 -0
  116. package/esm/schema/hosted_page.schema.js +1774 -0
  117. package/esm/schema/in_app_subscription.schema.js +65 -0
  118. package/esm/schema/index.js +72 -0
  119. package/esm/schema/invoice.schema.js +1682 -0
  120. package/esm/schema/item.schema.js +192 -0
  121. package/esm/schema/item_entitlement.schema.js +42 -0
  122. package/esm/schema/item_family.schema.js +54 -0
  123. package/esm/schema/item_price.schema.js +332 -0
  124. package/esm/schema/ledger_account_balance.schema.js +18 -0
  125. package/esm/schema/ledger_operation.schema.js +101 -0
  126. package/esm/schema/meter.schema.js +10 -0
  127. package/esm/schema/metered_feature.schema.js +17 -0
  128. package/esm/schema/non_subscription.schema.js +25 -0
  129. package/esm/schema/offer_event.schema.js +10 -0
  130. package/esm/schema/offer_fulfillment.schema.js +17 -0
  131. package/esm/schema/omnichannel_one_time_order.schema.js +23 -0
  132. package/esm/schema/omnichannel_subscription.schema.js +119 -0
  133. package/esm/schema/omnichannel_subscription_item.schema.js +10 -0
  134. package/esm/schema/order.schema.js +438 -0
  135. package/esm/schema/payment_intent.schema.js +124 -0
  136. package/esm/schema/payment_schedule_scheme.schema.js +17 -0
  137. package/esm/schema/payment_source.schema.js +627 -0
  138. package/esm/schema/payment_voucher.schema.js +54 -0
  139. package/esm/schema/personalized_offer.schema.js +25 -0
  140. package/esm/schema/plan.schema.js +360 -0
  141. package/esm/schema/portal_session.schema.js +19 -0
  142. package/esm/schema/price_variant.schema.js +90 -0
  143. package/esm/schema/pricing_page_session.schema.js +132 -0
  144. package/esm/schema/promotional_credit.schema.js +75 -0
  145. package/esm/schema/promotional_grant.schema.js +14 -0
  146. package/esm/schema/purchase.schema.js +274 -0
  147. package/esm/schema/quote.schema.js +1664 -0
  148. package/esm/schema/ramp.schema.js +242 -0
  149. package/esm/schema/recorded_purchase.schema.js +29 -0
  150. package/esm/schema/resource_migration.schema.js +11 -0
  151. package/esm/schema/site_migration_detail.schema.js +78 -0
  152. package/esm/schema/subscription.schema.js +3341 -0
  153. package/esm/schema/subscription_entitlement.schema.js +22 -0
  154. package/esm/schema/time_machine.schema.js +14 -0
  155. package/esm/schema/transaction.schema.js +741 -0
  156. package/esm/schema/unbilled_charge.schema.js +136 -0
  157. package/esm/schema/usage.schema.js +90 -0
  158. package/esm/schema/usage_charge.schema.js +14 -0
  159. package/esm/schema/usage_event.schema.js +25 -0
  160. package/esm/schema/usage_file.schema.js +10 -0
  161. package/esm/schema/usage_summary.schema.js +14 -0
  162. package/esm/schema/virtual_bank_account.schema.js +68 -0
  163. package/esm/schema/webhook_endpoint.schema.js +505 -0
  164. package/esm/telemetry/TelemetryAdapter.js +132 -0
  165. package/esm/telemetry/index.js +8 -0
  166. package/esm/telemetry/otel.js +62 -0
  167. package/esm/telemetry/types.js +44 -0
  168. package/esm/validationLoader.js +56 -0
  169. package/package.json +43 -24
  170. package/types/core.d.ts +2 -0
  171. package/types/index.d.ts +85 -0
  172. package/types/telemetry/otel.d.ts +22 -0
@@ -0,0 +1,165 @@
1
+ "use strict";
2
+ // Generated Zod schemas: Card
3
+ // Actions: updateCardForCustomer, switchGatewayForCustomer, copyCardForCustomer
4
+ // Do not edit manually – regenerate via sdk-generator
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.CopyCardForCustomerCardBodySchema = exports.SwitchGatewayForCustomerCardBodySchema = exports.UpdateCardForCustomerCardBodySchema = void 0;
7
+ const zod_1 = require("zod");
8
+ //Card.updateCardForCustomer
9
+ const UpdateCardForCustomerCardCustomerSchema = zod_1.z.object({
10
+ vat_number: zod_1.z.string().max(20).optional(),
11
+ });
12
+ const UpdateCardForCustomerCardBodySchema = zod_1.z.looseObject({
13
+ gateway: zod_1.z
14
+ .enum([
15
+ 'chargebee',
16
+ 'chargebee_payments',
17
+ 'adyen',
18
+ 'stripe',
19
+ 'wepay',
20
+ 'braintree',
21
+ 'authorize_net',
22
+ 'paypal_pro',
23
+ 'pin',
24
+ 'eway',
25
+ 'eway_rapid',
26
+ 'worldpay',
27
+ 'balanced_payments',
28
+ 'beanstream',
29
+ 'bluepay',
30
+ 'elavon',
31
+ 'first_data_global',
32
+ 'hdfc',
33
+ 'migs',
34
+ 'nmi',
35
+ 'ogone',
36
+ 'paymill',
37
+ 'paypal_payflow_pro',
38
+ 'sage_pay',
39
+ 'tco',
40
+ 'wirecard',
41
+ 'amazon_payments',
42
+ 'paypal_express_checkout',
43
+ 'orbital',
44
+ 'moneris_us',
45
+ 'moneris',
46
+ 'bluesnap',
47
+ 'cybersource',
48
+ 'vantiv',
49
+ 'checkout_com',
50
+ 'paypal',
51
+ 'ingenico_direct',
52
+ 'exact',
53
+ 'mollie',
54
+ 'quickbooks',
55
+ 'razorpay',
56
+ 'global_payments',
57
+ 'bank_of_america',
58
+ 'ecentric',
59
+ 'metrics_global',
60
+ 'windcave',
61
+ 'pay_com',
62
+ 'ebanx',
63
+ 'dlocal',
64
+ 'nuvei',
65
+ 'solidgate',
66
+ 'paystack',
67
+ 'jp_morgan',
68
+ 'deutsche_bank',
69
+ 'ezidebit',
70
+ 'twikey',
71
+ 'tempus',
72
+ 'moyasar',
73
+ 'payway',
74
+ ])
75
+ .optional(),
76
+ gateway_account_id: zod_1.z.string().max(50).optional(),
77
+ tmp_token: zod_1.z.string().max(300).optional(),
78
+ first_name: zod_1.z.string().max(50).optional(),
79
+ last_name: zod_1.z.string().max(50).optional(),
80
+ number: zod_1.z.string().max(1500),
81
+ expiry_month: zod_1.z.number().int().min(1).max(12),
82
+ expiry_year: zod_1.z.number().int(),
83
+ cvv: zod_1.z.string().max(520).optional(),
84
+ preferred_scheme: zod_1.z
85
+ .enum(['cartes_bancaires', 'mastercard', 'visa'])
86
+ .optional(),
87
+ billing_addr1: zod_1.z.string().max(150).optional(),
88
+ billing_addr2: zod_1.z.string().max(150).optional(),
89
+ billing_city: zod_1.z.string().max(50).optional(),
90
+ billing_state_code: zod_1.z.string().max(50).optional(),
91
+ billing_state: zod_1.z.string().max(50).optional(),
92
+ billing_zip: zod_1.z.string().max(20).optional(),
93
+ billing_country: zod_1.z.string().max(50).optional(),
94
+ ip_address: zod_1.z.string().max(50).optional(),
95
+ customer: UpdateCardForCustomerCardCustomerSchema.optional(),
96
+ });
97
+ exports.UpdateCardForCustomerCardBodySchema = UpdateCardForCustomerCardBodySchema;
98
+ //Card.switchGatewayForCustomer
99
+ const SwitchGatewayForCustomerCardBodySchema = zod_1.z.looseObject({
100
+ gateway: zod_1.z
101
+ .enum([
102
+ 'chargebee_payments',
103
+ 'adyen',
104
+ 'stripe',
105
+ 'wepay',
106
+ 'braintree',
107
+ 'authorize_net',
108
+ 'paypal_pro',
109
+ 'pin',
110
+ 'eway',
111
+ 'eway_rapid',
112
+ 'worldpay',
113
+ 'balanced_payments',
114
+ 'beanstream',
115
+ 'bluepay',
116
+ 'elavon',
117
+ 'first_data_global',
118
+ 'hdfc',
119
+ 'migs',
120
+ 'nmi',
121
+ 'ogone',
122
+ 'paymill',
123
+ 'paypal_payflow_pro',
124
+ 'sage_pay',
125
+ 'wirecard',
126
+ 'orbital',
127
+ 'moneris_us',
128
+ 'moneris',
129
+ 'bluesnap',
130
+ 'cybersource',
131
+ 'vantiv',
132
+ 'checkout_com',
133
+ 'ingenico_direct',
134
+ 'exact',
135
+ 'mollie',
136
+ 'quickbooks',
137
+ 'razorpay',
138
+ 'global_payments',
139
+ 'bank_of_america',
140
+ 'ecentric',
141
+ 'metrics_global',
142
+ 'windcave',
143
+ 'pay_com',
144
+ 'ebanx',
145
+ 'dlocal',
146
+ 'nuvei',
147
+ 'solidgate',
148
+ 'paystack',
149
+ 'jp_morgan',
150
+ 'deutsche_bank',
151
+ 'ezidebit',
152
+ 'twikey',
153
+ 'tempus',
154
+ 'moyasar',
155
+ 'payway',
156
+ ])
157
+ .optional(),
158
+ gateway_account_id: zod_1.z.string().max(50),
159
+ });
160
+ exports.SwitchGatewayForCustomerCardBodySchema = SwitchGatewayForCustomerCardBodySchema;
161
+ //Card.copyCardForCustomer
162
+ const CopyCardForCustomerCardBodySchema = zod_1.z.looseObject({
163
+ gateway_account_id: zod_1.z.string().max(50),
164
+ });
165
+ exports.CopyCardForCustomerCardBodySchema = CopyCardForCustomerCardBodySchema;
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ // Generated Zod schemas: Comment
3
+ // Actions: create, list
4
+ // Do not edit manually – regenerate via sdk-generator
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ListCommentBodySchema = exports.CreateCommentBodySchema = void 0;
7
+ const zod_1 = require("zod");
8
+ //Comment.create
9
+ const CreateCommentBodySchema = zod_1.z.looseObject({
10
+ entity_type: zod_1.z.enum([
11
+ 'customer',
12
+ 'subscription',
13
+ 'invoice',
14
+ 'quote',
15
+ 'credit_note',
16
+ 'transaction',
17
+ 'plan',
18
+ 'addon',
19
+ 'coupon',
20
+ 'order',
21
+ 'business_entity',
22
+ 'item_family',
23
+ 'item',
24
+ 'item_price',
25
+ 'price_variant',
26
+ ]),
27
+ entity_id: zod_1.z.string().max(100),
28
+ notes: zod_1.z.string().max(1000),
29
+ added_by: zod_1.z.string().max(100).optional(),
30
+ });
31
+ exports.CreateCommentBodySchema = CreateCommentBodySchema;
32
+ //Comment.list
33
+ const ListCommentCreatedAtSchema = zod_1.z.object({
34
+ after: zod_1.z.string().regex(RegExp('^\\d{10}$')).optional(),
35
+ before: zod_1.z.string().regex(RegExp('^\\d{10}$')).optional(),
36
+ on: zod_1.z.string().regex(RegExp('^\\d{10}$')).optional(),
37
+ between: zod_1.z.string().regex(RegExp('^\\[\\d{10},\\d{10}\\]$')).optional(),
38
+ });
39
+ const ListCommentSortBySchema = zod_1.z.looseObject({
40
+ asc: zod_1.z.enum(['created_at']).optional(),
41
+ desc: zod_1.z.enum(['created_at']).optional(),
42
+ });
43
+ const ListCommentBodySchema = zod_1.z.looseObject({
44
+ limit: zod_1.z.number().int().min(1).max(100).optional(),
45
+ offset: zod_1.z.string().max(1000).optional(),
46
+ entity_type: zod_1.z
47
+ .enum([
48
+ 'customer',
49
+ 'subscription',
50
+ 'invoice',
51
+ 'quote',
52
+ 'credit_note',
53
+ 'transaction',
54
+ 'plan',
55
+ 'addon',
56
+ 'coupon',
57
+ 'order',
58
+ 'business_entity',
59
+ 'item_family',
60
+ 'item',
61
+ 'item_price',
62
+ 'price_variant',
63
+ ])
64
+ .optional(),
65
+ entity_id: zod_1.z.string().max(100).optional(),
66
+ created_at: ListCommentCreatedAtSchema.optional(),
67
+ sort_by: ListCommentSortBySchema.optional(),
68
+ });
69
+ exports.ListCommentBodySchema = ListCommentBodySchema;
@@ -0,0 +1,323 @@
1
+ "use strict";
2
+ // Generated Zod schemas: Coupon
3
+ // Actions: create, createForItems, updateForItems, list, update, copy
4
+ // Do not edit manually – regenerate via sdk-generator
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.CopyCouponBodySchema = exports.UpdateCouponBodySchema = exports.ListCouponBodySchema = exports.UpdateForItemsCouponBodySchema = exports.CreateForItemsCouponBodySchema = exports.CreateCouponBodySchema = void 0;
7
+ const zod_1 = require("zod");
8
+ //Coupon.create
9
+ const CreateCouponMetaDataSchema = zod_1.z.looseObject({});
10
+ const CreateCouponBodySchema = zod_1.z.looseObject({
11
+ id: zod_1.z.string().max(100),
12
+ name: zod_1.z.string().max(50),
13
+ invoice_name: zod_1.z.string().max(100).optional(),
14
+ discount_type: zod_1.z
15
+ .enum(['fixed_amount', 'percentage', 'offer_quantity'])
16
+ .optional(),
17
+ discount_amount: zod_1.z.number().int().min(0).optional(),
18
+ currency_code: zod_1.z.string().max(3).optional(),
19
+ discount_percentage: zod_1.z.number().min(0.01).max(100).optional(),
20
+ discount_quantity: zod_1.z.number().int().min(1).optional(),
21
+ apply_on: zod_1.z.enum([
22
+ 'invoice_amount',
23
+ 'specified_items_total',
24
+ 'each_specified_item',
25
+ 'each_unit_of_specified_items',
26
+ ]),
27
+ duration_type: zod_1.z.enum(['one_time', 'forever', 'limited_period']).optional(),
28
+ duration_month: zod_1.z.number().int().min(1).max(240).optional(),
29
+ valid_till: zod_1.z.number().int().optional(),
30
+ max_redemptions: zod_1.z.number().int().min(1).optional(),
31
+ invoice_notes: zod_1.z.string().max(2000).optional(),
32
+ meta_data: CreateCouponMetaDataSchema.optional(),
33
+ included_in_mrr: zod_1.z.boolean().optional(),
34
+ period: zod_1.z.number().int().min(1).optional(),
35
+ period_unit: zod_1.z.enum(['day', 'week', 'month', 'year']).optional(),
36
+ plan_constraint: zod_1.z.enum(['none', 'all', 'specific']).optional(),
37
+ addon_constraint: zod_1.z.enum(['none', 'all', 'specific']).optional(),
38
+ plan_ids: zod_1.z.array(zod_1.z.string().max(100).optional()).optional(),
39
+ addon_ids: zod_1.z.array(zod_1.z.string().max(100).optional()).optional(),
40
+ status: zod_1.z.enum(['active', 'archived']).optional(),
41
+ });
42
+ exports.CreateCouponBodySchema = CreateCouponBodySchema;
43
+ //Coupon.createForItems
44
+ const CreateForItemsCouponMetaDataSchema = zod_1.z.looseObject({});
45
+ const CreateForItemsCouponItemConstraintsSchema = zod_1.z.object({
46
+ constraint: zod_1.z.array(zod_1.z.enum(['none', 'all', 'specific', 'criteria']).optional()),
47
+ item_type: zod_1.z.array(zod_1.z.enum(['plan', 'addon', 'charge']).optional()),
48
+ item_price_ids: zod_1.z.array(zod_1.z.array(zod_1.z.string().optional()).optional()).optional(),
49
+ });
50
+ const CreateForItemsCouponItemConstraintCriteriaSchema = zod_1.z.object({
51
+ item_type: zod_1.z.array(zod_1.z.enum(['plan', 'addon', 'charge']).optional()).optional(),
52
+ item_family_ids: zod_1.z
53
+ .array(zod_1.z.array(zod_1.z.string().optional()).optional())
54
+ .optional(),
55
+ currencies: zod_1.z.array(zod_1.z.array(zod_1.z.string().optional()).optional()).optional(),
56
+ item_price_periods: zod_1.z
57
+ .array(zod_1.z.array(zod_1.z.string().optional()).optional())
58
+ .optional(),
59
+ });
60
+ const CreateForItemsCouponCouponConstraintsSchema = zod_1.z.object({
61
+ entity_type: zod_1.z.array(zod_1.z.enum(['customer']).optional()),
62
+ type: zod_1.z.array(zod_1.z
63
+ .enum([
64
+ 'max_redemptions',
65
+ 'unique_by',
66
+ 'existing_customer',
67
+ 'new_customer',
68
+ ])
69
+ .optional()),
70
+ value: zod_1.z.array(zod_1.z.string().max(65000).optional()).optional(),
71
+ });
72
+ const CreateForItemsCouponBodySchema = zod_1.z.looseObject({
73
+ id: zod_1.z.string().max(100),
74
+ name: zod_1.z.string().max(50),
75
+ invoice_name: zod_1.z.string().max(100).optional(),
76
+ discount_type: zod_1.z
77
+ .enum(['fixed_amount', 'percentage', 'offer_quantity'])
78
+ .optional(),
79
+ discount_amount: zod_1.z.number().int().min(0).optional(),
80
+ currency_code: zod_1.z.string().max(3).optional(),
81
+ discount_percentage: zod_1.z.number().min(0.01).max(100).optional(),
82
+ discount_quantity: zod_1.z.number().int().min(1).optional(),
83
+ apply_on: zod_1.z.enum([
84
+ 'invoice_amount',
85
+ 'specified_items_total',
86
+ 'each_specified_item',
87
+ 'each_unit_of_specified_items',
88
+ ]),
89
+ duration_type: zod_1.z.enum(['one_time', 'forever', 'limited_period']).optional(),
90
+ duration_month: zod_1.z.number().int().min(1).max(240).optional(),
91
+ valid_from: zod_1.z.number().int().optional(),
92
+ valid_till: zod_1.z.number().int().optional(),
93
+ max_redemptions: zod_1.z.number().int().min(1).optional(),
94
+ invoice_notes: zod_1.z.string().max(2000).optional(),
95
+ meta_data: CreateForItemsCouponMetaDataSchema.optional(),
96
+ included_in_mrr: zod_1.z.boolean().optional(),
97
+ period: zod_1.z.number().int().min(1).optional(),
98
+ period_unit: zod_1.z.enum(['day', 'week', 'month', 'year']).optional(),
99
+ status: zod_1.z.enum(['active', 'archived']).optional(),
100
+ item_constraints: CreateForItemsCouponItemConstraintsSchema.optional(),
101
+ item_constraint_criteria: CreateForItemsCouponItemConstraintCriteriaSchema.optional(),
102
+ coupon_constraints: CreateForItemsCouponCouponConstraintsSchema.optional(),
103
+ });
104
+ exports.CreateForItemsCouponBodySchema = CreateForItemsCouponBodySchema;
105
+ //Coupon.updateForItems
106
+ const UpdateForItemsCouponMetaDataSchema = zod_1.z.looseObject({});
107
+ const UpdateForItemsCouponItemConstraintsSchema = zod_1.z.object({
108
+ constraint: zod_1.z.array(zod_1.z.enum(['none', 'all', 'specific', 'criteria']).optional()),
109
+ item_type: zod_1.z.array(zod_1.z.enum(['plan', 'addon', 'charge']).optional()),
110
+ item_price_ids: zod_1.z.array(zod_1.z.array(zod_1.z.string().optional()).optional()).optional(),
111
+ });
112
+ const UpdateForItemsCouponItemConstraintCriteriaSchema = zod_1.z.object({
113
+ item_type: zod_1.z.array(zod_1.z.enum(['plan', 'addon', 'charge']).optional()).optional(),
114
+ item_family_ids: zod_1.z
115
+ .array(zod_1.z.array(zod_1.z.string().optional()).optional())
116
+ .optional(),
117
+ currencies: zod_1.z.array(zod_1.z.array(zod_1.z.string().optional()).optional()).optional(),
118
+ item_price_periods: zod_1.z
119
+ .array(zod_1.z.array(zod_1.z.string().optional()).optional())
120
+ .optional(),
121
+ });
122
+ const UpdateForItemsCouponCouponConstraintsSchema = zod_1.z.object({
123
+ entity_type: zod_1.z.array(zod_1.z.enum(['customer']).optional()),
124
+ type: zod_1.z.array(zod_1.z
125
+ .enum([
126
+ 'max_redemptions',
127
+ 'unique_by',
128
+ 'existing_customer',
129
+ 'new_customer',
130
+ ])
131
+ .optional()),
132
+ value: zod_1.z.array(zod_1.z.string().max(65000).optional()).optional(),
133
+ });
134
+ const UpdateForItemsCouponBodySchema = zod_1.z.looseObject({
135
+ name: zod_1.z.string().max(50).optional(),
136
+ invoice_name: zod_1.z.string().max(100).optional(),
137
+ discount_type: zod_1.z
138
+ .enum(['fixed_amount', 'percentage', 'offer_quantity'])
139
+ .optional(),
140
+ discount_amount: zod_1.z.number().int().min(0).optional(),
141
+ currency_code: zod_1.z.string().max(3).optional(),
142
+ discount_percentage: zod_1.z.number().min(0.01).max(100).optional(),
143
+ discount_quantity: zod_1.z.number().int().min(1).optional(),
144
+ apply_on: zod_1.z
145
+ .enum([
146
+ 'invoice_amount',
147
+ 'specified_items_total',
148
+ 'each_specified_item',
149
+ 'each_unit_of_specified_items',
150
+ ])
151
+ .optional(),
152
+ duration_type: zod_1.z.enum(['one_time', 'forever', 'limited_period']).optional(),
153
+ duration_month: zod_1.z.number().int().min(1).max(240).optional(),
154
+ valid_from: zod_1.z.number().int().optional(),
155
+ valid_till: zod_1.z.number().int().optional(),
156
+ max_redemptions: zod_1.z.number().int().min(1).optional(),
157
+ invoice_notes: zod_1.z.string().max(2000).optional(),
158
+ meta_data: UpdateForItemsCouponMetaDataSchema.optional(),
159
+ included_in_mrr: zod_1.z.boolean().optional(),
160
+ period: zod_1.z.number().int().min(1).optional(),
161
+ period_unit: zod_1.z.enum(['day', 'week', 'month', 'year']).optional(),
162
+ item_constraints: UpdateForItemsCouponItemConstraintsSchema.optional(),
163
+ item_constraint_criteria: UpdateForItemsCouponItemConstraintCriteriaSchema.optional(),
164
+ coupon_constraints: UpdateForItemsCouponCouponConstraintsSchema.optional(),
165
+ });
166
+ exports.UpdateForItemsCouponBodySchema = UpdateForItemsCouponBodySchema;
167
+ //Coupon.list
168
+ const ListCouponIdSchema = zod_1.z.object({
169
+ is: zod_1.z.string().min(1).optional(),
170
+ is_not: zod_1.z.string().min(1).optional(),
171
+ starts_with: zod_1.z.string().min(1).optional(),
172
+ in: zod_1.z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
173
+ not_in: zod_1.z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
174
+ });
175
+ const ListCouponNameSchema = zod_1.z.object({
176
+ is: zod_1.z.string().min(1).optional(),
177
+ is_not: zod_1.z.string().min(1).optional(),
178
+ starts_with: zod_1.z.string().min(1).optional(),
179
+ in: zod_1.z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
180
+ not_in: zod_1.z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
181
+ });
182
+ const ListCouponDiscountTypeSchema = zod_1.z.object({
183
+ is: zod_1.z.enum(['fixed_amount', 'percentage', 'offer_quantity']).optional(),
184
+ is_not: zod_1.z.enum(['fixed_amount', 'percentage', 'offer_quantity']).optional(),
185
+ in: zod_1.z.enum(['fixed_amount', 'percentage', 'offer_quantity']).optional(),
186
+ not_in: zod_1.z.enum(['fixed_amount', 'percentage', 'offer_quantity']).optional(),
187
+ });
188
+ const ListCouponDurationTypeSchema = zod_1.z.object({
189
+ is: zod_1.z.enum(['one_time', 'forever', 'limited_period']).optional(),
190
+ is_not: zod_1.z.enum(['one_time', 'forever', 'limited_period']).optional(),
191
+ in: zod_1.z.enum(['one_time', 'forever', 'limited_period']).optional(),
192
+ not_in: zod_1.z.enum(['one_time', 'forever', 'limited_period']).optional(),
193
+ });
194
+ const ListCouponStatusSchema = zod_1.z.object({
195
+ is: zod_1.z.enum(['active', 'expired', 'archived', 'deleted', 'future']).optional(),
196
+ is_not: zod_1.z
197
+ .enum(['active', 'expired', 'archived', 'deleted', 'future'])
198
+ .optional(),
199
+ in: zod_1.z.enum(['active', 'expired', 'archived', 'deleted', 'future']).optional(),
200
+ not_in: zod_1.z
201
+ .enum(['active', 'expired', 'archived', 'deleted', 'future'])
202
+ .optional(),
203
+ });
204
+ const ListCouponApplyOnSchema = zod_1.z.object({
205
+ is: zod_1.z
206
+ .enum([
207
+ 'invoice_amount',
208
+ 'specified_items_total',
209
+ 'each_specified_item',
210
+ 'each_unit_of_specified_items',
211
+ ])
212
+ .optional(),
213
+ is_not: zod_1.z
214
+ .enum([
215
+ 'invoice_amount',
216
+ 'specified_items_total',
217
+ 'each_specified_item',
218
+ 'each_unit_of_specified_items',
219
+ ])
220
+ .optional(),
221
+ in: zod_1.z
222
+ .enum([
223
+ 'invoice_amount',
224
+ 'specified_items_total',
225
+ 'each_specified_item',
226
+ 'each_unit_of_specified_items',
227
+ ])
228
+ .optional(),
229
+ not_in: zod_1.z
230
+ .enum([
231
+ 'invoice_amount',
232
+ 'specified_items_total',
233
+ 'each_specified_item',
234
+ 'each_unit_of_specified_items',
235
+ ])
236
+ .optional(),
237
+ });
238
+ const ListCouponCreatedAtSchema = zod_1.z.object({
239
+ after: zod_1.z.string().regex(RegExp('^\\d{10}$')).optional(),
240
+ before: zod_1.z.string().regex(RegExp('^\\d{10}$')).optional(),
241
+ on: zod_1.z.string().regex(RegExp('^\\d{10}$')).optional(),
242
+ between: zod_1.z.string().regex(RegExp('^\\[\\d{10},\\d{10}\\]$')).optional(),
243
+ });
244
+ const ListCouponUpdatedAtSchema = zod_1.z.object({
245
+ after: zod_1.z.string().regex(RegExp('^\\d{10}$')).optional(),
246
+ before: zod_1.z.string().regex(RegExp('^\\d{10}$')).optional(),
247
+ on: zod_1.z.string().regex(RegExp('^\\d{10}$')).optional(),
248
+ between: zod_1.z.string().regex(RegExp('^\\[\\d{10},\\d{10}\\]$')).optional(),
249
+ });
250
+ const ListCouponSortBySchema = zod_1.z.looseObject({
251
+ asc: zod_1.z.enum(['created_at']).optional(),
252
+ desc: zod_1.z.enum(['created_at']).optional(),
253
+ });
254
+ const ListCouponCurrencyCodeSchema = zod_1.z.object({
255
+ is: zod_1.z.string().min(1).optional(),
256
+ is_not: zod_1.z.string().min(1).optional(),
257
+ starts_with: zod_1.z.string().min(1).optional(),
258
+ in: zod_1.z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
259
+ not_in: zod_1.z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
260
+ });
261
+ const ListCouponApplicableItemPriceIdsSchema = zod_1.z.object({
262
+ is: zod_1.z.string().min(1).optional(),
263
+ in: zod_1.z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
264
+ });
265
+ const ListCouponBodySchema = zod_1.z.looseObject({
266
+ limit: zod_1.z.number().int().min(1).max(100).optional(),
267
+ offset: zod_1.z.string().max(1000).optional(),
268
+ id: ListCouponIdSchema.optional(),
269
+ name: ListCouponNameSchema.optional(),
270
+ discount_type: ListCouponDiscountTypeSchema.optional(),
271
+ duration_type: ListCouponDurationTypeSchema.optional(),
272
+ status: ListCouponStatusSchema.optional(),
273
+ apply_on: ListCouponApplyOnSchema.optional(),
274
+ created_at: ListCouponCreatedAtSchema.optional(),
275
+ updated_at: ListCouponUpdatedAtSchema.optional(),
276
+ sort_by: ListCouponSortBySchema.optional(),
277
+ currency_code: ListCouponCurrencyCodeSchema.optional(),
278
+ applicable_item_price_ids: ListCouponApplicableItemPriceIdsSchema.optional(),
279
+ });
280
+ exports.ListCouponBodySchema = ListCouponBodySchema;
281
+ //Coupon.update
282
+ const UpdateCouponMetaDataSchema = zod_1.z.looseObject({});
283
+ const UpdateCouponBodySchema = zod_1.z.looseObject({
284
+ name: zod_1.z.string().max(50).optional(),
285
+ invoice_name: zod_1.z.string().max(100).optional(),
286
+ discount_type: zod_1.z
287
+ .enum(['fixed_amount', 'percentage', 'offer_quantity'])
288
+ .optional(),
289
+ discount_amount: zod_1.z.number().int().min(0).optional(),
290
+ currency_code: zod_1.z.string().max(3).optional(),
291
+ discount_percentage: zod_1.z.number().min(0.01).max(100).optional(),
292
+ discount_quantity: zod_1.z.number().int().min(1).optional(),
293
+ apply_on: zod_1.z
294
+ .enum([
295
+ 'invoice_amount',
296
+ 'specified_items_total',
297
+ 'each_specified_item',
298
+ 'each_unit_of_specified_items',
299
+ ])
300
+ .optional(),
301
+ duration_type: zod_1.z.enum(['one_time', 'forever', 'limited_period']).optional(),
302
+ duration_month: zod_1.z.number().int().min(1).max(240).optional(),
303
+ valid_till: zod_1.z.number().int().optional(),
304
+ max_redemptions: zod_1.z.number().int().min(1).optional(),
305
+ invoice_notes: zod_1.z.string().max(2000).optional(),
306
+ meta_data: UpdateCouponMetaDataSchema.optional(),
307
+ included_in_mrr: zod_1.z.boolean().optional(),
308
+ period: zod_1.z.number().int().min(1).optional(),
309
+ period_unit: zod_1.z.enum(['day', 'week', 'month', 'year']).optional(),
310
+ plan_constraint: zod_1.z.enum(['none', 'all', 'specific']).optional(),
311
+ addon_constraint: zod_1.z.enum(['none', 'all', 'specific']).optional(),
312
+ plan_ids: zod_1.z.array(zod_1.z.string().max(100).optional()).optional(),
313
+ addon_ids: zod_1.z.array(zod_1.z.string().max(100).optional()).optional(),
314
+ });
315
+ exports.UpdateCouponBodySchema = UpdateCouponBodySchema;
316
+ //Coupon.copy
317
+ const CopyCouponBodySchema = zod_1.z.looseObject({
318
+ from_site: zod_1.z.string().max(50),
319
+ id_at_from_site: zod_1.z.string().max(100),
320
+ id: zod_1.z.string().max(100).optional(),
321
+ for_site_merging: zod_1.z.boolean().default(false).optional(),
322
+ });
323
+ exports.CopyCouponBodySchema = CopyCouponBodySchema;
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ // Generated Zod schemas: CouponCode
3
+ // Actions: create, list
4
+ // Do not edit manually – regenerate via sdk-generator
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ListCouponCodeBodySchema = exports.CreateCouponCodeBodySchema = void 0;
7
+ const zod_1 = require("zod");
8
+ //CouponCode.create
9
+ const CreateCouponCodeBodySchema = zod_1.z.looseObject({
10
+ coupon_id: zod_1.z.string().max(100),
11
+ coupon_set_name: zod_1.z.string().max(50),
12
+ code: zod_1.z.string().max(50),
13
+ });
14
+ exports.CreateCouponCodeBodySchema = CreateCouponCodeBodySchema;
15
+ //CouponCode.list
16
+ const ListCouponCodeCodeSchema = zod_1.z.object({
17
+ is: zod_1.z.string().min(1).optional(),
18
+ is_not: zod_1.z.string().min(1).optional(),
19
+ starts_with: zod_1.z.string().min(1).optional(),
20
+ in: zod_1.z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
21
+ not_in: zod_1.z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
22
+ });
23
+ const ListCouponCodeCouponIdSchema = zod_1.z.object({
24
+ is: zod_1.z.string().min(1).optional(),
25
+ is_not: zod_1.z.string().min(1).optional(),
26
+ starts_with: zod_1.z.string().min(1).optional(),
27
+ in: zod_1.z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
28
+ not_in: zod_1.z.string().regex(RegExp('^\\[(.*)(,.*)*\\]$')).optional(),
29
+ });
30
+ const ListCouponCodeCouponSetNameSchema = zod_1.z.object({
31
+ is: zod_1.z.string().min(1).optional(),
32
+ is_not: zod_1.z.string().min(1).optional(),
33
+ starts_with: zod_1.z.string().min(1).optional(),
34
+ });
35
+ const ListCouponCodeStatusSchema = zod_1.z.object({
36
+ is: zod_1.z.enum(['not_redeemed', 'redeemed', 'archived']).optional(),
37
+ is_not: zod_1.z.enum(['not_redeemed', 'redeemed', 'archived']).optional(),
38
+ in: zod_1.z.enum(['not_redeemed', 'redeemed', 'archived']).optional(),
39
+ not_in: zod_1.z.enum(['not_redeemed', 'redeemed', 'archived']).optional(),
40
+ });
41
+ const ListCouponCodeBodySchema = zod_1.z.looseObject({
42
+ limit: zod_1.z.number().int().min(1).max(100).optional(),
43
+ offset: zod_1.z.string().max(1000).optional(),
44
+ code: ListCouponCodeCodeSchema.optional(),
45
+ coupon_id: ListCouponCodeCouponIdSchema.optional(),
46
+ coupon_set_name: ListCouponCodeCouponSetNameSchema.optional(),
47
+ status: ListCouponCodeStatusSchema.optional(),
48
+ });
49
+ exports.ListCouponCodeBodySchema = ListCouponCodeBodySchema;