/* * 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"; export type AchDetails = { /** * An optional override of the default NACHA company entry description for a transfer. */ companyEntryDescription?: string | undefined; /** * An optional override of the default NACHA company name for a transfer. */ originatingCompanyName?: string | undefined; }; export type CardDetails = { /** * An optional override of the default card statement descriptor for a transfer. Accounts must be enabled by Moov to set this field. */ dynamicDescriptor?: string | undefined; }; export type SchedulePaymentMethod = { paymentMethodID: string; achDetails?: AchDetails | undefined; cardDetails?: CardDetails | undefined; }; /** @internal */ export const AchDetails$inboundSchema: z.ZodType< AchDetails, z.ZodTypeDef, unknown > = z.object({ companyEntryDescription: z.string().optional(), originatingCompanyName: z.string().optional(), }); /** @internal */ export type AchDetails$Outbound = { companyEntryDescription?: string | undefined; originatingCompanyName?: string | undefined; }; /** @internal */ export const AchDetails$outboundSchema: z.ZodType< AchDetails$Outbound, z.ZodTypeDef, AchDetails > = z.object({ companyEntryDescription: z.string().optional(), originatingCompanyName: z.string().optional(), }); export function achDetailsToJSON(achDetails: AchDetails): string { return JSON.stringify(AchDetails$outboundSchema.parse(achDetails)); } export function achDetailsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AchDetails$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AchDetails' from JSON`, ); } /** @internal */ export const CardDetails$inboundSchema: z.ZodType< CardDetails, z.ZodTypeDef, unknown > = z.object({ dynamicDescriptor: z.string().optional(), }); /** @internal */ export type CardDetails$Outbound = { dynamicDescriptor?: string | undefined; }; /** @internal */ export const CardDetails$outboundSchema: z.ZodType< CardDetails$Outbound, z.ZodTypeDef, CardDetails > = z.object({ dynamicDescriptor: z.string().optional(), }); export function cardDetailsToJSON(cardDetails: CardDetails): string { return JSON.stringify(CardDetails$outboundSchema.parse(cardDetails)); } export function cardDetailsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CardDetails$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CardDetails' from JSON`, ); } /** @internal */ export const SchedulePaymentMethod$inboundSchema: z.ZodType< SchedulePaymentMethod, z.ZodTypeDef, unknown > = z.object({ paymentMethodID: z.string(), achDetails: z.lazy(() => AchDetails$inboundSchema).optional(), cardDetails: z.lazy(() => CardDetails$inboundSchema).optional(), }); /** @internal */ export type SchedulePaymentMethod$Outbound = { paymentMethodID: string; achDetails?: AchDetails$Outbound | undefined; cardDetails?: CardDetails$Outbound | undefined; }; /** @internal */ export const SchedulePaymentMethod$outboundSchema: z.ZodType< SchedulePaymentMethod$Outbound, z.ZodTypeDef, SchedulePaymentMethod > = z.object({ paymentMethodID: z.string(), achDetails: z.lazy(() => AchDetails$outboundSchema).optional(), cardDetails: z.lazy(() => CardDetails$outboundSchema).optional(), }); export function schedulePaymentMethodToJSON( schedulePaymentMethod: SchedulePaymentMethod, ): string { return JSON.stringify( SchedulePaymentMethod$outboundSchema.parse(schedulePaymentMethod), ); } export function schedulePaymentMethodFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => SchedulePaymentMethod$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SchedulePaymentMethod' from JSON`, ); }