/* * 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 { Tracking, Tracking$Outbound, Tracking$outboundSchema, } from "./tracking.js"; /** * Request body for capturing an authorized transaction. */ export type TransactionCaptureCreate = { /** * The amount to capture, in the smallest currency unit (e.g., cents). This must be less than or equal to the authorized amount, unless over-capture is available. */ amount?: number | null | undefined; /** * The airline data to submit to the payment service during the capture call. */ airline?: Airline | null | undefined; /** * An array of cart items that represents the line items of this capture. */ cartItems?: Array | null | undefined; /** * An array of shipment tracking details for this capture. */ tracking?: Array | null | undefined; /** * Whether this is marked as the final capture for the associated transaction. Must be `true` or omitted when multi-capture is not enabled; a value of `false` is only valid when multi-capture is available on the connection. */ final?: boolean | undefined; /** * An external identifier that can be used to match the capture against your own records. */ externalIdentifier?: string | null | undefined; /** * Whether this capture request should re-authorize the transaction if it has expired. */ reauthorizeIfAuthorizationExpired?: boolean | undefined; }; /** @internal */ export type TransactionCaptureCreate$Outbound = { amount?: number | null | undefined; airline?: Airline$Outbound | null | undefined; cart_items?: Array | null | undefined; tracking?: Array | null | undefined; final: boolean; external_identifier?: string | null | undefined; reauthorize_if_authorization_expired: boolean; }; /** @internal */ export const TransactionCaptureCreate$outboundSchema: z.ZodType< TransactionCaptureCreate$Outbound, z.ZodTypeDef, TransactionCaptureCreate > = z.object({ amount: z.nullable(z.number().int()).optional(), airline: z.nullable(Airline$outboundSchema).optional(), cartItems: z.nullable(z.array(CartItem$outboundSchema)).optional(), tracking: z.nullable(z.array(Tracking$outboundSchema)).optional(), final: z.boolean().default(true), externalIdentifier: z.nullable(z.string()).optional(), reauthorizeIfAuthorizationExpired: z.boolean().default(false), }).transform((v) => { return remap$(v, { cartItems: "cart_items", externalIdentifier: "external_identifier", reauthorizeIfAuthorizationExpired: "reauthorize_if_authorization_expired", }); }); export function transactionCaptureCreateToJSON( transactionCaptureCreate: TransactionCaptureCreate, ): string { return JSON.stringify( TransactionCaptureCreate$outboundSchema.parse(transactionCaptureCreate), ); }