/* * 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 { DecimalCreate, DecimalCreate$inboundSchema, DecimalCreate$Outbound, DecimalCreate$outboundSchema, } from "./decimalcreate.js"; import { RetirementDistributionCreate, RetirementDistributionCreate$inboundSchema, RetirementDistributionCreate$Outbound, RetirementDistributionCreate$outboundSchema, } from "./retirementdistributioncreate.js"; import { WireWithdrawalBeneficiaryCreate, WireWithdrawalBeneficiaryCreate$inboundSchema, WireWithdrawalBeneficiaryCreate$Outbound, WireWithdrawalBeneficiaryCreate$outboundSchema, } from "./wirewithdrawalbeneficiarycreate.js"; import { WireWithdrawalIntermediaryCreate, WireWithdrawalIntermediaryCreate$inboundSchema, WireWithdrawalIntermediaryCreate$Outbound, WireWithdrawalIntermediaryCreate$outboundSchema, } from "./wirewithdrawalintermediarycreate.js"; import { WireWithdrawalRecipientBankCreate, WireWithdrawalRecipientBankCreate$inboundSchema, WireWithdrawalRecipientBankCreate$Outbound, WireWithdrawalRecipientBankCreate$outboundSchema, } from "./wirewithdrawalrecipientbankcreate.js"; /** * A withdrawal transfer using the wire mechanism */ export type WireWithdrawalCreate = { /** * A representation of a decimal value, such as 2.5. Clients may convert values into language-native decimal formats, such as Java's [BigDecimal][] or Python's [decimal.Decimal][]. * * @remarks * * [BigDecimal]: * https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/math/BigDecimal.html * [decimal.Decimal]: https://docs.python.org/3/library/decimal.html */ amount?: DecimalCreate | undefined; /** * The person or entity taking receipt of the wired funds */ beneficiary: WireWithdrawalBeneficiaryCreate; /** * External identifier supplied by the API caller. Each request must have a unique pairing of client_transfer_id and account */ clientTransferId: string; /** * Whether the entire account balance is being withdrawn. If this field is set to True, a transfer amount must not be specified */ fullDisbursement?: boolean | undefined; /** * An intermediary party */ intermediary?: WireWithdrawalIntermediaryCreate | undefined; /** * A distribution from a retirement account. */ iraDistribution?: RetirementDistributionCreate | undefined; /** * A recipient bank / financial institution */ recipientBank: WireWithdrawalRecipientBankCreate; }; /** @internal */ export const WireWithdrawalCreate$inboundSchema: z.ZodType< WireWithdrawalCreate, z.ZodTypeDef, unknown > = z.object({ amount: DecimalCreate$inboundSchema.optional(), beneficiary: WireWithdrawalBeneficiaryCreate$inboundSchema, client_transfer_id: z.string(), full_disbursement: z.boolean().optional(), intermediary: WireWithdrawalIntermediaryCreate$inboundSchema.optional(), ira_distribution: RetirementDistributionCreate$inboundSchema.optional(), recipient_bank: WireWithdrawalRecipientBankCreate$inboundSchema, }).transform((v) => { return remap$(v, { "client_transfer_id": "clientTransferId", "full_disbursement": "fullDisbursement", "ira_distribution": "iraDistribution", "recipient_bank": "recipientBank", }); }); /** @internal */ export type WireWithdrawalCreate$Outbound = { amount?: DecimalCreate$Outbound | undefined; beneficiary: WireWithdrawalBeneficiaryCreate$Outbound; client_transfer_id: string; full_disbursement?: boolean | undefined; intermediary?: WireWithdrawalIntermediaryCreate$Outbound | undefined; ira_distribution?: RetirementDistributionCreate$Outbound | undefined; recipient_bank: WireWithdrawalRecipientBankCreate$Outbound; }; /** @internal */ export const WireWithdrawalCreate$outboundSchema: z.ZodType< WireWithdrawalCreate$Outbound, z.ZodTypeDef, WireWithdrawalCreate > = z.object({ amount: DecimalCreate$outboundSchema.optional(), beneficiary: WireWithdrawalBeneficiaryCreate$outboundSchema, clientTransferId: z.string(), fullDisbursement: z.boolean().optional(), intermediary: WireWithdrawalIntermediaryCreate$outboundSchema.optional(), iraDistribution: RetirementDistributionCreate$outboundSchema.optional(), recipientBank: WireWithdrawalRecipientBankCreate$outboundSchema, }).transform((v) => { return remap$(v, { clientTransferId: "client_transfer_id", fullDisbursement: "full_disbursement", iraDistribution: "ira_distribution", recipientBank: "recipient_bank", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace WireWithdrawalCreate$ { /** @deprecated use `WireWithdrawalCreate$inboundSchema` instead. */ export const inboundSchema = WireWithdrawalCreate$inboundSchema; /** @deprecated use `WireWithdrawalCreate$outboundSchema` instead. */ export const outboundSchema = WireWithdrawalCreate$outboundSchema; /** @deprecated use `WireWithdrawalCreate$Outbound` instead. */ export type Outbound = WireWithdrawalCreate$Outbound; } export function wireWithdrawalCreateToJSON( wireWithdrawalCreate: WireWithdrawalCreate, ): string { return JSON.stringify( WireWithdrawalCreate$outboundSchema.parse(wireWithdrawalCreate), ); } export function wireWithdrawalCreateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => WireWithdrawalCreate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'WireWithdrawalCreate' from JSON`, ); }