/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Indicates the status of the Refund. */ export const RefundStatus = { Queued: "QUEUED", Pending: "PENDING", Success: "SUCCESS", Error: "ERROR", } as const; /** * Indicates the status of the Refund. */ export type RefundStatus = ClosedEnum; export type Refund = { /** * Date and time of object creation. */ objectCreated?: Date | undefined; /** * Unique identifier of the given object. */ objectId?: string | undefined; /** * Username of the user who created the object. */ objectOwner?: string | undefined; /** * Date and time of last object update. */ objectUpdated?: Date | undefined; /** * Indicates the status of the Refund. */ status?: RefundStatus | undefined; /** * Indicates whether the object has been created in test mode. */ test?: boolean | undefined; /** * Object ID of the Transaction to be refunded. */ transaction?: string | undefined; }; /** @internal */ export const RefundStatus$inboundSchema: z.ZodMiniEnum = z .enum(RefundStatus); /** @internal */ export const Refund$inboundSchema: z.ZodMiniType = z.pipe( z.object({ object_created: z.optional( z.pipe(z.iso.datetime({ offset: true }), z.transform(v => new Date(v))), ), object_id: z.optional(z.string()), object_owner: z.optional(z.string()), object_updated: z.optional( z.pipe(z.iso.datetime({ offset: true }), z.transform(v => new Date(v))), ), status: z.optional(RefundStatus$inboundSchema), test: z.optional(z.boolean()), transaction: z.optional(z.string()), }), z.transform((v) => { return remap$(v, { "object_created": "objectCreated", "object_id": "objectId", "object_owner": "objectOwner", "object_updated": "objectUpdated", }); }), ); export function refundFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Refund$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Refund' from JSON`, ); }