/* * 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 { ThreeDSecureDataV1, ThreeDSecureDataV1$inboundSchema, } from "./threedsecuredatav1.js"; import { ThreeDSecureError, ThreeDSecureError$inboundSchema, } from "./threedsecureerror.js"; import { ThreeDSecureMethod, ThreeDSecureMethod$inboundSchema, } from "./threedsecuremethod.js"; import { ThreeDSecureStatus, ThreeDSecureStatus$inboundSchema, } from "./threedsecurestatus.js"; import { ThreeDSecureV2, ThreeDSecureV2$inboundSchema, } from "./threedsecurev2.js"; /** * The 3DS data sent to the payment service for this transaction. This will only be populated if external 3DS data was passed in directly as part of the transaction API call, or if our 3DS server returned a status code of `Y` or `A`. In case of a failure to authenticate (status `N`, `R`, or `U`) this field will not be populated. To see full details about the 3DS calls please use our transaction events API. */ export type ResponseData = ThreeDSecureDataV1 | ThreeDSecureV2; export type TransactionThreeDSecureSummary = { /** * The version of 3DS used for this transaction. */ version?: string | null | undefined; /** * The status of the 3DS challenge for this transaction. */ status?: ThreeDSecureStatus | null | undefined; /** * The method used for 3DS authentication for this transaction. */ method?: ThreeDSecureMethod | null | undefined; /** * The 3DS data sent to the payment service for this transaction. This will only be populated if external 3DS data was passed in directly as part of the transaction API call, or if our 3DS server returned a status code of `Y` or `A`. In case of a failure to authenticate (status `N`, `R`, or `U`) this field will not be populated. To see full details about the 3DS calls please use our transaction events API. */ responseData?: ThreeDSecureDataV1 | ThreeDSecureV2 | null | undefined; /** * The error data received from our 3DS server. This will not be populated if the customer failed the authentication with a status code of `N`, `R`, or `U`. To see full details about the 3DS calls in those situations please use our transaction events API. */ errorData?: ThreeDSecureError | null | undefined; /** * The amount used for 3DS authentication. */ amount?: number | null | undefined; }; /** @internal */ export const ResponseData$inboundSchema: z.ZodType< ResponseData, z.ZodTypeDef, unknown > = z.union([ThreeDSecureDataV1$inboundSchema, ThreeDSecureV2$inboundSchema]); export function responseDataFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ResponseData$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseData' from JSON`, ); } /** @internal */ export const TransactionThreeDSecureSummary$inboundSchema: z.ZodType< TransactionThreeDSecureSummary, z.ZodTypeDef, unknown > = z.object({ version: z.nullable(z.string()).optional(), status: z.nullable(ThreeDSecureStatus$inboundSchema).optional(), method: z.nullable(ThreeDSecureMethod$inboundSchema).optional(), response_data: z.nullable( z.union([ThreeDSecureDataV1$inboundSchema, ThreeDSecureV2$inboundSchema]), ).optional(), error_data: z.nullable(ThreeDSecureError$inboundSchema).optional(), amount: z.nullable(z.number().int()).optional(), }).transform((v) => { return remap$(v, { "response_data": "responseData", "error_data": "errorData", }); }); export function transactionThreeDSecureSummaryFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => TransactionThreeDSecureSummary$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TransactionThreeDSecureSummary' from JSON`, ); }