diff --git a/lib/accounts.js b/lib/accounts.js index c6d3310..2d18ceb 100644 --- a/lib/accounts.js +++ b/lib/accounts.js @@ -1,6 +1,7 @@ import { check, checkString } from "./helpers/checks.js"; -import { Err } from "./helpers/errors.js"; + import { Address } from "./address.js"; +import { Err } from "./helpers/errors.js"; /** @external Promise */ @@ -91,7 +92,7 @@ import { Address } from "./address.js"; /** * @typedef AccountCreate * @property {"individual"|"business"} accountType - Type of entity represented by this account - * @property {Profile} profile - Details for individual or business + * @property {ProfileCreate} profile - Details for individual or business * @property {object} metadata - Arbitrary key-value pairs * @property {TermsOfServiceToken|null} termsOfService - An encrypted value used to record acceptance of Moov's Terms of Service * @property {string} foreignID - Optional identification or alias @@ -258,6 +259,43 @@ import { Address } from "./address.js"; * @tag Accounts */ +/** + * Profile for a Moov acocunt. May be business or individual. + * @typedef ProfileCreate + * @property {BusinessProfileCreate} business - A business account + * @property {IndividualProfileCreate} individual - An individual account + * @tag Accounts + */ + +/** + * Describes a business account. + * @typedef BusinessProfileCreate + * @property {string} legalBusinessName - Business's legal name + * @property {string} doingBusinessAs - Business's trade name (if different than the legal name) + * @property {"soleProprietorship"|"unincorporatedAssociation"|"trust"|"publicCorporation"|"privateCorporation"|"privateCorporation"|"llc"|"partnership"|"unincorporatedNonProfit"|"incorporatedNonProfit"} businessType - The legal registered type of the business + * @property {Address} address - Business's address + * @property {Phone} phone - Business's phone number + * @property {string} email - Business's email + * @property {string} website - Business's website + * @property {string} description - Description of the business + * @property {TaxID} taxID - An EIN (employer identification number) for the business. For sole proprietors, an SSN can be used as the EIN. + * @property {IndustryCodes} industryCodes - Business's industry code (for example, `mcc`) + * @property {PrimaryRegulator} [primaryRegulator] - If the business is a financial institution, this field describes its primary regulator. (for example, `OCC`) + * @tag Accounts + */ + +/** + * Describes the individual associated with a non-business account. + * @typedef IndividualProfileCreate + * @property {Name} name - Individual's name + * @property {Phone} phone - Individual's phone number + * @property {string} email - Individual's email address + * @property {Address} address - Individual's address + * @property {IndividualBirthDate} birthDate - Individual's birth date + * @property {IndividualGovernmentID} governmentID - Government-issued ID for the business + * @tag Accounts + */ + /** * @typedef Phone * @property {string} number - Phone number @@ -274,6 +312,52 @@ import { Address } from "./address.js"; * @tag Accounts */ +/** + * Primary regulators for a financial institution. + * @typedef {"OCC"|"FDIC"|"NCUA"|"FRB"} PrimaryRegulator + * @tag Accounts + */ + +/** + * Describes a business account's tax identification number. + * @typedef TaxID + * @property {EIN} ein - Business's EIN (Employer Identification Number) + * @tag Accounts + */ + +/** + * Describes a business account's tax identification number. + * @typedef EIN + * @property {string} number - EIN (Employer Identification Number) + * @tag Accounts + */ + +/** + * Describes a Individual's birth date. + * @typedef IndividualBirthDate + * @property {number} day - 1 or 2 digit day of birth + * @property {number} month - 1 or 2 digit month of birth + * @property {number} year - 4 digit year of birth + * + * @tag Accounts + */ + +/** + * Describes a Individual's government ID. + * @typedef IndividualGovernmentID + * @property {GovernmentID} ssn - Individual's Social Security Number + * @property {GovernmentID} itin - Individual's International Taxpayer Identification Number + * @tag Accounts + */ + +/** + * Describes a Government ID number. + * @typedef GovernmentID + * @property {string} full - Full government ID number + * @property {string} lastFour - Last four digits of government ID number + * @tag Accounts + */ + /** * Describes an individual who represents a business account. * @typedef Representative @@ -378,7 +462,7 @@ export class Accounts { /** * Retrieves details for the list of accounts. * The `ACCOUNTS_READ` scope enum is required when making a request from the browser. - * + * * @param {string} accountID - Account to query * @param {AccountListCriteria} criteria - Optional criteria to limit the list returned. * @returns {Promise}