/* * 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 CreatePaymentLinkErrorData = { partnerAccountID?: string | undefined; merchantPaymentMethodID?: string | undefined; amount?: components.AmountValidationError | undefined; salesTaxAmount?: components.AmountValidationError | undefined; maxUses?: string | undefined; expiresOn?: string | undefined; display?: components.DisplayOptionsError | undefined; payment?: components.PaymentDetailsError | undefined; payout?: components.PayoutDetailsError | undefined; lineItems?: components.CreatePaymentLinkLineItemsValidationError | undefined; }; export class CreatePaymentLinkError extends MoovError { partnerAccountID?: string | undefined; merchantPaymentMethodID?: string | undefined; amount?: components.AmountValidationError | undefined; salesTaxAmount?: components.AmountValidationError | undefined; maxUses?: string | 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$: CreatePaymentLinkErrorData; constructor( err: CreatePaymentLinkErrorData, 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.partnerAccountID != null) { this.partnerAccountID = err.partnerAccountID; } if (err.merchantPaymentMethodID != null) { this.merchantPaymentMethodID = err.merchantPaymentMethodID; } if (err.amount != null) this.amount = err.amount; if (err.salesTaxAmount != null) this.salesTaxAmount = err.salesTaxAmount; if (err.maxUses != null) this.maxUses = err.maxUses; 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 = "CreatePaymentLinkError"; } } /** @internal */ export const CreatePaymentLinkError$inboundSchema: z.ZodType< CreatePaymentLinkError, z.ZodTypeDef, unknown > = z.object({ partnerAccountID: z.string().optional(), merchantPaymentMethodID: z.string().optional(), amount: components.AmountValidationError$inboundSchema.optional(), salesTaxAmount: components.AmountValidationError$inboundSchema.optional(), maxUses: z.string().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 CreatePaymentLinkError(v, { request: v.request$, response: v.response$, body: v.body$, }); }); /** @internal */ export type CreatePaymentLinkError$Outbound = { partnerAccountID?: string | undefined; merchantPaymentMethodID?: string | undefined; amount?: components.AmountValidationError$Outbound | undefined; salesTaxAmount?: components.AmountValidationError$Outbound | undefined; maxUses?: string | 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 CreatePaymentLinkError$outboundSchema: z.ZodType< CreatePaymentLinkError$Outbound, z.ZodTypeDef, CreatePaymentLinkError > = z.instanceof(CreatePaymentLinkError) .transform(v => v.data$) .pipe(z.object({ partnerAccountID: z.string().optional(), merchantPaymentMethodID: z.string().optional(), amount: components.AmountValidationError$outboundSchema.optional(), salesTaxAmount: components.AmountValidationError$outboundSchema.optional(), maxUses: z.string().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(), }));