/* * 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 components from "../components/index.js"; import { MoovError } from "./mooverror.js"; export type TransferValidationErrorData = { amount?: string | undefined; source?: string | undefined; sourcePaymentMethodID?: string | undefined; destinationPaymentMethodID?: string | undefined; description?: string | undefined; facilitatorFeeTotalDecimal?: string | undefined; facilitatorFeeMarkupDecimal?: string | undefined; metadata?: string | undefined; salesTaxAmount?: string | undefined; foreignID?: string | undefined; lineItems?: components.CreateTransferLineItemsValidationError | undefined; }; export class TransferValidationError extends MoovError { amount?: string | undefined; source?: string | undefined; sourcePaymentMethodID?: string | undefined; destinationPaymentMethodID?: string | undefined; description?: string | undefined; facilitatorFeeTotalDecimal?: string | undefined; facilitatorFeeMarkupDecimal?: string | undefined; metadata?: string | undefined; salesTaxAmount?: string | undefined; foreignID?: string | undefined; lineItems?: components.CreateTransferLineItemsValidationError | undefined; /** The original data that was passed to this error instance. */ data$: TransferValidationErrorData; constructor( err: TransferValidationErrorData, 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.source != null) this.source = err.source; if (err.sourcePaymentMethodID != null) { this.sourcePaymentMethodID = err.sourcePaymentMethodID; } if (err.destinationPaymentMethodID != null) { this.destinationPaymentMethodID = err.destinationPaymentMethodID; } if (err.description != null) this.description = err.description; if (err.facilitatorFeeTotalDecimal != null) { this.facilitatorFeeTotalDecimal = err.facilitatorFeeTotalDecimal; } if (err.facilitatorFeeMarkupDecimal != null) { this.facilitatorFeeMarkupDecimal = err.facilitatorFeeMarkupDecimal; } if (err.metadata != null) this.metadata = err.metadata; if (err.salesTaxAmount != null) this.salesTaxAmount = err.salesTaxAmount; if (err.foreignID != null) this.foreignID = err.foreignID; if (err.lineItems != null) this.lineItems = err.lineItems; this.name = "TransferValidationError"; } } /** @internal */ export const TransferValidationError$inboundSchema: z.ZodType< TransferValidationError, z.ZodTypeDef, unknown > = z.object({ amount: z.string().optional(), source: z.string().optional(), sourcePaymentMethodID: z.string().optional(), destinationPaymentMethodID: z.string().optional(), description: z.string().optional(), "FacilitatorFee.TotalDecimal": z.string().optional(), "FacilitatorFee.MarkupDecimal": z.string().optional(), metadata: z.string().optional(), salesTaxAmount: z.string().optional(), foreignID: z.string().optional(), lineItems: components.CreateTransferLineItemsValidationError$inboundSchema .optional(), request$: z.instanceof(Request), response$: z.instanceof(Response), body$: z.string(), }) .transform((v) => { const remapped = remap$(v, { "FacilitatorFee.TotalDecimal": "facilitatorFeeTotalDecimal", "FacilitatorFee.MarkupDecimal": "facilitatorFeeMarkupDecimal", }); return new TransferValidationError(remapped, { request: v.request$, response: v.response$, body: v.body$, }); }); /** @internal */ export type TransferValidationError$Outbound = { amount?: string | undefined; source?: string | undefined; sourcePaymentMethodID?: string | undefined; destinationPaymentMethodID?: string | undefined; description?: string | undefined; "FacilitatorFee.TotalDecimal"?: string | undefined; "FacilitatorFee.MarkupDecimal"?: string | undefined; metadata?: string | undefined; salesTaxAmount?: string | undefined; foreignID?: string | undefined; lineItems?: | components.CreateTransferLineItemsValidationError$Outbound | undefined; }; /** @internal */ export const TransferValidationError$outboundSchema: z.ZodType< TransferValidationError$Outbound, z.ZodTypeDef, TransferValidationError > = z.instanceof(TransferValidationError) .transform(v => v.data$) .pipe( z.object({ amount: z.string().optional(), source: z.string().optional(), sourcePaymentMethodID: z.string().optional(), destinationPaymentMethodID: z.string().optional(), description: z.string().optional(), facilitatorFeeTotalDecimal: z.string().optional(), facilitatorFeeMarkupDecimal: z.string().optional(), metadata: z.string().optional(), salesTaxAmount: z.string().optional(), foreignID: z.string().optional(), lineItems: components .CreateTransferLineItemsValidationError$outboundSchema.optional(), }).transform((v) => { return remap$(v, { facilitatorFeeTotalDecimal: "FacilitatorFee.TotalDecimal", facilitatorFeeMarkupDecimal: "FacilitatorFee.MarkupDecimal", }); }), );