/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Refund, Refund$inboundSchema, Refund$Outbound, Refund$outboundSchema, } from "./refund.js"; /** * Sent when a refund is created regardless of status. * * @remarks * * **Discord & Slack support:** Full */ export type WebhookRefundCreatedPayload = { type: "refund.created"; timestamp: Date; data: Refund; }; /** @internal */ export const WebhookRefundCreatedPayload$inboundSchema: z.ZodMiniType< WebhookRefundCreatedPayload, unknown > = z.object({ type: z.literal("refund.created"), timestamp: z.pipe( z.iso.datetime({ offset: true }), z.transform(v => new Date(v)), ), data: Refund$inboundSchema, }); /** @internal */ export type WebhookRefundCreatedPayload$Outbound = { type: "refund.created"; timestamp: string; data: Refund$Outbound; }; /** @internal */ export const WebhookRefundCreatedPayload$outboundSchema: z.ZodMiniType< WebhookRefundCreatedPayload$Outbound, WebhookRefundCreatedPayload > = z.object({ type: z.literal("refund.created"), timestamp: z.pipe(z.date(), z.transform(v => v.toISOString())), data: Refund$outboundSchema, }); export function webhookRefundCreatedPayloadToJSON( webhookRefundCreatedPayload: WebhookRefundCreatedPayload, ): string { return JSON.stringify( WebhookRefundCreatedPayload$outboundSchema.parse( webhookRefundCreatedPayload, ), ); } export function webhookRefundCreatedPayloadFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => WebhookRefundCreatedPayload$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'WebhookRefundCreatedPayload' from JSON`, ); }