/* * 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"; /** * Specifies a partial amount to refund. * * @remarks * * This request body is optional, an empty body will issue a refund for the full amount of the original transfer. */ export type CreateRefund = { /** * Amount to refund in cents. If null, the original transfer's full amount will be refunded. */ amount?: number | undefined; }; /** @internal */ export const CreateRefund$inboundSchema: z.ZodType< CreateRefund, z.ZodTypeDef, unknown > = z.object({ amount: z.number().int().optional(), }); /** @internal */ export type CreateRefund$Outbound = { amount?: number | undefined; }; /** @internal */ export const CreateRefund$outboundSchema: z.ZodType< CreateRefund$Outbound, z.ZodTypeDef, CreateRefund > = z.object({ amount: z.number().int().optional(), }); export function createRefundToJSON(createRefund: CreateRefund): string { return JSON.stringify(CreateRefund$outboundSchema.parse(createRefund)); } export function createRefundFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreateRefund$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateRefund' from JSON`, ); }