/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { SDKValidationError } from "./sdk-validation-error.js"; import { WebhookDtoCheckoutSession, WebhookDtoCheckoutSession$inboundSchema, } from "./webhook-dto-checkout-session.js"; import { WebhookEventName, WebhookEventName$inboundSchema, } from "./webhook-event-name.js"; export type WebhookDtoCheckoutSessionWebhookPayload = { checkoutSession?: WebhookDtoCheckoutSession | undefined; eventType?: WebhookEventName | undefined; }; /** @internal */ export const WebhookDtoCheckoutSessionWebhookPayload$inboundSchema: z.ZodMiniType = z.pipe( z.object({ checkout_session: types.optional(WebhookDtoCheckoutSession$inboundSchema), event_type: types.optional(WebhookEventName$inboundSchema), }), z.transform((v) => { return remap$(v, { "checkout_session": "checkoutSession", "event_type": "eventType", }); }), ); export function webhookDtoCheckoutSessionWebhookPayloadFromJSON( jsonString: string, ): SafeParseResult< WebhookDtoCheckoutSessionWebhookPayload, SDKValidationError > { return safeParse( jsonString, (x) => WebhookDtoCheckoutSessionWebhookPayload$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'WebhookDtoCheckoutSessionWebhookPayload' from JSON`, ); }