/* * 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 { 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"; /** * Bank account type */ export const AccountType = { Checking: "Checking", Savings: "Savings", } as const; /** * Bank account type */ export type AccountType = ClosedEnum; /** * The verification status of the bank account. * * @remarks * * 'awaiting_deposits' means the bank account is just created and money is being transferred. * 'ready_for_verification' means the micro-deposits are completed and the verification process can begin by using the verify endpoint. * 'verified' means the bank account is verified. */ export const VerificationStatus = { AwaitingDeposits: "awaiting_deposits", ReadyForVerification: "ready_for_verification", Verified: "verified", } as const; /** * The verification status of the bank account. * * @remarks * * 'awaiting_deposits' means the bank account is just created and money is being transferred. * 'ready_for_verification' means the micro-deposits are completed and the verification process can begin by using the verify endpoint. * 'verified' means the bank account is verified. */ export type VerificationStatus = ClosedEnum; /** * The verification type of the bank account. * * @remarks * * 'bank_deposits' means the bank account is connected by entering routing and accounting numbers and verifying through micro-deposits. * 'plaid' means the bank account is connected through Plaid. */ export const VerificationType = { BankDeposits: "bank_deposits", Plaid: "plaid", PlaidExternal: "plaid_external", } as const; /** * The verification type of the bank account. * * @remarks * * 'bank_deposits' means the bank account is connected by entering routing and accounting numbers and verifying through micro-deposits. * 'plaid' means the bank account is connected through Plaid. */ export type VerificationType = ClosedEnum; export const PlaidStatus = { Connected: "connected", Disconnected: "disconnected", } as const; export type PlaidStatus = ClosedEnum; /** * The company bank account */ export type CompanyBankAccount = { /** * UUID of the bank account */ uuid: string; /** * UUID of the company */ companyUuid?: string | undefined; /** * Bank account type */ accountType?: AccountType | undefined; /** * The bank account's routing number */ routingNumber?: string | undefined; /** * Masked bank account number */ hiddenAccountNumber?: string | undefined; /** * The verification status of the bank account. * * @remarks * * 'awaiting_deposits' means the bank account is just created and money is being transferred. * 'ready_for_verification' means the micro-deposits are completed and the verification process can begin by using the verify endpoint. * 'verified' means the bank account is verified. */ verificationStatus?: VerificationStatus | undefined; /** * The verification type of the bank account. * * @remarks * * 'bank_deposits' means the bank account is connected by entering routing and accounting numbers and verifying through micro-deposits. * 'plaid' means the bank account is connected through Plaid. */ verificationType?: VerificationType | undefined; /** * The Plaid connection status of the bank account. Only applies when verification type is Plaid. */ plaidStatus?: PlaidStatus | null | undefined; /** * The last fetch balance for the bank account. Please be aware that this amount does not reflect the most up-to-date balance and only applies when the verification type is Plaid. */ lastCachedBalance?: string | null | undefined; /** * The balance fetch date associated with the last_cached_balance. Only applies when verification type is Plaid. */ balanceFetchedDate?: string | null | undefined; /** * Name of bank account */ name?: string | undefined; /** * Whether the company has at least one bank account with active reverse-wire * * @remarks * funding. The same value is returned on every bank-account row in this * response. */ reverseWireEnabled?: boolean | null | undefined; }; /** @internal */ export const AccountType$inboundSchema: z.ZodNativeEnum = z .nativeEnum(AccountType); /** @internal */ export const VerificationStatus$inboundSchema: z.ZodNativeEnum< typeof VerificationStatus > = z.nativeEnum(VerificationStatus); /** @internal */ export const VerificationType$inboundSchema: z.ZodNativeEnum< typeof VerificationType > = z.nativeEnum(VerificationType); /** @internal */ export const PlaidStatus$inboundSchema: z.ZodNativeEnum = z .nativeEnum(PlaidStatus); /** @internal */ export const CompanyBankAccount$inboundSchema: z.ZodType< CompanyBankAccount, z.ZodTypeDef, unknown > = z.object({ uuid: z.string(), company_uuid: z.string().optional(), account_type: AccountType$inboundSchema.optional(), routing_number: z.string().optional(), hidden_account_number: z.string().optional(), verification_status: VerificationStatus$inboundSchema.optional(), verification_type: VerificationType$inboundSchema.optional(), plaid_status: z.nullable(PlaidStatus$inboundSchema).optional(), last_cached_balance: z.nullable(z.string()).optional(), balance_fetched_date: z.nullable(z.string()).optional(), name: z.string().optional(), reverse_wire_enabled: z.nullable(z.boolean()).optional(), }).transform((v) => { return remap$(v, { "company_uuid": "companyUuid", "account_type": "accountType", "routing_number": "routingNumber", "hidden_account_number": "hiddenAccountNumber", "verification_status": "verificationStatus", "verification_type": "verificationType", "plaid_status": "plaidStatus", "last_cached_balance": "lastCachedBalance", "balance_fetched_date": "balanceFetchedDate", "reverse_wire_enabled": "reverseWireEnabled", }); }); export function companyBankAccountFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CompanyBankAccount$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CompanyBankAccount' from JSON`, ); }