/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * The type of routing number. */ export const Type = { Rtn: "rtn", Aba: "aba", Swift: "swift", Bsb: "bsb", Iban: "iban", Nz2: "nz2", Trno: "trno", Sortcode: "sortcode", Blz: "blz", Ifsc: "ifsc", Bankcode: "bankcode", Apca: "apca", Clabe: "clabe", } as const; /** * The type of routing number. */ export type Type = ClosedEnum; /** * Routing information for the bank. This does not include account number. */ export type RoutingInfo = { /** * The numeric identifier of the routing number */ bankCode?: string | null | undefined; /** * The type of routing number. */ type?: Type | null | undefined; }; /** @internal */ export const Type$inboundSchema: z.ZodNativeEnum = z.nativeEnum( Type, ); /** @internal */ export const Type$outboundSchema: z.ZodNativeEnum = Type$inboundSchema; /** @internal */ export const RoutingInfo$inboundSchema: z.ZodType< RoutingInfo, z.ZodTypeDef, unknown > = z.object({ bankCode: z.nullable(z.string()).optional(), type: z.nullable(Type$inboundSchema.default("bankcode")), }); /** @internal */ export type RoutingInfo$Outbound = { bankCode?: string | null | undefined; type: string | null; }; /** @internal */ export const RoutingInfo$outboundSchema: z.ZodType< RoutingInfo$Outbound, z.ZodTypeDef, RoutingInfo > = z.object({ bankCode: z.nullable(z.string()).optional(), type: z.nullable(Type$outboundSchema.default("bankcode")), }); export function routingInfoToJSON(routingInfo: RoutingInfo): string { return JSON.stringify(RoutingInfo$outboundSchema.parse(routingInfo)); } export function routingInfoFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => RoutingInfo$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RoutingInfo' from JSON`, ); }