/* * 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 { Address, Address$inboundSchema, Address$Outbound, Address$outboundSchema, } from "./address.js"; import { Contact, Contact$inboundSchema, Contact$Outbound, Contact$outboundSchema, } from "./contact.js"; export type ACHInstitution = { /** * Name of the financial institution. */ name: string; routingNumber: string; address?: Address | undefined; contact?: Contact | undefined; }; /** @internal */ export const ACHInstitution$inboundSchema: z.ZodType< ACHInstitution, z.ZodTypeDef, unknown > = z.object({ name: z.string(), routingNumber: z.string(), address: Address$inboundSchema.optional(), contact: Contact$inboundSchema.optional(), }); /** @internal */ export type ACHInstitution$Outbound = { name: string; routingNumber: string; address?: Address$Outbound | undefined; contact?: Contact$Outbound | undefined; }; /** @internal */ export const ACHInstitution$outboundSchema: z.ZodType< ACHInstitution$Outbound, z.ZodTypeDef, ACHInstitution > = z.object({ name: z.string(), routingNumber: z.string(), address: Address$outboundSchema.optional(), contact: Contact$outboundSchema.optional(), }); export function achInstitutionToJSON(achInstitution: ACHInstitution): string { return JSON.stringify(ACHInstitution$outboundSchema.parse(achInstitution)); } export function achInstitutionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ACHInstitution$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ACHInstitution' from JSON`, ); }