/* * 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 CreatePaymentMethodGlobals = { merchantAccountId?: string | undefined; }; export type CreatePaymentMethodBody = | components.RedirectPaymentMethodCreate | components.ACHBankPaymentMethodCreate | components.BACSBankPaymentMethodCreate | components.CardPaymentMethodCreate | components.SEPABankPaymentMethodCreate | components.CheckoutSessionPaymentMethodCreate | components.PlaidPaymentMethodCreate; export type CreatePaymentMethodRequest = { /** * The ID of the merchant account to use for this request. */ merchantAccountId?: string | null | undefined; requestBody: | components.RedirectPaymentMethodCreate | components.ACHBankPaymentMethodCreate | components.BACSBankPaymentMethodCreate | components.CardPaymentMethodCreate | components.SEPABankPaymentMethodCreate | components.CheckoutSessionPaymentMethodCreate | components.PlaidPaymentMethodCreate; }; /** @internal */ export type CreatePaymentMethodBody$Outbound = | components.RedirectPaymentMethodCreate$Outbound | components.ACHBankPaymentMethodCreate$Outbound | components.BACSBankPaymentMethodCreate$Outbound | components.CardPaymentMethodCreate$Outbound | components.SEPABankPaymentMethodCreate$Outbound | components.CheckoutSessionPaymentMethodCreate$Outbound | components.PlaidPaymentMethodCreate$Outbound; /** @internal */ export const CreatePaymentMethodBody$outboundSchema: z.ZodType< CreatePaymentMethodBody$Outbound, z.ZodTypeDef, CreatePaymentMethodBody > = z.union([ components.RedirectPaymentMethodCreate$outboundSchema, components.ACHBankPaymentMethodCreate$outboundSchema, components.BACSBankPaymentMethodCreate$outboundSchema, components.CardPaymentMethodCreate$outboundSchema, components.SEPABankPaymentMethodCreate$outboundSchema, components.CheckoutSessionPaymentMethodCreate$outboundSchema, components.PlaidPaymentMethodCreate$outboundSchema, ]); export function createPaymentMethodBodyToJSON( createPaymentMethodBody: CreatePaymentMethodBody, ): string { return JSON.stringify( CreatePaymentMethodBody$outboundSchema.parse(createPaymentMethodBody), ); } /** @internal */ export type CreatePaymentMethodRequest$Outbound = { merchantAccountId?: string | null | undefined; RequestBody: | components.RedirectPaymentMethodCreate$Outbound | components.ACHBankPaymentMethodCreate$Outbound | components.BACSBankPaymentMethodCreate$Outbound | components.CardPaymentMethodCreate$Outbound | components.SEPABankPaymentMethodCreate$Outbound | components.CheckoutSessionPaymentMethodCreate$Outbound | components.PlaidPaymentMethodCreate$Outbound; }; /** @internal */ export const CreatePaymentMethodRequest$outboundSchema: z.ZodType< CreatePaymentMethodRequest$Outbound, z.ZodTypeDef, CreatePaymentMethodRequest > = z.object({ merchantAccountId: z.nullable(z.string()).optional(), requestBody: z.union([ components.RedirectPaymentMethodCreate$outboundSchema, components.ACHBankPaymentMethodCreate$outboundSchema, components.BACSBankPaymentMethodCreate$outboundSchema, components.CardPaymentMethodCreate$outboundSchema, components.SEPABankPaymentMethodCreate$outboundSchema, components.CheckoutSessionPaymentMethodCreate$outboundSchema, components.PlaidPaymentMethodCreate$outboundSchema, ]), }).transform((v) => { return remap$(v, { requestBody: "RequestBody", }); }); export function createPaymentMethodRequestToJSON( createPaymentMethodRequest: CreatePaymentMethodRequest, ): string { return JSON.stringify( CreatePaymentMethodRequest$outboundSchema.parse(createPaymentMethodRequest), ); }