UNPKG

quickbooks-api

Version:

A modular TypeScript SDK for seamless integration with Intuit QuickBooks APIs. Provides robust authentication handling and future-ready foundation for accounting, payments, and commerce operations.

260 lines (259 loc) 7.35 kB
import { ApiClient } from '../../packages/api/api-client.js'; import { DeliveryMethod, EmailAddress, ModificationMetadata, ReferenceType, TelephoneNumber, WebsiteAddress } from '../types.js'; /** * Customer * * @description * The Customer Object * * @see {@link https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/customer} */ export declare class Customer { /** * @description The API client used to make requests to the API to manage the Customer object */ private apiClient; /** * @description Unique identifier for this object * @readonly @systemDefined * @filterable * @sortable * @requiredForUpdate */ readonly Id: string; /** * @description Version number for update tracking * @readonly @systemDefined * @requiredForUpdate */ readonly SyncToken: string; /** * @description Currency reference for all customer amounts * @readonly */ readonly CurrencyRef?: ReferenceType; /** * @description System-defined metadata. Read-only */ readonly MetaData?: ModificationMetadata; /** * @description Fully qualified hierarchical name * @readonly * @systemDefined * @filterable * @sortable * @remarks Format: Customer:Job:Sub-job (max 5 levels) * @example "ParentCustomer:ChildJob:SubJob" */ readonly FullyQualifiedName: string; /** * @description Hierarchy level position * @readonly * @systemDefined * @remarks 0 = top level, increments with depth (max 5 levels) */ readonly Level: number; /** * @description Primary email address * @filterable * @maxLength 500 */ PrimaryEmailAddr?: EmailAddress; /** * @description Resale number or additional customer info * @maxLength 16 */ ResaleNum?: string; /** * @description Default tax code reference (requires Taxable=true) * @remarks Ignored if Taxable=false. System-managed when automated tax enabled */ DefaultTaxCodeRef?: ReferenceType; /** * @description Preferred delivery method */ PreferredDeliveryMethod?: DeliveryMethod; /** * @description Reference to sales terms associated with this customer * @remarks Query SalesTerm list to determine appropriate reference */ SalesTermRef?: ReferenceType; /** * @description Customer type classification reference * @remarks From predefined customer type list */ CustomerTypeRef?: ReferenceType; /** * @description Fax number * @maxLength 30 */ Fax?: TelephoneNumber; /** * @description Indicates if customer is billed with parent * @remarks Only valid for Job/Sub-Customer, requires ParentRef */ BillWithParent?: boolean; /** * @description Mobile phone number * @maxLength 30 */ Mobile?: TelephoneNumber; /** * @description Indicates if this is a Job/Sub-customer * @remarks Requires ParentRef if true */ Job?: boolean; /** * @description Cumulative open balance including sub-jobs * @readonly * @sortable */ BalanceWithJobs?: number; /** * @description Primary phone number * @maxLength 30 */ PrimaryPhone?: TelephoneNumber; /** * @description Date of opening balance * @remarks Write-on-create field */ OpenBalanceDate?: string; /** * @description Indicates if transactions are taxable * @remarks Defaults true if DefaultTaxCodeRef defined */ Taxable?: boolean; /** * @description Alternate phone number * @maxLength 30 */ AlternatePhone?: TelephoneNumber; /** * @description Reference to parent customer * @remarks Required for sub-customers/jobs */ ParentRef?: ReferenceType; /** * @description Free-form notes about customer * @maxLength 2000 */ Notes?: string; /** * @description Website address * @maxLength 1000 */ WebAddr?: WebsiteAddress; /** * @description Customer active status * @filterable * @sortable * @remarks Inactive customers with balances get CreditMemo */ Active?: boolean; /** * @description Associated company name * @maxLength 100 * @filterable * @sortable */ CompanyName?: string; /** * @description Open balance amount * @filterable * @sortable * @remarks Write-on-create field */ Balance?: number; /** * @description Default shipping address * @remarks Address components handled differently in transactions */ ShipAddr?: string; /** * @description Preferred payment method reference * @remarks Query PaymentMethod list for valid references */ PaymentMethodRef?: ReferenceType; /** * @description Name printed on checks * @maxLength 110 * @filterable * @sortable * @remarks Defaults to DisplayName if not provided */ PrintOnCheckName?: string; /** * @description Default billing address * @remarks Address components handled differently in transactions */ BillAddr?: string; /** * @description Display name (conditionally required) * @maxLength 500 * @filterable * @sortable * @remarks Must be unique across all entities. Generated from name components if not provided */ DisplayName: string; /** * @description Title (conditionally required) * @maxLength 16 * @remarks Part of name component group (with GivenName/MiddleName/FamilyName/Suffix) */ Title: string; /** * @description Given name (conditionally required). Maximum 100 characters * @filterable, sortable * @remarks Part of name component group */ GivenName: string; /** * @description Middle name (conditionally required). Maximum 100 characters * @filterable, sortable * @remarks Part of name component group */ MiddleName: string; /** * @description Name suffix (conditionally required). Maximum 16 characters * @remarks Part of name component group */ Suffix: string; /** * @description Family name (conditionally required). Maximum 100 characters * @filterable, sortable * @remarks Part of name component group */ FamilyName: string; /** * @description Constructor for Customer * @param apiClient - The API client * @param customerCreationData - The data for the customer */ constructor(apiClient: ApiClient, customerCreationData: CustomerCreationData); /** * @description Set the API Client * @param apiClient - The API client */ setApiClient(apiClient: ApiClient): void; /** * @description Reload the Customer Data */ reload(): Promise<void>; /** * @description Custom JSON serialization to exclude private properties */ private toJSON; /** * @description Updates or creates (if the Id is not set) the Customer */ save(): Promise<void>; } export type CustomerCreationData = { DisplayName: string; Title: string; GivenName: string; MiddleName: string; Suffix: string; FamilyName: string; };