/* * 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 { ACHPaymentDetailsError, ACHPaymentDetailsError$inboundSchema, ACHPaymentDetailsError$Outbound, ACHPaymentDetailsError$outboundSchema, } from "./achpaymentdetailserror.js"; import { CardPaymentDetailsError, CardPaymentDetailsError$inboundSchema, CardPaymentDetailsError$Outbound, CardPaymentDetailsError$outboundSchema, } from "./cardpaymentdetailserror.js"; export type PaymentDetailsError = { allowedMethods?: string | undefined; cardDetails?: CardPaymentDetailsError | undefined; achDetails?: ACHPaymentDetailsError | undefined; metadata?: string | undefined; }; /** @internal */ export const PaymentDetailsError$inboundSchema: z.ZodType< PaymentDetailsError, z.ZodTypeDef, unknown > = z.object({ allowedMethods: z.string().optional(), cardDetails: CardPaymentDetailsError$inboundSchema.optional(), achDetails: ACHPaymentDetailsError$inboundSchema.optional(), metadata: z.string().optional(), }); /** @internal */ export type PaymentDetailsError$Outbound = { allowedMethods?: string | undefined; cardDetails?: CardPaymentDetailsError$Outbound | undefined; achDetails?: ACHPaymentDetailsError$Outbound | undefined; metadata?: string | undefined; }; /** @internal */ export const PaymentDetailsError$outboundSchema: z.ZodType< PaymentDetailsError$Outbound, z.ZodTypeDef, PaymentDetailsError > = z.object({ allowedMethods: z.string().optional(), cardDetails: CardPaymentDetailsError$outboundSchema.optional(), achDetails: ACHPaymentDetailsError$outboundSchema.optional(), metadata: z.string().optional(), }); export function paymentDetailsErrorToJSON( paymentDetailsError: PaymentDetailsError, ): string { return JSON.stringify( PaymentDetailsError$outboundSchema.parse(paymentDetailsError), ); } export function paymentDetailsErrorFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PaymentDetailsError$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PaymentDetailsError' from JSON`, ); }