/* * 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 { ForterAntiFraudOptionsDiscountCouponDiscountAmount, ForterAntiFraudOptionsDiscountCouponDiscountAmount$Outbound, ForterAntiFraudOptionsDiscountCouponDiscountAmount$outboundSchema, } from "./forterantifraudoptionsdiscountcoupondiscountamount.js"; export type ForterAntiFraudOptionsDiscount = { /** * The coupon code applied to the order. */ couponCodeUsed: string; /** * The type of discount applied to the order. */ discountType: string; /** * Monetary details of the discount amount. */ couponDiscountAmount?: | ForterAntiFraudOptionsDiscountCouponDiscountAmount | null | undefined; /** * The percentage discount applied via the coupon. */ couponDiscountPercent?: string | null | undefined; }; /** @internal */ export type ForterAntiFraudOptionsDiscount$Outbound = { coupon_code_used: string; discount_type: string; coupon_discount_amount?: | ForterAntiFraudOptionsDiscountCouponDiscountAmount$Outbound | null | undefined; coupon_discount_percent?: string | null | undefined; }; /** @internal */ export const ForterAntiFraudOptionsDiscount$outboundSchema: z.ZodType< ForterAntiFraudOptionsDiscount$Outbound, z.ZodTypeDef, ForterAntiFraudOptionsDiscount > = z.object({ couponCodeUsed: z.string(), discountType: z.string(), couponDiscountAmount: z.nullable( ForterAntiFraudOptionsDiscountCouponDiscountAmount$outboundSchema, ).optional(), couponDiscountPercent: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { couponCodeUsed: "coupon_code_used", discountType: "discount_type", couponDiscountAmount: "coupon_discount_amount", couponDiscountPercent: "coupon_discount_percent", }); }); export function forterAntiFraudOptionsDiscountToJSON( forterAntiFraudOptionsDiscount: ForterAntiFraudOptionsDiscount, ): string { return JSON.stringify( ForterAntiFraudOptionsDiscount$outboundSchema.parse( forterAntiFraudOptionsDiscount, ), ); }