/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import * as components from "../components/index.js"; import { MoovError } from "./mooverror.js"; export type UpdatePaymentLinkErrorData = { amount?: components.AmountValidationError | undefined; salesTaxAmount?: components.AmountValidationError | undefined; expiresOn?: string | undefined; display?: components.DisplayOptionsError | undefined; payment?: components.PaymentDetailsError | undefined; payout?: components.PayoutDetailsError | undefined; lineItems?: components.CreatePaymentLinkLineItemsValidationError | undefined; }; export class UpdatePaymentLinkError extends MoovError { amount?: components.AmountValidationError | undefined; salesTaxAmount?: components.AmountValidationError | undefined; expiresOn?: string | undefined; display?: components.DisplayOptionsError | undefined; payment?: components.PaymentDetailsError | undefined; payout?: components.PayoutDetailsError | undefined; lineItems?: components.CreatePaymentLinkLineItemsValidationError | undefined; /** The original data that was passed to this error instance. */ data$: UpdatePaymentLinkErrorData; constructor( err: UpdatePaymentLinkErrorData, 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.salesTaxAmount != null) this.salesTaxAmount = err.salesTaxAmount; if (err.expiresOn != null) this.expiresOn = err.expiresOn; if (err.display != null) this.display = err.display; if (err.payment != null) this.payment = err.payment; if (err.payout != null) this.payout = err.payout; if (err.lineItems != null) this.lineItems = err.lineItems; this.name = "UpdatePaymentLinkError"; } } /** @internal */ export const UpdatePaymentLinkError$inboundSchema: z.ZodType< UpdatePaymentLinkError, z.ZodTypeDef, unknown > = z.object({ amount: components.AmountValidationError$inboundSchema.optional(), salesTaxAmount: components.AmountValidationError$inboundSchema.optional(), expiresOn: z.string().optional(), display: components.DisplayOptionsError$inboundSchema.optional(), payment: components.PaymentDetailsError$inboundSchema.optional(), payout: components.PayoutDetailsError$inboundSchema.optional(), lineItems: components.CreatePaymentLinkLineItemsValidationError$inboundSchema .optional(), request$: z.instanceof(Request), response$: z.instanceof(Response), body$: z.string(), }) .transform((v) => { return new UpdatePaymentLinkError(v, { request: v.request$, response: v.response$, body: v.body$, }); }); /** @internal */ export type UpdatePaymentLinkError$Outbound = { amount?: components.AmountValidationError$Outbound | undefined; salesTaxAmount?: components.AmountValidationError$Outbound | undefined; expiresOn?: string | undefined; display?: components.DisplayOptionsError$Outbound | undefined; payment?: components.PaymentDetailsError$Outbound | undefined; payout?: components.PayoutDetailsError$Outbound | undefined; lineItems?: | components.CreatePaymentLinkLineItemsValidationError$Outbound | undefined; }; /** @internal */ export const UpdatePaymentLinkError$outboundSchema: z.ZodType< UpdatePaymentLinkError$Outbound, z.ZodTypeDef, UpdatePaymentLinkError > = z.instanceof(UpdatePaymentLinkError) .transform(v => v.data$) .pipe(z.object({ amount: components.AmountValidationError$outboundSchema.optional(), salesTaxAmount: components.AmountValidationError$outboundSchema.optional(), expiresOn: z.string().optional(), display: components.DisplayOptionsError$outboundSchema.optional(), payment: components.PaymentDetailsError$outboundSchema.optional(), payout: components.PayoutDetailsError$outboundSchema.optional(), lineItems: components .CreatePaymentLinkLineItemsValidationError$outboundSchema.optional(), }));