/* * 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"; import { Transaction, Transaction$inboundSchema, Transaction$Outbound, Transaction$outboundSchema, } from "./transaction.js"; export enum PaymentResponseFinalizedTag { Finalized = "finalized", } export enum Status { Success = "success", } export type PaymentResponseFinalized = { dotTag: PaymentResponseFinalizedTag; id?: string | undefined; status: Status; transaction: Transaction; }; /** @internal */ export const PaymentResponseFinalizedTag$inboundSchema: z.ZodNativeEnum< typeof PaymentResponseFinalizedTag > = z.nativeEnum(PaymentResponseFinalizedTag); /** @internal */ export const PaymentResponseFinalizedTag$outboundSchema: z.ZodNativeEnum< typeof PaymentResponseFinalizedTag > = PaymentResponseFinalizedTag$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PaymentResponseFinalizedTag$ { /** @deprecated use `PaymentResponseFinalizedTag$inboundSchema` instead. */ export const inboundSchema = PaymentResponseFinalizedTag$inboundSchema; /** @deprecated use `PaymentResponseFinalizedTag$outboundSchema` instead. */ export const outboundSchema = PaymentResponseFinalizedTag$outboundSchema; } /** @internal */ export const Status$inboundSchema: z.ZodNativeEnum = z .nativeEnum(Status); /** @internal */ export const Status$outboundSchema: z.ZodNativeEnum = Status$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace Status$ { /** @deprecated use `Status$inboundSchema` instead. */ export const inboundSchema = Status$inboundSchema; /** @deprecated use `Status$outboundSchema` instead. */ export const outboundSchema = Status$outboundSchema; } /** @internal */ export const PaymentResponseFinalized$inboundSchema: z.ZodType< PaymentResponseFinalized, z.ZodTypeDef, unknown > = z.object({ ".tag": PaymentResponseFinalizedTag$inboundSchema, id: z.string().optional(), status: Status$inboundSchema, transaction: Transaction$inboundSchema, }).transform((v) => { return remap$(v, { ".tag": "dotTag", }); }); /** @internal */ export type PaymentResponseFinalized$Outbound = { ".tag": string; id?: string | undefined; status: string; transaction: Transaction$Outbound; }; /** @internal */ export const PaymentResponseFinalized$outboundSchema: z.ZodType< PaymentResponseFinalized$Outbound, z.ZodTypeDef, PaymentResponseFinalized > = z.object({ dotTag: PaymentResponseFinalizedTag$outboundSchema, id: z.string().optional(), status: Status$outboundSchema, transaction: Transaction$outboundSchema, }).transform((v) => { return remap$(v, { dotTag: ".tag", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PaymentResponseFinalized$ { /** @deprecated use `PaymentResponseFinalized$inboundSchema` instead. */ export const inboundSchema = PaymentResponseFinalized$inboundSchema; /** @deprecated use `PaymentResponseFinalized$outboundSchema` instead. */ export const outboundSchema = PaymentResponseFinalized$outboundSchema; /** @deprecated use `PaymentResponseFinalized$Outbound` instead. */ export type Outbound = PaymentResponseFinalized$Outbound; } export function paymentResponseFinalizedToJSON( paymentResponseFinalized: PaymentResponseFinalized, ): string { return JSON.stringify( PaymentResponseFinalized$outboundSchema.parse(paymentResponseFinalized), ); } export function paymentResponseFinalizedFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PaymentResponseFinalized$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PaymentResponseFinalized' from JSON`, ); }