/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { AccountNameVerification, AccountNameVerification$inboundSchema, AccountNameVerification$Outbound, AccountNameVerification$outboundSchema, } from "./accountnameverification.js"; import { CardVerificationResult, CardVerificationResult$inboundSchema, CardVerificationResult$outboundSchema, } from "./cardverificationresult.js"; /** * The results of submitting cardholder data to a card network for verification. */ export type CardVerification = { cvv: CardVerificationResult; addressLine1: CardVerificationResult; postalCode: CardVerificationResult; /** * The results of submitting cardholder name to a card network for verification. */ accountName?: AccountNameVerification | undefined; }; /** @internal */ export const CardVerification$inboundSchema: z.ZodType< CardVerification, z.ZodTypeDef, unknown > = z.object({ cvv: CardVerificationResult$inboundSchema, addressLine1: CardVerificationResult$inboundSchema, postalCode: CardVerificationResult$inboundSchema, accountName: AccountNameVerification$inboundSchema.optional(), }); /** @internal */ export type CardVerification$Outbound = { cvv: string; addressLine1: string; postalCode: string; accountName?: AccountNameVerification$Outbound | undefined; }; /** @internal */ export const CardVerification$outboundSchema: z.ZodType< CardVerification$Outbound, z.ZodTypeDef, CardVerification > = z.object({ cvv: CardVerificationResult$outboundSchema, addressLine1: CardVerificationResult$outboundSchema, postalCode: CardVerificationResult$outboundSchema, accountName: AccountNameVerification$outboundSchema.optional(), }); export function cardVerificationToJSON( cardVerification: CardVerification, ): string { return JSON.stringify( CardVerification$outboundSchema.parse(cardVerification), ); } export function cardVerificationFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CardVerification$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CardVerification' from JSON`, ); }