/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { lazySchema as lazySchema$, safeParse } from "../../lib/schemas.js"; import * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Currency, Currency$inboundSchema, Currency$outboundSchema, } from "./currency.js"; /** * The type of bank account. */ export const BankAccount2AccountType = { BankAccount: "bank_account", CreditCard: "credit_card", Other: "other", } as const; /** * The type of bank account. */ export type BankAccount2AccountType = OpenEnum; export type BankAccount2 = { /** * The name of the bank or financial institution */ bankName?: string | null | undefined; /** * The bank account number */ accountNumber?: string | null | undefined; /** * The name of the bank account */ accountName?: string | null | undefined; /** * The type of bank account. */ accountType?: BankAccount2AccountType | null | undefined; /** * International Bank Account Number */ iban?: string | null | undefined; /** * Bank Identifier Code / SWIFT Code */ bic?: string | null | undefined; /** * Bank routing number (US) */ routingNumber?: string | null | undefined; /** * Bank State Branch number (Australia/New Zealand) */ bsbNumber?: string | null | undefined; /** * Bank branch identifier */ branchIdentifier?: string | null | undefined; /** * Bank code assigned by central bank */ bankCode?: string | null | undefined; /** * Indicates the associated currency for an amount of money. Values correspond to [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217). */ currency?: Currency | null | undefined; /** * Country code according to ISO 3166-1 alpha-2. */ country?: string | null | undefined; }; /** @internal */ export const BankAccount2AccountType$inboundSchema: z.ZodType< BankAccount2AccountType, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(BankAccount2AccountType) ); /** @internal */ export const BankAccount2AccountType$outboundSchema: z.ZodType< string, z.ZodTypeDef, BankAccount2AccountType > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(BankAccount2AccountType) ); /** @internal */ export const BankAccount2$inboundSchema: z.ZodType< BankAccount2, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ bank_name: z.nullable(types.string()).optional(), account_number: z.nullable(types.string()).optional(), account_name: z.nullable(types.string()).optional(), account_type: z.nullable(BankAccount2AccountType$inboundSchema).optional(), iban: z.nullable(types.string()).optional(), bic: z.nullable(types.string()).optional(), routing_number: z.nullable(types.string()).optional(), bsb_number: z.nullable(types.string()).optional(), branch_identifier: z.nullable(types.string()).optional(), bank_code: z.nullable(types.string()).optional(), currency: z.nullable(Currency$inboundSchema).optional(), country: z.nullable(types.string()).optional(), }).transform((v) => { return remap$(v, { "bank_name": "bankName", "account_number": "accountNumber", "account_name": "accountName", "account_type": "accountType", "routing_number": "routingNumber", "bsb_number": "bsbNumber", "branch_identifier": "branchIdentifier", "bank_code": "bankCode", }); }) ); /** @internal */ export type BankAccount2$Outbound = { bank_name?: string | null | undefined; account_number?: string | null | undefined; account_name?: string | null | undefined; account_type?: string | null | undefined; iban?: string | null | undefined; bic?: string | null | undefined; routing_number?: string | null | undefined; bsb_number?: string | null | undefined; branch_identifier?: string | null | undefined; bank_code?: string | null | undefined; currency?: string | null | undefined; country?: string | null | undefined; }; /** @internal */ export const BankAccount2$outboundSchema: z.ZodType< BankAccount2$Outbound, z.ZodTypeDef, BankAccount2 > = /* @__PURE__ */ lazySchema$(() => z.object({ bankName: z.nullable(z.string()).optional(), accountNumber: z.nullable(z.string()).optional(), accountName: z.nullable(z.string()).optional(), accountType: z.nullable(BankAccount2AccountType$outboundSchema).optional(), iban: z.nullable(z.string()).optional(), bic: z.nullable(z.string()).optional(), routingNumber: z.nullable(z.string()).optional(), bsbNumber: z.nullable(z.string()).optional(), branchIdentifier: z.nullable(z.string()).optional(), bankCode: z.nullable(z.string()).optional(), currency: z.nullable(Currency$outboundSchema).optional(), country: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { bankName: "bank_name", accountNumber: "account_number", accountName: "account_name", accountType: "account_type", routingNumber: "routing_number", bsbNumber: "bsb_number", branchIdentifier: "branch_identifier", bankCode: "bank_code", }); }) ); export function bankAccount2ToJSON(bankAccount2: BankAccount2): string { return JSON.stringify(BankAccount2$outboundSchema.parse(bankAccount2)); } export function bankAccount2FromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BankAccount2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BankAccount2' from JSON`, ); }