/* * 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 { smartUnion } from "../../types/smartUnion.js"; import { AddressInput, AddressInput$Outbound, AddressInput$outboundSchema, } from "./addressinput.js"; import { MemberOwnerCreate, MemberOwnerCreate$Outbound, MemberOwnerCreate$outboundSchema, } from "./memberownercreate.js"; export type CustomerIndividualCreateMetadata = | string | number | number | boolean; export type CustomerIndividualCreate = { /** * Key-value object allowing you to store additional information. * * @remarks * * The key must be a string with a maximum length of **40 characters**. * The value must be either: * * * A string with a maximum length of **500 characters** * * An integer * * A floating-point number * * A boolean * * You can store up to **50 key-value pairs**. */ metadata?: { [k: string]: string | number | number | boolean } | undefined; /** * The ID of the customer in your system. This must be unique within the organization. Once set, it can't be updated. */ externalId?: string | null | undefined; name?: string | null | undefined; billingAddress?: AddressInput | null | undefined; taxId?: string | null | undefined; locale?: string | null | undefined; /** * The ID of the organization owning the customer. **Required unless you use an organization token.** */ organizationId?: string | null | undefined; /** * Optional owner member to create with the customer. If not provided, an owner member will be automatically created using the customer's email and name. */ owner?: MemberOwnerCreate | null | undefined; type?: "individual" | undefined; /** * The email address of the customer. This must be unique within the organization. */ email: string; }; /** @internal */ export type CustomerIndividualCreateMetadata$Outbound = | string | number | number | boolean; /** @internal */ export const CustomerIndividualCreateMetadata$outboundSchema: z.ZodMiniType< CustomerIndividualCreateMetadata$Outbound, CustomerIndividualCreateMetadata > = smartUnion([z.string(), z.int(), z.number(), z.boolean()]); export function customerIndividualCreateMetadataToJSON( customerIndividualCreateMetadata: CustomerIndividualCreateMetadata, ): string { return JSON.stringify( CustomerIndividualCreateMetadata$outboundSchema.parse( customerIndividualCreateMetadata, ), ); } /** @internal */ export type CustomerIndividualCreate$Outbound = { metadata?: { [k: string]: string | number | number | boolean } | undefined; external_id?: string | null | undefined; name?: string | null | undefined; billing_address?: AddressInput$Outbound | null | undefined; tax_id?: string | null | undefined; locale?: string | null | undefined; organization_id?: string | null | undefined; owner?: MemberOwnerCreate$Outbound | null | undefined; type: "individual"; email: string; }; /** @internal */ export const CustomerIndividualCreate$outboundSchema: z.ZodMiniType< CustomerIndividualCreate$Outbound, CustomerIndividualCreate > = z.pipe( z.object({ metadata: z.optional( z.record( z.string(), smartUnion([z.string(), z.int(), z.number(), z.boolean()]), ), ), externalId: z.optional(z.nullable(z.string())), name: z.optional(z.nullable(z.string())), billingAddress: z.optional(z.nullable(AddressInput$outboundSchema)), taxId: z.optional(z.nullable(z.string())), locale: z.optional(z.nullable(z.string())), organizationId: z.optional(z.nullable(z.string())), owner: z.optional(z.nullable(MemberOwnerCreate$outboundSchema)), type: z._default(z.literal("individual"), "individual" as const), email: z.string(), }), z.transform((v) => { return remap$(v, { externalId: "external_id", billingAddress: "billing_address", taxId: "tax_id", organizationId: "organization_id", }); }), ); export function customerIndividualCreateToJSON( customerIndividualCreate: CustomerIndividualCreate, ): string { return JSON.stringify( CustomerIndividualCreate$outboundSchema.parse(customerIndividualCreate), ); }