chargebee 3.24.0 → 3.25.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +39 -0
  3. package/cjs/RequestWrapper.js +27 -0
  4. package/cjs/chargebee.cjs.js +3 -0
  5. package/cjs/chargebee.cjs.worker.js +2 -0
  6. package/cjs/chargebeeZodValidationError.js +18 -0
  7. package/cjs/createChargebee.js +5 -0
  8. package/cjs/environment.js +1 -1
  9. package/cjs/schema/addon.schema.js +153 -0
  10. package/cjs/schema/address.schema.js +35 -0
  11. package/cjs/schema/alert.schema.js +38 -0
  12. package/cjs/schema/attached_item.schema.js +58 -0
  13. package/cjs/schema/business_entity.schema.js +46 -0
  14. package/cjs/schema/card.schema.js +165 -0
  15. package/cjs/schema/comment.schema.js +69 -0
  16. package/cjs/schema/coupon.schema.js +209 -0
  17. package/cjs/schema/coupon_code.schema.js +14 -0
  18. package/cjs/schema/coupon_set.schema.js +28 -0
  19. package/cjs/schema/credit_note.schema.js +288 -0
  20. package/cjs/schema/currency.schema.js +32 -0
  21. package/cjs/schema/customer.schema.js +986 -0
  22. package/cjs/schema/customer_entitlement.schema.js +14 -0
  23. package/cjs/schema/differential_price.schema.js +68 -0
  24. package/cjs/schema/entitlement.schema.js +27 -0
  25. package/cjs/schema/entitlement_override.schema.js +33 -0
  26. package/cjs/schema/estimate.schema.js +1525 -0
  27. package/cjs/schema/export.schema.js +1545 -0
  28. package/cjs/schema/feature.schema.js +37 -0
  29. package/cjs/schema/gift.schema.js +277 -0
  30. package/cjs/schema/hosted_page.schema.js +1649 -0
  31. package/cjs/schema/in_app_subscription.schema.js +68 -0
  32. package/cjs/schema/index.js +80 -0
  33. package/cjs/schema/invoice.schema.js +1467 -0
  34. package/cjs/schema/item.schema.js +91 -0
  35. package/cjs/schema/item_entitlement.schema.js +45 -0
  36. package/cjs/schema/item_family.schema.js +21 -0
  37. package/cjs/schema/item_price.schema.js +190 -0
  38. package/cjs/schema/non_subscription.schema.js +28 -0
  39. package/cjs/schema/offer_event.schema.js +13 -0
  40. package/cjs/schema/offer_fulfillment.schema.js +20 -0
  41. package/cjs/schema/omnichannel_one_time_order.schema.js +26 -0
  42. package/cjs/schema/omnichannel_subscription.schema.js +89 -0
  43. package/cjs/schema/omnichannel_subscription_item.schema.js +13 -0
  44. package/cjs/schema/order.schema.js +273 -0
  45. package/cjs/schema/payment_intent.schema.js +117 -0
  46. package/cjs/schema/payment_schedule_scheme.schema.js +20 -0
  47. package/cjs/schema/payment_source.schema.js +358 -0
  48. package/cjs/schema/payment_voucher.schema.js +57 -0
  49. package/cjs/schema/personalized_offer.schema.js +28 -0
  50. package/cjs/schema/plan.schema.js +225 -0
  51. package/cjs/schema/portal_session.schema.js +22 -0
  52. package/cjs/schema/price_variant.schema.js +36 -0
  53. package/cjs/schema/pricing_page_session.schema.js +135 -0
  54. package/cjs/schema/promotional_credit.schema.js +78 -0
  55. package/cjs/schema/purchase.schema.js +272 -0
  56. package/cjs/schema/quote.schema.js +1557 -0
  57. package/cjs/schema/ramp.schema.js +209 -0
  58. package/cjs/schema/recorded_purchase.schema.js +32 -0
  59. package/cjs/schema/resource_migration.schema.js +14 -0
  60. package/cjs/schema/site_migration_detail.schema.js +81 -0
  61. package/cjs/schema/subscription.schema.js +2993 -0
  62. package/cjs/schema/subscription_entitlement.schema.js +25 -0
  63. package/cjs/schema/time_machine.schema.js +17 -0
  64. package/cjs/schema/transaction.schema.js +70 -0
  65. package/cjs/schema/unbilled_charge.schema.js +113 -0
  66. package/cjs/schema/usage.schema.js +93 -0
  67. package/cjs/schema/usage_charge.schema.js +17 -0
  68. package/cjs/schema/usage_event.schema.js +28 -0
  69. package/cjs/schema/usage_file.schema.js +13 -0
  70. package/cjs/schema/usage_summary.schema.js +17 -0
  71. package/cjs/schema/virtual_bank_account.schema.js +43 -0
  72. package/cjs/schema/webhook_endpoint.schema.js +504 -0
  73. package/cjs/validationLoader.js +59 -0
  74. package/esm/RequestWrapper.js +27 -0
  75. package/esm/chargebee.esm.js +2 -0
  76. package/esm/chargebee.esm.worker.js +1 -0
  77. package/esm/chargebeeZodValidationError.js +14 -0
  78. package/esm/createChargebee.js +5 -0
  79. package/esm/environment.js +1 -1
  80. package/esm/schema/addon.schema.js +150 -0
  81. package/esm/schema/address.schema.js +32 -0
  82. package/esm/schema/alert.schema.js +35 -0
  83. package/esm/schema/attached_item.schema.js +55 -0
  84. package/esm/schema/business_entity.schema.js +43 -0
  85. package/esm/schema/card.schema.js +162 -0
  86. package/esm/schema/comment.schema.js +66 -0
  87. package/esm/schema/coupon.schema.js +206 -0
  88. package/esm/schema/coupon_code.schema.js +11 -0
  89. package/esm/schema/coupon_set.schema.js +25 -0
  90. package/esm/schema/credit_note.schema.js +285 -0
  91. package/esm/schema/currency.schema.js +29 -0
  92. package/esm/schema/customer.schema.js +983 -0
  93. package/esm/schema/customer_entitlement.schema.js +11 -0
  94. package/esm/schema/differential_price.schema.js +65 -0
  95. package/esm/schema/entitlement.schema.js +24 -0
  96. package/esm/schema/entitlement_override.schema.js +30 -0
  97. package/esm/schema/estimate.schema.js +1522 -0
  98. package/esm/schema/export.schema.js +1542 -0
  99. package/esm/schema/feature.schema.js +34 -0
  100. package/esm/schema/gift.schema.js +274 -0
  101. package/esm/schema/hosted_page.schema.js +1646 -0
  102. package/esm/schema/in_app_subscription.schema.js +65 -0
  103. package/esm/schema/index.js +64 -0
  104. package/esm/schema/invoice.schema.js +1464 -0
  105. package/esm/schema/item.schema.js +88 -0
  106. package/esm/schema/item_entitlement.schema.js +42 -0
  107. package/esm/schema/item_family.schema.js +18 -0
  108. package/esm/schema/item_price.schema.js +187 -0
  109. package/esm/schema/non_subscription.schema.js +25 -0
  110. package/esm/schema/offer_event.schema.js +10 -0
  111. package/esm/schema/offer_fulfillment.schema.js +17 -0
  112. package/esm/schema/omnichannel_one_time_order.schema.js +23 -0
  113. package/esm/schema/omnichannel_subscription.schema.js +86 -0
  114. package/esm/schema/omnichannel_subscription_item.schema.js +10 -0
  115. package/esm/schema/order.schema.js +270 -0
  116. package/esm/schema/payment_intent.schema.js +114 -0
  117. package/esm/schema/payment_schedule_scheme.schema.js +17 -0
  118. package/esm/schema/payment_source.schema.js +355 -0
  119. package/esm/schema/payment_voucher.schema.js +54 -0
  120. package/esm/schema/personalized_offer.schema.js +25 -0
  121. package/esm/schema/plan.schema.js +222 -0
  122. package/esm/schema/portal_session.schema.js +19 -0
  123. package/esm/schema/price_variant.schema.js +33 -0
  124. package/esm/schema/pricing_page_session.schema.js +132 -0
  125. package/esm/schema/promotional_credit.schema.js +75 -0
  126. package/esm/schema/purchase.schema.js +269 -0
  127. package/esm/schema/quote.schema.js +1554 -0
  128. package/esm/schema/ramp.schema.js +206 -0
  129. package/esm/schema/recorded_purchase.schema.js +29 -0
  130. package/esm/schema/resource_migration.schema.js +11 -0
  131. package/esm/schema/site_migration_detail.schema.js +78 -0
  132. package/esm/schema/subscription.schema.js +2990 -0
  133. package/esm/schema/subscription_entitlement.schema.js +22 -0
  134. package/esm/schema/time_machine.schema.js +14 -0
  135. package/esm/schema/transaction.schema.js +67 -0
  136. package/esm/schema/unbilled_charge.schema.js +110 -0
  137. package/esm/schema/usage.schema.js +90 -0
  138. package/esm/schema/usage_charge.schema.js +14 -0
  139. package/esm/schema/usage_event.schema.js +25 -0
  140. package/esm/schema/usage_file.schema.js +10 -0
  141. package/esm/schema/usage_summary.schema.js +14 -0
  142. package/esm/schema/virtual_bank_account.schema.js +40 -0
  143. package/esm/schema/webhook_endpoint.schema.js +501 -0
  144. package/esm/validationLoader.js +56 -0
  145. package/package.json +4 -1
  146. package/types/core.d.ts +2 -0
  147. package/types/index.d.ts +16 -0
@@ -0,0 +1,33 @@
1
+ // Generated Zod schemas: PriceVariant
2
+ // Actions: create, update
3
+ // Do not edit manually – regenerate via sdk-generator
4
+ import { z } from 'zod';
5
+ //PriceVariant.create
6
+ const CreatePriceVariantAttributesSchema = z.object({
7
+ name: z.array(z.string().max(100).optional()),
8
+ value: z.array(z.string().max(100).optional()),
9
+ });
10
+ const CreatePriceVariantBodySchema = z.looseObject({
11
+ id: z.string().max(100),
12
+ name: z.string().max(100),
13
+ external_name: z.string().max(100).optional(),
14
+ description: z.string().max(500).optional(),
15
+ variant_group: z.string().max(100).optional(),
16
+ business_entity_id: z.string().max(50).optional(),
17
+ attributes: CreatePriceVariantAttributesSchema.optional(),
18
+ });
19
+ export { CreatePriceVariantBodySchema };
20
+ //PriceVariant.update
21
+ const UpdatePriceVariantAttributesSchema = z.object({
22
+ name: z.array(z.string().max(100).optional()),
23
+ value: z.array(z.string().max(100).optional()),
24
+ });
25
+ const UpdatePriceVariantBodySchema = z.looseObject({
26
+ name: z.string().max(100).optional(),
27
+ external_name: z.string().max(100).optional(),
28
+ description: z.string().max(500).optional(),
29
+ variant_group: z.string().max(100).optional(),
30
+ status: z.enum(['active', 'archived']).optional(),
31
+ attributes: UpdatePriceVariantAttributesSchema.optional(),
32
+ });
33
+ export { UpdatePriceVariantBodySchema };
@@ -0,0 +1,132 @@
1
+ // Generated Zod schemas: PricingPageSession
2
+ // Actions: createForNewSubscription, createForExistingSubscription
3
+ // Do not edit manually – regenerate via sdk-generator
4
+ import { z } from 'zod';
5
+ //PricingPageSession.createForNewSubscription
6
+ const CreateForNewSubscriptionPricingPageSessionCustomSchema = z.looseObject({});
7
+ const CreateForNewSubscriptionPricingPageSessionPricingPageSchema = z.object({
8
+ id: z.string().max(50),
9
+ });
10
+ const CreateForNewSubscriptionPricingPageSessionSubscriptionSchema = z.looseObject({
11
+ id: z.string().max(50).optional(),
12
+ });
13
+ const CreateForNewSubscriptionPricingPageSessionCustomerSchema = z.looseObject({
14
+ id: z.string().max(50).optional(),
15
+ email: z.string().email().max(70).optional(),
16
+ first_name: z.string().max(150).optional(),
17
+ last_name: z.string().max(150).optional(),
18
+ company: z.string().max(250).optional(),
19
+ phone: z.string().max(50).optional(),
20
+ locale: z.string().max(50).optional(),
21
+ });
22
+ const CreateForNewSubscriptionPricingPageSessionBillingAddressSchema = z.object({
23
+ first_name: z.string().max(150).optional(),
24
+ last_name: z.string().max(150).optional(),
25
+ email: z.string().email().max(70).optional(),
26
+ company: z.string().max(250).optional(),
27
+ phone: z.string().max(50).optional(),
28
+ line1: z.string().max(150).optional(),
29
+ line2: z.string().max(150).optional(),
30
+ line3: z.string().max(150).optional(),
31
+ city: z.string().max(50).optional(),
32
+ state_code: z.string().max(50).optional(),
33
+ state: z.string().max(50).optional(),
34
+ zip: z.string().max(20).optional(),
35
+ country: z.string().max(50).optional(),
36
+ validation_status: z
37
+ .enum(['not_validated', 'valid', 'partially_valid', 'invalid'])
38
+ .optional(),
39
+ });
40
+ const CreateForNewSubscriptionPricingPageSessionShippingAddressSchema = z.object({
41
+ first_name: z.string().max(150).optional(),
42
+ last_name: z.string().max(150).optional(),
43
+ email: z.string().email().max(70).optional(),
44
+ company: z.string().max(250).optional(),
45
+ phone: z.string().max(50).optional(),
46
+ line1: z.string().max(150).optional(),
47
+ line2: z.string().max(150).optional(),
48
+ line3: z.string().max(150).optional(),
49
+ city: z.string().max(50).optional(),
50
+ state_code: z.string().max(50).optional(),
51
+ state: z.string().max(50).optional(),
52
+ zip: z.string().max(20).optional(),
53
+ country: z.string().max(50).optional(),
54
+ validation_status: z
55
+ .enum(['not_validated', 'valid', 'partially_valid', 'invalid'])
56
+ .optional(),
57
+ });
58
+ const CreateForNewSubscriptionPricingPageSessionContractTermSchema = z.object({
59
+ action_at_term_end: z
60
+ .enum(['renew', 'evergreen', 'cancel', 'renew_once'])
61
+ .optional(),
62
+ cancellation_cutoff_period: z.number().int().optional(),
63
+ });
64
+ const CreateForNewSubscriptionPricingPageSessionDiscountsSchema = z.object({
65
+ apply_on: z
66
+ .array(z.enum(['invoice_amount', 'specific_item_price']).optional())
67
+ .optional(),
68
+ duration_type: z.array(z.enum(['one_time', 'forever', 'limited_period']).optional()),
69
+ percentage: z.array(z.number().min(0.01).max(100).optional()).optional(),
70
+ amount: z.array(z.number().int().min(0).optional()).optional(),
71
+ period: z.array(z.number().int().min(1).optional()).optional(),
72
+ period_unit: z
73
+ .array(z.enum(['day', 'week', 'month', 'year']).optional())
74
+ .optional(),
75
+ included_in_mrr: z.array(z.boolean().optional()).optional(),
76
+ item_price_id: z.array(z.string().max(100).optional()).optional(),
77
+ quantity: z.array(z.number().int().min(1).optional()).optional(),
78
+ label: z.array(z.string().max(100).optional()).optional(),
79
+ });
80
+ const CreateForNewSubscriptionPricingPageSessionBodySchema = z.looseObject({
81
+ redirect_url: z.string().max(250).optional(),
82
+ business_entity_id: z.string().max(50).optional(),
83
+ auto_select_local_currency: z.boolean().default(false).optional(),
84
+ custom: CreateForNewSubscriptionPricingPageSessionCustomSchema.optional(),
85
+ pricing_page: CreateForNewSubscriptionPricingPageSessionPricingPageSchema.optional(),
86
+ subscription: CreateForNewSubscriptionPricingPageSessionSubscriptionSchema.optional(),
87
+ customer: CreateForNewSubscriptionPricingPageSessionCustomerSchema.optional(),
88
+ billing_address: CreateForNewSubscriptionPricingPageSessionBillingAddressSchema.optional(),
89
+ shipping_address: CreateForNewSubscriptionPricingPageSessionShippingAddressSchema.optional(),
90
+ contract_term: CreateForNewSubscriptionPricingPageSessionContractTermSchema.optional(),
91
+ discounts: CreateForNewSubscriptionPricingPageSessionDiscountsSchema.optional(),
92
+ });
93
+ export { CreateForNewSubscriptionPricingPageSessionBodySchema };
94
+ //PricingPageSession.createForExistingSubscription
95
+ const CreateForExistingSubscriptionPricingPageSessionCustomSchema = z.looseObject({});
96
+ const CreateForExistingSubscriptionPricingPageSessionPricingPageSchema = z.object({
97
+ id: z.string().max(50).optional(),
98
+ });
99
+ const CreateForExistingSubscriptionPricingPageSessionSubscriptionSchema = z.looseObject({
100
+ id: z.string().max(50),
101
+ });
102
+ const CreateForExistingSubscriptionPricingPageSessionContractTermSchema = z.object({
103
+ action_at_term_end: z
104
+ .enum(['renew', 'evergreen', 'cancel', 'renew_once'])
105
+ .optional(),
106
+ cancellation_cutoff_period: z.number().int().optional(),
107
+ });
108
+ const CreateForExistingSubscriptionPricingPageSessionDiscountsSchema = z.object({
109
+ apply_on: z
110
+ .array(z.enum(['invoice_amount', 'specific_item_price']).optional())
111
+ .optional(),
112
+ duration_type: z.array(z.enum(['one_time', 'forever', 'limited_period']).optional()),
113
+ percentage: z.array(z.number().min(0.01).max(100).optional()).optional(),
114
+ amount: z.array(z.number().int().min(0).optional()).optional(),
115
+ period: z.array(z.number().int().min(1).optional()).optional(),
116
+ period_unit: z
117
+ .array(z.enum(['day', 'week', 'month', 'year']).optional())
118
+ .optional(),
119
+ included_in_mrr: z.array(z.boolean().optional()).optional(),
120
+ item_price_id: z.array(z.string().max(100).optional()).optional(),
121
+ quantity: z.array(z.number().int().min(1).optional()).optional(),
122
+ label: z.array(z.string().max(100).optional()).optional(),
123
+ });
124
+ const CreateForExistingSubscriptionPricingPageSessionBodySchema = z.looseObject({
125
+ redirect_url: z.string().max(250).optional(),
126
+ custom: CreateForExistingSubscriptionPricingPageSessionCustomSchema.optional(),
127
+ pricing_page: CreateForExistingSubscriptionPricingPageSessionPricingPageSchema.optional(),
128
+ subscription: CreateForExistingSubscriptionPricingPageSessionSubscriptionSchema.optional(),
129
+ contract_term: CreateForExistingSubscriptionPricingPageSessionContractTermSchema.optional(),
130
+ discounts: CreateForExistingSubscriptionPricingPageSessionDiscountsSchema.optional(),
131
+ });
132
+ export { CreateForExistingSubscriptionPricingPageSessionBodySchema };
@@ -0,0 +1,75 @@
1
+ // Generated Zod schemas: PromotionalCredit
2
+ // Actions: add, deduct, set, list
3
+ // Do not edit manually – regenerate via sdk-generator
4
+ import { z } from 'zod';
5
+ //PromotionalCredit.add
6
+ const AddPromotionalCreditBodySchema = z.looseObject({
7
+ customer_id: z.string().max(50),
8
+ amount: z.number().int().min(0).optional(),
9
+ amount_in_decimal: z.string().max(33).optional(),
10
+ currency_code: z.string().max(3).optional(),
11
+ description: z.string().max(250),
12
+ credit_type: z
13
+ .enum(['loyalty_credits', 'referral_rewards', 'general'])
14
+ .optional(),
15
+ reference: z.string().max(500).optional(),
16
+ });
17
+ export { AddPromotionalCreditBodySchema };
18
+ //PromotionalCredit.deduct
19
+ const DeductPromotionalCreditBodySchema = z.looseObject({
20
+ customer_id: z.string().max(50),
21
+ amount: z.number().int().min(0).optional(),
22
+ amount_in_decimal: z.string().max(33).optional(),
23
+ currency_code: z.string().max(3).optional(),
24
+ description: z.string().max(250),
25
+ credit_type: z
26
+ .enum(['loyalty_credits', 'referral_rewards', 'general'])
27
+ .optional(),
28
+ reference: z.string().max(500).optional(),
29
+ });
30
+ export { DeductPromotionalCreditBodySchema };
31
+ //PromotionalCredit.set
32
+ const SetPromotionalCreditBodySchema = z.looseObject({
33
+ customer_id: z.string().max(50),
34
+ amount: z.number().int().min(0).optional(),
35
+ amount_in_decimal: z.string().max(33).optional(),
36
+ currency_code: z.string().max(3).optional(),
37
+ description: z.string().max(250),
38
+ credit_type: z
39
+ .enum(['loyalty_credits', 'referral_rewards', 'general'])
40
+ .optional(),
41
+ reference: z.string().max(500).optional(),
42
+ });
43
+ export { SetPromotionalCreditBodySchema };
44
+ //PromotionalCredit.list
45
+ const ListPromotionalCreditIdSchema = z.object({
46
+ is: z.string().min(1).optional(),
47
+ is_not: z.string().min(1).optional(),
48
+ starts_with: z.string().min(1).optional(),
49
+ });
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(),
55
+ });
56
+ const ListPromotionalCreditTypeSchema = z.object({
57
+ is: z.enum(['increment', 'decrement']).optional(),
58
+ is_not: z.enum(['increment', 'decrement']).optional(),
59
+ in: z.enum(['increment', 'decrement']).optional(),
60
+ not_in: z.enum(['increment', 'decrement']).optional(),
61
+ });
62
+ const ListPromotionalCreditCustomerIdSchema = z.object({
63
+ is: z.string().min(1).optional(),
64
+ is_not: z.string().min(1).optional(),
65
+ starts_with: z.string().min(1).optional(),
66
+ });
67
+ const ListPromotionalCreditBodySchema = z.looseObject({
68
+ limit: z.number().int().min(1).max(100).optional(),
69
+ offset: z.string().max(1000).optional(),
70
+ id: ListPromotionalCreditIdSchema.optional(),
71
+ created_at: ListPromotionalCreditCreatedAtSchema.optional(),
72
+ type: ListPromotionalCreditTypeSchema.optional(),
73
+ customer_id: ListPromotionalCreditCustomerIdSchema.optional(),
74
+ });
75
+ export { ListPromotionalCreditBodySchema };
@@ -0,0 +1,269 @@
1
+ // Generated Zod schemas: Purchase
2
+ // Actions: create, estimate
3
+ // Do not edit manually – regenerate via sdk-generator
4
+ import { z } from 'zod';
5
+ //Purchase.create
6
+ const CreatePurchaseInvoiceInfoSchema = z.object({
7
+ po_number: z.string().max(100).optional(),
8
+ notes: z.string().max(2000).optional(),
9
+ });
10
+ const CreatePurchasePaymentScheduleSchema = z.object({
11
+ scheme_id: z.string().max(40).optional(),
12
+ amount: z.number().int().min(0).optional(),
13
+ });
14
+ const CreatePurchaseStatementDescriptorSchema = z.object({
15
+ descriptor: z.string().max(65000).optional(),
16
+ });
17
+ const CreatePurchaseAdditionalInformationSchema = z.looseObject({});
18
+ const CreatePurchasePaymentIntentSchema = z.object({
19
+ id: z.string().max(150).optional(),
20
+ gateway_account_id: z.string().max(50).optional(),
21
+ gw_token: z.string().max(65000).optional(),
22
+ payment_method_type: z
23
+ .enum([
24
+ 'card',
25
+ 'ideal',
26
+ 'sofort',
27
+ 'bancontact',
28
+ 'google_pay',
29
+ 'dotpay',
30
+ 'giropay',
31
+ 'apple_pay',
32
+ 'upi',
33
+ 'netbanking_emandates',
34
+ 'paypal_express_checkout',
35
+ 'direct_debit',
36
+ 'boleto',
37
+ 'venmo',
38
+ 'amazon_payments',
39
+ 'pay_to',
40
+ 'faster_payments',
41
+ 'sepa_instant_transfer',
42
+ 'klarna_pay_now',
43
+ 'online_banking_poland',
44
+ 'payconiq_by_bancontact',
45
+ 'electronic_payment_standard',
46
+ 'kbc_payment_button',
47
+ 'pay_by_bank',
48
+ 'trustly',
49
+ 'stablecoin',
50
+ 'kakao_pay',
51
+ 'naver_pay',
52
+ 'revolut_pay',
53
+ 'cash_app_pay',
54
+ 'wechat_pay',
55
+ 'alipay',
56
+ 'pix',
57
+ 'twint',
58
+ 'go_pay',
59
+ 'grab_pay',
60
+ 'pay_co',
61
+ 'after_pay',
62
+ 'swish',
63
+ 'payme',
64
+ ])
65
+ .optional(),
66
+ reference_id: z.string().max(65000).optional(),
67
+ gw_payment_method_id: z.string().max(65000).optional(),
68
+ additional_information: CreatePurchaseAdditionalInformationSchema.optional(),
69
+ });
70
+ const CreatePurchasePurchaseItemsSchema = z.object({
71
+ index: z.array(z.number().int().min(0).optional()),
72
+ item_price_id: z.array(z.string().max(100).optional()),
73
+ quantity: z.array(z.number().int().min(1).optional()).optional(),
74
+ unit_amount: z.array(z.number().int().min(0).optional()).optional(),
75
+ unit_amount_in_decimal: z.array(z.string().max(39).optional()).optional(),
76
+ quantity_in_decimal: z.array(z.string().max(33).optional()).optional(),
77
+ });
78
+ const CreatePurchaseItemTiersSchema = z.object({
79
+ index: z.array(z.number().int().min(0).optional()),
80
+ item_price_id: z.array(z.string().max(100).optional()).optional(),
81
+ starting_unit: z.array(z.number().int().min(1).optional()).optional(),
82
+ ending_unit: z.array(z.number().int().optional()).optional(),
83
+ price: z.array(z.number().int().min(0).optional()).optional(),
84
+ starting_unit_in_decimal: z.array(z.string().max(33).optional()).optional(),
85
+ ending_unit_in_decimal: z.array(z.string().max(33).optional()).optional(),
86
+ price_in_decimal: z.array(z.string().max(39).optional()).optional(),
87
+ });
88
+ const CreatePurchaseShippingAddressesSchema = z.object({
89
+ first_name: z.array(z.string().max(150).optional()).optional(),
90
+ last_name: z.array(z.string().max(150).optional()).optional(),
91
+ email: z.array(z.string().email().max(70).optional()).optional(),
92
+ company: z.array(z.string().max(250).optional()).optional(),
93
+ phone: z.array(z.string().max(50).optional()).optional(),
94
+ line1: z.array(z.string().max(150).optional()).optional(),
95
+ line2: z.array(z.string().max(150).optional()).optional(),
96
+ line3: z.array(z.string().max(150).optional()).optional(),
97
+ city: z.array(z.string().max(50).optional()).optional(),
98
+ state: z.array(z.string().max(50).optional()).optional(),
99
+ state_code: z.array(z.string().max(50).optional()).optional(),
100
+ country: z.array(z.string().max(50).optional()).optional(),
101
+ zip: z.array(z.string().max(20).optional()).optional(),
102
+ validation_status: z
103
+ .array(z
104
+ .enum(['not_validated', 'valid', 'partially_valid', 'invalid'])
105
+ .optional())
106
+ .optional(),
107
+ });
108
+ const CreatePurchaseDiscountsSchema = z.object({
109
+ index: z.array(z.number().int().min(0).optional()).optional(),
110
+ coupon_id: z.array(z.string().max(100).optional()).optional(),
111
+ percentage: z.array(z.number().min(0.01).max(100).optional()).optional(),
112
+ quantity: z.array(z.number().int().min(1).optional()).optional(),
113
+ amount: z.array(z.number().int().min(0).optional()).optional(),
114
+ included_in_mrr: z.array(z.boolean().optional()).optional(),
115
+ });
116
+ const CreatePurchaseMetaDataItemSchema = z.looseObject({});
117
+ const CreatePurchaseSubscriptionInfoSchema = z.object({
118
+ index: z.array(z.number().int().min(0).optional()),
119
+ subscription_id: z.array(z.string().max(50).optional()).optional(),
120
+ billing_cycles: z.array(z.number().int().min(0).optional()).optional(),
121
+ contract_term_billing_cycle_on_renewal: z
122
+ .array(z.number().int().min(1).max(100).optional())
123
+ .optional(),
124
+ meta_data: z.array(CreatePurchaseMetaDataItemSchema.optional()).optional(),
125
+ });
126
+ const CreatePurchaseContractTermsSchema = z.object({
127
+ index: z.array(z.number().int().min(0).optional()),
128
+ action_at_term_end: z
129
+ .array(z.enum(['renew', 'evergreen', 'cancel', 'renew_once']).optional())
130
+ .optional(),
131
+ cancellation_cutoff_period: z.array(z.number().int().optional()).optional(),
132
+ });
133
+ const CreatePurchaseBodySchema = z.looseObject({
134
+ customer_id: z.string().max(50),
135
+ payment_source_id: z.string().max(40).optional(),
136
+ replace_primary_payment_source: z.boolean().default(true).optional(),
137
+ invoice_info: CreatePurchaseInvoiceInfoSchema.optional(),
138
+ payment_schedule: CreatePurchasePaymentScheduleSchema.optional(),
139
+ statement_descriptor: CreatePurchaseStatementDescriptorSchema.optional(),
140
+ payment_intent: CreatePurchasePaymentIntentSchema.optional(),
141
+ purchase_items: CreatePurchasePurchaseItemsSchema.optional(),
142
+ item_tiers: CreatePurchaseItemTiersSchema.optional(),
143
+ shipping_addresses: CreatePurchaseShippingAddressesSchema.optional(),
144
+ discounts: CreatePurchaseDiscountsSchema.optional(),
145
+ subscription_info: CreatePurchaseSubscriptionInfoSchema.optional(),
146
+ contract_terms: CreatePurchaseContractTermsSchema.optional(),
147
+ });
148
+ export { CreatePurchaseBodySchema };
149
+ //Purchase.estimate
150
+ const EstimatePurchaseCustomerSchema = z.object({
151
+ vat_number: z.string().max(20).optional(),
152
+ vat_number_prefix: z.string().max(10).optional(),
153
+ registered_for_gst: z.boolean().optional(),
154
+ taxability: z.enum(['taxable', 'exempt']).optional(),
155
+ entity_code: z
156
+ .enum([
157
+ 'a',
158
+ 'b',
159
+ 'c',
160
+ 'd',
161
+ 'e',
162
+ 'f',
163
+ 'g',
164
+ 'h',
165
+ 'i',
166
+ 'j',
167
+ 'k',
168
+ 'l',
169
+ 'm',
170
+ 'n',
171
+ 'p',
172
+ 'q',
173
+ 'r',
174
+ 'med1',
175
+ 'med2',
176
+ ])
177
+ .optional(),
178
+ exempt_number: z.string().max(100).optional(),
179
+ exemption_details: z.array(z.string().optional()).optional(),
180
+ customer_type: z
181
+ .enum(['residential', 'business', 'senior_citizen', 'industrial'])
182
+ .optional(),
183
+ });
184
+ const EstimatePurchaseBillingAddressSchema = z.object({
185
+ line1: z.string().max(150).optional(),
186
+ line2: z.string().max(150).optional(),
187
+ line3: z.string().max(150).optional(),
188
+ city: z.string().max(50).optional(),
189
+ state_code: z.string().max(50).optional(),
190
+ zip: z.string().max(20).optional(),
191
+ country: z.string().max(50).optional(),
192
+ validation_status: z
193
+ .enum(['not_validated', 'valid', 'partially_valid', 'invalid'])
194
+ .optional(),
195
+ });
196
+ const EstimatePurchasePurchaseItemsSchema = z.object({
197
+ index: z.array(z.number().int().min(0).optional()),
198
+ item_price_id: z.array(z.string().max(100).optional()),
199
+ quantity: z.array(z.number().int().min(1).optional()).optional(),
200
+ unit_amount: z.array(z.number().int().min(0).optional()).optional(),
201
+ unit_amount_in_decimal: z.array(z.string().max(39).optional()).optional(),
202
+ quantity_in_decimal: z.array(z.string().max(33).optional()).optional(),
203
+ });
204
+ const EstimatePurchaseItemTiersSchema = z.object({
205
+ index: z.array(z.number().int().min(0).optional()),
206
+ item_price_id: z.array(z.string().max(100).optional()).optional(),
207
+ starting_unit: z.array(z.number().int().min(1).optional()).optional(),
208
+ ending_unit: z.array(z.number().int().optional()).optional(),
209
+ price: z.array(z.number().int().min(0).optional()).optional(),
210
+ starting_unit_in_decimal: z.array(z.string().max(33).optional()).optional(),
211
+ ending_unit_in_decimal: z.array(z.string().max(33).optional()).optional(),
212
+ price_in_decimal: z.array(z.string().max(39).optional()).optional(),
213
+ });
214
+ const EstimatePurchaseShippingAddressesSchema = z.object({
215
+ first_name: z.array(z.string().max(150).optional()).optional(),
216
+ last_name: z.array(z.string().max(150).optional()).optional(),
217
+ email: z.array(z.string().email().max(70).optional()).optional(),
218
+ company: z.array(z.string().max(250).optional()).optional(),
219
+ phone: z.array(z.string().max(50).optional()).optional(),
220
+ line1: z.array(z.string().max(150).optional()).optional(),
221
+ line2: z.array(z.string().max(150).optional()).optional(),
222
+ line3: z.array(z.string().max(150).optional()).optional(),
223
+ city: z.array(z.string().max(50).optional()).optional(),
224
+ state: z.array(z.string().max(50).optional()).optional(),
225
+ state_code: z.array(z.string().max(50).optional()).optional(),
226
+ country: z.array(z.string().max(50).optional()).optional(),
227
+ zip: z.array(z.string().max(20).optional()).optional(),
228
+ validation_status: z
229
+ .array(z
230
+ .enum(['not_validated', 'valid', 'partially_valid', 'invalid'])
231
+ .optional())
232
+ .optional(),
233
+ });
234
+ const EstimatePurchaseDiscountsSchema = z.object({
235
+ index: z.array(z.number().int().min(0).optional()).optional(),
236
+ coupon_id: z.array(z.string().max(100).optional()).optional(),
237
+ percentage: z.array(z.number().min(0.01).max(100).optional()).optional(),
238
+ quantity: z.array(z.number().int().min(1).optional()).optional(),
239
+ amount: z.array(z.number().int().min(0).optional()).optional(),
240
+ included_in_mrr: z.array(z.boolean().optional()).optional(),
241
+ });
242
+ const EstimatePurchaseSubscriptionInfoSchema = z.object({
243
+ index: z.array(z.number().int().min(0).optional()),
244
+ subscription_id: z.array(z.string().max(50).optional()).optional(),
245
+ billing_cycles: z.array(z.number().int().min(0).optional()).optional(),
246
+ contract_term_billing_cycle_on_renewal: z
247
+ .array(z.number().int().min(1).max(100).optional())
248
+ .optional(),
249
+ });
250
+ const EstimatePurchaseContractTermsSchema = z.object({
251
+ index: z.array(z.number().int().min(0).optional()),
252
+ action_at_term_end: z
253
+ .array(z.enum(['renew', 'evergreen', 'cancel', 'renew_once']).optional())
254
+ .optional(),
255
+ cancellation_cutoff_period: z.array(z.number().int().optional()).optional(),
256
+ });
257
+ const EstimatePurchaseBodySchema = z.looseObject({
258
+ client_profile_id: z.string().max(50).optional(),
259
+ customer_id: z.string().max(50).optional(),
260
+ customer: EstimatePurchaseCustomerSchema.optional(),
261
+ billing_address: EstimatePurchaseBillingAddressSchema.optional(),
262
+ purchase_items: EstimatePurchasePurchaseItemsSchema.optional(),
263
+ item_tiers: EstimatePurchaseItemTiersSchema.optional(),
264
+ shipping_addresses: EstimatePurchaseShippingAddressesSchema.optional(),
265
+ discounts: EstimatePurchaseDiscountsSchema.optional(),
266
+ subscription_info: EstimatePurchaseSubscriptionInfoSchema.optional(),
267
+ contract_terms: EstimatePurchaseContractTermsSchema.optional(),
268
+ });
269
+ export { EstimatePurchaseBodySchema };