/* * 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 * as components from "../components/index.js"; export type CreateTransactionGlobals = { merchantAccountId?: string | undefined; }; export type CreateTransactionRequest = { /** * The ID of the merchant account to use for this request. */ merchantAccountId?: string | null | undefined; /** * A unique key that identifies this request. Providing this header will make this an idempotent request. We recommend using V4 UUIDs, or another random string with enough entropy to avoid collisions. */ idempotencyKey?: string | null | undefined; /** * The IP address to forward from the customer. Use this when calling * * @remarks * our API from the server side to ensure the customer's address is * passed to downstream services, rather than your server IP. */ xForwardedFor?: string | undefined; transactionCreate: components.TransactionCreate; }; /** @internal */ export type CreateTransactionRequest$Outbound = { merchantAccountId?: string | null | undefined; "idempotency-key"?: string | null | undefined; "X-Forwarded-For"?: string | undefined; TransactionCreate: components.TransactionCreate$Outbound; }; /** @internal */ export const CreateTransactionRequest$outboundSchema: z.ZodType< CreateTransactionRequest$Outbound, z.ZodTypeDef, CreateTransactionRequest > = z.object({ merchantAccountId: z.nullable(z.string()).optional(), idempotencyKey: z.nullable(z.string()).optional(), xForwardedFor: z.string().optional(), transactionCreate: components.TransactionCreate$outboundSchema, }).transform((v) => { return remap$(v, { idempotencyKey: "idempotency-key", xForwardedFor: "X-Forwarded-For", transactionCreate: "TransactionCreate", }); }); export function createTransactionRequestToJSON( createTransactionRequest: CreateTransactionRequest, ): string { return JSON.stringify( CreateTransactionRequest$outboundSchema.parse(createTransactionRequest), ); }