/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { CardScheme, CardScheme$inboundSchema, CardScheme$outboundSchema, } from "./cardscheme.js"; export type ThreeDSecureDataV1 = { /** * The cardholder authentication value or AAV. */ cavv: string; /** * The ecommerce indicator for the 3DS transaction. */ eci: string; /** * The version of 3-D Secure that was used. */ version: string; /** * For 3-D Secure version 1, the enrolment response. For 3-D Secure version 2 and above, the transaction status from the `ARes`. */ directoryResponse: string; /** * The scheme/brand of the card that is used for 3-D Secure. */ scheme?: CardScheme | null | undefined; /** * The response for the 3DS authentication call. */ authenticationResponse: string; /** * The CAVV algorithm used. */ cavvAlgorithm: string; /** * The transaction identifier. */ xid: string; }; /** @internal */ export const ThreeDSecureDataV1$inboundSchema: z.ZodType< ThreeDSecureDataV1, z.ZodTypeDef, unknown > = z.object({ cavv: z.string(), eci: z.string(), version: z.string(), directory_response: z.string(), scheme: z.nullable(CardScheme$inboundSchema).optional(), authentication_response: z.string(), cavv_algorithm: z.string(), xid: z.string(), }).transform((v) => { return remap$(v, { "directory_response": "directoryResponse", "authentication_response": "authenticationResponse", "cavv_algorithm": "cavvAlgorithm", }); }); /** @internal */ export type ThreeDSecureDataV1$Outbound = { cavv: string; eci: string; version: string; directory_response: string; scheme?: string | null | undefined; authentication_response: string; cavv_algorithm: string; xid: string; }; /** @internal */ export const ThreeDSecureDataV1$outboundSchema: z.ZodType< ThreeDSecureDataV1$Outbound, z.ZodTypeDef, ThreeDSecureDataV1 > = z.object({ cavv: z.string(), eci: z.string(), version: z.string(), directoryResponse: z.string(), scheme: z.nullable(CardScheme$outboundSchema).optional(), authenticationResponse: z.string(), cavvAlgorithm: z.string(), xid: z.string(), }).transform((v) => { return remap$(v, { directoryResponse: "directory_response", authenticationResponse: "authentication_response", cavvAlgorithm: "cavv_algorithm", }); }); export function threeDSecureDataV1ToJSON( threeDSecureDataV1: ThreeDSecureDataV1, ): string { return JSON.stringify( ThreeDSecureDataV1$outboundSchema.parse(threeDSecureDataV1), ); } export function threeDSecureDataV1FromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ThreeDSecureDataV1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ThreeDSecureDataV1' from JSON`, ); }