/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { BankAccountHolderType, BankAccountHolderType$inboundSchema, BankAccountHolderType$outboundSchema, } from "./bankaccountholdertype.js"; import { BankAccountStatus, BankAccountStatus$inboundSchema, BankAccountStatus$outboundSchema, } from "./bankaccountstatus.js"; import { BankAccountType, BankAccountType$inboundSchema, BankAccountType$outboundSchema, } from "./bankaccounttype.js"; /** * A bank account as contained within a payment method. */ export type PaymentMethodsBankAccount = { bankAccountID: string; /** * Once the bank account is linked, we don't reveal the full bank account number. * * @remarks * * The fingerprint acts as a way to identify whether two linked bank accounts are the same. */ fingerprint: string; status: BankAccountStatus; holderName: string; /** * The type of holder on a funding source. */ holderType: BankAccountHolderType; bankName: string; /** * The bank account type. */ bankAccountType: BankAccountType; routingNumber: string; lastFourAccountNumber: string; updatedOn: Date; }; /** @internal */ export const PaymentMethodsBankAccount$inboundSchema: z.ZodType< PaymentMethodsBankAccount, z.ZodTypeDef, unknown > = z.object({ bankAccountID: z.string(), fingerprint: z.string(), status: BankAccountStatus$inboundSchema, holderName: z.string(), holderType: BankAccountHolderType$inboundSchema, bankName: z.string(), bankAccountType: BankAccountType$inboundSchema, routingNumber: z.string(), lastFourAccountNumber: z.string(), updatedOn: z.string().datetime({ offset: true }).transform(v => new Date(v)), }); /** @internal */ export type PaymentMethodsBankAccount$Outbound = { bankAccountID: string; fingerprint: string; status: string; holderName: string; holderType: string; bankName: string; bankAccountType: string; routingNumber: string; lastFourAccountNumber: string; updatedOn: string; }; /** @internal */ export const PaymentMethodsBankAccount$outboundSchema: z.ZodType< PaymentMethodsBankAccount$Outbound, z.ZodTypeDef, PaymentMethodsBankAccount > = z.object({ bankAccountID: z.string(), fingerprint: z.string(), status: BankAccountStatus$outboundSchema, holderName: z.string(), holderType: BankAccountHolderType$outboundSchema, bankName: z.string(), bankAccountType: BankAccountType$outboundSchema, routingNumber: z.string(), lastFourAccountNumber: z.string(), updatedOn: z.date().transform(v => v.toISOString()), }); export function paymentMethodsBankAccountToJSON( paymentMethodsBankAccount: PaymentMethodsBankAccount, ): string { return JSON.stringify( PaymentMethodsBankAccount$outboundSchema.parse(paymentMethodsBankAccount), ); } export function paymentMethodsBankAccountFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PaymentMethodsBankAccount$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PaymentMethodsBankAccount' from JSON`, ); }