/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { AsyncCreatedRefund, AsyncCreatedRefund$inboundSchema, AsyncCreatedRefund$Outbound, AsyncCreatedRefund$outboundSchema, } from "./asynccreatedrefund.js"; import { CardAcquiringRefund, CardAcquiringRefund$inboundSchema, CardAcquiringRefund$Outbound, CardAcquiringRefund$outboundSchema, } from "./cardacquiringrefund.js"; export type CreateRefundResponse = CardAcquiringRefund | AsyncCreatedRefund; /** @internal */ export const CreateRefundResponse$inboundSchema: z.ZodType< CreateRefundResponse, z.ZodTypeDef, unknown > = z.union([ CardAcquiringRefund$inboundSchema, AsyncCreatedRefund$inboundSchema, ]); /** @internal */ export type CreateRefundResponse$Outbound = | CardAcquiringRefund$Outbound | AsyncCreatedRefund$Outbound; /** @internal */ export const CreateRefundResponse$outboundSchema: z.ZodType< CreateRefundResponse$Outbound, z.ZodTypeDef, CreateRefundResponse > = z.union([ CardAcquiringRefund$outboundSchema, AsyncCreatedRefund$outboundSchema, ]); export function createRefundResponseToJSON( createRefundResponse: CreateRefundResponse, ): string { return JSON.stringify( CreateRefundResponse$outboundSchema.parse(createRefundResponse), ); } export function createRefundResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreateRefundResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateRefundResponse' from JSON`, ); }