/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; 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"; /** * Raw authorization response from the payment processor */ export type ProcessorResponse = { contentType?: string | undefined; apiVersion?: string | undefined; text?: string | undefined; }; /** @internal */ export const ProcessorResponse$inboundSchema: z.ZodType< ProcessorResponse, z.ZodTypeDef, unknown > = z.object({ content_type: z.string().optional(), api_version: z.string().optional(), text: z.string().optional(), }).transform((v) => { return remap$(v, { "content_type": "contentType", "api_version": "apiVersion", }); }); /** @internal */ export type ProcessorResponse$Outbound = { content_type?: string | undefined; api_version?: string | undefined; text?: string | undefined; }; /** @internal */ export const ProcessorResponse$outboundSchema: z.ZodType< ProcessorResponse$Outbound, z.ZodTypeDef, ProcessorResponse > = z.object({ contentType: z.string().optional(), apiVersion: z.string().optional(), text: z.string().optional(), }).transform((v) => { return remap$(v, { contentType: "content_type", apiVersion: "api_version", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace ProcessorResponse$ { /** @deprecated use `ProcessorResponse$inboundSchema` instead. */ export const inboundSchema = ProcessorResponse$inboundSchema; /** @deprecated use `ProcessorResponse$outboundSchema` instead. */ export const outboundSchema = ProcessorResponse$outboundSchema; /** @deprecated use `ProcessorResponse$Outbound` instead. */ export type Outbound = ProcessorResponse$Outbound; } export function processorResponseToJSON( processorResponse: ProcessorResponse, ): string { return JSON.stringify( ProcessorResponse$outboundSchema.parse(processorResponse), ); } export function processorResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ProcessorResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ProcessorResponse' from JSON`, ); }