chargebee
Version:
A library for integrating with Chargebee.
136 lines (135 loc) • 7.82 kB
JavaScript
"use strict";
// Generated Zod schemas: PricingPageSession
// Actions: createForNewSubscription, createForExistingSubscription
// Do not edit manually – regenerate via sdk-generator
Object.defineProperty(exports, "__esModule", { value: true });
exports.CreateForExistingSubscriptionPricingPageSessionBodySchema = exports.CreateForNewSubscriptionPricingPageSessionBodySchema = void 0;
const zod_1 = require("zod");
//PricingPageSession.createForNewSubscription
const CreateForNewSubscriptionPricingPageSessionCustomSchema = zod_1.z.looseObject({});
const CreateForNewSubscriptionPricingPageSessionPricingPageSchema = zod_1.z.object({
id: zod_1.z.string().max(50),
});
const CreateForNewSubscriptionPricingPageSessionSubscriptionSchema = zod_1.z.looseObject({
id: zod_1.z.string().max(50).optional(),
});
const CreateForNewSubscriptionPricingPageSessionCustomerSchema = zod_1.z.looseObject({
id: zod_1.z.string().max(50).optional(),
email: zod_1.z.string().email().max(70).optional(),
first_name: zod_1.z.string().max(150).optional(),
last_name: zod_1.z.string().max(150).optional(),
company: zod_1.z.string().max(250).optional(),
phone: zod_1.z.string().max(50).optional(),
locale: zod_1.z.string().max(50).optional(),
});
const CreateForNewSubscriptionPricingPageSessionBillingAddressSchema = zod_1.z.object({
first_name: zod_1.z.string().max(150).optional(),
last_name: zod_1.z.string().max(150).optional(),
email: zod_1.z.string().email().max(70).optional(),
company: zod_1.z.string().max(250).optional(),
phone: zod_1.z.string().max(50).optional(),
line1: zod_1.z.string().max(150).optional(),
line2: zod_1.z.string().max(150).optional(),
line3: zod_1.z.string().max(150).optional(),
city: zod_1.z.string().max(50).optional(),
state_code: zod_1.z.string().max(50).optional(),
state: zod_1.z.string().max(50).optional(),
zip: zod_1.z.string().max(20).optional(),
country: zod_1.z.string().max(50).optional(),
validation_status: zod_1.z
.enum(['not_validated', 'valid', 'partially_valid', 'invalid'])
.optional(),
});
const CreateForNewSubscriptionPricingPageSessionShippingAddressSchema = zod_1.z.object({
first_name: zod_1.z.string().max(150).optional(),
last_name: zod_1.z.string().max(150).optional(),
email: zod_1.z.string().email().max(70).optional(),
company: zod_1.z.string().max(250).optional(),
phone: zod_1.z.string().max(50).optional(),
line1: zod_1.z.string().max(150).optional(),
line2: zod_1.z.string().max(150).optional(),
line3: zod_1.z.string().max(150).optional(),
city: zod_1.z.string().max(50).optional(),
state_code: zod_1.z.string().max(50).optional(),
state: zod_1.z.string().max(50).optional(),
zip: zod_1.z.string().max(20).optional(),
country: zod_1.z.string().max(50).optional(),
validation_status: zod_1.z
.enum(['not_validated', 'valid', 'partially_valid', 'invalid'])
.optional(),
});
const CreateForNewSubscriptionPricingPageSessionContractTermSchema = zod_1.z.object({
action_at_term_end: zod_1.z
.enum(['renew', 'evergreen', 'cancel', 'renew_once'])
.optional(),
cancellation_cutoff_period: zod_1.z.number().int().optional(),
});
const CreateForNewSubscriptionPricingPageSessionDiscountsSchema = zod_1.z.object({
apply_on: zod_1.z
.array(zod_1.z.enum(['invoice_amount', 'specific_item_price']).optional())
.optional(),
duration_type: zod_1.z.array(zod_1.z.enum(['one_time', 'forever', 'limited_period']).optional()),
percentage: zod_1.z.array(zod_1.z.number().min(0.01).max(100).optional()).optional(),
amount: zod_1.z.array(zod_1.z.number().int().min(0).optional()).optional(),
period: zod_1.z.array(zod_1.z.number().int().min(1).optional()).optional(),
period_unit: zod_1.z
.array(zod_1.z.enum(['day', 'week', 'month', 'year']).optional())
.optional(),
included_in_mrr: zod_1.z.array(zod_1.z.boolean().optional()).optional(),
item_price_id: zod_1.z.array(zod_1.z.string().max(100).optional()).optional(),
quantity: zod_1.z.array(zod_1.z.number().int().min(1).optional()).optional(),
label: zod_1.z.array(zod_1.z.string().max(100).optional()).optional(),
});
const CreateForNewSubscriptionPricingPageSessionBodySchema = zod_1.z.looseObject({
redirect_url: zod_1.z.string().max(250).optional(),
business_entity_id: zod_1.z.string().max(50).optional(),
auto_select_local_currency: zod_1.z.boolean().default(false).optional(),
custom: CreateForNewSubscriptionPricingPageSessionCustomSchema.optional(),
pricing_page: CreateForNewSubscriptionPricingPageSessionPricingPageSchema.optional(),
subscription: CreateForNewSubscriptionPricingPageSessionSubscriptionSchema.optional(),
customer: CreateForNewSubscriptionPricingPageSessionCustomerSchema.optional(),
billing_address: CreateForNewSubscriptionPricingPageSessionBillingAddressSchema.optional(),
shipping_address: CreateForNewSubscriptionPricingPageSessionShippingAddressSchema.optional(),
contract_term: CreateForNewSubscriptionPricingPageSessionContractTermSchema.optional(),
discounts: CreateForNewSubscriptionPricingPageSessionDiscountsSchema.optional(),
});
exports.CreateForNewSubscriptionPricingPageSessionBodySchema = CreateForNewSubscriptionPricingPageSessionBodySchema;
//PricingPageSession.createForExistingSubscription
const CreateForExistingSubscriptionPricingPageSessionCustomSchema = zod_1.z.looseObject({});
const CreateForExistingSubscriptionPricingPageSessionPricingPageSchema = zod_1.z.object({
id: zod_1.z.string().max(50).optional(),
});
const CreateForExistingSubscriptionPricingPageSessionSubscriptionSchema = zod_1.z.looseObject({
id: zod_1.z.string().max(50),
});
const CreateForExistingSubscriptionPricingPageSessionContractTermSchema = zod_1.z.object({
action_at_term_end: zod_1.z
.enum(['renew', 'evergreen', 'cancel', 'renew_once'])
.optional(),
cancellation_cutoff_period: zod_1.z.number().int().optional(),
});
const CreateForExistingSubscriptionPricingPageSessionDiscountsSchema = zod_1.z.object({
apply_on: zod_1.z
.array(zod_1.z.enum(['invoice_amount', 'specific_item_price']).optional())
.optional(),
duration_type: zod_1.z.array(zod_1.z.enum(['one_time', 'forever', 'limited_period']).optional()),
percentage: zod_1.z.array(zod_1.z.number().min(0.01).max(100).optional()).optional(),
amount: zod_1.z.array(zod_1.z.number().int().min(0).optional()).optional(),
period: zod_1.z.array(zod_1.z.number().int().min(1).optional()).optional(),
period_unit: zod_1.z
.array(zod_1.z.enum(['day', 'week', 'month', 'year']).optional())
.optional(),
included_in_mrr: zod_1.z.array(zod_1.z.boolean().optional()).optional(),
item_price_id: zod_1.z.array(zod_1.z.string().max(100).optional()).optional(),
quantity: zod_1.z.array(zod_1.z.number().int().min(1).optional()).optional(),
label: zod_1.z.array(zod_1.z.string().max(100).optional()).optional(),
});
const CreateForExistingSubscriptionPricingPageSessionBodySchema = zod_1.z.looseObject({
redirect_url: zod_1.z.string().max(250).optional(),
custom: CreateForExistingSubscriptionPricingPageSessionCustomSchema.optional(),
pricing_page: CreateForExistingSubscriptionPricingPageSessionPricingPageSchema.optional(),
subscription: CreateForExistingSubscriptionPricingPageSessionSubscriptionSchema.optional(),
contract_term: CreateForExistingSubscriptionPricingPageSessionContractTermSchema.optional(),
discounts: CreateForExistingSubscriptionPricingPageSessionDiscountsSchema.optional(),
});
exports.CreateForExistingSubscriptionPricingPageSessionBodySchema = CreateForExistingSubscriptionPricingPageSessionBodySchema;