/* * 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 { catchUnrecognizedEnum, OpenEnum, Unrecognized, } from "../../types/enums.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 { IctWithdrawalTravelRuleCreate, IctWithdrawalTravelRuleCreate$inboundSchema, IctWithdrawalTravelRuleCreate$Outbound, IctWithdrawalTravelRuleCreate$outboundSchema, } from "./ictwithdrawaltravelrulecreate.js"; import { RetirementDistributionCreate, RetirementDistributionCreate$inboundSchema, RetirementDistributionCreate$Outbound, RetirementDistributionCreate$outboundSchema, } from "./retirementdistributioncreate.js"; /** * The name of the program that the ICT withdrawal is associated with. */ export enum IctWithdrawalCreateProgram { IctProgramUnspecified = "ICT_PROGRAM_UNSPECIFIED", BrokerPartner = "BROKER_PARTNER", DepositOnly = "DEPOSIT_ONLY", BankingPartner = "BANKING_PARTNER", MoneyTransmitter = "MONEY_TRANSMITTER", WithdrawalOnly = "WITHDRAWAL_ONLY", DigitalPartner = "DIGITAL_PARTNER", } /** * The name of the program that the ICT withdrawal is associated with. */ export type IctWithdrawalCreateProgramOpen = OpenEnum< typeof IctWithdrawalCreateProgram >; /** * An Instant Cash Transfer. Funds are moved from a customer's brokerage account to a configured Firm account. */ export type IctWithdrawalCreate = { /** * 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; /** * 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. This field should either be set to true or left unset if the amount field is provided. */ fullDisbursement?: boolean | undefined; /** * The name of the program that the ICT withdrawal is associated with. */ program: IctWithdrawalCreateProgramOpen; /** * A distribution from a retirement account. */ retirementDistribution?: RetirementDistributionCreate | undefined; /** * The travel rules associated with an ICT withdrawal */ travelRule: IctWithdrawalTravelRuleCreate; }; /** @internal */ export const IctWithdrawalCreateProgram$inboundSchema: z.ZodType< IctWithdrawalCreateProgramOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(IctWithdrawalCreateProgram), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const IctWithdrawalCreateProgram$outboundSchema: z.ZodType< IctWithdrawalCreateProgramOpen, z.ZodTypeDef, IctWithdrawalCreateProgramOpen > = z.union([ z.nativeEnum(IctWithdrawalCreateProgram), z.string().and(z.custom>()), ]); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace IctWithdrawalCreateProgram$ { /** @deprecated use `IctWithdrawalCreateProgram$inboundSchema` instead. */ export const inboundSchema = IctWithdrawalCreateProgram$inboundSchema; /** @deprecated use `IctWithdrawalCreateProgram$outboundSchema` instead. */ export const outboundSchema = IctWithdrawalCreateProgram$outboundSchema; } /** @internal */ export const IctWithdrawalCreate$inboundSchema: z.ZodType< IctWithdrawalCreate, z.ZodTypeDef, unknown > = z.object({ amount: DecimalCreate$inboundSchema.optional(), client_transfer_id: z.string(), full_disbursement: z.boolean().optional(), program: IctWithdrawalCreateProgram$inboundSchema, retirement_distribution: RetirementDistributionCreate$inboundSchema .optional(), travel_rule: IctWithdrawalTravelRuleCreate$inboundSchema, }).transform((v) => { return remap$(v, { "client_transfer_id": "clientTransferId", "full_disbursement": "fullDisbursement", "retirement_distribution": "retirementDistribution", "travel_rule": "travelRule", }); }); /** @internal */ export type IctWithdrawalCreate$Outbound = { amount?: DecimalCreate$Outbound | undefined; client_transfer_id: string; full_disbursement?: boolean | undefined; program: string; retirement_distribution?: RetirementDistributionCreate$Outbound | undefined; travel_rule: IctWithdrawalTravelRuleCreate$Outbound; }; /** @internal */ export const IctWithdrawalCreate$outboundSchema: z.ZodType< IctWithdrawalCreate$Outbound, z.ZodTypeDef, IctWithdrawalCreate > = z.object({ amount: DecimalCreate$outboundSchema.optional(), clientTransferId: z.string(), fullDisbursement: z.boolean().optional(), program: IctWithdrawalCreateProgram$outboundSchema, retirementDistribution: RetirementDistributionCreate$outboundSchema .optional(), travelRule: IctWithdrawalTravelRuleCreate$outboundSchema, }).transform((v) => { return remap$(v, { clientTransferId: "client_transfer_id", fullDisbursement: "full_disbursement", retirementDistribution: "retirement_distribution", travelRule: "travel_rule", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace IctWithdrawalCreate$ { /** @deprecated use `IctWithdrawalCreate$inboundSchema` instead. */ export const inboundSchema = IctWithdrawalCreate$inboundSchema; /** @deprecated use `IctWithdrawalCreate$outboundSchema` instead. */ export const outboundSchema = IctWithdrawalCreate$outboundSchema; /** @deprecated use `IctWithdrawalCreate$Outbound` instead. */ export type Outbound = IctWithdrawalCreate$Outbound; } export function ictWithdrawalCreateToJSON( ictWithdrawalCreate: IctWithdrawalCreate, ): string { return JSON.stringify( IctWithdrawalCreate$outboundSchema.parse(ictWithdrawalCreate), ); } export function ictWithdrawalCreateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => IctWithdrawalCreate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'IctWithdrawalCreate' from JSON`, ); }