/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Cart, Cart$inboundSchema, Cart$Outbound, Cart$outboundSchema, } from "./cart.js"; import { PaymentMethodInput, PaymentMethodInput$inboundSchema, PaymentMethodInput$Outbound, PaymentMethodInput$outboundSchema, } from "./paymentmethodinput.js"; import { ProfileCreationData, ProfileCreationData$inboundSchema, ProfileCreationData$Outbound, ProfileCreationData$outboundSchema, } from "./profilecreationdata.js"; export type GuestPaymentInitializeRequest = { profile: ProfileCreationData; cart: Cart; paymentMethod: PaymentMethodInput; }; /** @internal */ export const GuestPaymentInitializeRequest$inboundSchema: z.ZodType< GuestPaymentInitializeRequest, z.ZodTypeDef, unknown > = z.object({ profile: ProfileCreationData$inboundSchema, cart: Cart$inboundSchema, payment_method: PaymentMethodInput$inboundSchema, }).transform((v) => { return remap$(v, { "payment_method": "paymentMethod", }); }); /** @internal */ export type GuestPaymentInitializeRequest$Outbound = { profile: ProfileCreationData$Outbound; cart: Cart$Outbound; payment_method: PaymentMethodInput$Outbound; }; /** @internal */ export const GuestPaymentInitializeRequest$outboundSchema: z.ZodType< GuestPaymentInitializeRequest$Outbound, z.ZodTypeDef, GuestPaymentInitializeRequest > = z.object({ profile: ProfileCreationData$outboundSchema, cart: Cart$outboundSchema, paymentMethod: PaymentMethodInput$outboundSchema, }).transform((v) => { return remap$(v, { paymentMethod: "payment_method", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace GuestPaymentInitializeRequest$ { /** @deprecated use `GuestPaymentInitializeRequest$inboundSchema` instead. */ export const inboundSchema = GuestPaymentInitializeRequest$inboundSchema; /** @deprecated use `GuestPaymentInitializeRequest$outboundSchema` instead. */ export const outboundSchema = GuestPaymentInitializeRequest$outboundSchema; /** @deprecated use `GuestPaymentInitializeRequest$Outbound` instead. */ export type Outbound = GuestPaymentInitializeRequest$Outbound; } export function guestPaymentInitializeRequestToJSON( guestPaymentInitializeRequest: GuestPaymentInitializeRequest, ): string { return JSON.stringify( GuestPaymentInitializeRequest$outboundSchema.parse( guestPaymentInitializeRequest, ), ); } export function guestPaymentInitializeRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GuestPaymentInitializeRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GuestPaymentInitializeRequest' from JSON`, ); }