/** * 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 { LinkDescription, linkDescriptionSchema } from './linkDescription.js'; import { Money, moneySchema } from './money.js'; import { PlanDetails, planDetailsSchema } from './planDetails.js'; import { Subscriber, subscriberSchema } from './subscriber.js'; import { SubscriptionBillingInformation, subscriptionBillingInformationSchema, } from './subscriptionBillingInformation.js'; /** The subscription details. */ export interface Subscription { /** The PayPal-generated ID for the subscription. */ id?: string; /** The ID of the plan. */ planId?: string; /** The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional. Note: The regular expression provides guidance but does not reject all invalid dates. */ startTime?: string; /** The quantity of the product in the subscription. */ quantity?: string; /** The currency and amount for a financial transaction, such as a balance or payment due. */ shippingAmount?: Money; /** The subscriber response information. */ subscriber?: Subscriber; /** The billing details for the subscription. If the subscription was or is active, these fields are populated. */ billingInfo?: SubscriptionBillingInformation; /** The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional. Note: The regular expression provides guidance but does not reject all invalid dates. */ createTime?: string; /** The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional. Note: The regular expression provides guidance but does not reject all invalid dates. */ updateTime?: string; /** The custom id for the subscription. Can be invoice id. */ customId?: string; /** Indicates whether the subscription has overridden any plan attributes. */ planOverridden?: boolean; /** The plan details. */ plan?: PlanDetails; /** An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links). */ links?: LinkDescription[]; } export const subscriptionSchema: Schema = lazy(() => object({ id: ['id', optional(string())], planId: ['plan_id', optional(string())], startTime: ['start_time', optional(string())], quantity: ['quantity', optional(string())], shippingAmount: ['shipping_amount', optional(moneySchema)], subscriber: ['subscriber', optional(subscriberSchema)], billingInfo: [ 'billing_info', optional(subscriptionBillingInformationSchema), ], createTime: ['create_time', optional(string())], updateTime: ['update_time', optional(string())], customId: ['custom_id', optional(string())], planOverridden: ['plan_overridden', optional(boolean())], plan: ['plan', optional(planDetailsSchema)], links: ['links', optional(array(linkDescriptionSchema))], }) );