/* * 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 { PaymentMethodsBankAccount, PaymentMethodsBankAccount$inboundSchema, PaymentMethodsBankAccount$Outbound, PaymentMethodsBankAccount$outboundSchema, } from "./paymentmethodsbankaccount.js"; export type AchDebitCollectPaymentMethod = { /** * ID of the payment method. */ paymentMethodID: string; paymentMethodType: "ach-debit-collect"; /** * A bank account as contained within a payment method. */ bankAccount: PaymentMethodsBankAccount; }; /** @internal */ export const AchDebitCollectPaymentMethod$inboundSchema: z.ZodType< AchDebitCollectPaymentMethod, z.ZodTypeDef, unknown > = z.object({ paymentMethodID: z.string(), paymentMethodType: z.literal("ach-debit-collect"), bankAccount: PaymentMethodsBankAccount$inboundSchema, }); /** @internal */ export type AchDebitCollectPaymentMethod$Outbound = { paymentMethodID: string; paymentMethodType: "ach-debit-collect"; bankAccount: PaymentMethodsBankAccount$Outbound; }; /** @internal */ export const AchDebitCollectPaymentMethod$outboundSchema: z.ZodType< AchDebitCollectPaymentMethod$Outbound, z.ZodTypeDef, AchDebitCollectPaymentMethod > = z.object({ paymentMethodID: z.string(), paymentMethodType: z.literal("ach-debit-collect"), bankAccount: PaymentMethodsBankAccount$outboundSchema, }); export function achDebitCollectPaymentMethodToJSON( achDebitCollectPaymentMethod: AchDebitCollectPaymentMethod, ): string { return JSON.stringify( AchDebitCollectPaymentMethod$outboundSchema.parse( achDebitCollectPaymentMethod, ), ); } export function achDebitCollectPaymentMethodFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AchDebitCollectPaymentMethod$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AchDebitCollectPaymentMethod' from JSON`, ); }