/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { MoovError } from "./mooverror.js"; export type RefundValidationErrorData = { amount?: string | undefined; /** * Used for generic errors when invalid request data isn't attributed to a single request field. */ error?: string | undefined; }; export class RefundValidationError extends MoovError { amount?: string | undefined; /** * Used for generic errors when invalid request data isn't attributed to a single request field. */ error?: string | undefined; /** The original data that was passed to this error instance. */ data$: RefundValidationErrorData; constructor( err: RefundValidationErrorData, httpMeta: { response: Response; request: Request; body: string }, ) { const message = "message" in err && typeof err.message === "string" ? err.message : `API error occurred: ${JSON.stringify(err)}`; super(message, httpMeta); this.data$ = err; if (err.amount != null) this.amount = err.amount; if (err.error != null) this.error = err.error; this.name = "RefundValidationError"; } } /** @internal */ export const RefundValidationError$inboundSchema: z.ZodType< RefundValidationError, z.ZodTypeDef, unknown > = z.object({ amount: z.string().optional(), error: z.string().optional(), request$: z.instanceof(Request), response$: z.instanceof(Response), body$: z.string(), }) .transform((v) => { return new RefundValidationError(v, { request: v.request$, response: v.response$, body: v.body$, }); }); /** @internal */ export type RefundValidationError$Outbound = { amount?: string | undefined; error?: string | undefined; }; /** @internal */ export const RefundValidationError$outboundSchema: z.ZodType< RefundValidationError$Outbound, z.ZodTypeDef, RefundValidationError > = z.instanceof(RefundValidationError) .transform(v => v.data$) .pipe(z.object({ amount: z.string().optional(), error: z.string().optional(), }));