/** * PagarmeApiSDKLib * * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). */ import { array, boolean, dict, lazy, number, object, optional, Schema, string, } from '../schema'; import { CreatePlanItemRequest, createPlanItemRequestSchema, } from './createPlanItemRequest'; import { CreatePricingSchemeRequest, createPricingSchemeRequestSchema, } from './createPricingSchemeRequest'; /** Request for creating a plan */ export interface CreatePlanRequest { /** Plan's name */ name: string; /** Description */ description: string; /** Text that will be printed on the credit card's statement */ statementDescriptor: string; /** Plan items */ items: CreatePlanItemRequest[]; /** Indicates if the plan is shippable */ shippable: boolean; /** Allowed payment methods for the plan */ paymentMethods: string[]; /** Number of installments */ installments: number[]; /** Currency */ currency: string; /** Interval */ interval: string; /** Interval counts between two charges. For instance, if the interval is 'month' and count is 2, the customer will be charged once every two months. */ intervalCount: number; /** Allowed billings days for the subscription, in case the plan type is 'exact_day' */ billingDays: number[]; /** Billing type */ billingType: string; /** Plan's pricing scheme */ pricingScheme: CreatePricingSchemeRequest; /** Metadata */ metadata: Record; /** Minimum price that will be charged */ minimumPrice?: number; /** Number of cycles */ cycles?: number; /** Quantity */ quantity?: number; /** Trial period, where the customer will not be charged. */ trialPeriodDays?: number; } export const createPlanRequestSchema: Schema = object({ name: ['name', string()], description: ['description', string()], statementDescriptor: ['statement_descriptor', string()], items: ['items', array(lazy(() => createPlanItemRequestSchema))], shippable: ['shippable', boolean()], paymentMethods: ['payment_methods', array(string())], installments: ['installments', array(number())], currency: ['currency', string()], interval: ['interval', string()], intervalCount: ['interval_count', number()], billingDays: ['billing_days', array(number())], billingType: ['billing_type', string()], pricingScheme: [ 'pricing_scheme', lazy(() => createPricingSchemeRequestSchema), ], metadata: ['metadata', dict(string())], minimumPrice: ['minimum_price', optional(number())], cycles: ['cycles', optional(number())], quantity: ['quantity', optional(number())], trialPeriodDays: ['trial_period_days', optional(number())], });