/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { MoovError } from "./mooverror.js"; export type LinkApplePayErrorData = { /** * Describes an error that wasn't attributable to a single request field. */ error?: string | undefined; /** * Describes an error within the `token.paymentData` request field. */ paymentData?: string | undefined; /** * Describes an error within the `token.paymentMethod` request field. */ paymentMethod?: string | undefined; /** * Describes an error within the `token.transactionIdentifier` request field. */ transactionIdentifier?: string | undefined; }; export class LinkApplePayError extends MoovError { /** * Describes an error that wasn't attributable to a single request field. */ error?: string | undefined; /** * Describes an error within the `token.paymentData` request field. */ paymentData?: string | undefined; /** * Describes an error within the `token.paymentMethod` request field. */ paymentMethod?: string | undefined; /** * Describes an error within the `token.transactionIdentifier` request field. */ transactionIdentifier?: string | undefined; /** The original data that was passed to this error instance. */ data$: LinkApplePayErrorData; constructor( err: LinkApplePayErrorData, 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.error != null) this.error = err.error; if (err.paymentData != null) this.paymentData = err.paymentData; if (err.paymentMethod != null) this.paymentMethod = err.paymentMethod; if (err.transactionIdentifier != null) { this.transactionIdentifier = err.transactionIdentifier; } this.name = "LinkApplePayError"; } } /** @internal */ export const LinkApplePayError$inboundSchema: z.ZodType< LinkApplePayError, z.ZodTypeDef, unknown > = z.object({ error: z.string().optional(), paymentData: z.string().optional(), paymentMethod: z.string().optional(), transactionIdentifier: z.string().optional(), request$: z.instanceof(Request), response$: z.instanceof(Response), body$: z.string(), }) .transform((v) => { return new LinkApplePayError(v, { request: v.request$, response: v.response$, body: v.body$, }); }); /** @internal */ export type LinkApplePayError$Outbound = { error?: string | undefined; paymentData?: string | undefined; paymentMethod?: string | undefined; transactionIdentifier?: string | undefined; }; /** @internal */ export const LinkApplePayError$outboundSchema: z.ZodType< LinkApplePayError$Outbound, z.ZodTypeDef, LinkApplePayError > = z.instanceof(LinkApplePayError) .transform(v => v.data$) .pipe(z.object({ error: z.string().optional(), paymentData: z.string().optional(), paymentMethod: z.string().optional(), transactionIdentifier: z.string().optional(), }));