/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; 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"; /** * An object representing a discount applied to an ecommerce order or product. */ export type EcommerceDiscount = { /** * The code used to apply the discount. */ code?: string | null | undefined; /** * The fixed amount of the discount. */ amount?: string | null | undefined; /** * The percentage of the discount. */ percentage?: string | null | undefined; }; /** @internal */ export const EcommerceDiscount$inboundSchema: z.ZodType< EcommerceDiscount, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ code: z.nullable(types.string()).optional(), amount: z.nullable(types.string()).optional(), percentage: z.nullable(types.string()).optional(), }) ); export function ecommerceDiscountFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => EcommerceDiscount$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'EcommerceDiscount' from JSON`, ); }