/** * PayPal Server SDKLib * * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). */ import { array, lazy, object, optional, Schema } from '../schema.js'; import { CheckoutPaymentIntent, checkoutPaymentIntentSchema, } from './checkoutPaymentIntent.js'; import { OrderApplicationContext, orderApplicationContextSchema, } from './orderApplicationContext.js'; import { Payer, payerSchema } from './payer.js'; import { PaymentSource, paymentSourceSchema } from './paymentSource.js'; import { PurchaseUnitRequest, purchaseUnitRequestSchema, } from './purchaseUnitRequest.js'; /** The order request details. */ export interface OrderRequest { /** The intent to either capture payment immediately or authorize a payment for an order after order creation. */ intent: CheckoutPaymentIntent; /** DEPRECATED. The customer is also known as the payer. The Payer object was intended to only be used with the `payment_source.paypal` object. In order to make this design more clear, the details in the `payer` object are now available under `payment_source.paypal`. Please use `payment_source.paypal`. */ payer?: Payer; /** An array of purchase units. Each purchase unit establishes a contract between a payer and the payee. Each purchase unit represents either a full or partial order that the payer intends to purchase from the payee. */ purchaseUnits: PurchaseUnitRequest[]; /** The payment source definition. */ paymentSource?: PaymentSource; /** Customizes the payer experience during the approval process for the payment with PayPal. Note: Partners and Marketplaces might configure brand_name and shipping_preference during partner account setup, which overrides the request values. */ applicationContext?: OrderApplicationContext; } export const orderRequestSchema: Schema = lazy(() => object({ intent: ['intent', checkoutPaymentIntentSchema], payer: ['payer', optional(payerSchema)], purchaseUnits: ['purchase_units', array(purchaseUnitRequestSchema)], paymentSource: ['payment_source', optional(paymentSourceSchema)], applicationContext: [ 'application_context', optional(orderApplicationContextSchema), ], }) );