/* * 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 { PaymentDestinationType, PaymentDestinationType$inboundSchema, } from "./payment-destination-type.js"; import { PaymentMethodType, PaymentMethodType$inboundSchema, } from "./payment-method-type.js"; import { PaymentStatus, PaymentStatus$inboundSchema, } from "./payment-status.js"; import { SDKValidationError } from "./sdk-validation-error.js"; export type WebhookDtoPayment = { amount?: string | undefined; currency?: string | undefined; destinationId?: string | undefined; destinationType?: PaymentDestinationType | undefined; errorMessage?: string | undefined; failedAt?: Date | undefined; id?: string | undefined; invoiceNumber?: string | undefined; paymentGateway?: string | undefined; paymentMethodType?: PaymentMethodType | undefined; paymentStatus?: PaymentStatus | undefined; refundedAt?: Date | undefined; succeededAt?: Date | undefined; voidedAt?: Date | undefined; }; /** @internal */ export const WebhookDtoPayment$inboundSchema: z.ZodMiniType< WebhookDtoPayment, unknown > = z.pipe( z.object({ amount: types.optional(types.string()), currency: types.optional(types.string()), destination_id: types.optional(types.string()), destination_type: types.optional(PaymentDestinationType$inboundSchema), error_message: types.optional(types.string()), failed_at: types.optional(types.date()), id: types.optional(types.string()), invoice_number: types.optional(types.string()), payment_gateway: types.optional(types.string()), payment_method_type: types.optional(PaymentMethodType$inboundSchema), payment_status: types.optional(PaymentStatus$inboundSchema), refunded_at: types.optional(types.date()), succeeded_at: types.optional(types.date()), voided_at: types.optional(types.date()), }), z.transform((v) => { return remap$(v, { "destination_id": "destinationId", "destination_type": "destinationType", "error_message": "errorMessage", "failed_at": "failedAt", "invoice_number": "invoiceNumber", "payment_gateway": "paymentGateway", "payment_method_type": "paymentMethodType", "payment_status": "paymentStatus", "refunded_at": "refundedAt", "succeeded_at": "succeededAt", "voided_at": "voidedAt", }); }), ); export function webhookDtoPaymentFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => WebhookDtoPayment$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'WebhookDtoPayment' from JSON`, ); }