/* * 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 { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { PaymentProcessor, PaymentProcessor$inboundSchema, } from "./paymentprocessor.js"; export type PaymentMethodGeneric = { /** * The ID of the object. */ id: string; /** * Creation timestamp of the object. */ createdAt: Date; /** * Last modification timestamp of the object. */ modifiedAt: Date | null; processor: PaymentProcessor; customerId: string; type: string; }; /** @internal */ export const PaymentMethodGeneric$inboundSchema: z.ZodMiniType< PaymentMethodGeneric, unknown > = z.pipe( z.object({ id: z.string(), created_at: z.pipe( z.iso.datetime({ offset: true }), z.transform(v => new Date(v)), ), modified_at: z.nullable( z.pipe(z.iso.datetime({ offset: true }), z.transform(v => new Date(v))), ), processor: PaymentProcessor$inboundSchema, customer_id: z.string(), type: z.string(), }), z.transform((v) => { return remap$(v, { "created_at": "createdAt", "modified_at": "modifiedAt", "customer_id": "customerId", }); }), ); export function paymentMethodGenericFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PaymentMethodGeneric$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PaymentMethodGeneric' from JSON`, ); }