/* * 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 { CreateTransferSourceACH, CreateTransferSourceACH$inboundSchema, CreateTransferSourceACH$Outbound, CreateTransferSourceACH$outboundSchema, } from "./createtransfersourceach.js"; import { CreateTransferSourceCard, CreateTransferSourceCard$inboundSchema, CreateTransferSourceCard$Outbound, CreateTransferSourceCard$outboundSchema, } from "./createtransfersourcecard.js"; /** * Where funds for a transfer originate. For the source, you must include either a `paymentMethodID` or a `transferID`. */ export type CreateTransferSource = { /** * A `transferID` is used to create a [transfer group](https://docs.moov.io/guides/money-movement/transfer-groups/), * * @remarks * associating the new transfer with a parent transfer. */ transferID?: string | undefined; paymentMethodID?: string | undefined; paymentToken?: string | undefined; cardDetails?: CreateTransferSourceCard | undefined; achDetails?: CreateTransferSourceACH | undefined; }; /** @internal */ export const CreateTransferSource$inboundSchema: z.ZodType< CreateTransferSource, z.ZodTypeDef, unknown > = z.object({ transferID: z.string().optional(), paymentMethodID: z.string().optional(), paymentToken: z.string().optional(), cardDetails: CreateTransferSourceCard$inboundSchema.optional(), achDetails: CreateTransferSourceACH$inboundSchema.optional(), }); /** @internal */ export type CreateTransferSource$Outbound = { transferID?: string | undefined; paymentMethodID?: string | undefined; paymentToken?: string | undefined; cardDetails?: CreateTransferSourceCard$Outbound | undefined; achDetails?: CreateTransferSourceACH$Outbound | undefined; }; /** @internal */ export const CreateTransferSource$outboundSchema: z.ZodType< CreateTransferSource$Outbound, z.ZodTypeDef, CreateTransferSource > = z.object({ transferID: z.string().optional(), paymentMethodID: z.string().optional(), paymentToken: z.string().optional(), cardDetails: CreateTransferSourceCard$outboundSchema.optional(), achDetails: CreateTransferSourceACH$outboundSchema.optional(), }); export function createTransferSourceToJSON( createTransferSource: CreateTransferSource, ): string { return JSON.stringify( CreateTransferSource$outboundSchema.parse(createTransferSource), ); } export function createTransferSourceFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreateTransferSource$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateTransferSource' from JSON`, ); }