/* * 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 LinkCardErrorData = { error?: string | undefined; e2ee?: components.End2EndEncryptionError | undefined; cardNumber?: string | undefined; cardCvv?: string | undefined; expiration?: string | undefined; holderName?: string | undefined; billingAddress?: string | undefined; cardOnFile?: string | undefined; merchantAccountID?: string | undefined; verifyName?: string | undefined; }; export class LinkCardError extends MoovError { error?: string | undefined; e2ee?: components.End2EndEncryptionError | undefined; cardNumber?: string | undefined; cardCvv?: string | undefined; expiration?: string | undefined; holderName?: string | undefined; billingAddress?: string | undefined; cardOnFile?: string | undefined; merchantAccountID?: string | undefined; verifyName?: string | undefined; /** The original data that was passed to this error instance. */ data$: LinkCardErrorData; constructor( err: LinkCardErrorData, 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.e2ee != null) this.e2ee = err.e2ee; if (err.cardNumber != null) this.cardNumber = err.cardNumber; if (err.cardCvv != null) this.cardCvv = err.cardCvv; if (err.expiration != null) this.expiration = err.expiration; if (err.holderName != null) this.holderName = err.holderName; if (err.billingAddress != null) this.billingAddress = err.billingAddress; if (err.cardOnFile != null) this.cardOnFile = err.cardOnFile; if (err.merchantAccountID != null) { this.merchantAccountID = err.merchantAccountID; } if (err.verifyName != null) this.verifyName = err.verifyName; this.name = "LinkCardError"; } } /** @internal */ export const LinkCardError$inboundSchema: z.ZodType< LinkCardError, z.ZodTypeDef, unknown > = z.object({ error: z.string().optional(), e2ee: components.End2EndEncryptionError$inboundSchema.optional(), cardNumber: z.string().optional(), cardCvv: z.string().optional(), expiration: z.string().optional(), holderName: z.string().optional(), billingAddress: z.string().optional(), cardOnFile: z.string().optional(), merchantAccountID: z.string().optional(), verifyName: z.string().optional(), request$: z.instanceof(Request), response$: z.instanceof(Response), body$: z.string(), }) .transform((v) => { return new LinkCardError(v, { request: v.request$, response: v.response$, body: v.body$, }); }); /** @internal */ export type LinkCardError$Outbound = { error?: string | undefined; e2ee?: components.End2EndEncryptionError$Outbound | undefined; cardNumber?: string | undefined; cardCvv?: string | undefined; expiration?: string | undefined; holderName?: string | undefined; billingAddress?: string | undefined; cardOnFile?: string | undefined; merchantAccountID?: string | undefined; verifyName?: string | undefined; }; /** @internal */ export const LinkCardError$outboundSchema: z.ZodType< LinkCardError$Outbound, z.ZodTypeDef, LinkCardError > = z.instanceof(LinkCardError) .transform(v => v.data$) .pipe(z.object({ error: z.string().optional(), e2ee: components.End2EndEncryptionError$outboundSchema.optional(), cardNumber: z.string().optional(), cardCvv: z.string().optional(), expiration: z.string().optional(), holderName: z.string().optional(), billingAddress: z.string().optional(), cardOnFile: z.string().optional(), merchantAccountID: z.string().optional(), verifyName: z.string().optional(), }));