/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { Decimal as Decimal$ } from "../../types/decimal.js"; import { AccountInfo, AccountInfo$Outbound, AccountInfo$outboundSchema, } from "./accountinfo.js"; import { AccountType, AccountType$outboundSchema } from "./accounttype.js"; import { RoutingInfo, RoutingInfo$Outbound, RoutingInfo$outboundSchema, } from "./routinginfo.js"; export type SourceAccountV2Prototype = { /** * Unique ID for the bank account. */ id: string; /** * The bank account name. */ accountName: string; /** * The type of bank account e.g. checking, savings, loan, creditCard, prepaidCard. */ accountType: AccountType; /** * The account number. */ accountNumber: string; /** * Routing information for the bank. This does not include account number. */ routingInfo?: RoutingInfo | undefined; /** * The sort code. */ sortCode?: string | null | undefined; /** * The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_. * * @remarks * * ## Unknown currencies * * In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction. * * There are only a very small number of edge cases where this currency code is returned by the Codat system. */ currency: string; /** * The latest balance for the bank account. */ balance: Decimal$ | number; /** * In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: * * @remarks * * ``` * 2020-10-08T22:40:50Z * 2021-01-01T00:00:00 * ``` * * When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: * * - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` * - Unqualified local time: `2021-11-15T01:00:00` * - UTC time offsets: `2021-11-15T01:00:00-05:00` * * > Time zones * > * > Not all dates from Codat will contain information about time zones. * > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. */ modifiedDate?: string | undefined; accountInfo?: AccountInfo | null | undefined; }; /** @internal */ export type SourceAccountV2Prototype$Outbound = { id: string; accountName: string; accountType: string; accountNumber: string; routingInfo?: RoutingInfo$Outbound | undefined; sortCode?: string | null | undefined; currency: string; balance: number; modifiedDate?: string | undefined; accountInfo?: AccountInfo$Outbound | null | undefined; }; /** @internal */ export const SourceAccountV2Prototype$outboundSchema: z.ZodType< SourceAccountV2Prototype$Outbound, z.ZodTypeDef, SourceAccountV2Prototype > = z.object({ id: z.string(), accountName: z.string(), accountType: AccountType$outboundSchema, accountNumber: z.string(), routingInfo: RoutingInfo$outboundSchema.optional(), sortCode: z.nullable(z.string()).optional(), currency: z.string(), balance: z.union([z.instanceof(Decimal$), z.number()]).transform(v => typeof v === "number" ? v : v.toNumber() ), modifiedDate: z.string().optional(), accountInfo: z.nullable(AccountInfo$outboundSchema).optional(), }); export function sourceAccountV2PrototypeToJSON( sourceAccountV2Prototype: SourceAccountV2Prototype, ): string { return JSON.stringify( SourceAccountV2Prototype$outboundSchema.parse(sourceAccountV2Prototype), ); }