/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { lazySchema as lazySchema$, safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Currency, Currency$inboundSchema } from "./currency.js"; /** * A refund for an ecommerce order. */ export type EcommerceOrderRefund = { /** * A unique identifier for an object. */ id?: string | null | undefined; /** * The amount of the refund. */ amount?: string | undefined; /** * Indicates the associated currency for an amount of money. Values correspond to [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217). */ currency?: Currency | null | undefined; /** * The reason for the refund. */ reason?: string | undefined; /** * The date and time when the object was created. */ createdAt?: Date | null | undefined; }; /** @internal */ export const EcommerceOrderRefund$inboundSchema: z.ZodType< EcommerceOrderRefund, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ id: z.nullable(types.string()).optional(), amount: types.optional(types.string()), currency: z.nullable(Currency$inboundSchema).optional(), reason: types.optional(types.string()), created_at: z.nullable(types.date()).optional(), }).transform((v) => { return remap$(v, { "created_at": "createdAt", }); }) ); export function ecommerceOrderRefundFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => EcommerceOrderRefund$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'EcommerceOrderRefund' from JSON`, ); }