/* * 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 { BankAccountCreate, BankAccountCreate$inboundSchema, BankAccountCreate$Outbound, BankAccountCreate$outboundSchema, } from "./bankaccountcreate.js"; /** * The verification method of the bank relationship. */ export enum VerificationMethod { VerificationMethodUnspecified = "VERIFICATION_METHOD_UNSPECIFIED", MicroDeposit = "MICRO_DEPOSIT", Yodlee = "YODLEE", Quovo = "QUOVO", Giact = "GIACT", Synapse = "SYNAPSE", Sophtron = "SOPHTRON", InternalBank = "INTERNAL_BANK", Mx = "MX", Fiserv = "FISERV", PlaidToken = "PLAID_TOKEN", } /** * The verification method of the bank relationship. */ export type VerificationMethodOpen = OpenEnum; /** * A relationship between a bank account and an Apex account. */ export type BankRelationshipCreate = { /** * A representation of a bank account. */ bankAccount?: BankAccountCreate | undefined; /** * The nickname of the bank relationship. */ nickname: string; /** * A processor token from Plaid (vendor). Required if using `PLAID_TOKEN` verification method. */ plaidProcessorToken?: string | undefined; /** * The verification method of the bank relationship. */ verificationMethod: VerificationMethodOpen; }; /** @internal */ export const VerificationMethod$inboundSchema: z.ZodType< VerificationMethodOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(VerificationMethod), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const VerificationMethod$outboundSchema: z.ZodType< VerificationMethodOpen, z.ZodTypeDef, VerificationMethodOpen > = z.union([ z.nativeEnum(VerificationMethod), 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 VerificationMethod$ { /** @deprecated use `VerificationMethod$inboundSchema` instead. */ export const inboundSchema = VerificationMethod$inboundSchema; /** @deprecated use `VerificationMethod$outboundSchema` instead. */ export const outboundSchema = VerificationMethod$outboundSchema; } /** @internal */ export const BankRelationshipCreate$inboundSchema: z.ZodType< BankRelationshipCreate, z.ZodTypeDef, unknown > = z.object({ bank_account: BankAccountCreate$inboundSchema.optional(), nickname: z.string(), plaid_processor_token: z.string().optional(), verification_method: VerificationMethod$inboundSchema, }).transform((v) => { return remap$(v, { "bank_account": "bankAccount", "plaid_processor_token": "plaidProcessorToken", "verification_method": "verificationMethod", }); }); /** @internal */ export type BankRelationshipCreate$Outbound = { bank_account?: BankAccountCreate$Outbound | undefined; nickname: string; plaid_processor_token?: string | undefined; verification_method: string; }; /** @internal */ export const BankRelationshipCreate$outboundSchema: z.ZodType< BankRelationshipCreate$Outbound, z.ZodTypeDef, BankRelationshipCreate > = z.object({ bankAccount: BankAccountCreate$outboundSchema.optional(), nickname: z.string(), plaidProcessorToken: z.string().optional(), verificationMethod: VerificationMethod$outboundSchema, }).transform((v) => { return remap$(v, { bankAccount: "bank_account", plaidProcessorToken: "plaid_processor_token", verificationMethod: "verification_method", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace BankRelationshipCreate$ { /** @deprecated use `BankRelationshipCreate$inboundSchema` instead. */ export const inboundSchema = BankRelationshipCreate$inboundSchema; /** @deprecated use `BankRelationshipCreate$outboundSchema` instead. */ export const outboundSchema = BankRelationshipCreate$outboundSchema; /** @deprecated use `BankRelationshipCreate$Outbound` instead. */ export type Outbound = BankRelationshipCreate$Outbound; } export function bankRelationshipCreateToJSON( bankRelationshipCreate: BankRelationshipCreate, ): string { return JSON.stringify( BankRelationshipCreate$outboundSchema.parse(bankRelationshipCreate), ); } export function bankRelationshipCreateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BankRelationshipCreate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BankRelationshipCreate' from JSON`, ); }