/* * 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"; /** * A wallet represents your balance with an organization. * * @remarks * * You can top-up your wallet and use the balance to pay for usage. */ export type CustomerWallet = { /** * The ID of the object. */ id: string; /** * Creation timestamp of the object. */ createdAt: Date; /** * Last modification timestamp of the object. */ modifiedAt: Date | null; /** * The ID of the customer that owns the wallet. */ customerId: string; /** * The current balance of the wallet, in cents. */ balance: number; /** * The currency of the wallet. */ currency: string; }; /** @internal */ export const CustomerWallet$inboundSchema: z.ZodMiniType< CustomerWallet, 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))), ), customer_id: z.string(), balance: z.int(), currency: z.string(), }), z.transform((v) => { return remap$(v, { "created_at": "createdAt", "modified_at": "modifiedAt", "customer_id": "customerId", }); }), ); export function customerWalletFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CustomerWallet$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CustomerWallet' from JSON`, ); }