/* * 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"; export enum PaymentActionRequestTag { Finalize = "finalize", } export type PaymentActionRequest = { dotTag: PaymentActionRequestTag; /** * Optional redirect result token required for an APM payment (excluding PayPal). */ redirectResult?: string | undefined; }; /** @internal */ export const PaymentActionRequestTag$inboundSchema: z.ZodNativeEnum< typeof PaymentActionRequestTag > = z.nativeEnum(PaymentActionRequestTag); /** @internal */ export const PaymentActionRequestTag$outboundSchema: z.ZodNativeEnum< typeof PaymentActionRequestTag > = PaymentActionRequestTag$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PaymentActionRequestTag$ { /** @deprecated use `PaymentActionRequestTag$inboundSchema` instead. */ export const inboundSchema = PaymentActionRequestTag$inboundSchema; /** @deprecated use `PaymentActionRequestTag$outboundSchema` instead. */ export const outboundSchema = PaymentActionRequestTag$outboundSchema; } /** @internal */ export const PaymentActionRequest$inboundSchema: z.ZodType< PaymentActionRequest, z.ZodTypeDef, unknown > = z.object({ ".tag": PaymentActionRequestTag$inboundSchema, redirect_result: z.string().optional(), }).transform((v) => { return remap$(v, { ".tag": "dotTag", "redirect_result": "redirectResult", }); }); /** @internal */ export type PaymentActionRequest$Outbound = { ".tag": string; redirect_result?: string | undefined; }; /** @internal */ export const PaymentActionRequest$outboundSchema: z.ZodType< PaymentActionRequest$Outbound, z.ZodTypeDef, PaymentActionRequest > = z.object({ dotTag: PaymentActionRequestTag$outboundSchema, redirectResult: z.string().optional(), }).transform((v) => { return remap$(v, { dotTag: ".tag", redirectResult: "redirect_result", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PaymentActionRequest$ { /** @deprecated use `PaymentActionRequest$inboundSchema` instead. */ export const inboundSchema = PaymentActionRequest$inboundSchema; /** @deprecated use `PaymentActionRequest$outboundSchema` instead. */ export const outboundSchema = PaymentActionRequest$outboundSchema; /** @deprecated use `PaymentActionRequest$Outbound` instead. */ export type Outbound = PaymentActionRequest$Outbound; } export function paymentActionRequestToJSON( paymentActionRequest: PaymentActionRequest, ): string { return JSON.stringify( PaymentActionRequest$outboundSchema.parse(paymentActionRequest), ); } export function paymentActionRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PaymentActionRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PaymentActionRequest' from JSON`, ); }