/* * 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"; import { CustomField, CustomField$inboundSchema, CustomField$Outbound, CustomField$outboundSchema, } from "./customfield.js"; import { LinkedLedgerAccount, LinkedLedgerAccount$inboundSchema, LinkedLedgerAccount$Outbound, LinkedLedgerAccount$outboundSchema, } from "./linkedledgeraccount.js"; /** * The type of bank account */ export const AccountingBankAccountAccountType = { Checking: "checking", Savings: "savings", CreditCard: "credit_card", MoneyMarket: "money_market", LineOfCredit: "line_of_credit", Other: "other", Cash: "cash", } as const; /** * The type of bank account */ export type AccountingBankAccountAccountType = OpenEnum< typeof AccountingBankAccountAccountType >; /** * The status of the bank account */ export const AccountingBankAccountStatus = { Active: "active", Inactive: "inactive", Closed: "closed", } as const; /** * The status of the bank account */ export type AccountingBankAccountStatus = OpenEnum< typeof AccountingBankAccountStatus >; export type AccountingBankAccount = { /** * A unique identifier for an object. */ id: string; /** * The third-party API ID of original entity */ downstreamId?: string | null | undefined; /** * Display ID for the bank account */ displayId?: string | null | undefined; /** * The name of the bank account */ name?: string | null | undefined; /** * The bank account number */ accountNumber?: string | null | undefined; /** * The type of bank account */ accountType?: AccountingBankAccountAccountType | undefined; ledgerAccount?: LinkedLedgerAccount | null | undefined; /** * The name of the bank or financial institution */ bankName?: 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; /** * The current balance of the bank account */ balance?: number | null | undefined; /** * The available balance (considering pending transactions and overdraft) */ availableBalance?: number | null | undefined; /** * The overdraft limit for the account */ overdraftLimit?: number | null | undefined; /** * Bank routing number (US) */ routingNumber?: string | null | undefined; /** * International Bank Account Number */ iban?: string | null | undefined; /** * Bank Identifier Code / SWIFT Code */ bic?: 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; /** * Country code according to ISO 3166-1 alpha-2. */ country?: string | null | undefined; /** * The status of the bank account */ status?: AccountingBankAccountStatus | null | undefined; /** * Description or notes about the bank account */ description?: string | null | undefined; customFields?: Array | undefined; /** * When custom mappings are configured on the resource, the result is included here. */ customMappings?: { [k: string]: any } | null | undefined; /** * The date and time when the object was created. */ createdAt?: Date | null | undefined; /** * The date and time when the object was last updated. */ updatedAt?: Date | null | undefined; /** * The user who created the object. */ createdBy?: string | null | undefined; /** * The user who last updated the object. */ updatedBy?: string | null | undefined; }; export type AccountingBankAccountInput = { /** * Display ID for the bank account */ displayId?: string | null | undefined; /** * The name of the bank account */ name?: string | null | undefined; /** * The bank account number */ accountNumber?: string | null | undefined; /** * The type of bank account */ accountType?: AccountingBankAccountAccountType | undefined; ledgerAccount?: LinkedLedgerAccount | null | undefined; /** * The name of the bank or financial institution */ bankName?: 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; /** * The current balance of the bank account */ balance?: number | null | undefined; /** * The available balance (considering pending transactions and overdraft) */ availableBalance?: number | null | undefined; /** * The overdraft limit for the account */ overdraftLimit?: number | null | undefined; /** * Bank routing number (US) */ routingNumber?: string | null | undefined; /** * International Bank Account Number */ iban?: string | null | undefined; /** * Bank Identifier Code / SWIFT Code */ bic?: 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; /** * Country code according to ISO 3166-1 alpha-2. */ country?: string | null | undefined; /** * The status of the bank account */ status?: AccountingBankAccountStatus | null | undefined; /** * Description or notes about the bank account */ description?: string | null | undefined; customFields?: Array | undefined; }; /** @internal */ export const AccountingBankAccountAccountType$inboundSchema: z.ZodType< AccountingBankAccountAccountType, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(AccountingBankAccountAccountType) ); /** @internal */ export const AccountingBankAccountAccountType$outboundSchema: z.ZodType< string, z.ZodTypeDef, AccountingBankAccountAccountType > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(AccountingBankAccountAccountType) ); /** @internal */ export const AccountingBankAccountStatus$inboundSchema: z.ZodType< AccountingBankAccountStatus, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(AccountingBankAccountStatus) ); /** @internal */ export const AccountingBankAccountStatus$outboundSchema: z.ZodType< string, z.ZodTypeDef, AccountingBankAccountStatus > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(AccountingBankAccountStatus) ); /** @internal */ export const AccountingBankAccount$inboundSchema: z.ZodType< AccountingBankAccount, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.string(), downstream_id: z.nullable(types.string()).optional(), display_id: z.nullable(types.string()).optional(), name: z.nullable(types.string()).optional(), account_number: z.nullable(types.string()).optional(), account_type: types.optional( AccountingBankAccountAccountType$inboundSchema, ), ledger_account: z.nullable(LinkedLedgerAccount$inboundSchema).optional(), bank_name: z.nullable(types.string()).optional(), currency: z.nullable(Currency$inboundSchema).optional(), balance: z.nullable(types.number()).optional(), available_balance: z.nullable(types.number()).optional(), overdraft_limit: z.nullable(types.number()).optional(), routing_number: z.nullable(types.string()).optional(), iban: z.nullable(types.string()).optional(), bic: 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(), country: z.nullable(types.string()).optional(), status: z.nullable(AccountingBankAccountStatus$inboundSchema).optional(), description: z.nullable(types.string()).optional(), custom_fields: types.optional(z.array(CustomField$inboundSchema)), custom_mappings: z.nullable(z.record(z.any())).optional(), created_at: z.nullable(types.date()).optional(), updated_at: z.nullable(types.date()).optional(), created_by: z.nullable(types.string()).optional(), updated_by: z.nullable(types.string()).optional(), }).transform((v) => { return remap$(v, { "downstream_id": "downstreamId", "display_id": "displayId", "account_number": "accountNumber", "account_type": "accountType", "ledger_account": "ledgerAccount", "bank_name": "bankName", "available_balance": "availableBalance", "overdraft_limit": "overdraftLimit", "routing_number": "routingNumber", "bsb_number": "bsbNumber", "branch_identifier": "branchIdentifier", "bank_code": "bankCode", "custom_fields": "customFields", "custom_mappings": "customMappings", "created_at": "createdAt", "updated_at": "updatedAt", "created_by": "createdBy", "updated_by": "updatedBy", }); }) ); export function accountingBankAccountFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingBankAccount$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingBankAccount' from JSON`, ); } /** @internal */ export type AccountingBankAccountInput$Outbound = { display_id?: string | null | undefined; name?: string | null | undefined; account_number?: string | null | undefined; account_type?: string | undefined; ledger_account?: LinkedLedgerAccount$Outbound | null | undefined; bank_name?: string | null | undefined; currency?: string | null | undefined; balance?: number | null | undefined; available_balance?: number | null | undefined; overdraft_limit?: number | null | undefined; routing_number?: string | null | undefined; iban?: string | null | undefined; bic?: string | null | undefined; bsb_number?: string | null | undefined; branch_identifier?: string | null | undefined; bank_code?: string | null | undefined; country?: string | null | undefined; status?: string | null | undefined; description?: string | null | undefined; custom_fields?: Array | undefined; }; /** @internal */ export const AccountingBankAccountInput$outboundSchema: z.ZodType< AccountingBankAccountInput$Outbound, z.ZodTypeDef, AccountingBankAccountInput > = /* @__PURE__ */ lazySchema$(() => z.object({ displayId: z.nullable(z.string()).optional(), name: z.nullable(z.string()).optional(), accountNumber: z.nullable(z.string()).optional(), accountType: AccountingBankAccountAccountType$outboundSchema.optional(), ledgerAccount: z.nullable(LinkedLedgerAccount$outboundSchema).optional(), bankName: z.nullable(z.string()).optional(), currency: z.nullable(Currency$outboundSchema).optional(), balance: z.nullable(z.number()).optional(), availableBalance: z.nullable(z.number()).optional(), overdraftLimit: z.nullable(z.number()).optional(), routingNumber: z.nullable(z.string()).optional(), iban: z.nullable(z.string()).optional(), bic: z.nullable(z.string()).optional(), bsbNumber: z.nullable(z.string()).optional(), branchIdentifier: z.nullable(z.string()).optional(), bankCode: z.nullable(z.string()).optional(), country: z.nullable(z.string()).optional(), status: z.nullable(AccountingBankAccountStatus$outboundSchema).optional(), description: z.nullable(z.string()).optional(), customFields: z.array(CustomField$outboundSchema).optional(), }).transform((v) => { return remap$(v, { displayId: "display_id", accountNumber: "account_number", accountType: "account_type", ledgerAccount: "ledger_account", bankName: "bank_name", availableBalance: "available_balance", overdraftLimit: "overdraft_limit", routingNumber: "routing_number", bsbNumber: "bsb_number", branchIdentifier: "branch_identifier", bankCode: "bank_code", customFields: "custom_fields", }); }) ); export function accountingBankAccountInputToJSON( accountingBankAccountInput: AccountingBankAccountInput, ): string { return JSON.stringify( AccountingBankAccountInput$outboundSchema.parse(accountingBankAccountInput), ); }