/* * 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 { CheckoutAction, CheckoutAction$inboundSchema, } from "./checkout-action.js"; import { CheckoutPaymentProvider, CheckoutPaymentProvider$inboundSchema, } from "./checkout-payment-provider.js"; import { CheckoutStatus, CheckoutStatus$inboundSchema, } from "./checkout-status.js"; import { PaymentAction, PaymentAction$inboundSchema, } from "./payment-action.js"; import { SDKValidationError } from "./sdk-validation-error.js"; export type WebhookDtoCheckoutSession = { action?: CheckoutAction | undefined; cancelledAt?: Date | undefined; checkoutInvoiceId?: string | undefined; checkoutPaymentId?: string | undefined; checkoutStatus?: CheckoutStatus | undefined; completedAt?: Date | undefined; customerId?: string | undefined; expiresAt?: Date | undefined; failureReason?: string | undefined; id?: string | undefined; paymentAction?: PaymentAction | undefined; paymentProvider?: CheckoutPaymentProvider | undefined; }; /** @internal */ export const WebhookDtoCheckoutSession$inboundSchema: z.ZodMiniType< WebhookDtoCheckoutSession, unknown > = z.pipe( z.object({ action: types.optional(CheckoutAction$inboundSchema), cancelled_at: types.optional(types.date()), checkout_invoice_id: types.optional(types.string()), checkout_payment_id: types.optional(types.string()), checkout_status: types.optional(CheckoutStatus$inboundSchema), completed_at: types.optional(types.date()), customer_id: types.optional(types.string()), expires_at: types.optional(types.date()), failure_reason: types.optional(types.string()), id: types.optional(types.string()), payment_action: types.optional(PaymentAction$inboundSchema), payment_provider: types.optional(CheckoutPaymentProvider$inboundSchema), }), z.transform((v) => { return remap$(v, { "cancelled_at": "cancelledAt", "checkout_invoice_id": "checkoutInvoiceId", "checkout_payment_id": "checkoutPaymentId", "checkout_status": "checkoutStatus", "completed_at": "completedAt", "customer_id": "customerId", "expires_at": "expiresAt", "failure_reason": "failureReason", "payment_action": "paymentAction", "payment_provider": "paymentProvider", }); }), ); export function webhookDtoCheckoutSessionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => WebhookDtoCheckoutSession$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'WebhookDtoCheckoutSession' from JSON`, ); }