/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { AddressCreate, AddressCreate$inboundSchema, AddressCreate$Outbound, AddressCreate$outboundSchema, } from "./addresscreate.js"; /** * A Check Beneficiary */ export type TransfersBeneficiaryCreate = { /** * **Field Dependencies:** * * @remarks * * Account title is required for third party beneficiaries * * Required if `third_party` is `true`. */ accountTitle?: string | undefined; /** * The data structure containing attributes describing the location of an underlying entity. */ address?: AddressCreate | undefined; /** * Indicates if this beneficiary is a third party beneficiary. A check transfer is considered third party if the beneficiary is not the exact same person and/or entity that the funds originated from. This includes check transfers where the originator account is an individual account and the beneficiary account is a joint account */ thirdParty?: boolean | undefined; }; /** @internal */ export const TransfersBeneficiaryCreate$inboundSchema: z.ZodType< TransfersBeneficiaryCreate, z.ZodTypeDef, unknown > = z.object({ account_title: z.string().optional(), address: AddressCreate$inboundSchema.optional(), third_party: z.boolean().optional(), }).transform((v) => { return remap$(v, { "account_title": "accountTitle", "third_party": "thirdParty", }); }); /** @internal */ export type TransfersBeneficiaryCreate$Outbound = { account_title?: string | undefined; address?: AddressCreate$Outbound | undefined; third_party?: boolean | undefined; }; /** @internal */ export const TransfersBeneficiaryCreate$outboundSchema: z.ZodType< TransfersBeneficiaryCreate$Outbound, z.ZodTypeDef, TransfersBeneficiaryCreate > = z.object({ accountTitle: z.string().optional(), address: AddressCreate$outboundSchema.optional(), thirdParty: z.boolean().optional(), }).transform((v) => { return remap$(v, { accountTitle: "account_title", thirdParty: "third_party", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace TransfersBeneficiaryCreate$ { /** @deprecated use `TransfersBeneficiaryCreate$inboundSchema` instead. */ export const inboundSchema = TransfersBeneficiaryCreate$inboundSchema; /** @deprecated use `TransfersBeneficiaryCreate$outboundSchema` instead. */ export const outboundSchema = TransfersBeneficiaryCreate$outboundSchema; /** @deprecated use `TransfersBeneficiaryCreate$Outbound` instead. */ export type Outbound = TransfersBeneficiaryCreate$Outbound; } export function transfersBeneficiaryCreateToJSON( transfersBeneficiaryCreate: TransfersBeneficiaryCreate, ): string { return JSON.stringify( TransfersBeneficiaryCreate$outboundSchema.parse(transfersBeneficiaryCreate), ); } export function transfersBeneficiaryCreateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => TransfersBeneficiaryCreate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TransfersBeneficiaryCreate' from JSON`, ); }