chargebee 3.25.0-beta.1 → 3.25.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 (166) hide show
  1. package/CHANGELOG.md +66 -4
  2. package/README.md +0 -39
  3. package/cjs/RequestWrapper.js +1 -28
  4. package/cjs/chargebee.cjs.js +0 -3
  5. package/cjs/chargebee.cjs.worker.js +0 -2
  6. package/cjs/createChargebee.js +0 -5
  7. package/cjs/environment.js +1 -1
  8. package/cjs/resources/api_endpoints.js +1 -2
  9. package/cjs/resources/webhook/eventType.js +2 -0
  10. package/esm/RequestWrapper.js +1 -28
  11. package/esm/chargebee.esm.js +0 -2
  12. package/esm/chargebee.esm.worker.js +0 -1
  13. package/esm/createChargebee.js +0 -5
  14. package/esm/environment.js +1 -1
  15. package/esm/resources/api_endpoints.js +1 -2
  16. package/esm/resources/webhook/eventType.js +2 -0
  17. package/package.json +1 -4
  18. package/types/core.d.ts +23 -6
  19. package/types/index.d.ts +0 -17
  20. package/types/resources/Content.d.ts +0 -1
  21. package/types/resources/Customer.d.ts +14 -4
  22. package/types/resources/Estimate.d.ts +14 -4
  23. package/types/resources/Event.d.ts +2 -0
  24. package/types/resources/Gift.d.ts +23 -6
  25. package/types/resources/HostedPage.d.ts +1 -0
  26. package/types/resources/Invoice.d.ts +14 -5
  27. package/types/resources/OmnichannelSubscription.d.ts +6 -0
  28. package/types/resources/OmnichannelSubscriptionItem.d.ts +1 -0
  29. package/types/resources/PaymentIntent.d.ts +35 -10
  30. package/types/resources/PaymentSource.d.ts +7 -2
  31. package/types/resources/Purchase.d.ts +7 -2
  32. package/types/resources/Subscription.d.ts +49 -14
  33. package/types/resources/WebhookEvent.d.ts +22 -4
  34. package/cjs/chargebeeZodValidationError.js +0 -18
  35. package/cjs/schema/addon.schema.js +0 -153
  36. package/cjs/schema/address.schema.js +0 -35
  37. package/cjs/schema/alert.schema.js +0 -38
  38. package/cjs/schema/attached_item.schema.js +0 -58
  39. package/cjs/schema/business_entity.schema.js +0 -46
  40. package/cjs/schema/card.schema.js +0 -165
  41. package/cjs/schema/comment.schema.js +0 -69
  42. package/cjs/schema/coupon.schema.js +0 -209
  43. package/cjs/schema/coupon_code.schema.js +0 -14
  44. package/cjs/schema/coupon_set.schema.js +0 -28
  45. package/cjs/schema/credit_note.schema.js +0 -288
  46. package/cjs/schema/currency.schema.js +0 -32
  47. package/cjs/schema/customer.schema.js +0 -986
  48. package/cjs/schema/customer_entitlement.schema.js +0 -14
  49. package/cjs/schema/differential_price.schema.js +0 -68
  50. package/cjs/schema/entitlement.schema.js +0 -27
  51. package/cjs/schema/entitlement_override.schema.js +0 -33
  52. package/cjs/schema/estimate.schema.js +0 -1525
  53. package/cjs/schema/export.schema.js +0 -1545
  54. package/cjs/schema/feature.schema.js +0 -37
  55. package/cjs/schema/gift.schema.js +0 -277
  56. package/cjs/schema/hosted_page.schema.js +0 -1649
  57. package/cjs/schema/in_app_subscription.schema.js +0 -68
  58. package/cjs/schema/index.js +0 -80
  59. package/cjs/schema/invoice.schema.js +0 -1467
  60. package/cjs/schema/item.schema.js +0 -91
  61. package/cjs/schema/item_entitlement.schema.js +0 -45
  62. package/cjs/schema/item_family.schema.js +0 -21
  63. package/cjs/schema/item_price.schema.js +0 -190
  64. package/cjs/schema/non_subscription.schema.js +0 -28
  65. package/cjs/schema/offer_event.schema.js +0 -13
  66. package/cjs/schema/offer_fulfillment.schema.js +0 -20
  67. package/cjs/schema/omnichannel_one_time_order.schema.js +0 -26
  68. package/cjs/schema/omnichannel_subscription.schema.js +0 -89
  69. package/cjs/schema/omnichannel_subscription_item.schema.js +0 -13
  70. package/cjs/schema/order.schema.js +0 -273
  71. package/cjs/schema/payment_intent.schema.js +0 -117
  72. package/cjs/schema/payment_schedule_scheme.schema.js +0 -20
  73. package/cjs/schema/payment_source.schema.js +0 -358
  74. package/cjs/schema/payment_voucher.schema.js +0 -57
  75. package/cjs/schema/personalized_offer.schema.js +0 -28
  76. package/cjs/schema/plan.schema.js +0 -225
  77. package/cjs/schema/portal_session.schema.js +0 -22
  78. package/cjs/schema/price_variant.schema.js +0 -36
  79. package/cjs/schema/pricing_page_session.schema.js +0 -135
  80. package/cjs/schema/promotional_credit.schema.js +0 -78
  81. package/cjs/schema/purchase.schema.js +0 -272
  82. package/cjs/schema/quote.schema.js +0 -1557
  83. package/cjs/schema/ramp.schema.js +0 -209
  84. package/cjs/schema/recorded_purchase.schema.js +0 -32
  85. package/cjs/schema/resource_migration.schema.js +0 -14
  86. package/cjs/schema/site_migration_detail.schema.js +0 -81
  87. package/cjs/schema/subscription.schema.js +0 -2993
  88. package/cjs/schema/subscription_entitlement.schema.js +0 -25
  89. package/cjs/schema/time_machine.schema.js +0 -17
  90. package/cjs/schema/transaction.schema.js +0 -70
  91. package/cjs/schema/unbilled_charge.schema.js +0 -113
  92. package/cjs/schema/usage.schema.js +0 -93
  93. package/cjs/schema/usage_charge.schema.js +0 -17
  94. package/cjs/schema/usage_event.schema.js +0 -28
  95. package/cjs/schema/usage_file.schema.js +0 -13
  96. package/cjs/schema/usage_summary.schema.js +0 -17
  97. package/cjs/schema/virtual_bank_account.schema.js +0 -43
  98. package/cjs/schema/webhook_endpoint.schema.js +0 -504
  99. package/cjs/validationLoader.js +0 -59
  100. package/esm/chargebeeZodValidationError.js +0 -14
  101. package/esm/schema/addon.schema.js +0 -150
  102. package/esm/schema/address.schema.js +0 -32
  103. package/esm/schema/alert.schema.js +0 -35
  104. package/esm/schema/attached_item.schema.js +0 -55
  105. package/esm/schema/business_entity.schema.js +0 -43
  106. package/esm/schema/card.schema.js +0 -162
  107. package/esm/schema/comment.schema.js +0 -66
  108. package/esm/schema/coupon.schema.js +0 -206
  109. package/esm/schema/coupon_code.schema.js +0 -11
  110. package/esm/schema/coupon_set.schema.js +0 -25
  111. package/esm/schema/credit_note.schema.js +0 -285
  112. package/esm/schema/currency.schema.js +0 -29
  113. package/esm/schema/customer.schema.js +0 -983
  114. package/esm/schema/customer_entitlement.schema.js +0 -11
  115. package/esm/schema/differential_price.schema.js +0 -65
  116. package/esm/schema/entitlement.schema.js +0 -24
  117. package/esm/schema/entitlement_override.schema.js +0 -30
  118. package/esm/schema/estimate.schema.js +0 -1522
  119. package/esm/schema/export.schema.js +0 -1542
  120. package/esm/schema/feature.schema.js +0 -34
  121. package/esm/schema/gift.schema.js +0 -274
  122. package/esm/schema/hosted_page.schema.js +0 -1646
  123. package/esm/schema/in_app_subscription.schema.js +0 -65
  124. package/esm/schema/index.js +0 -64
  125. package/esm/schema/invoice.schema.js +0 -1464
  126. package/esm/schema/item.schema.js +0 -88
  127. package/esm/schema/item_entitlement.schema.js +0 -42
  128. package/esm/schema/item_family.schema.js +0 -18
  129. package/esm/schema/item_price.schema.js +0 -187
  130. package/esm/schema/non_subscription.schema.js +0 -25
  131. package/esm/schema/offer_event.schema.js +0 -10
  132. package/esm/schema/offer_fulfillment.schema.js +0 -17
  133. package/esm/schema/omnichannel_one_time_order.schema.js +0 -23
  134. package/esm/schema/omnichannel_subscription.schema.js +0 -86
  135. package/esm/schema/omnichannel_subscription_item.schema.js +0 -10
  136. package/esm/schema/order.schema.js +0 -270
  137. package/esm/schema/payment_intent.schema.js +0 -114
  138. package/esm/schema/payment_schedule_scheme.schema.js +0 -17
  139. package/esm/schema/payment_source.schema.js +0 -355
  140. package/esm/schema/payment_voucher.schema.js +0 -54
  141. package/esm/schema/personalized_offer.schema.js +0 -25
  142. package/esm/schema/plan.schema.js +0 -222
  143. package/esm/schema/portal_session.schema.js +0 -19
  144. package/esm/schema/price_variant.schema.js +0 -33
  145. package/esm/schema/pricing_page_session.schema.js +0 -132
  146. package/esm/schema/promotional_credit.schema.js +0 -75
  147. package/esm/schema/purchase.schema.js +0 -269
  148. package/esm/schema/quote.schema.js +0 -1554
  149. package/esm/schema/ramp.schema.js +0 -206
  150. package/esm/schema/recorded_purchase.schema.js +0 -29
  151. package/esm/schema/resource_migration.schema.js +0 -11
  152. package/esm/schema/site_migration_detail.schema.js +0 -78
  153. package/esm/schema/subscription.schema.js +0 -2990
  154. package/esm/schema/subscription_entitlement.schema.js +0 -22
  155. package/esm/schema/time_machine.schema.js +0 -14
  156. package/esm/schema/transaction.schema.js +0 -67
  157. package/esm/schema/unbilled_charge.schema.js +0 -110
  158. package/esm/schema/usage.schema.js +0 -90
  159. package/esm/schema/usage_charge.schema.js +0 -14
  160. package/esm/schema/usage_event.schema.js +0 -25
  161. package/esm/schema/usage_file.schema.js +0 -10
  162. package/esm/schema/usage_summary.schema.js +0 -14
  163. package/esm/schema/virtual_bank_account.schema.js +0 -40
  164. package/esm/schema/webhook_endpoint.schema.js +0 -501
  165. package/esm/validationLoader.js +0 -56
  166. package/types/resources/QuoteEntitlement.d.ts +0 -16
@@ -1,33 +0,0 @@
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 };
@@ -1,132 +0,0 @@
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 };
@@ -1,75 +0,0 @@
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 };
@@ -1,269 +0,0 @@
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 };