/** * PayPal Server SDKLib * * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). */ import { array, boolean, lazy, object, optional, Schema, string, } from '../schema.js'; import { MerchantPreferences, merchantPreferencesSchema, } from './merchantPreferences.js'; import { PaymentPreferences, paymentPreferencesSchema, } from './paymentPreferences.js'; import { PlanRequestStatus, planRequestStatusSchema, } from './planRequestStatus.js'; import { SubscriptionBillingCycle, subscriptionBillingCycleSchema, } from './subscriptionBillingCycle.js'; import { Taxes, taxesSchema } from './taxes.js'; /** The create plan request details. */ export interface PlanRequest { /** The ID of the product created through Catalog Products API. */ productId: string; /** The plan name. */ name: string; /** The initial state of the plan. Allowed input values are CREATED and ACTIVE. */ status?: PlanRequestStatus; /** The detailed description of the plan. */ description?: string; /** An array of billing cycles for trial billing and regular billing. A plan can have at most two trial cycles and only one regular cycle. */ billingCycles: SubscriptionBillingCycle[]; /** The payment preferences for a subscription. */ paymentPreferences: PaymentPreferences; /** The merchant preferences for a subscription. */ merchantPreferences?: MerchantPreferences; /** The tax details. */ taxes?: Taxes; /** Indicates whether you can subscribe to this plan by providing a quantity for the goods or service. */ quantitySupported?: boolean; } export const planRequestSchema: Schema = lazy(() => object({ productId: ['product_id', string()], name: ['name', string()], status: ['status', optional(planRequestStatusSchema)], description: ['description', optional(string())], billingCycles: ['billing_cycles', array(subscriptionBillingCycleSchema)], paymentPreferences: ['payment_preferences', paymentPreferencesSchema], merchantPreferences: [ 'merchant_preferences', optional(merchantPreferencesSchema), ], taxes: ['taxes', optional(taxesSchema)], quantitySupported: ['quantity_supported', optional(boolean())], }) );