/* * 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"; /** * The notice of change reason code. */ export enum Code { CodeUnspecified = "CODE_UNSPECIFIED", C01 = "C01", C02 = "C02", C03 = "C03", C04 = "C04", C05 = "C05", C06 = "C06", C07 = "C07", C08 = "C08", C09 = "C09", C13 = "C13", C14 = "C14", C61 = "C61", C62 = "C62", C63 = "C63", C64 = "C64", C65 = "C65", C66 = "C66", C67 = "C67", C68 = "C68", C69 = "C69", } /** * The notice of change reason code. */ export type CodeOpen = OpenEnum; /** * The updated bank account type. Should only be set when the code is for an incorrect transaction code. */ export enum UpdatedBankAccountType { TypeUnspecified = "TYPE_UNSPECIFIED", Checking = "CHECKING", Savings = "SAVINGS", } /** * The updated bank account type. Should only be set when the code is for an incorrect transaction code. */ export type UpdatedBankAccountTypeOpen = OpenEnum< typeof UpdatedBankAccountType >; /** * A notice of change (NOC) on an ACH transfer from the Nacha network. */ export type NachaNocCreate = { /** * The notice of change reason code. */ code: CodeOpen; /** * The updated bank account number. Should only be set when the code is for an incorrect DFI account number. */ updatedBankAccountNumber?: string | undefined; /** * The updated bank account type. Should only be set when the code is for an incorrect transaction code. */ updatedBankAccountType?: UpdatedBankAccountTypeOpen | undefined; /** * The updated bank routing number. Should only be set when the code is for an incorrect routing number. */ updatedBankRoutingNumber?: string | undefined; }; /** @internal */ export const Code$inboundSchema: z.ZodType = z .union([ z.nativeEnum(Code), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const Code$outboundSchema: z.ZodType = z.union([ z.nativeEnum(Code), 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 Code$ { /** @deprecated use `Code$inboundSchema` instead. */ export const inboundSchema = Code$inboundSchema; /** @deprecated use `Code$outboundSchema` instead. */ export const outboundSchema = Code$outboundSchema; } /** @internal */ export const UpdatedBankAccountType$inboundSchema: z.ZodType< UpdatedBankAccountTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(UpdatedBankAccountType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const UpdatedBankAccountType$outboundSchema: z.ZodType< UpdatedBankAccountTypeOpen, z.ZodTypeDef, UpdatedBankAccountTypeOpen > = z.union([ z.nativeEnum(UpdatedBankAccountType), 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 UpdatedBankAccountType$ { /** @deprecated use `UpdatedBankAccountType$inboundSchema` instead. */ export const inboundSchema = UpdatedBankAccountType$inboundSchema; /** @deprecated use `UpdatedBankAccountType$outboundSchema` instead. */ export const outboundSchema = UpdatedBankAccountType$outboundSchema; } /** @internal */ export const NachaNocCreate$inboundSchema: z.ZodType< NachaNocCreate, z.ZodTypeDef, unknown > = z.object({ code: Code$inboundSchema, updated_bank_account_number: z.string().optional(), updated_bank_account_type: UpdatedBankAccountType$inboundSchema.optional(), updated_bank_routing_number: z.string().optional(), }).transform((v) => { return remap$(v, { "updated_bank_account_number": "updatedBankAccountNumber", "updated_bank_account_type": "updatedBankAccountType", "updated_bank_routing_number": "updatedBankRoutingNumber", }); }); /** @internal */ export type NachaNocCreate$Outbound = { code: string; updated_bank_account_number?: string | undefined; updated_bank_account_type?: string | undefined; updated_bank_routing_number?: string | undefined; }; /** @internal */ export const NachaNocCreate$outboundSchema: z.ZodType< NachaNocCreate$Outbound, z.ZodTypeDef, NachaNocCreate > = z.object({ code: Code$outboundSchema, updatedBankAccountNumber: z.string().optional(), updatedBankAccountType: UpdatedBankAccountType$outboundSchema.optional(), updatedBankRoutingNumber: z.string().optional(), }).transform((v) => { return remap$(v, { updatedBankAccountNumber: "updated_bank_account_number", updatedBankAccountType: "updated_bank_account_type", updatedBankRoutingNumber: "updated_bank_routing_number", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace NachaNocCreate$ { /** @deprecated use `NachaNocCreate$inboundSchema` instead. */ export const inboundSchema = NachaNocCreate$inboundSchema; /** @deprecated use `NachaNocCreate$outboundSchema` instead. */ export const outboundSchema = NachaNocCreate$outboundSchema; /** @deprecated use `NachaNocCreate$Outbound` instead. */ export type Outbound = NachaNocCreate$Outbound; } export function nachaNocCreateToJSON(nachaNocCreate: NachaNocCreate): string { return JSON.stringify(NachaNocCreate$outboundSchema.parse(nachaNocCreate)); } export function nachaNocCreateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => NachaNocCreate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'NachaNocCreate' from JSON`, ); }