/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { CreateTransferDestinationACH, CreateTransferDestinationACH$inboundSchema, CreateTransferDestinationACH$Outbound, CreateTransferDestinationACH$outboundSchema, } from "./createtransferdestinationach.js"; import { CreateTransferDestinationCard, CreateTransferDestinationCard$inboundSchema, CreateTransferDestinationCard$Outbound, CreateTransferDestinationCard$outboundSchema, } from "./createtransferdestinationcard.js"; /** * The final stage of a transfer and the ultimate recipient of the funds. */ export type CreateTransferDestination = { paymentMethodID: string; cardDetails?: CreateTransferDestinationCard | undefined; achDetails?: CreateTransferDestinationACH | undefined; }; /** @internal */ export const CreateTransferDestination$inboundSchema: z.ZodType< CreateTransferDestination, z.ZodTypeDef, unknown > = z.object({ paymentMethodID: z.string(), cardDetails: CreateTransferDestinationCard$inboundSchema.optional(), achDetails: CreateTransferDestinationACH$inboundSchema.optional(), }); /** @internal */ export type CreateTransferDestination$Outbound = { paymentMethodID: string; cardDetails?: CreateTransferDestinationCard$Outbound | undefined; achDetails?: CreateTransferDestinationACH$Outbound | undefined; }; /** @internal */ export const CreateTransferDestination$outboundSchema: z.ZodType< CreateTransferDestination$Outbound, z.ZodTypeDef, CreateTransferDestination > = z.object({ paymentMethodID: z.string(), cardDetails: CreateTransferDestinationCard$outboundSchema.optional(), achDetails: CreateTransferDestinationACH$outboundSchema.optional(), }); export function createTransferDestinationToJSON( createTransferDestination: CreateTransferDestination, ): string { return JSON.stringify( CreateTransferDestination$outboundSchema.parse(createTransferDestination), ); } export function createTransferDestinationFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreateTransferDestination$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateTransferDestination' from JSON`, ); }