/* * 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 * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { ForterAntiFraudOptionsCartItem, ForterAntiFraudOptionsCartItem$Outbound, ForterAntiFraudOptionsCartItem$outboundSchema, } from "./forterantifraudoptionscartitem.js"; import { ForterAntiFraudOptionsDiscount, ForterAntiFraudOptionsDiscount$Outbound, ForterAntiFraudOptionsDiscount$outboundSchema, } from "./forterantifraudoptionsdiscount.js"; export const DeliveryType = { Digital: "DIGITAL", Physical: "PHYSICAL", Hybrid: "HYBRID", } as const; export type DeliveryType = OpenEnum; export type ForterAntiFraudOptions = { /** * The delivery type */ deliveryType?: DeliveryType | null | undefined; /** * The delivery method */ deliveryMethod?: string | null | undefined; /** * Defines if this payment is made using guest checkout. */ isGuestBuyer?: boolean | null | undefined; /** * A list of cart items details to pass to the Forter API. */ cartItems?: Array | null | undefined; /** * Information about the discount applied to this order. */ totalDiscount?: ForterAntiFraudOptionsDiscount | null | undefined; }; /** @internal */ export const DeliveryType$outboundSchema: z.ZodType< string, z.ZodTypeDef, DeliveryType > = openEnums.outboundSchema(DeliveryType); /** @internal */ export type ForterAntiFraudOptions$Outbound = { delivery_type?: string | null | undefined; delivery_method?: string | null | undefined; is_guest_buyer?: boolean | null | undefined; cart_items?: | Array | null | undefined; total_discount?: ForterAntiFraudOptionsDiscount$Outbound | null | undefined; }; /** @internal */ export const ForterAntiFraudOptions$outboundSchema: z.ZodType< ForterAntiFraudOptions$Outbound, z.ZodTypeDef, ForterAntiFraudOptions > = z.object({ deliveryType: z.nullable(DeliveryType$outboundSchema).optional(), deliveryMethod: z.nullable(z.string()).optional(), isGuestBuyer: z.nullable(z.boolean()).optional(), cartItems: z.nullable(z.array(ForterAntiFraudOptionsCartItem$outboundSchema)) .optional(), totalDiscount: z.nullable(ForterAntiFraudOptionsDiscount$outboundSchema) .optional(), }).transform((v) => { return remap$(v, { deliveryType: "delivery_type", deliveryMethod: "delivery_method", isGuestBuyer: "is_guest_buyer", cartItems: "cart_items", totalDiscount: "total_discount", }); }); export function forterAntiFraudOptionsToJSON( forterAntiFraudOptions: ForterAntiFraudOptions, ): string { return JSON.stringify( ForterAntiFraudOptions$outboundSchema.parse(forterAntiFraudOptions), ); }