/** * PayPal Server SDKLib * * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). */ import { array, lazy, number, object, optional, Schema, string, } from '../schema.js'; import { CycleExecution, cycleExecutionSchema } from './cycleExecution.js'; import { FailedPaymentDetails, failedPaymentDetailsSchema, } from './failedPaymentDetails.js'; import { LastPaymentDetails, lastPaymentDetailsSchema, } from './lastPaymentDetails.js'; import { Money, moneySchema } from './money.js'; /** The billing details for the subscription. If the subscription was or is active, these fields are populated. */ export interface SubscriptionBillingInformation { /** The currency and amount for a financial transaction, such as a balance or payment due. */ outstandingBalance: Money; /** The trial and regular billing executions. */ cycleExecutions?: CycleExecution[]; /** The details for the last payment. */ lastPayment?: LastPaymentDetails; /** 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. */ nextBillingTime?: 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. */ finalPaymentTime?: string; /** The number of consecutive payment failures. Resets to `0` after a successful payment. If this reaches the `payment_failure_threshold` value, the subscription updates to the `SUSPENDED` state. */ failedPaymentsCount: number; /** The details for the failed payment of the subscription. */ lastFailedPayment?: FailedPaymentDetails; } export const subscriptionBillingInformationSchema: Schema = lazy( () => object({ outstandingBalance: ['outstanding_balance', moneySchema], cycleExecutions: [ 'cycle_executions', optional(array(cycleExecutionSchema)), ], lastPayment: ['last_payment', optional(lastPaymentDetailsSchema)], nextBillingTime: ['next_billing_time', optional(string())], finalPaymentTime: ['final_payment_time', optional(string())], failedPaymentsCount: ['failed_payments_count', number()], lastFailedPayment: [ 'last_failed_payment', optional(failedPaymentDetailsSchema), ], }) );