/* * 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 { CreateEntityIntegrationMappingRequest, CreateEntityIntegrationMappingRequest$Outbound, CreateEntityIntegrationMappingRequest$outboundSchema, } from "./create-entity-integration-mapping-request.js"; import { TaxRateOverride, TaxRateOverride$Outbound, TaxRateOverride$outboundSchema, } from "./tax-rate-override.js"; /** * Request object for creating a new customer in the system */ export type CreateCustomerRequest = { /** * address_city is the city name with maximum 100 characters */ addressCity?: string | undefined; /** * address_country is the two-letter ISO 3166-1 alpha-2 country code */ addressCountry?: string | undefined; /** * address_line1 is the primary address line with maximum 255 characters */ addressLine1?: string | undefined; /** * address_line2 is the secondary address line with maximum 255 characters */ addressLine2?: string | undefined; /** * address_postal_code is the ZIP code or postal code with maximum 20 characters */ addressPostalCode?: string | undefined; /** * address_state is the state, province, or region name with maximum 100 characters */ addressState?: string | undefined; /** * contact is an optional contact number for the customer (e.g. phone) */ contact?: string | undefined; /** * email is the customer's email address and must be a valid email format if provided */ email?: string | undefined; /** * external_id is the unique identifier from your system to reference this customer (required) */ externalId: string; /** * integration_entity_mapping contains provider integration mappings for this customer */ integrationEntityMapping?: | Array | undefined; /** * metadata contains additional key-value pairs for storing extra information */ metadata?: { [k: string]: string } | undefined; /** * name is the full name or company name of the customer */ name: string; /** * onboarding_workflow_name is given if a custom onboarding workflow is to be triggered for this customer */ onboardingWorkflowName?: string | undefined; /** * skip_onboarding_workflow when true, prevents the customer onboarding workflow from being triggered * * @remarks * This is used internally when a customer is created via a workflow to prevent infinite loops * Default: false */ skipOnboardingWorkflow?: boolean | undefined; /** * tax_rate_overrides contains tax rate configurations to be linked to this customer */ taxRateOverrides?: Array | undefined; /** * timezone is the customer's IANA timezone name (e.g. "Asia/Kolkata", "America/New_York") * * @remarks * Defaults to "UTC" if not provided */ timezone?: string | undefined; }; /** @internal */ export type CreateCustomerRequest$Outbound = { address_city?: string | undefined; address_country?: string | undefined; address_line1?: string | undefined; address_line2?: string | undefined; address_postal_code?: string | undefined; address_state?: string | undefined; contact?: string | undefined; email?: string | undefined; external_id: string; integration_entity_mapping?: | Array | undefined; metadata?: { [k: string]: string } | undefined; name: string; onboarding_workflow_name?: string | undefined; skip_onboarding_workflow?: boolean | undefined; tax_rate_overrides?: Array | undefined; timezone?: string | undefined; }; /** @internal */ export const CreateCustomerRequest$outboundSchema: z.ZodMiniType< CreateCustomerRequest$Outbound, CreateCustomerRequest > = z.pipe( z.object({ addressCity: z.optional(z.string()), addressCountry: z.optional(z.string()), addressLine1: z.optional(z.string()), addressLine2: z.optional(z.string()), addressPostalCode: z.optional(z.string()), addressState: z.optional(z.string()), contact: z.optional(z.string()), email: z.optional(z.string()), externalId: z.string(), integrationEntityMapping: z.optional( z.array(CreateEntityIntegrationMappingRequest$outboundSchema), ), metadata: z.optional(z.record(z.string(), z.string())), name: z.string(), onboardingWorkflowName: z.optional(z.string()), skipOnboardingWorkflow: z.optional(z.boolean()), taxRateOverrides: z.optional(z.array(TaxRateOverride$outboundSchema)), timezone: z.optional(z.string()), }), z.transform((v) => { return remap$(v, { addressCity: "address_city", addressCountry: "address_country", addressLine1: "address_line1", addressLine2: "address_line2", addressPostalCode: "address_postal_code", addressState: "address_state", externalId: "external_id", integrationEntityMapping: "integration_entity_mapping", onboardingWorkflowName: "onboarding_workflow_name", skipOnboardingWorkflow: "skip_onboarding_workflow", taxRateOverrides: "tax_rate_overrides", }); }), ); export function createCustomerRequestToJSON( createCustomerRequest: CreateCustomerRequest, ): string { return JSON.stringify( CreateCustomerRequest$outboundSchema.parse(createCustomerRequest), ); }