/* * 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 { ReversedWithCancellation, ReversedWithCancellation$inboundSchema, ReversedWithCancellation$Outbound, ReversedWithCancellation$outboundSchema, } from "./reversedwithcancellation.js"; import { ReversedWithRefund, ReversedWithRefund$inboundSchema, ReversedWithRefund$Outbound, ReversedWithRefund$outboundSchema, } from "./reversedwithrefund.js"; /** * Contains either a cancellation or refund, depending on the method used to reverse the transfer. */ export type Reversal = ReversedWithCancellation | ReversedWithRefund; /** @internal */ export const Reversal$inboundSchema: z.ZodType< Reversal, z.ZodTypeDef, unknown > = z.union([ ReversedWithCancellation$inboundSchema, ReversedWithRefund$inboundSchema, ]); /** @internal */ export type Reversal$Outbound = | ReversedWithCancellation$Outbound | ReversedWithRefund$Outbound; /** @internal */ export const Reversal$outboundSchema: z.ZodType< Reversal$Outbound, z.ZodTypeDef, Reversal > = z.union([ ReversedWithCancellation$outboundSchema, ReversedWithRefund$outboundSchema, ]); export function reversalToJSON(reversal: Reversal): string { return JSON.stringify(Reversal$outboundSchema.parse(reversal)); } export function reversalFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Reversal$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Reversal' from JSON`, ); }