/* * 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 * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { BankAccountHolder, BankAccountHolder$Outbound, BankAccountHolder$outboundSchema, } from "./bankaccountholder.js"; /** * Specify whether this is a `checking` or `savings` account. Defaults to `checking`. */ export const AccountType = { Checking: "checking", Savings: "savings", } as const; /** * Specify whether this is a `checking` or `savings` account. Defaults to `checking`. */ export type AccountType = OpenEnum; /** * ACH Bank Payment Method * * @remarks * * Bank Payment Method for ACH bank accounts. */ export type ACHBankPaymentMethodCreate = { /** * Always `bank`. */ method?: "bank" | undefined; accountHolder: BankAccountHolder; /** * The ID of the buyer to attach the method to. */ buyerId?: string | null | undefined; /** * The merchant reference for this payment method. */ buyerExternalIdentifier?: string | null | undefined; /** * The merchant identifier for this payment method. */ externalIdentifier?: string | null | undefined; /** * Always `ach`. */ scheme?: "ach" | undefined; /** * The account number for this ACH bank account */ accountNumber: string; /** * The routing number for this ACH bank account */ routingNumber: string; /** * Whether the account number is tokenized */ isTokenized?: boolean | undefined; /** * Specify whether this is a `checking` or `savings` account. Defaults to `checking`. */ accountType?: AccountType | undefined; }; /** @internal */ export const AccountType$outboundSchema: z.ZodType< string, z.ZodTypeDef, AccountType > = openEnums.outboundSchema(AccountType); /** @internal */ export type ACHBankPaymentMethodCreate$Outbound = { method: "bank"; account_holder: BankAccountHolder$Outbound; buyer_id?: string | null | undefined; buyer_external_identifier?: string | null | undefined; external_identifier?: string | null | undefined; scheme: "ach"; account_number: string; routing_number: string; is_tokenized: boolean; account_type: string; }; /** @internal */ export const ACHBankPaymentMethodCreate$outboundSchema: z.ZodType< ACHBankPaymentMethodCreate$Outbound, z.ZodTypeDef, ACHBankPaymentMethodCreate > = z.object({ method: z.literal("bank").default("bank" as const), accountHolder: BankAccountHolder$outboundSchema, buyerId: z.nullable(z.string()).optional(), buyerExternalIdentifier: z.nullable(z.string()).optional(), externalIdentifier: z.nullable(z.string()).optional(), scheme: z.literal("ach").default("ach" as const), accountNumber: z.string(), routingNumber: z.string(), isTokenized: z.boolean().default(false), accountType: AccountType$outboundSchema.default("checking"), }).transform((v) => { return remap$(v, { accountHolder: "account_holder", buyerId: "buyer_id", buyerExternalIdentifier: "buyer_external_identifier", externalIdentifier: "external_identifier", accountNumber: "account_number", routingNumber: "routing_number", isTokenized: "is_tokenized", accountType: "account_type", }); }); export function achBankPaymentMethodCreateToJSON( achBankPaymentMethodCreate: ACHBankPaymentMethodCreate, ): string { return JSON.stringify( ACHBankPaymentMethodCreate$outboundSchema.parse(achBankPaymentMethodCreate), ); }