/* * 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 { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Currency, Currency$inboundSchema, Currency$outboundSchema, } from "./currency.js"; /** * The type of bank account. */ export const AccountType = { BankAccount: "bank_account", CreditCard: "credit_card", Other: "other", } as const; /** * The type of bank account. */ export type AccountType = ClosedEnum; export type BankAccount = { /** * The name of the bank */ bankName?: string | null | undefined; /** * A bank account number is a number that is tied to your bank account. If you have several bank accounts, such as personal, joint, business (and so on), each account will have a different account number. */ accountNumber?: string | null | undefined; /** * The name which you used in opening your bank account. */ accountName?: string | null | undefined; /** * The type of bank account. */ accountType?: AccountType | null | undefined; /** * The International Bank Account Number (IBAN). */ iban?: string | null | undefined; /** * The Bank Identifier Code (BIC). */ bic?: string | null | undefined; /** * A routing number is a nine-digit code used to identify a financial institution in the United States. */ routingNumber?: string | null | undefined; /** * A BSB is a 6 digit numeric code used for identifying the branch of an Australian or New Zealand bank or financial institution. */ bsbNumber?: string | null | undefined; /** * A branch identifier is a unique identifier for a branch of a bank or financial institution. */ branchIdentifier?: string | null | undefined; /** * A bank code is a code assigned by a central bank, a bank supervisory body or a Bankers Association in a country to all its licensed member banks or financial institutions. */ 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; }; /** @internal */ export const AccountType$inboundSchema: z.ZodNativeEnum = z .nativeEnum(AccountType); /** @internal */ export const AccountType$outboundSchema: z.ZodNativeEnum = AccountType$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AccountType$ { /** @deprecated use `AccountType$inboundSchema` instead. */ export const inboundSchema = AccountType$inboundSchema; /** @deprecated use `AccountType$outboundSchema` instead. */ export const outboundSchema = AccountType$outboundSchema; } /** @internal */ export const BankAccount$inboundSchema: z.ZodType< BankAccount, z.ZodTypeDef, unknown > = z.object({ bank_name: z.nullable(z.string()).optional(), account_number: z.nullable(z.string()).optional(), account_name: z.nullable(z.string()).optional(), account_type: z.nullable(AccountType$inboundSchema).optional(), iban: z.nullable(z.string()).optional(), bic: z.nullable(z.string()).optional(), routing_number: z.nullable(z.string()).optional(), bsb_number: z.nullable(z.string()).optional(), branch_identifier: z.nullable(z.string()).optional(), bank_code: z.nullable(z.string()).optional(), currency: z.nullable(Currency$inboundSchema).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 BankAccount$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; }; /** @internal */ export const BankAccount$outboundSchema: z.ZodType< BankAccount$Outbound, z.ZodTypeDef, BankAccount > = z.object({ bankName: z.nullable(z.string()).optional(), accountNumber: z.nullable(z.string()).optional(), accountName: z.nullable(z.string()).optional(), accountType: z.nullable(AccountType$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(), }).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", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace BankAccount$ { /** @deprecated use `BankAccount$inboundSchema` instead. */ export const inboundSchema = BankAccount$inboundSchema; /** @deprecated use `BankAccount$outboundSchema` instead. */ export const outboundSchema = BankAccount$outboundSchema; /** @deprecated use `BankAccount$Outbound` instead. */ export type Outbound = BankAccount$Outbound; } export function bankAccountToJSON(bankAccount: BankAccount): string { return JSON.stringify(BankAccount$outboundSchema.parse(bankAccount)); } export function bankAccountFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BankAccount$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BankAccount' from JSON`, ); }