/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { Airline, Airline$Outbound, Airline$outboundSchema, } from "./airline.js"; import { CartItem, CartItem$Outbound, CartItem$outboundSchema, } from "./cartitem.js"; import { GuestBuyer, GuestBuyer$Outbound, GuestBuyer$outboundSchema, } from "./guestbuyer.js"; export type CheckoutSessionCreate = { /** * An array of cart items that represents the line items of a transaction. */ cartItems?: Array | null | undefined; /** * Any additional information about the transaction that you would like to store as key-value pairs. This data is passed to payment service providers that support it. */ metadata?: { [k: string]: string } | null | undefined; /** * Provide buyer details for the transaction. No buyer resource will be created on Gr4vy when used. */ buyer?: GuestBuyer | null | undefined; /** * The airline addendum data which describes the airline booking associated with this transaction. */ airline?: Airline | null | undefined; /** * The total amount for this transaction. */ amount?: number | null | undefined; /** * The currency code for this transaction. */ currency?: string | null | undefined; /** * The unique identifier of an existing payment service. When provided, the created transaction will be processed by the given payment service and any routing rules will be skipped. */ paymentServiceId?: string | null | undefined; /** * The time in seconds when this checkout session expires. */ expiresIn?: number | undefined; }; /** @internal */ export type CheckoutSessionCreate$Outbound = { cart_items?: Array | null | undefined; metadata?: { [k: string]: string } | null | undefined; buyer?: GuestBuyer$Outbound | null | undefined; airline?: Airline$Outbound | null | undefined; amount?: number | null | undefined; currency?: string | null | undefined; payment_service_id?: string | null | undefined; expires_in: number; }; /** @internal */ export const CheckoutSessionCreate$outboundSchema: z.ZodType< CheckoutSessionCreate$Outbound, z.ZodTypeDef, CheckoutSessionCreate > = z.object({ cartItems: z.nullable(z.array(CartItem$outboundSchema)).optional(), metadata: z.nullable(z.record(z.string())).optional(), buyer: z.nullable(GuestBuyer$outboundSchema).optional(), airline: z.nullable(Airline$outboundSchema).optional(), amount: z.nullable(z.number().int()).optional(), currency: z.nullable(z.string()).optional(), paymentServiceId: z.nullable(z.string()).optional(), expiresIn: z.number().default(3600), }).transform((v) => { return remap$(v, { cartItems: "cart_items", paymentServiceId: "payment_service_id", expiresIn: "expires_in", }); }); export function checkoutSessionCreateToJSON( checkoutSessionCreate: CheckoutSessionCreate, ): string { return JSON.stringify( CheckoutSessionCreate$outboundSchema.parse(checkoutSessionCreate), ); }