Socket
Socket
Sign inDemoInstall

@moovio/node

Package Overview
Dependencies
62
Maintainers
7
Versions
34
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.6 to 1.0.7

4

dist/cjs/accounts.d.ts

@@ -348,6 +348,6 @@ /** @external Promise */

* @param {AccountListCriteria} criteria - Optional criteria to limit the list returned.
* @returns {Promise<Account>}
* @returns {Promise<Account[]>}
* @tag Accounts
*/
list(accountID: string, criteria: AccountListCriteria): Promise<Account>;
list(accountID: string, criteria: AccountListCriteria): Promise<Account[]>;
/**

@@ -354,0 +354,0 @@ * Retrieves details for the account with the specified ID.

@@ -374,3 +374,3 @@ "use strict";

* @param {AccountListCriteria} criteria - Optional criteria to limit the list returned.
* @returns {Promise<Account>}
* @returns {Promise<Account[]>}
* @tag Accounts

@@ -380,3 +380,3 @@ */

return __awaiter(this, void 0, void 0, function* () {
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.AccountID);
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.MISSING_ACCOUNT_ID);
let params = "";

@@ -408,3 +408,3 @@ if (criteria) {

return __awaiter(this, void 0, void 0, function* () {
(0, checks_js_1.checkString)(connectedAccountID).or(errors_js_1.Err.AccountID);
(0, checks_js_1.checkString)(connectedAccountID).or(errors_js_1.Err.MISSING_ACCOUNT_ID);
const result = yield this.moov

@@ -443,3 +443,3 @@ .got({

return __awaiter(this, void 0, void 0, function* () {
(0, checks_js_1.checkString)(account.accountID).or(errors_js_1.Err.AccountID);
(0, checks_js_1.checkString)(account.accountID).or(errors_js_1.Err.MISSING_ACCOUNT_ID);
const patchAccount = Object.assign({}, account);

@@ -466,3 +466,3 @@ delete patchAccount.accountID;

return __awaiter(this, void 0, void 0, function* () {
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.AccountID);
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.MISSING_ACCOUNT_ID);
const result = yield this.moov

@@ -487,3 +487,3 @@ .got({

return __awaiter(this, void 0, void 0, function* () {
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.AccountID);
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.MISSING_ACCOUNT_ID);
(0, checks_js_1.check)(countries).or(errors_js_1.Err.MISSING_COUNTRIES);

@@ -490,0 +490,0 @@ const result = yield this.moov

@@ -44,3 +44,3 @@ "use strict";

return __awaiter(this, void 0, void 0, function* () {
(0, checks_js_1.checkString)(uniqueId).or(errors_js_1.Err.MISSING_UNIQUE_ID_ERROR_MESSAGE);
(0, checks_js_1.checkString)(uniqueId).or(errors_js_1.Err.MISSING_UNIQUE_ID);
const result = yield this.moov

@@ -47,0 +47,0 @@ .got({

@@ -48,23 +48,23 @@ "use strict";

if (!bankAccount.accountNumber) {
console.log(errors_js_1.Err.MISSING_BANK_ACCOUNT_NUMBER_ERROR_MESSAGE);
throw new Error(errors_js_1.Err.MISSING_BANK_ACCOUNT_NUMBER_ERROR_MESSAGE);
console.log(errors_js_1.Err.MISSING_BANK_ACCOUNT_NUMBER);
throw new Error(errors_js_1.Err.MISSING_BANK_ACCOUNT_NUMBER);
}
if (!bankAccount.routingNumber) {
console.log(errors_js_1.Err.MISSING_BANK_ACCOUNT_ROUTING_NUMBER_ERROR_MESSAGE);
throw new Error(errors_js_1.Err.MISSING_BANK_ACCOUNT_ROUTING_NUMBER_ERROR_MESSAGE);
console.log(errors_js_1.Err.MISSING_BANK_ACCOUNT_ROUTING_NUMBER);
throw new Error(errors_js_1.Err.MISSING_BANK_ACCOUNT_ROUTING_NUMBER);
}
if (bankAccount.routingNumber.length !== 9) {
console.log(errors_js_1.Err.MISSING_BANK_ACCOUNT_ROUTING_NUMBER_LENGTH_ERROR_MESSAGE);
throw new Error(errors_js_1.Err.MISSING_BANK_ACCOUNT_ROUTING_NUMBER_LENGTH_ERROR_MESSAGE);
console.log(errors_js_1.Err.MISSING_BANK_ACCOUNT_ROUTING_NUMBER_LENGTH);
throw new Error(errors_js_1.Err.MISSING_BANK_ACCOUNT_ROUTING_NUMBER_LENGTH);
}
if (!bankAccount.holderName) {
console.log(errors_js_1.Err.MISSING_BANK_ACCOUNT_HOLDER_NAME_ERROR_MESSAGE);
throw new Error(errors_js_1.Err.MISSING_BANK_ACCOUNT_HOLDER_NAME_ERROR_MESSAGE);
console.log(errors_js_1.Err.MISSING_BANK_ACCOUNT_HOLDER_NAME);
throw new Error(errors_js_1.Err.MISSING_BANK_ACCOUNT_HOLDER_NAME);
}
if (!bankAccount.holderType) {
console.log(errors_js_1.Err.MISSING_BANK_ACCOUNT_HOLDER_TYPE_ERROR_MESSAGE);
throw new Error(errors_js_1.Err.MISSING_BANK_ACCOUNT_HOLDER_TYPE_ERROR_MESSAGE);
console.log(errors_js_1.Err.MISSING_BANK_ACCOUNT_HOLDER_TYPE);
throw new Error(errors_js_1.Err.MISSING_BANK_ACCOUNT_HOLDER_TYPE);
}
payload = {
account: bankAccount
account: bankAccount,
};

@@ -74,3 +74,3 @@ }

payload = {
plaid: { token: plaidToken }
plaid: { token: plaidToken },
};

@@ -80,3 +80,3 @@ }

payload = {
mx: { authorizationCode: mxAuthorizationCode }
mx: { authorizationCode: mxAuthorizationCode },
};

@@ -105,4 +105,4 @@ }

return __awaiter(this, void 0, void 0, function* () {
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.AccountID);
(0, checks_js_1.checkString)(bankAccountID).or(errors_js_1.Err.BankAccountID);
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.MISSING_ACCOUNT_ID);
(0, checks_js_1.checkString)(bankAccountID).or(errors_js_1.Err.MISSING_BANK_ACCOUNT_ID);
const result = yield this.moov

@@ -127,3 +127,3 @@ .got({

return __awaiter(this, void 0, void 0, function* () {
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.AccountID);
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.MISSING_ACCOUNT_ID);
const result = yield this.moov

@@ -149,4 +149,4 @@ .got({

return __awaiter(this, void 0, void 0, function* () {
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.AccountID);
(0, checks_js_1.checkString)(bankAccountID).or(errors_js_1.Err.BankAccountID);
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.MISSING_ACCOUNT_ID);
(0, checks_js_1.checkString)(bankAccountID).or(errors_js_1.Err.MISSING_BANK_ACCOUNT_ID);
const result = yield this.moov

@@ -172,4 +172,4 @@ .got({

return __awaiter(this, void 0, void 0, function* () {
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.AccountID);
(0, checks_js_1.checkString)(bankAccountID).or(errors_js_1.Err.BankAccountID);
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.MISSING_ACCOUNT_ID);
(0, checks_js_1.checkString)(bankAccountID).or(errors_js_1.Err.MISSING_BANK_ACCOUNT_ID);
const result = yield this.moov

@@ -196,4 +196,4 @@ .got({

return __awaiter(this, void 0, void 0, function* () {
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.AccountID);
(0, checks_js_1.checkString)(bankAccountID).or(errors_js_1.Err.BankAccountID);
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.MISSING_ACCOUNT_ID);
(0, checks_js_1.checkString)(bankAccountID).or(errors_js_1.Err.MISSING_BANK_ACCOUNT_ID);
(0, checks_js_1.check)(amounts).or(errors_js_1.Err.MISSING_AMOUNTS);

@@ -204,3 +204,3 @@ const result = yield this.moov

method: "PUT",
json: { "amounts": amounts },
json: { amounts: amounts },
})

@@ -207,0 +207,0 @@ .json();

@@ -155,3 +155,3 @@ /**

* @tag Capabilities
*/
*/
/**

@@ -158,0 +158,0 @@ * The Capabilities API

@@ -67,3 +67,3 @@ "use strict";

*/
PENDING: "pending"
PENDING: "pending",
};

@@ -226,3 +226,3 @@ /**

*/
DOCUMENT: "document.{doc-uuid}"
DOCUMENT: "document.{doc-uuid}",
};

@@ -305,3 +305,3 @@ /**

*/
DOCUMENT_EXPIRED: "document-expired"
DOCUMENT_EXPIRED: "document-expired",
};

@@ -357,3 +357,3 @@ /**

* @tag Capabilities
*/
*/
/**

@@ -378,3 +378,3 @@ * The Capabilities API

return __awaiter(this, void 0, void 0, function* () {
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.AccountID);
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.MISSING_ACCOUNT_ID);
(0, checks_js_1.check)(capabilities).or(errors_js_1.Err.MISSING_CAPABILITIES);

@@ -385,3 +385,3 @@ const result = yield this.moov

method: "POST",
json: { "capabilities": capabilities },
json: { capabilities: capabilities },
})

@@ -403,3 +403,3 @@ .json();

return __awaiter(this, void 0, void 0, function* () {
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.AccountID);
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.MISSING_ACCOUNT_ID);
(0, checks_js_1.checkString)(capability).or(errors_js_1.Err.MISSING_CAPABILITY);

@@ -425,3 +425,3 @@ const result = yield this.moov

return __awaiter(this, void 0, void 0, function* () {
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.AccountID);
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.MISSING_ACCOUNT_ID);
const result = yield this.moov

@@ -447,3 +447,3 @@ .got({

return __awaiter(this, void 0, void 0, function* () {
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.AccountID);
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.MISSING_ACCOUNT_ID);
(0, checks_js_1.checkString)(capability).or(errors_js_1.Err.MISSING_CAPABILITY);

@@ -450,0 +450,0 @@ const result = yield this.moov

@@ -31,2 +31,13 @@ export type CARD_BRAND = any;

/**
* Card information collected for acquisition.
* @typedef LinkCard
* @property {string} cardNumber - All digits of the card
* @property {CardExpiration} expiration - Card expiration date
* @property {string} cardCvv - 3-4 digit card verification value
* @property {string} holderName - Full name of the card holder
* @property {CardBillingAddress} billingAddress - The billing address of the card
*
* @tag Cards
*/
/**
* Card billing address

@@ -125,2 +136,12 @@ * @typedef CardBillingAddress

/**
* Links a card to a Moov account. Only use this endpoint if you have provided Moov with a
* copy of your PCI attestation of compliance.
*
* @param {string} accountID - Account to link
* @param {LinkCard} card - Card information
* @returns {Promise<Card>}
* @tag Cards
*/
link(accountID: string, card: LinkCard): Promise<Card>;
/**
* Disables a card with the specified ID.

@@ -149,2 +170,27 @@ *

/**
* Card information collected for acquisition.
*/
export type LinkCard = {
/**
* - All digits of the card
*/
cardNumber: string;
/**
* - Card expiration date
*/
expiration: CardExpiration;
/**
* - 3-4 digit card verification value
*/
cardCvv: string;
/**
* - Full name of the card holder
*/
holderName: string;
/**
* - The billing address of the card
*/
billingAddress: CardBillingAddress;
};
/**
* Card billing address

@@ -151,0 +197,0 @@ */

@@ -40,3 +40,3 @@ "use strict";

*/
VISA: "Visa"
VISA: "Visa",
};

@@ -67,3 +67,3 @@ /**

*/
UNKNOWN: "unknown"
UNKNOWN: "unknown",
};

@@ -94,3 +94,3 @@ /**

*/
UNAVAILABLE: "unavailable"
UNAVAILABLE: "unavailable",
};

@@ -106,2 +106,13 @@ /**

/**
* Card information collected for acquisition.
* @typedef LinkCard
* @property {string} cardNumber - All digits of the card
* @property {CardExpiration} expiration - Card expiration date
* @property {string} cardCvv - 3-4 digit card verification value
* @property {string} holderName - Full name of the card holder
* @property {CardBillingAddress} billingAddress - The billing address of the card
*
* @tag Cards
*/
/**
* Card billing address

@@ -193,4 +204,4 @@ * @typedef CardBillingAddress

return __awaiter(this, void 0, void 0, function* () {
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.AccountID);
(0, checks_js_1.checkString)(cardID).or(errors_js_1.Err.CardID);
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.MISSING_ACCOUNT_ID);
(0, checks_js_1.checkString)(cardID).or(errors_js_1.Err.MISSING_CARD_ID);
const result = yield this.moov

@@ -214,3 +225,3 @@ .got({

return __awaiter(this, void 0, void 0, function* () {
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.AccountID);
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.MISSING_ACCOUNT_ID);
const result = yield this.moov

@@ -220,2 +231,3 @@ .got({

method: "GET",
json: card,
})

@@ -227,2 +239,25 @@ .json();

/**
* Links a card to a Moov account. Only use this endpoint if you have provided Moov with a
* copy of your PCI attestation of compliance.
*
* @param {string} accountID - Account to link
* @param {LinkCard} card - Card information
* @returns {Promise<Card>}
* @tag Cards
*/
link(accountID, card) {
return __awaiter(this, void 0, void 0, function* () {
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.MISSING_ACCOUNT_ID);
(0, checks_js_1.check)(card).or(errors_js_1.Err.MISSING_CARD);
const result = yield this.moov
.got({
url: `accounts/${accountID}/cards`,
method: "POST",
json: card,
})
.json();
return result;
});
}
/**
* Disables a card with the specified ID.

@@ -237,4 +272,4 @@ *

return __awaiter(this, void 0, void 0, function* () {
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.AccountID);
(0, checks_js_1.checkString)(cardID).or(errors_js_1.Err.CardID);
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.MISSING_ACCOUNT_ID);
(0, checks_js_1.checkString)(cardID).or(errors_js_1.Err.MISSING_CARD_ID);
const result = yield this.moov

@@ -241,0 +276,0 @@ .got({

@@ -77,4 +77,4 @@ "use strict";

return __awaiter(this, void 0, void 0, function* () {
(0, checks_js_1.check)(criteria).or(errors_js_1.Err.MISSING_CRITERIA_ERROR_MESSAGE);
(0, checks_js_1.checkString)(criteria.search).or(errors_js_1.Err.MISSING_ENRICH_ADDRESS_SEARCH_ERROR_MESSAGE);
(0, checks_js_1.check)(criteria).or(errors_js_1.Err.MISSING_CRITERIA);
(0, checks_js_1.checkString)(criteria.search).or(errors_js_1.Err.MISSING_ENRICH_ADDRESS_SEARCH);
const options = {

@@ -81,0 +81,0 @@ url: "enrichment/address",

@@ -104,3 +104,3 @@ "use strict";

return __awaiter(this, void 0, void 0, function* () {
(0, checks_js_1.checkString)(email).or(errors_js_1.Err.MISSING_EMAIL_ERROR_MESSAGE);
(0, checks_js_1.checkString)(email).or(errors_js_1.Err.MISSING_EMAIL);
const result = yield this.moov

@@ -111,4 +111,4 @@ .got({

searchParams: {
email: email
}
email: email,
},
})

@@ -115,0 +115,0 @@ .json();

export namespace Err {
const ApiKeyCredentials: string;
const AccountID: string;
const CardID: string;
const BankAccountID: string;
const RepresentativeID: string;
const PaymentMethodID: string;
const TransferID: string;
const RefundID: string;
const WalletID: string;
const PublicKey: string;
const SecretKey: string;
const Domain: string;
const Scopes: string;
const MISSING_ACCOUNT_ID_ERROR_MESSAGE: string;
const MISSING_ACCOUNT_ID: string;
const MISSING_AMOUNTS: string;
const MISSING_API_KEY_CREDENTIALS: string;
const MISSING_BANK_ACCOUNT_HOLDER_NAME: string;
const MISSING_BANK_ACCOUNT_HOLDER_TYPE: string;
const MISSING_BANK_ACCOUNT_ID: string;
const MISSING_BANK_ACCOUNT_NUMBER: string;
const MISSING_BANK_ACCOUNT_ROUTING_NUMBER: string;
const MISSING_BANK_ACCOUNT_ROUTING_NUMBER_LENGTH: string;
const MISSING_BANK_PAYLOAD: string;
const MISSING_BANK_ACCOUNT_NUMBER_ERROR_MESSAGE: string;
const MISSING_BANK_ACCOUNT_ROUTING_NUMBER_ERROR_MESSAGE: string;
const MISSING_BANK_ACCOUNT_ROUTING_NUMBER_LENGTH_ERROR_MESSAGE: string;
const MISSING_BANK_ACCOUNT_HOLDER_NAME_ERROR_MESSAGE: string;
const MISSING_BANK_ACCOUNT_HOLDER_TYPE_ERROR_MESSAGE: string;
const MISSING_CRITERIA_ERROR_MESSAGE: string;
const MISSING_EMAIL_ERROR_MESSAGE: string;
const MISSING_ENRICH_ADDRESS_SEARCH_ERROR_MESSAGE: string;
const MISSING_INSTITUTION_NAME_OR_ROUTING_ERROR_MESSAGE: string;
const MISSING_REPRESENTATIVE_ERROR_MESSAGE: string;
const MISSING_UNIQUE_ID_ERROR_MESSAGE: string;
const MISSING_CAPABILITIES: string;
const MISSING_CAPABILITY: string;
const MISSING_TRANSFER_ERROR_MESSAGE: string;
const MISSING_TRANSFER_OPTION_CRITERIA_ERROR_MESSAGE: string;
const MISSING_CARD: string;
const MISSING_CARD_ID: string;
const MISSING_COUNTRIES: string;
const MISSING_AMOUNTS: string;
const MISSING_CRITERIA: string;
const MISSING_DOMAIN: string;
const MISSING_EMAIL: string;
const MISSING_ENRICH_ADDRESS_SEARCH: string;
const MISSING_INSTITUTION_NAME_OR_ROUTING: string;
const MISSING_PAYMENT_METHOD_ID: string;
const MISSING_PUBLIC_KEY: string;
const MISSING_REFUND_ID: string;
const MISSING_REPRESENTATIVE: string;
const MISSING_REPRESENTATIVE_ID: string;
const MISSING_SCOPES: string;
const MISSING_SECRET_KEY: string;
const MISSING_TRANSFER: string;
const MISSING_TRANSFER_ID: string;
const MISSING_TRANSFER_OPTION_CRITERIA: string;
const MISSING_UNIQUE_ID: string;
const MISSING_WALLET_ID: string;
}

@@ -5,35 +5,38 @@ "use strict";

exports.Err = {
// Parameter errors
ApiKeyCredentials: "credentials are required",
AccountID: "accountID is required",
CardID: "cardID is required",
BankAccountID: "bankAccountID is required",
RepresentativeID: "representativeID is required",
PaymentMethodID: "paymentMethodID is required",
TransferID: "transferID is required",
RefundID: "refundID is required",
WalletID: "walletID is required",
PublicKey: "publicKey is required",
SecretKey: "secretKey is required",
Domain: "domain is required and must be a valid URL",
Scopes: "one or more scopes are required",
MISSING_ACCOUNT_ID_ERROR_MESSAGE: "Please provide an accountID",
MISSING_BANK_PAYLOAD: "Please provide a bankAccount, plaidToken, or mxAuthorizationCode.",
MISSING_BANK_ACCOUNT_NUMBER_ERROR_MESSAGE: "Please provide a bank account number.",
MISSING_BANK_ACCOUNT_ROUTING_NUMBER_ERROR_MESSAGE: "Please provide a routingNumber.",
MISSING_BANK_ACCOUNT_ROUTING_NUMBER_LENGTH_ERROR_MESSAGE: "Routing number must be 9 digits.",
MISSING_BANK_ACCOUNT_HOLDER_NAME_ERROR_MESSAGE: "Please provide a holderName.",
MISSING_BANK_ACCOUNT_HOLDER_TYPE_ERROR_MESSAGE: "Please provide a holderType.",
MISSING_CRITERIA_ERROR_MESSAGE: "Please provide search criteria.",
MISSING_EMAIL_ERROR_MESSAGE: "Please provide an email.",
MISSING_ENRICH_ADDRESS_SEARCH_ERROR_MESSAGE: "Please provide a partial or complete address to search.",
MISSING_INSTITUTION_NAME_OR_ROUTING_ERROR_MESSAGE: "Please provide a financial institution's name or routing number to search.",
MISSING_REPRESENTATIVE_ERROR_MESSAGE: "Please provide representative details.",
MISSING_UNIQUE_ID_ERROR_MESSAGE: "Please provide a uniqueID.",
MISSING_CAPABILITIES: "Please provide capabilities.",
MISSING_CAPABILITY: "Please provide capability.",
MISSING_TRANSFER_ERROR_MESSAGE: "Please provide transfer details.",
MISSING_TRANSFER_OPTION_CRITERIA_ERROR_MESSAGE: "Please provide transfer option criteria.",
MISSING_COUNTRIES: "Please provide countries.",
MISSING_AMOUNTS: "Please provide amounts.",
// 1. Keep these errors alphabetized
// 2. Do not use variable names -- use phrases (e.g. "bank account ID" not "bankAccountID")
// 3. Duplicate the voice and tone used by existing errors when you add a new one
// 4. Do not capitialize or use punctuation -- these errors are for developers
MISSING_ACCOUNT_ID: "account ID is required",
MISSING_AMOUNTS: "amounts are required",
MISSING_API_KEY_CREDENTIALS: "credentials are required",
MISSING_BANK_ACCOUNT_HOLDER_NAME: "holder name is required",
MISSING_BANK_ACCOUNT_HOLDER_TYPE: "holder type is required",
MISSING_BANK_ACCOUNT_ID: "bank account ID is required",
MISSING_BANK_ACCOUNT_NUMBER: "bank account number is required",
MISSING_BANK_ACCOUNT_ROUTING_NUMBER: "routing number is required",
MISSING_BANK_ACCOUNT_ROUTING_NUMBER_LENGTH: "routing number must be 9 digits",
MISSING_BANK_PAYLOAD: "a bank account, Plaid token, or MX authorization code is required",
MISSING_CAPABILITIES: "capabilities are required",
MISSING_CAPABILITY: "capability is required",
MISSING_CARD: "card information is required",
MISSING_CARD_ID: "card ID is required",
MISSING_COUNTRIES: "countries are required",
MISSING_CRITERIA: "search criteria is required",
MISSING_DOMAIN: "domain is required and must be a valid URL",
MISSING_EMAIL: "email is required",
MISSING_ENRICH_ADDRESS_SEARCH: "partial or complete address to search is required",
MISSING_INSTITUTION_NAME_OR_ROUTING: "financial institution's name or routing number to search is required",
MISSING_PAYMENT_METHOD_ID: "payment method ID is required",
MISSING_PUBLIC_KEY: "public key is required",
MISSING_REFUND_ID: "refund ID is required",
MISSING_REPRESENTATIVE: "representative details are required",
MISSING_REPRESENTATIVE_ID: "representative ID is required",
MISSING_SCOPES: "one or more scopes are required",
MISSING_SECRET_KEY: "secret key is required",
MISSING_TRANSFER: "transfer details are required",
MISSING_TRANSFER_ID: "transfer ID is required",
MISSING_TRANSFER_OPTION_CRITERIA: "transfer option criteria is required",
MISSING_UNIQUE_ID: "unique ID is required",
MISSING_WALLET_ID: "wallet ID is required",
};

@@ -165,5 +165,5 @@ "use strict";

return __awaiter(this, void 0, void 0, function* () {
(0, checks_js_1.check)(criteria).or(errors_js_1.Err.MISSING_CRITERIA_ERROR_MESSAGE);
(0, checks_js_1.check)(criteria).or(errors_js_1.Err.MISSING_CRITERIA);
if (!criteria.name && !criteria.routingNumber) {
throw new TypeError(errors_js_1.Err.MISSING_INSTITUTION_NAME_OR_ROUTING_ERROR_MESSAGE);
throw new TypeError(errors_js_1.Err.MISSING_INSTITUTION_NAME_OR_ROUTING);
}

@@ -178,3 +178,3 @@ const params = new URLSearchParams();

method: "GET",
searchParams: params
searchParams: params,
})

@@ -181,0 +181,0 @@ .json();

@@ -282,3 +282,3 @@ /**

*
* @example
* @example
* const moov = new Moov(...);

@@ -285,0 +285,0 @@ * try {

@@ -219,6 +219,6 @@ "use strict";

constructor(credentials, gotOptionsOrInstance) {
(0, checks_js_1.check)(credentials).or(errors_js_1.Err.ApiKeyCredentials);
(0, checks_js_1.checkString)(credentials.accountID).or(errors_js_1.Err.AccountID);
(0, checks_js_1.checkString)(credentials.publicKey).or(errors_js_1.Err.PublicKey);
(0, checks_js_1.checkString)(credentials.secretKey).or(errors_js_1.Err.SecretKey);
(0, checks_js_1.check)(credentials).or(errors_js_1.Err.MISSING_API_KEY_CREDENTIALS);
(0, checks_js_1.checkString)(credentials.accountID).or(errors_js_1.Err.MISSING_ACCOUNT_ID);
(0, checks_js_1.checkString)(credentials.publicKey).or(errors_js_1.Err.MISSING_PUBLIC_KEY);
(0, checks_js_1.checkString)(credentials.secretKey).or(errors_js_1.Err.MISSING_SECRET_KEY);
(0, checks_js_1.checkUrl)(credentials.domain).or(errors_js_1.Err.DomainRequired);

@@ -258,3 +258,3 @@ this.credentials = credentials;

return __awaiter(this, void 0, void 0, function* () {
(0, checks_js_1.checkArrayLength)(scopes).or(errors_js_1.Err.Scopes);
(0, checks_js_1.checkArrayLength)(scopes).or(errors_js_1.Err.MISSING_SCOPES);
if (!accountID) {

@@ -265,3 +265,3 @@ accountID = this.credentials.accountID;

for (let scope of scopes) {
(0, checks_js_1.checkString)(scope).or(errors_js_1.Err.Scopes);
(0, checks_js_1.checkString)(scope).or(errors_js_1.Err.MISSING_SCOPES);
renderedScopes.push(scope.replace("{accountID}", accountID));

@@ -280,3 +280,3 @@ }

origin: this.credentials.domain,
}
},
}).json();

@@ -519,3 +519,3 @@ const expiresOn = new Date(new Date().getTime() + result.expires_in * 1000);

*
* @example
* @example
* const moov = new Moov(...);

@@ -522,0 +522,0 @@ * try {

@@ -104,4 +104,4 @@ "use strict";

return __awaiter(this, void 0, void 0, function* () {
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.AccountID);
(0, checks_js_1.checkString)(paymentMethodID).or(errors_js_1.Err.PaymentMethodID);
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.MISSING_ACCOUNT_ID);
(0, checks_js_1.checkString)(paymentMethodID).or(errors_js_1.Err.MISSING_PAYMENT_METHOD_ID);
const result = yield this.moov

@@ -126,3 +126,3 @@ .got({

return __awaiter(this, void 0, void 0, function* () {
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.AccountID);
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.MISSING_ACCOUNT_ID);
const result = yield this.moov

@@ -129,0 +129,0 @@ .got({

@@ -158,4 +158,4 @@ "use strict";

return __awaiter(this, void 0, void 0, function* () {
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.AccountID);
(0, checks_js_1.check)(representative).or(errors_js_1.Err.MISSING_REPRESENTATIVE_ERROR_MESSAGE);
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.MISSING_ACCOUNT_ID);
(0, checks_js_1.check)(representative).or(errors_js_1.Err.MISSING_REPRESENTATIVE);
const result = yield this.moov

@@ -180,3 +180,3 @@ .got({

return __awaiter(this, void 0, void 0, function* () {
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.AccountID);
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.MISSING_ACCOUNT_ID);
const result = yield this.moov

@@ -201,4 +201,4 @@ .got({

return __awaiter(this, void 0, void 0, function* () {
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.AccountID);
(0, checks_js_1.checkString)(representativeID).or(errors_js_1.Err.RepresentativeID);
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.MISSING_ACCOUNT_ID);
(0, checks_js_1.checkString)(representativeID).or(errors_js_1.Err.MISSING_REPRESENTATIVE_ID);
const result = yield this.moov

@@ -223,4 +223,4 @@ .got({

return __awaiter(this, void 0, void 0, function* () {
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.AccountID);
(0, checks_js_1.checkString)(representativeID).or(errors_js_1.Err.RepresentativeID);
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.MISSING_ACCOUNT_ID);
(0, checks_js_1.checkString)(representativeID).or(errors_js_1.Err.MISSING_REPRESENTATIVE_ID);
const result = yield this.moov

@@ -246,5 +246,5 @@ .got({

return __awaiter(this, void 0, void 0, function* () {
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.AccountID);
(0, checks_js_1.checkString)(representativeID).or(errors_js_1.Err.RepresentativeID);
(0, checks_js_1.check)(representative).or(errors_js_1.Err.MISSING_REPRESENTATIVE_ERROR_MESSAGE);
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.MISSING_ACCOUNT_ID);
(0, checks_js_1.checkString)(representativeID).or(errors_js_1.Err.MISSING_REPRESENTATIVE_ID);
(0, checks_js_1.check)(representative).or(errors_js_1.Err.MISSING_REPRESENTATIVE);
const result = yield this.moov

@@ -251,0 +251,0 @@ .got({

@@ -271,3 +271,3 @@ "use strict";

return __awaiter(this, void 0, void 0, function* () {
(0, checks_js_1.check)(transfer).or(errors_js_1.Err.MISSING_TRANSFER_ERROR_MESSAGE);
(0, checks_js_1.check)(transfer).or(errors_js_1.Err.MISSING_TRANSFER);
const result = yield this.moov

@@ -358,3 +358,3 @@ .got({

return __awaiter(this, void 0, void 0, function* () {
(0, checks_js_1.checkString)(transferID).or(errors_js_1.Err.TransferID);
(0, checks_js_1.checkString)(transferID).or(errors_js_1.Err.MISSING_TRANSFER_ID);
const result = yield this.moov

@@ -390,3 +390,3 @@ .got({

return __awaiter(this, void 0, void 0, function* () {
(0, checks_js_1.checkString)(transferID).or(errors_js_1.Err.TransferID);
(0, checks_js_1.checkString)(transferID).or(errors_js_1.Err.MISSING_TRANSFER_ID);
const result = yield this.moov

@@ -434,3 +434,3 @@ .got({

return __awaiter(this, void 0, void 0, function* () {
(0, checks_js_1.check)(transferOptionsCriteria).or(errors_js_1.Err.MISSING_TRANSFER_OPTION_CRITERIA_ERROR_MESSAGE);
(0, checks_js_1.check)(transferOptionsCriteria).or(errors_js_1.Err.MISSING_TRANSFER_OPTION_CRITERIA);
const result = yield this.moov

@@ -463,3 +463,3 @@ .got({

return __awaiter(this, void 0, void 0, function* () {
(0, checks_js_1.checkString)(transferID).or(errors_js_1.Err.TransferID);
(0, checks_js_1.checkString)(transferID).or(errors_js_1.Err.MISSING_TRANSFER_ID);
const result = yield this.moov

@@ -494,3 +494,3 @@ .got({

return __awaiter(this, void 0, void 0, function* () {
(0, checks_js_1.checkString)(transferID).or(errors_js_1.Err.TransferID);
(0, checks_js_1.checkString)(transferID).or(errors_js_1.Err.MISSING_TRANSFER_ID);
const result = yield this.moov

@@ -523,4 +523,4 @@ .got({

return __awaiter(this, void 0, void 0, function* () {
(0, checks_js_1.checkString)(transferID).or(errors_js_1.Err.TransferID);
(0, checks_js_1.checkString)(refundID).or(errors_js_1.Err.RefundID);
(0, checks_js_1.checkString)(transferID).or(errors_js_1.Err.MISSING_TRANSFER_ID);
(0, checks_js_1.checkString)(refundID).or(errors_js_1.Err.MISSING_REFUND_ID);
const result = yield this.moov

@@ -527,0 +527,0 @@ .got({

@@ -60,4 +60,4 @@ "use strict";

return __awaiter(this, void 0, void 0, function* () {
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.AccountID);
(0, checks_js_1.checkString)(walletID).or(errors_js_1.Err.WalletID);
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.MISSING_ACCOUNT_ID);
(0, checks_js_1.checkString)(walletID).or(errors_js_1.Err.MISSING_WALLET_ID);
const result = yield this.moov

@@ -82,3 +82,3 @@ .got({

return __awaiter(this, void 0, void 0, function* () {
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.AccountID);
(0, checks_js_1.checkString)(accountID).or(errors_js_1.Err.MISSING_ACCOUNT_ID);
const result = yield this.moov

@@ -85,0 +85,0 @@ .got({

@@ -348,6 +348,6 @@ /** @external Promise */

* @param {AccountListCriteria} criteria - Optional criteria to limit the list returned.
* @returns {Promise<Account>}
* @returns {Promise<Account[]>}
* @tag Accounts
*/
list(accountID: string, criteria: AccountListCriteria): Promise<Account>;
list(accountID: string, criteria: AccountListCriteria): Promise<Account[]>;
/**

@@ -354,0 +354,0 @@ * Retrieves details for the account with the specified ID.

@@ -360,7 +360,7 @@ import { check, checkString } from "./helpers/checks.js";

* @param {AccountListCriteria} criteria - Optional criteria to limit the list returned.
* @returns {Promise<Account>}
* @returns {Promise<Account[]>}
* @tag Accounts
*/
async list(accountID, criteria) {
checkString(accountID).or(Err.AccountID);
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);
let params = "";

@@ -390,3 +390,3 @@ if (criteria) {

async get(connectedAccountID) {
checkString(connectedAccountID).or(Err.AccountID);
checkString(connectedAccountID).or(Err.MISSING_ACCOUNT_ID);
const result = await this.moov

@@ -421,3 +421,3 @@ .got({

async patch(account) {
checkString(account.accountID).or(Err.AccountID);
checkString(account.accountID).or(Err.MISSING_ACCOUNT_ID);
const patchAccount = { ...account };

@@ -442,3 +442,3 @@ delete patchAccount.accountID;

async getCountries(accountID) {
checkString(accountID).or(Err.AccountID);
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);
const result = await this.moov

@@ -461,3 +461,3 @@ .got({

async assignCountries(accountID, countries) {
checkString(accountID).or(Err.AccountID);
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);
check(countries).or(Err.MISSING_COUNTRIES);

@@ -464,0 +464,0 @@ const result = await this.moov

@@ -31,3 +31,3 @@ import { checkString } from "./helpers/checks.js";

async get(uniqueId) {
checkString(uniqueId).or(Err.MISSING_UNIQUE_ID_ERROR_MESSAGE);
checkString(uniqueId).or(Err.MISSING_UNIQUE_ID);
const result = await this.moov

@@ -34,0 +34,0 @@ .got({

@@ -35,23 +35,23 @@ import { check, checkString } from "./helpers/checks.js";

if (!bankAccount.accountNumber) {
console.log(Err.MISSING_BANK_ACCOUNT_NUMBER_ERROR_MESSAGE);
throw new Error(Err.MISSING_BANK_ACCOUNT_NUMBER_ERROR_MESSAGE);
console.log(Err.MISSING_BANK_ACCOUNT_NUMBER);
throw new Error(Err.MISSING_BANK_ACCOUNT_NUMBER);
}
if (!bankAccount.routingNumber) {
console.log(Err.MISSING_BANK_ACCOUNT_ROUTING_NUMBER_ERROR_MESSAGE);
throw new Error(Err.MISSING_BANK_ACCOUNT_ROUTING_NUMBER_ERROR_MESSAGE);
console.log(Err.MISSING_BANK_ACCOUNT_ROUTING_NUMBER);
throw new Error(Err.MISSING_BANK_ACCOUNT_ROUTING_NUMBER);
}
if (bankAccount.routingNumber.length !== 9) {
console.log(Err.MISSING_BANK_ACCOUNT_ROUTING_NUMBER_LENGTH_ERROR_MESSAGE);
throw new Error(Err.MISSING_BANK_ACCOUNT_ROUTING_NUMBER_LENGTH_ERROR_MESSAGE);
console.log(Err.MISSING_BANK_ACCOUNT_ROUTING_NUMBER_LENGTH);
throw new Error(Err.MISSING_BANK_ACCOUNT_ROUTING_NUMBER_LENGTH);
}
if (!bankAccount.holderName) {
console.log(Err.MISSING_BANK_ACCOUNT_HOLDER_NAME_ERROR_MESSAGE);
throw new Error(Err.MISSING_BANK_ACCOUNT_HOLDER_NAME_ERROR_MESSAGE);
console.log(Err.MISSING_BANK_ACCOUNT_HOLDER_NAME);
throw new Error(Err.MISSING_BANK_ACCOUNT_HOLDER_NAME);
}
if (!bankAccount.holderType) {
console.log(Err.MISSING_BANK_ACCOUNT_HOLDER_TYPE_ERROR_MESSAGE);
throw new Error(Err.MISSING_BANK_ACCOUNT_HOLDER_TYPE_ERROR_MESSAGE);
console.log(Err.MISSING_BANK_ACCOUNT_HOLDER_TYPE);
throw new Error(Err.MISSING_BANK_ACCOUNT_HOLDER_TYPE);
}
payload = {
account: bankAccount
account: bankAccount,
};

@@ -61,3 +61,3 @@ }

payload = {
plaid: { token: plaidToken }
plaid: { token: plaidToken },
};

@@ -67,3 +67,3 @@ }

payload = {
mx: { authorizationCode: mxAuthorizationCode }
mx: { authorizationCode: mxAuthorizationCode },
};

@@ -90,4 +90,4 @@ }

async get(accountID, bankAccountID) {
checkString(accountID).or(Err.AccountID);
checkString(bankAccountID).or(Err.BankAccountID);
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);
checkString(bankAccountID).or(Err.MISSING_BANK_ACCOUNT_ID);
const result = await this.moov

@@ -110,3 +110,3 @@ .got({

async list(accountID) {
checkString(accountID).or(Err.AccountID);
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);
const result = await this.moov

@@ -130,4 +130,4 @@ .got({

async disable(accountID, bankAccountID) {
checkString(accountID).or(Err.AccountID);
checkString(bankAccountID).or(Err.BankAccountID);
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);
checkString(bankAccountID).or(Err.MISSING_BANK_ACCOUNT_ID);
const result = await this.moov

@@ -151,4 +151,4 @@ .got({

async initMicroDeposits(accountID, bankAccountID) {
checkString(accountID).or(Err.AccountID);
checkString(bankAccountID).or(Err.BankAccountID);
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);
checkString(bankAccountID).or(Err.MISSING_BANK_ACCOUNT_ID);
const result = await this.moov

@@ -173,4 +173,4 @@ .got({

async completeMicroDeposits(accountID, bankAccountID, amounts) {
checkString(accountID).or(Err.AccountID);
checkString(bankAccountID).or(Err.BankAccountID);
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);
checkString(bankAccountID).or(Err.MISSING_BANK_ACCOUNT_ID);
check(amounts).or(Err.MISSING_AMOUNTS);

@@ -181,3 +181,3 @@ const result = await this.moov

method: "PUT",
json: { "amounts": amounts },
json: { amounts: amounts },
})

@@ -184,0 +184,0 @@ .json();

@@ -155,3 +155,3 @@ /**

* @tag Capabilities
*/
*/
/**

@@ -158,0 +158,0 @@ * The Capabilities API

@@ -55,3 +55,3 @@ import { check, checkString } from "./helpers/checks.js";

*/
PENDING: "pending"
PENDING: "pending",
};

@@ -214,3 +214,3 @@ /**

*/
DOCUMENT: "document.{doc-uuid}"
DOCUMENT: "document.{doc-uuid}",
};

@@ -293,3 +293,3 @@ /**

*/
DOCUMENT_EXPIRED: "document-expired"
DOCUMENT_EXPIRED: "document-expired",
};

@@ -345,3 +345,3 @@ /**

* @tag Capabilities
*/
*/
/**

@@ -365,3 +365,3 @@ * The Capabilities API

async requestCapabilities(accountID, capabilities) {
checkString(accountID).or(Err.AccountID);
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);
check(capabilities).or(Err.MISSING_CAPABILITIES);

@@ -372,3 +372,3 @@ const result = await this.moov

method: "POST",
json: { "capabilities": capabilities },
json: { capabilities: capabilities },
})

@@ -388,3 +388,3 @@ .json();

async get(accountID, capability) {
checkString(accountID).or(Err.AccountID);
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);
checkString(capability).or(Err.MISSING_CAPABILITY);

@@ -408,3 +408,3 @@ const result = await this.moov

async list(accountID) {
checkString(accountID).or(Err.AccountID);
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);
const result = await this.moov

@@ -428,3 +428,3 @@ .got({

async disable(accountID, capability) {
checkString(accountID).or(Err.AccountID);
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);
checkString(capability).or(Err.MISSING_CAPABILITY);

@@ -431,0 +431,0 @@ const result = await this.moov

@@ -31,2 +31,13 @@ export type CARD_BRAND = any;

/**
* Card information collected for acquisition.
* @typedef LinkCard
* @property {string} cardNumber - All digits of the card
* @property {CardExpiration} expiration - Card expiration date
* @property {string} cardCvv - 3-4 digit card verification value
* @property {string} holderName - Full name of the card holder
* @property {CardBillingAddress} billingAddress - The billing address of the card
*
* @tag Cards
*/
/**
* Card billing address

@@ -125,2 +136,12 @@ * @typedef CardBillingAddress

/**
* Links a card to a Moov account. Only use this endpoint if you have provided Moov with a
* copy of your PCI attestation of compliance.
*
* @param {string} accountID - Account to link
* @param {LinkCard} card - Card information
* @returns {Promise<Card>}
* @tag Cards
*/
link(accountID: string, card: LinkCard): Promise<Card>;
/**
* Disables a card with the specified ID.

@@ -149,2 +170,27 @@ *

/**
* Card information collected for acquisition.
*/
export type LinkCard = {
/**
* - All digits of the card
*/
cardNumber: string;
/**
* - Card expiration date
*/
expiration: CardExpiration;
/**
* - 3-4 digit card verification value
*/
cardCvv: string;
/**
* - Full name of the card holder
*/
holderName: string;
/**
* - The billing address of the card
*/
billingAddress: CardBillingAddress;
};
/**
* Card billing address

@@ -151,0 +197,0 @@ */

@@ -1,2 +0,2 @@

import { checkString } from "./helpers/checks.js";
import { check, checkString } from "./helpers/checks.js";
import { Err } from "./helpers/errors.js";

@@ -28,3 +28,3 @@ /** @external Promise */

*/
VISA: "Visa"
VISA: "Visa",
};

@@ -55,3 +55,3 @@ /**

*/
UNKNOWN: "unknown"
UNKNOWN: "unknown",
};

@@ -82,3 +82,3 @@ /**

*/
UNAVAILABLE: "unavailable"
UNAVAILABLE: "unavailable",
};

@@ -94,2 +94,13 @@ /**

/**
* Card information collected for acquisition.
* @typedef LinkCard
* @property {string} cardNumber - All digits of the card
* @property {CardExpiration} expiration - Card expiration date
* @property {string} cardCvv - 3-4 digit card verification value
* @property {string} holderName - Full name of the card holder
* @property {CardBillingAddress} billingAddress - The billing address of the card
*
* @tag Cards
*/
/**
* Card billing address

@@ -180,4 +191,4 @@ * @typedef CardBillingAddress

async get(accountID, cardID) {
checkString(accountID).or(Err.AccountID);
checkString(cardID).or(Err.CardID);
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);
checkString(cardID).or(Err.MISSING_CARD_ID);
const result = await this.moov

@@ -199,3 +210,3 @@ .got({

async list(accountID) {
checkString(accountID).or(Err.AccountID);
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);
const result = await this.moov

@@ -205,2 +216,3 @@ .got({

method: "GET",
json: card,
})

@@ -211,2 +223,23 @@ .json();

/**
* Links a card to a Moov account. Only use this endpoint if you have provided Moov with a
* copy of your PCI attestation of compliance.
*
* @param {string} accountID - Account to link
* @param {LinkCard} card - Card information
* @returns {Promise<Card>}
* @tag Cards
*/
async link(accountID, card) {
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);
check(card).or(Err.MISSING_CARD);
const result = await this.moov
.got({
url: `accounts/${accountID}/cards`,
method: "POST",
json: card,
})
.json();
return result;
}
/**
* Disables a card with the specified ID.

@@ -220,4 +253,4 @@ *

async disable(accountID, cardID) {
checkString(accountID).or(Err.AccountID);
checkString(cardID).or(Err.CardID);
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);
checkString(cardID).or(Err.MISSING_CARD_ID);
const result = await this.moov

@@ -224,0 +257,0 @@ .got({

@@ -64,4 +64,4 @@ import { check, checkString } from "./helpers/checks.js";

async get(criteria) {
check(criteria).or(Err.MISSING_CRITERIA_ERROR_MESSAGE);
checkString(criteria.search).or(Err.MISSING_ENRICH_ADDRESS_SEARCH_ERROR_MESSAGE);
check(criteria).or(Err.MISSING_CRITERIA);
checkString(criteria.search).or(Err.MISSING_ENRICH_ADDRESS_SEARCH);
const options = {

@@ -68,0 +68,0 @@ url: "enrichment/address",

@@ -91,3 +91,3 @@ import { checkString } from "./helpers/checks.js";

async get(email) {
checkString(email).or(Err.MISSING_EMAIL_ERROR_MESSAGE);
checkString(email).or(Err.MISSING_EMAIL);
const result = await this.moov

@@ -98,4 +98,4 @@ .got({

searchParams: {
email: email
}
email: email,
},
})

@@ -102,0 +102,0 @@ .json();

export namespace Err {
const ApiKeyCredentials: string;
const AccountID: string;
const CardID: string;
const BankAccountID: string;
const RepresentativeID: string;
const PaymentMethodID: string;
const TransferID: string;
const RefundID: string;
const WalletID: string;
const PublicKey: string;
const SecretKey: string;
const Domain: string;
const Scopes: string;
const MISSING_ACCOUNT_ID_ERROR_MESSAGE: string;
const MISSING_ACCOUNT_ID: string;
const MISSING_AMOUNTS: string;
const MISSING_API_KEY_CREDENTIALS: string;
const MISSING_BANK_ACCOUNT_HOLDER_NAME: string;
const MISSING_BANK_ACCOUNT_HOLDER_TYPE: string;
const MISSING_BANK_ACCOUNT_ID: string;
const MISSING_BANK_ACCOUNT_NUMBER: string;
const MISSING_BANK_ACCOUNT_ROUTING_NUMBER: string;
const MISSING_BANK_ACCOUNT_ROUTING_NUMBER_LENGTH: string;
const MISSING_BANK_PAYLOAD: string;
const MISSING_BANK_ACCOUNT_NUMBER_ERROR_MESSAGE: string;
const MISSING_BANK_ACCOUNT_ROUTING_NUMBER_ERROR_MESSAGE: string;
const MISSING_BANK_ACCOUNT_ROUTING_NUMBER_LENGTH_ERROR_MESSAGE: string;
const MISSING_BANK_ACCOUNT_HOLDER_NAME_ERROR_MESSAGE: string;
const MISSING_BANK_ACCOUNT_HOLDER_TYPE_ERROR_MESSAGE: string;
const MISSING_CRITERIA_ERROR_MESSAGE: string;
const MISSING_EMAIL_ERROR_MESSAGE: string;
const MISSING_ENRICH_ADDRESS_SEARCH_ERROR_MESSAGE: string;
const MISSING_INSTITUTION_NAME_OR_ROUTING_ERROR_MESSAGE: string;
const MISSING_REPRESENTATIVE_ERROR_MESSAGE: string;
const MISSING_UNIQUE_ID_ERROR_MESSAGE: string;
const MISSING_CAPABILITIES: string;
const MISSING_CAPABILITY: string;
const MISSING_TRANSFER_ERROR_MESSAGE: string;
const MISSING_TRANSFER_OPTION_CRITERIA_ERROR_MESSAGE: string;
const MISSING_CARD: string;
const MISSING_CARD_ID: string;
const MISSING_COUNTRIES: string;
const MISSING_AMOUNTS: string;
const MISSING_CRITERIA: string;
const MISSING_DOMAIN: string;
const MISSING_EMAIL: string;
const MISSING_ENRICH_ADDRESS_SEARCH: string;
const MISSING_INSTITUTION_NAME_OR_ROUTING: string;
const MISSING_PAYMENT_METHOD_ID: string;
const MISSING_PUBLIC_KEY: string;
const MISSING_REFUND_ID: string;
const MISSING_REPRESENTATIVE: string;
const MISSING_REPRESENTATIVE_ID: string;
const MISSING_SCOPES: string;
const MISSING_SECRET_KEY: string;
const MISSING_TRANSFER: string;
const MISSING_TRANSFER_ID: string;
const MISSING_TRANSFER_OPTION_CRITERIA: string;
const MISSING_UNIQUE_ID: string;
const MISSING_WALLET_ID: string;
}
export const Err = {
// Parameter errors
ApiKeyCredentials: "credentials are required",
AccountID: "accountID is required",
CardID: "cardID is required",
BankAccountID: "bankAccountID is required",
RepresentativeID: "representativeID is required",
PaymentMethodID: "paymentMethodID is required",
TransferID: "transferID is required",
RefundID: "refundID is required",
WalletID: "walletID is required",
PublicKey: "publicKey is required",
SecretKey: "secretKey is required",
Domain: "domain is required and must be a valid URL",
Scopes: "one or more scopes are required",
MISSING_ACCOUNT_ID_ERROR_MESSAGE: "Please provide an accountID",
MISSING_BANK_PAYLOAD: "Please provide a bankAccount, plaidToken, or mxAuthorizationCode.",
MISSING_BANK_ACCOUNT_NUMBER_ERROR_MESSAGE: "Please provide a bank account number.",
MISSING_BANK_ACCOUNT_ROUTING_NUMBER_ERROR_MESSAGE: "Please provide a routingNumber.",
MISSING_BANK_ACCOUNT_ROUTING_NUMBER_LENGTH_ERROR_MESSAGE: "Routing number must be 9 digits.",
MISSING_BANK_ACCOUNT_HOLDER_NAME_ERROR_MESSAGE: "Please provide a holderName.",
MISSING_BANK_ACCOUNT_HOLDER_TYPE_ERROR_MESSAGE: "Please provide a holderType.",
MISSING_CRITERIA_ERROR_MESSAGE: "Please provide search criteria.",
MISSING_EMAIL_ERROR_MESSAGE: "Please provide an email.",
MISSING_ENRICH_ADDRESS_SEARCH_ERROR_MESSAGE: "Please provide a partial or complete address to search.",
MISSING_INSTITUTION_NAME_OR_ROUTING_ERROR_MESSAGE: "Please provide a financial institution's name or routing number to search.",
MISSING_REPRESENTATIVE_ERROR_MESSAGE: "Please provide representative details.",
MISSING_UNIQUE_ID_ERROR_MESSAGE: "Please provide a uniqueID.",
MISSING_CAPABILITIES: "Please provide capabilities.",
MISSING_CAPABILITY: "Please provide capability.",
MISSING_TRANSFER_ERROR_MESSAGE: "Please provide transfer details.",
MISSING_TRANSFER_OPTION_CRITERIA_ERROR_MESSAGE: "Please provide transfer option criteria.",
MISSING_COUNTRIES: "Please provide countries.",
MISSING_AMOUNTS: "Please provide amounts.",
// 1. Keep these errors alphabetized
// 2. Do not use variable names -- use phrases (e.g. "bank account ID" not "bankAccountID")
// 3. Duplicate the voice and tone used by existing errors when you add a new one
// 4. Do not capitialize or use punctuation -- these errors are for developers
MISSING_ACCOUNT_ID: "account ID is required",
MISSING_AMOUNTS: "amounts are required",
MISSING_API_KEY_CREDENTIALS: "credentials are required",
MISSING_BANK_ACCOUNT_HOLDER_NAME: "holder name is required",
MISSING_BANK_ACCOUNT_HOLDER_TYPE: "holder type is required",
MISSING_BANK_ACCOUNT_ID: "bank account ID is required",
MISSING_BANK_ACCOUNT_NUMBER: "bank account number is required",
MISSING_BANK_ACCOUNT_ROUTING_NUMBER: "routing number is required",
MISSING_BANK_ACCOUNT_ROUTING_NUMBER_LENGTH: "routing number must be 9 digits",
MISSING_BANK_PAYLOAD: "a bank account, Plaid token, or MX authorization code is required",
MISSING_CAPABILITIES: "capabilities are required",
MISSING_CAPABILITY: "capability is required",
MISSING_CARD: "card information is required",
MISSING_CARD_ID: "card ID is required",
MISSING_COUNTRIES: "countries are required",
MISSING_CRITERIA: "search criteria is required",
MISSING_DOMAIN: "domain is required and must be a valid URL",
MISSING_EMAIL: "email is required",
MISSING_ENRICH_ADDRESS_SEARCH: "partial or complete address to search is required",
MISSING_INSTITUTION_NAME_OR_ROUTING: "financial institution's name or routing number to search is required",
MISSING_PAYMENT_METHOD_ID: "payment method ID is required",
MISSING_PUBLIC_KEY: "public key is required",
MISSING_REFUND_ID: "refund ID is required",
MISSING_REPRESENTATIVE: "representative details are required",
MISSING_REPRESENTATIVE_ID: "representative ID is required",
MISSING_SCOPES: "one or more scopes are required",
MISSING_SECRET_KEY: "secret key is required",
MISSING_TRANSFER: "transfer details are required",
MISSING_TRANSFER_ID: "transfer ID is required",
MISSING_TRANSFER_OPTION_CRITERIA: "transfer option criteria is required",
MISSING_UNIQUE_ID: "unique ID is required",
MISSING_WALLET_ID: "wallet ID is required",
};

@@ -148,5 +148,5 @@ import { check } from "./helpers/checks.js";

async getInstitution(criteria, rail) {
check(criteria).or(Err.MISSING_CRITERIA_ERROR_MESSAGE);
check(criteria).or(Err.MISSING_CRITERIA);
if (!criteria.name && !criteria.routingNumber) {
throw new TypeError(Err.MISSING_INSTITUTION_NAME_OR_ROUTING_ERROR_MESSAGE);
throw new TypeError(Err.MISSING_INSTITUTION_NAME_OR_ROUTING);
}

@@ -161,3 +161,3 @@ const params = new URLSearchParams();

method: "GET",
searchParams: params
searchParams: params,
})

@@ -164,0 +164,0 @@ .json();

@@ -282,3 +282,3 @@ /**

*
* @example
* @example
* const moov = new Moov(...);

@@ -285,0 +285,0 @@ * try {

@@ -207,6 +207,6 @@ import { got } from "got-cjs";

constructor(credentials, gotOptionsOrInstance) {
check(credentials).or(Err.ApiKeyCredentials);
checkString(credentials.accountID).or(Err.AccountID);
checkString(credentials.publicKey).or(Err.PublicKey);
checkString(credentials.secretKey).or(Err.SecretKey);
check(credentials).or(Err.MISSING_API_KEY_CREDENTIALS);
checkString(credentials.accountID).or(Err.MISSING_ACCOUNT_ID);
checkString(credentials.publicKey).or(Err.MISSING_PUBLIC_KEY);
checkString(credentials.secretKey).or(Err.MISSING_SECRET_KEY);
checkUrl(credentials.domain).or(Err.DomainRequired);

@@ -245,3 +245,3 @@ this.credentials = credentials;

async generateToken(scopes, accountID) {
checkArrayLength(scopes).or(Err.Scopes);
checkArrayLength(scopes).or(Err.MISSING_SCOPES);
if (!accountID) {

@@ -252,3 +252,3 @@ accountID = this.credentials.accountID;

for (let scope of scopes) {
checkString(scope).or(Err.Scopes);
checkString(scope).or(Err.MISSING_SCOPES);
renderedScopes.push(scope.replace("{accountID}", accountID));

@@ -267,3 +267,3 @@ }

origin: this.credentials.domain,
}
},
}).json();

@@ -503,3 +503,3 @@ const expiresOn = new Date(new Date().getTime() + result.expires_in * 1000);

*
* @example
* @example
* const moov = new Moov(...);

@@ -506,0 +506,0 @@ * try {

@@ -1,2 +0,2 @@

import { checkString } from './helpers/checks.js';
import { checkString } from "./helpers/checks.js";
import { Err } from "./helpers/errors.js";

@@ -91,4 +91,4 @@ /** @external Promise */

async get(accountID, paymentMethodID) {
checkString(accountID).or(Err.AccountID);
checkString(paymentMethodID).or(Err.PaymentMethodID);
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);
checkString(paymentMethodID).or(Err.MISSING_PAYMENT_METHOD_ID);
const result = await this.moov

@@ -111,3 +111,3 @@ .got({

async list(accountID) {
checkString(accountID).or(Err.AccountID);
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);
const result = await this.moov

@@ -114,0 +114,0 @@ .got({

@@ -145,4 +145,4 @@ import { check, checkString } from "./helpers/checks.js";

async create(accountID, representative) {
checkString(accountID).or(Err.AccountID);
check(representative).or(Err.MISSING_REPRESENTATIVE_ERROR_MESSAGE);
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);
check(representative).or(Err.MISSING_REPRESENTATIVE);
const result = await this.moov

@@ -165,3 +165,3 @@ .got({

async list(accountID) {
checkString(accountID).or(Err.AccountID);
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);
const result = await this.moov

@@ -184,4 +184,4 @@ .got({

async get(accountID, representativeID) {
checkString(accountID).or(Err.AccountID);
checkString(representativeID).or(Err.RepresentativeID);
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);
checkString(representativeID).or(Err.MISSING_REPRESENTATIVE_ID);
const result = await this.moov

@@ -204,4 +204,4 @@ .got({

async delete(accountID, representativeID) {
checkString(accountID).or(Err.AccountID);
checkString(representativeID).or(Err.RepresentativeID);
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);
checkString(representativeID).or(Err.MISSING_REPRESENTATIVE_ID);
const result = await this.moov

@@ -225,5 +225,5 @@ .got({

async update(accountID, representativeID, representative) {
checkString(accountID).or(Err.AccountID);
checkString(representativeID).or(Err.RepresentativeID);
check(representative).or(Err.MISSING_REPRESENTATIVE_ERROR_MESSAGE);
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);
checkString(representativeID).or(Err.MISSING_REPRESENTATIVE_ID);
check(representative).or(Err.MISSING_REPRESENTATIVE);
const result = await this.moov

@@ -230,0 +230,0 @@ .got({

@@ -258,3 +258,3 @@ import { randomUUID } from "crypto";

async create(transfer) {
check(transfer).or(Err.MISSING_TRANSFER_ERROR_MESSAGE);
check(transfer).or(Err.MISSING_TRANSFER);
const result = await this.moov

@@ -341,3 +341,3 @@ .got({

async get(transferID) {
checkString(transferID).or(Err.TransferID);
checkString(transferID).or(Err.MISSING_TRANSFER_ID);
const result = await this.moov

@@ -371,3 +371,3 @@ .got({

async updateMetadata(transferID, metadata) {
checkString(transferID).or(Err.TransferID);
checkString(transferID).or(Err.MISSING_TRANSFER_ID);
const result = await this.moov

@@ -413,3 +413,3 @@ .got({

async getTransferOptions(transferOptionsCriteria) {
check(transferOptionsCriteria).or(Err.MISSING_TRANSFER_OPTION_CRITERIA_ERROR_MESSAGE);
check(transferOptionsCriteria).or(Err.MISSING_TRANSFER_OPTION_CRITERIA);
const result = await this.moov

@@ -440,3 +440,3 @@ .got({

async refund(transferID) {
checkString(transferID).or(Err.TransferID);
checkString(transferID).or(Err.MISSING_TRANSFER_ID);
const result = await this.moov

@@ -469,3 +469,3 @@ .got({

async listRefunds(transferID) {
checkString(transferID).or(Err.TransferID);
checkString(transferID).or(Err.MISSING_TRANSFER_ID);
const result = await this.moov

@@ -496,4 +496,4 @@ .got({

async getRefund(transferID, refundID) {
checkString(transferID).or(Err.TransferID);
checkString(refundID).or(Err.RefundID);
checkString(transferID).or(Err.MISSING_TRANSFER_ID);
checkString(refundID).or(Err.MISSING_REFUND_ID);
const result = await this.moov

@@ -500,0 +500,0 @@ .got({

@@ -47,4 +47,4 @@ /** @external Promise */

async get(accountID, walletID) {
checkString(accountID).or(Err.AccountID);
checkString(walletID).or(Err.WalletID);
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);
checkString(walletID).or(Err.MISSING_WALLET_ID);
const result = await this.moov

@@ -67,3 +67,3 @@ .got({

async list(accountID) {
checkString(accountID).or(Err.AccountID);
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);
const result = await this.moov

@@ -70,0 +70,0 @@ .got({

@@ -383,7 +383,7 @@ import { check, checkString } from "./helpers/checks.js";

* @param {AccountListCriteria} criteria - Optional criteria to limit the list returned.
* @returns {Promise<Account>}
* @returns {Promise<Account[]>}
* @tag Accounts
*/
async list(accountID, criteria) {
checkString(accountID).or(Err.AccountID);
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);
let params = "";

@@ -418,3 +418,3 @@

async get(connectedAccountID) {
checkString(connectedAccountID).or(Err.AccountID);
checkString(connectedAccountID).or(Err.MISSING_ACCOUNT_ID);
const result = await this.moov

@@ -454,3 +454,3 @@ .got({

async patch(account) {
checkString(account.accountID).or(Err.AccountID);
checkString(account.accountID).or(Err.MISSING_ACCOUNT_ID);

@@ -480,3 +480,3 @@ const patchAccount = { ...account };

async getCountries(accountID) {
checkString(accountID).or(Err.AccountID);
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);

@@ -502,3 +502,3 @@ const result = await this.moov

async assignCountries(accountID, countries) {
checkString(accountID).or(Err.AccountID);
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);
check(countries).or(Err.MISSING_COUNTRIES);

@@ -505,0 +505,0 @@

@@ -10,7 +10,7 @@ import { checkString } from "./helpers/checks.js";

constructor(moov) {
/**
* @type {Moov}
* @private
*/
this.moov = moov;
/**
* @type {Moov}
* @private
*/
this.moov = moov;
}

@@ -20,7 +20,7 @@

* Gets a binary represention of an avatar.
*
*
* @param {string} uniqueId - Any unique ID associated with an account such as AccountID, RepresentativeID, Routing Number, or User ID
* @returns {Promise<Blob>} - Binary representation of the avatar.
* @tag Avatars
*
*
* @example

@@ -35,13 +35,13 @@ * const moov = new Moov(...);

async get(uniqueId) {
checkString(uniqueId).or(Err.MISSING_UNIQUE_ID_ERROR_MESSAGE);
const result = await this.moov
.got({
url: `avatars/${uniqueId}`,
method: "GET",
})
.blob();
checkString(uniqueId).or(Err.MISSING_UNIQUE_ID);
return result;
const result = await this.moov
.got({
url: `avatars/${uniqueId}`,
method: "GET",
})
.blob();
return result;
}
}
}

@@ -18,12 +18,12 @@ import { check, checkString } from "./helpers/checks.js";

* Link a bank account to a Moov account
*
*
* @param {string} accountID - Account on which to add the bank account
* @param {BankAccountAdd} [bankAccount] - Optional bank account details
* @param {BankAccountAdd} [bankAccount] - Optional bank account details
* @param {string} [plaidToken] - Optional Plaid processor token
* @param {string} [mxAuthorizationCode] - Optional Plaid processor authorization code
* @returns {Promise<BankAccount>}
*
*
* @tag Bank accounts
*/
async link( accountID, bankAccount, plaidToken, mxAuthorizationCode ) {
async link(accountID, bankAccount, plaidToken, mxAuthorizationCode) {
let payload = {};

@@ -34,3 +34,3 @@ if (!accountID) {

}
if (!bankAccount && !plaidToken && !mxAuthorizationCode) {

@@ -43,32 +43,32 @@ console.log(Err.MISSING_BANK_PAYLOAD);

if (!bankAccount.accountNumber) {
console.log(Err.MISSING_BANK_ACCOUNT_NUMBER_ERROR_MESSAGE);
throw new Error(Err.MISSING_BANK_ACCOUNT_NUMBER_ERROR_MESSAGE);
console.log(Err.MISSING_BANK_ACCOUNT_NUMBER);
throw new Error(Err.MISSING_BANK_ACCOUNT_NUMBER);
}
if (!bankAccount.routingNumber) {
console.log(Err.MISSING_BANK_ACCOUNT_ROUTING_NUMBER_ERROR_MESSAGE);
throw new Error(Err.MISSING_BANK_ACCOUNT_ROUTING_NUMBER_ERROR_MESSAGE);
console.log(Err.MISSING_BANK_ACCOUNT_ROUTING_NUMBER);
throw new Error(Err.MISSING_BANK_ACCOUNT_ROUTING_NUMBER);
}
if (bankAccount.routingNumber.length !== 9) {
console.log(Err.MISSING_BANK_ACCOUNT_ROUTING_NUMBER_LENGTH_ERROR_MESSAGE);
throw new Error(Err.MISSING_BANK_ACCOUNT_ROUTING_NUMBER_LENGTH_ERROR_MESSAGE);
console.log(Err.MISSING_BANK_ACCOUNT_ROUTING_NUMBER_LENGTH);
throw new Error(Err.MISSING_BANK_ACCOUNT_ROUTING_NUMBER_LENGTH);
}
if (!bankAccount.holderName) {
console.log(Err.MISSING_BANK_ACCOUNT_HOLDER_NAME_ERROR_MESSAGE);
throw new Error(Err.MISSING_BANK_ACCOUNT_HOLDER_NAME_ERROR_MESSAGE);
console.log(Err.MISSING_BANK_ACCOUNT_HOLDER_NAME);
throw new Error(Err.MISSING_BANK_ACCOUNT_HOLDER_NAME);
}
if (!bankAccount.holderType) {
console.log(Err.MISSING_BANK_ACCOUNT_HOLDER_TYPE_ERROR_MESSAGE);
throw new Error(Err.MISSING_BANK_ACCOUNT_HOLDER_TYPE_ERROR_MESSAGE);
console.log(Err.MISSING_BANK_ACCOUNT_HOLDER_TYPE);
throw new Error(Err.MISSING_BANK_ACCOUNT_HOLDER_TYPE);
}
payload = {
account: bankAccount
}
account: bankAccount,
};
} else if (plaidToken) {
payload = {
plaid: { token: plaidToken }
}
plaid: { token: plaidToken },
};
} else if (mxAuthorizationCode) {
payload = {
mx: { authorizationCode: mxAuthorizationCode }
}
mx: { authorizationCode: mxAuthorizationCode },
};
}

@@ -89,12 +89,12 @@

* Retrieve bank account details (i.e. routing number or account type) associated with a specific Moov account.
*
*
* @param {string} accountID - Account on which to request bank account
* @param {string} bankAccountID - ID of the bank account to retrieve
* @param {string} bankAccountID - ID of the bank account to retrieve
* @returns {Promise<BankAccount>}
*
*
* @tag Bank accounts
*/
async get(accountID, bankAccountID) {
checkString(accountID).or(Err.AccountID);
checkString(bankAccountID).or(Err.BankAccountID);
async get(accountID, bankAccountID) {
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);
checkString(bankAccountID).or(Err.MISSING_BANK_ACCOUNT_ID);

@@ -113,10 +113,10 @@ const result = await this.moov

* List all the bank accounts associated with a particular Moov account.
*
*
* @param {string} accountID - Account on which to request bank account
* @returns {Promise<BankAccount[]>}
*
*
* @tag Bank accounts
*/
async list(accountID) {
checkString(accountID).or(Err.AccountID);
async list(accountID) {
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);

@@ -135,12 +135,12 @@ const result = await this.moov

* Discontinue using a specified bank account linked to a Moov account.
*
*
* @param {string} accountID - Account on which to request bank account
* @param {string} bankAccountID - ID of the bank account to disable
* @param {string} bankAccountID - ID of the bank account to disable
* @returns {Promise<void>}
*
*
* @tag Bank accounts
*/
async disable(accountID, bankAccountID) {
checkString(accountID).or(Err.AccountID);
checkString(bankAccountID).or(Err.BankAccountID);
async disable(accountID, bankAccountID) {
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);
checkString(bankAccountID).or(Err.MISSING_BANK_ACCOUNT_ID);

@@ -159,12 +159,12 @@ const result = await this.moov

* Initiate a micro deposit for a bank account linked to a Moov account.
*
*
* @param {string} accountID - Account on which to request bank account
* @param {string} bankAccountID - ID of the bank account to disable
* @param {string} bankAccountID - ID of the bank account to disable
* @returns {Promise<void>}
*
*
* @tag Bank accounts
*/
async initMicroDeposits(accountID, bankAccountID) {
checkString(accountID).or(Err.AccountID);
checkString(bankAccountID).or(Err.BankAccountID);
async initMicroDeposits(accountID, bankAccountID) {
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);
checkString(bankAccountID).or(Err.MISSING_BANK_ACCOUNT_ID);

@@ -183,13 +183,13 @@ const result = await this.moov

* Complete the micro-deposit validation process by passing the amounts of the two transfers.
*
*
* @param {string} accountID - Account on which to request bank account
* @param {string} bankAccountID - ID of the bank account to disable
* @param {string} bankAccountID - ID of the bank account to disable
* @param {Array.<number>} amounts - Array of two positive integers, in cents, equal to the values of the micro-deposits sent to the bank account.
* @returns {Promise<void>}
*
*
* @tag Bank accounts
*/
async completeMicroDeposits(accountID, bankAccountID, amounts) {
checkString(accountID).or(Err.AccountID);
checkString(bankAccountID).or(Err.BankAccountID);
async completeMicroDeposits(accountID, bankAccountID, amounts) {
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);
checkString(bankAccountID).or(Err.MISSING_BANK_ACCOUNT_ID);
check(amounts).or(Err.MISSING_AMOUNTS);

@@ -201,3 +201,3 @@

method: "PUT",
json: {"amounts": amounts},
json: { amounts: amounts },
})

@@ -208,3 +208,2 @@ .json();

}
}
}

@@ -37,3 +37,3 @@ import { check, checkString } from "./helpers/checks.js";

1099: "1099",
}
};

@@ -59,4 +59,4 @@ /**

*/
PENDING: "pending"
}
PENDING: "pending",
};

@@ -219,4 +219,4 @@ /**

*/
DOCUMENT: "document.{doc-uuid}"
}
DOCUMENT: "document.{doc-uuid}",
};

@@ -299,4 +299,4 @@ /**

*/
DOCUMENT_EXPIRED: "document-expired"
}
DOCUMENT_EXPIRED: "document-expired",
};

@@ -352,5 +352,5 @@ /**

* @property {Array.<REQUIREMENT_ERROR_CODE>} errorCode
*
*
* @tag Capabilities
*/
*/

@@ -368,11 +368,11 @@ /**

* Request a capability to be added to an account
*
*
* @param {string} accountID - Account on which to request capabilites
* @param {CAPABILITIES[]} capabilities - One or more capability to request
* @returns {Promise<Capability[]>}
*
*
* @tag Capabilities
*/
async requestCapabilities(accountID, capabilities) {
checkString(accountID).or(Err.AccountID);
async requestCapabilities(accountID, capabilities) {
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);
check(capabilities).or(Err.MISSING_CAPABILITIES);

@@ -384,3 +384,3 @@

method: "POST",
json: {"capabilities": capabilities},
json: { capabilities: capabilities },
})

@@ -394,11 +394,11 @@ .json();

* Retrieve a capability of an account
*
*
* @param {string} accountID - Account on which to request capabilites
* @param {CAPABILITIES} capability - Capability to retrieve
* @param {CAPABILITIES} capability - Capability to retrieve
* @returns {Promise<Capability>}
*
*
* @tag Capabilities
*/
async get(accountID, capability) {
checkString(accountID).or(Err.AccountID);
async get(accountID, capability) {
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);
checkString(capability).or(Err.MISSING_CAPABILITY);

@@ -418,10 +418,10 @@

* List capabilities on an account
*
*
* @param {string} accountID - Account on which to request capabilites
* @returns {Promise<Capability[]>}
*
*
* @tag Capabilities
*/
async list(accountID) {
checkString(accountID).or(Err.AccountID);
async list(accountID) {
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);

@@ -440,11 +440,11 @@ const result = await this.moov

* Disable a capability of an account
*
*
* @param {string} accountID - Account on which to request capabilites
* @param {CAPABILITIES} capability - Capability to retrieve
* @param {CAPABILITIES} capability - Capability to retrieve
* @returns {Promise<void>}
*
*
* @tag Capabilities
*/
async disable(accountID, capability) {
checkString(accountID).or(Err.AccountID);
async disable(accountID, capability) {
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);
checkString(capability).or(Err.MISSING_CAPABILITY);

@@ -461,2 +461,2 @@

}
}
}

@@ -1,6 +0,4 @@

import { checkString } from "./helpers/checks.js";
import { check, checkString } from "./helpers/checks.js";
import { Err } from "./helpers/errors.js";
import { Address } from "./address.js";
/** @external Promise */

@@ -32,4 +30,4 @@

*/
VISA: "Visa"
}
VISA: "Visa",
};

@@ -40,3 +38,3 @@ /**

*/
export const CARD_TYPE = {
export const CARD_TYPE = {
/**

@@ -61,4 +59,4 @@ * Debit card

*/
UNKNOWN: "unknown"
}
UNKNOWN: "unknown",
};

@@ -69,3 +67,3 @@ /**

*/
export const CARD_VERIFICATION_STATUS = {
export const CARD_VERIFICATION_STATUS = {
/**

@@ -90,4 +88,4 @@ * No Match

*/
UNAVAILABLE: "unavailable"
}
UNAVAILABLE: "unavailable",
};

@@ -99,7 +97,17 @@ /**

* @property {string} year - 2 character year
*
*
* @tag Cards
*/
/**
* Card information collected for acquisition.
* @typedef LinkCard
* @property {string} cardNumber - All digits of the card
* @property {CardExpiration} expiration - Card expiration date
* @property {string} cardCvv - 3-4 digit card verification value
* @property {string} holderName - Full name of the card holder
* @property {CardBillingAddress} billingAddress - The billing address of the card
*
* @tag Cards
*/
/**
* Card billing address

@@ -113,3 +121,3 @@ * @typedef CardBillingAddress

* @property {string} country - string <= 2 characters
*
*
* @tag Cards

@@ -124,3 +132,3 @@ */

* @property {CARD_VERIFICATION_STATUS} postalCode - Verification status of the postalCode
*
*
* @tag Cards

@@ -182,3 +190,3 @@ */

*/
export class Cards {
export class Cards {
constructor(moov) {

@@ -196,5 +204,5 @@ this.moov = moov;

*/
async get(accountID, cardID) {
checkString(accountID).or(Err.AccountID);
checkString(cardID).or(Err.CardID);
async get(accountID, cardID) {
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);
checkString(cardID).or(Err.MISSING_CARD_ID);

@@ -218,4 +226,4 @@ const result = await this.moov

*/
async list(accountID) {
checkString(accountID).or(Err.AccountID);
async list(accountID) {
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);

@@ -226,2 +234,3 @@ const result = await this.moov

method: "GET",
json: card,
})

@@ -234,2 +243,26 @@ .json();

/**
* Links a card to a Moov account. Only use this endpoint if you have provided Moov with a
* copy of your PCI attestation of compliance.
*
* @param {string} accountID - Account to link
* @param {LinkCard} card - Card information
* @returns {Promise<Card>}
* @tag Cards
*/
async link(accountID, card) {
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);
check(card).or(Err.MISSING_CARD);
const result = await this.moov
.got({
url: `accounts/${accountID}/cards`,
method: "POST",
json: card,
})
.json();
return result;
}
/**
* Disables a card with the specified ID.

@@ -242,5 +275,5 @@ *

*/
async disable(accountID, cardID) {
checkString(accountID).or(Err.AccountID);
checkString(cardID).or(Err.CardID);
async disable(accountID, cardID) {
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);
checkString(cardID).or(Err.MISSING_CARD_ID);

@@ -256,3 +289,2 @@ const result = await this.moov

}
}
}

@@ -12,3 +12,3 @@ import { check, checkString } from "./helpers/checks.js";

* @property {number} entries
*
*
* @tag Enrichment

@@ -32,3 +32,3 @@ */

* @property {"all"|"postal"} [source] - Optional Include results from alternate data sources. Allowed values are -- all (non-postal addresses) or postal (postal addresses only).
*
*
* @tag Enrichment

@@ -52,7 +52,7 @@ * */

* Gets enriched address suggestions.
*
*
* @param {EnrichedAddressGetCriteria} criteria - Criterial for available search parameters.
* @returns {Promise<EnrichedAddress[]>}
* @tag Enrichment
*
*
* @example

@@ -65,3 +65,3 @@ * const moov = new Moov(...);

* // ...
* });
* });
* } catch (err) {

@@ -72,4 +72,4 @@ * // ...

async get(criteria) {
check(criteria).or(Err.MISSING_CRITERIA_ERROR_MESSAGE);
checkString(criteria.search).or(Err.MISSING_ENRICH_ADDRESS_SEARCH_ERROR_MESSAGE);
check(criteria).or(Err.MISSING_CRITERIA);
checkString(criteria.search).or(Err.MISSING_ENRICH_ADDRESS_SEARCH);

@@ -130,6 +130,3 @@ const options = {

return result;
}
}

@@ -8,3 +8,3 @@ import { checkString } from "./helpers/checks.js";

* @property {EnrichedBusinessProfile} business - Describes a company
*
*
* @tag Enrichment

@@ -21,3 +21,3 @@ */

* @property {string} website
*
*
* @tag Enrichment

@@ -31,3 +31,3 @@ */

* @property {EnrichedProfileAddress} address
*
*
* @tag Enrichment

@@ -44,3 +44,3 @@ */

* @property {string} country
*
*
* @tag Enrichment

@@ -53,3 +53,3 @@ */

* @property {string} sic
*
*
* @tag Enrichment

@@ -64,3 +64,3 @@ */

* @property {string} suffix
*
*
* @tag Enrichment

@@ -73,7 +73,6 @@ */

* @property {string} countryCode
*
*
* @tag Enrichment
*/
/**

@@ -98,3 +97,3 @@ * The Enriched Profile API.

* @tag Enrichment
*
*
* @example

@@ -109,3 +108,3 @@ * const moov = new Moov(...);

async get(email) {
checkString(email).or(Err.MISSING_EMAIL_ERROR_MESSAGE);
checkString(email).or(Err.MISSING_EMAIL);

@@ -117,4 +116,4 @@ const result = await this.moov

searchParams: {
email: email
}
email: email,
},
})

@@ -125,2 +124,2 @@ .json();

}
}
}
export const Err = {
// Parameter errors
ApiKeyCredentials: "credentials are required",
AccountID: "accountID is required",
CardID: "cardID is required",
BankAccountID: "bankAccountID is required",
RepresentativeID: "representativeID is required",
PaymentMethodID: "paymentMethodID is required",
TransferID: "transferID is required",
RefundID: "refundID is required",
WalletID: "walletID is required",
PublicKey: "publicKey is required",
SecretKey: "secretKey is required",
Domain: "domain is required and must be a valid URL",
Scopes: "one or more scopes are required",
MISSING_ACCOUNT_ID_ERROR_MESSAGE: "Please provide an accountID",
MISSING_BANK_PAYLOAD: "Please provide a bankAccount, plaidToken, or mxAuthorizationCode.",
MISSING_BANK_ACCOUNT_NUMBER_ERROR_MESSAGE: "Please provide a bank account number.",
MISSING_BANK_ACCOUNT_ROUTING_NUMBER_ERROR_MESSAGE: "Please provide a routingNumber.",
MISSING_BANK_ACCOUNT_ROUTING_NUMBER_LENGTH_ERROR_MESSAGE: "Routing number must be 9 digits.",
MISSING_BANK_ACCOUNT_HOLDER_NAME_ERROR_MESSAGE: "Please provide a holderName.",
MISSING_BANK_ACCOUNT_HOLDER_TYPE_ERROR_MESSAGE: "Please provide a holderType.",
MISSING_CRITERIA_ERROR_MESSAGE: "Please provide search criteria.",
MISSING_EMAIL_ERROR_MESSAGE: "Please provide an email.",
MISSING_ENRICH_ADDRESS_SEARCH_ERROR_MESSAGE: "Please provide a partial or complete address to search.",
MISSING_INSTITUTION_NAME_OR_ROUTING_ERROR_MESSAGE: "Please provide a financial institution's name or routing number to search.",
MISSING_REPRESENTATIVE_ERROR_MESSAGE: "Please provide representative details.",
MISSING_UNIQUE_ID_ERROR_MESSAGE: "Please provide a uniqueID.",
MISSING_CAPABILITIES: "Please provide capabilities.",
MISSING_CAPABILITY: "Please provide capability.",
MISSING_TRANSFER_ERROR_MESSAGE: "Please provide transfer details.",
MISSING_TRANSFER_OPTION_CRITERIA_ERROR_MESSAGE: "Please provide transfer option criteria.",
MISSING_COUNTRIES: "Please provide countries.",
MISSING_AMOUNTS: "Please provide amounts.",
// 1. Keep these errors alphabetized
// 2. Do not use variable names -- use phrases (e.g. "bank account ID" not "bankAccountID")
// 3. Duplicate the voice and tone used by existing errors when you add a new one
// 4. Do not capitialize or use punctuation -- these errors are for developers
MISSING_ACCOUNT_ID: "account ID is required",
MISSING_AMOUNTS: "amounts are required",
MISSING_API_KEY_CREDENTIALS: "credentials are required",
MISSING_BANK_ACCOUNT_HOLDER_NAME: "holder name is required",
MISSING_BANK_ACCOUNT_HOLDER_TYPE: "holder type is required",
MISSING_BANK_ACCOUNT_ID: "bank account ID is required",
MISSING_BANK_ACCOUNT_NUMBER: "bank account number is required",
MISSING_BANK_ACCOUNT_ROUTING_NUMBER: "routing number is required",
MISSING_BANK_ACCOUNT_ROUTING_NUMBER_LENGTH: "routing number must be 9 digits",
MISSING_BANK_PAYLOAD:
"a bank account, Plaid token, or MX authorization code is required",
MISSING_CAPABILITIES: "capabilities are required",
MISSING_CAPABILITY: "capability is required",
MISSING_CARD: "card information is required",
MISSING_CARD_ID: "card ID is required",
MISSING_COUNTRIES: "countries are required",
MISSING_CRITERIA: "search criteria is required",
MISSING_DOMAIN: "domain is required and must be a valid URL",
MISSING_EMAIL: "email is required",
MISSING_ENRICH_ADDRESS_SEARCH:
"partial or complete address to search is required",
MISSING_INSTITUTION_NAME_OR_ROUTING:
"financial institution's name or routing number to search is required",
MISSING_PAYMENT_METHOD_ID: "payment method ID is required",
MISSING_PUBLIC_KEY: "public key is required",
MISSING_REFUND_ID: "refund ID is required",
MISSING_REPRESENTATIVE: "representative details are required",
MISSING_REPRESENTATIVE_ID: "representative ID is required",
MISSING_SCOPES: "one or more scopes are required",
MISSING_SECRET_KEY: "secret key is required",
MISSING_TRANSFER: "transfer details are required",
MISSING_TRANSFER_ID: "transfer ID is required",
MISSING_TRANSFER_OPTION_CRITERIA: "transfer option criteria is required",
MISSING_UNIQUE_ID: "unique ID is required",
MISSING_WALLET_ID: "wallet ID is required",
};

@@ -53,3 +53,3 @@ import { check } from "./helpers/checks.js";

* @property {string} postalCodeExtension - Up to 4 characters
*
*
* @tag Institutions

@@ -65,3 +65,3 @@ */

* @property {string} [skip] - Optional The number of items to offset before starting to collect the result set
*
*
* @tag Institutions

@@ -105,3 +105,3 @@ */

* @property {string} state - Up to 24 characters
*
*
* @tag Institutions

@@ -115,3 +115,3 @@ */

* @property {WireInstitution[]} [wireParticipants]
*
*
* @tag Institutions

@@ -124,3 +124,3 @@ */

*/
export class Institutions {
export class Institutions {
constructor(moov) {

@@ -132,6 +132,6 @@ this.moov = moov;

* Get information on a financial institution for ACH
*
*
* @param {ACHInstitutionSearchCriteria} criteria - Criteria for available search parameters.
* @returns {Promise<InstitutionParticipants>}
*
*
* @tag Institutions

@@ -142,12 +142,12 @@ */

}
/**
* Get information on a financial institution for WIRE
*
*
* @param {ACHInstitutionSearchCriteria} criteria - Criteria for available search parameters.
* @returns {Promise<InstitutionParticipants>}
*
*
* @tag Institutions
*/
async getWireInstitution(criteria) {
async getWireInstitution(criteria) {
return this.getInstitution(criteria, "wire");

@@ -158,14 +158,14 @@ }

* Get information on a financial institution
*
*
* @param {ACHInstitutionSearchCriteria} criteria - Criteria for available search parameters.
* @param {string} rail - The specific rail to check on, 'ach' or 'wire'.
* @returns {Promise<InstitutionParticipants>}
*
*
* @tag Institutions
*/
async getInstitution(criteria, rail) {
check(criteria).or(Err.MISSING_CRITERIA_ERROR_MESSAGE);
async getInstitution(criteria, rail) {
check(criteria).or(Err.MISSING_CRITERIA);
if(!criteria.name && !criteria.routingNumber) {
throw new TypeError(Err.MISSING_INSTITUTION_NAME_OR_ROUTING_ERROR_MESSAGE);
if (!criteria.name && !criteria.routingNumber) {
throw new TypeError(Err.MISSING_INSTITUTION_NAME_OR_ROUTING);
}

@@ -175,3 +175,3 @@

if(criteria.routingNumber) {
if (criteria.routingNumber) {
params.append("routingNumber", criteria.routingNumber);

@@ -184,3 +184,3 @@ }

method: "GET",
searchParams: params
searchParams: params,
})

@@ -191,2 +191,2 @@ .json();

}
}
}

@@ -67,6 +67,6 @@ import { got } from "got-cjs";

CAPABILITIES_READ: "/accounts/{accountID}/capabilities.read",
/**
* Access to request capabilities, determining what actions the account can do
* @tag Authentication
*/
/**
* Access to request capabilities, determining what actions the account can do
* @tag Authentication
*/
CAPABILITIES_WRITE: "/accounts/{accountID}/capabilities.write",

@@ -78,6 +78,6 @@ /**

DOCUMENTS_READ: "/accounts/{accountID}/documents.read",
/**
* Access to upload documents (like I-9s, W-4s) associated with a Moov account
* @tag Authentication
*/
/**
* Access to upload documents (like I-9s, W-4s) associated with a Moov account
* @tag Authentication
*/
DOCUMENTS_WRITE: "/accounts/{accountID}/documents.write",

@@ -109,6 +109,6 @@ /**

REPRESENTATIVE_READ: "/accounts/{accountID}/representatives.read",
/**
* Access to add details on business representatives for a Moov account
* @tag Authentication
*/
/**
* Access to add details on business representatives for a Moov account
* @tag Authentication
*/
REPRESENTATIVE_WRITE: "/accounts/{accountID}/representatives.write",

@@ -209,3 +209,3 @@ /**

* @param {object} [gotOptionsOrInstance] - Customized Got options or instance. See [docs](https://github.com/sindresorhus/got).
*
*
* @kind constructor

@@ -223,6 +223,6 @@ * @tag Moov

constructor(credentials, gotOptionsOrInstance) {
check(credentials).or(Err.ApiKeyCredentials);
checkString(credentials.accountID).or(Err.AccountID);
checkString(credentials.publicKey).or(Err.PublicKey);
checkString(credentials.secretKey).or(Err.SecretKey);
check(credentials).or(Err.MISSING_API_KEY_CREDENTIALS);
checkString(credentials.accountID).or(Err.MISSING_ACCOUNT_ID);
checkString(credentials.publicKey).or(Err.MISSING_PUBLIC_KEY);
checkString(credentials.secretKey).or(Err.MISSING_SECRET_KEY);
checkUrl(credentials.domain).or(Err.DomainRequired);

@@ -248,3 +248,3 @@

* @summary
* Generates an OAuth token required by Moov API requests. For more on our authentication protocol, read our [quick start guide](/guides/quick-start/#create-an-access-token).
* Generates an OAuth token required by Moov API requests. For more on our authentication protocol, read our [quick start guide](/guides/quick-start/#create-an-access-token).
*

@@ -269,3 +269,3 @@ * @param {SCOPES[]} scopes - One or more permissions to request

async generateToken(scopes, accountID) {
checkArrayLength(scopes).or(Err.Scopes);
checkArrayLength(scopes).or(Err.MISSING_SCOPES);

@@ -278,3 +278,3 @@ if (!accountID) {

for (let scope of scopes) {
checkString(scope).or(Err.Scopes);
checkString(scope).or(Err.MISSING_SCOPES);
renderedScopes.push(scope.replace("{accountID}", accountID));

@@ -294,3 +294,3 @@ }

origin: this.credentials.domain,
}
},
}).json();

@@ -351,3 +351,3 @@

* @tag Moov
*
*
* @example

@@ -361,3 +361,3 @@ * const moov = new Moov(...);

*/
get avatars() {
get avatars() {
if (!this._avatars) {

@@ -381,3 +381,3 @@ this._avatars = new Avatars(this);

*/
get bankAccounts() {
get bankAccounts() {
if (!this._bankAccounts) {

@@ -401,3 +401,3 @@ this._bankAccounts = new BankAccounts(this);

*/
get capabilities() {
get capabilities() {
if (!this._capabilities) {

@@ -421,3 +421,3 @@ this._capabilities = new Capabilities(this);

*/
get cards() {
get cards() {
if (!this._cards) {

@@ -441,3 +441,3 @@ this._cards = new Cards(this);

*/
get enrichedAddresses() {
get enrichedAddresses() {
if (!this._enrichedAddresses) {

@@ -461,3 +461,3 @@ this._enrichedAddresses = new EnrichedAddresses(this);

*/
get enrichedProfiles() {
get enrichedProfiles() {
if (!this._enrichedProfiles) {

@@ -481,3 +481,3 @@ this._enrichedProfiles = new EnrichedProfiles(this);

*/
get paymentMethods() {
get paymentMethods() {
if (!this._paymentMethods) {

@@ -501,3 +501,3 @@ this._paymentMethods = new PaymentMethods(this);

*/
get institutions() {
get institutions() {
if (!this._institutions) {

@@ -522,3 +522,3 @@ this._institutions = new Institutions(this);

*/
get representatives() {
get representatives() {
if (!this._representatives) {

@@ -529,3 +529,3 @@ this._representatives = new Representatives(this);

}
/**

@@ -556,3 +556,3 @@ * Gets the Transfers API.

*
* @example
* @example
* const moov = new Moov(...);

@@ -565,8 +565,8 @@ * try {

*/
get wallets() {
if (!this._wallets) {
this._wallets = new Wallets(this);
}
return this._wallets;
get wallets() {
if (!this._wallets) {
this._wallets = new Wallets(this);
}
return this._wallets;
}

@@ -596,3 +596,2 @@ /**

}
}
}

@@ -1,3 +0,3 @@

import {BankAccount} from './bankAccountsTypedefs.js';
import { checkString } from './helpers/checks.js';
import { BankAccount } from "./bankAccountsTypedefs.js";
import { checkString } from "./helpers/checks.js";
import { Err } from "./helpers/errors.js";

@@ -11,3 +11,3 @@

*/
export const PAYMENT_METHODS_TYPE = {
export const PAYMENT_METHODS_TYPE = {
/**

@@ -43,10 +43,10 @@ * Moov Wallet Payment Type

CARD: "card-payment",
}
};
/**
* Wallet Payment Type
* @typedef WalletPaymentType
* @property {string} walletID - Wallet identifier
* @tag Payment methods
*/
/**
* Wallet Payment Type
* @typedef WalletPaymentType
* @property {string} walletID - Wallet identifier
* @tag Payment methods
*/

@@ -85,3 +85,3 @@ /**

*/
export class PaymentMethods {
export class PaymentMethods {
constructor(moov) {

@@ -93,12 +93,12 @@ this.moov = moov;

* Get the specified payment method associated with a Moov account.
*
*
* @param {string} accountID - Account on which to request bank account
* @param {string} paymentMethodID - ID of the payment method to retrieve
* @param {string} paymentMethodID - ID of the payment method to retrieve
* @returns {Promise<PaymentMethod>}
*
*
* @tag Payment methods
*/
async get(accountID, paymentMethodID) {
checkString(accountID).or(Err.AccountID);
checkString(paymentMethodID).or(Err.PaymentMethodID)
async get(accountID, paymentMethodID) {
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);
checkString(paymentMethodID).or(Err.MISSING_PAYMENT_METHOD_ID);

@@ -117,11 +117,11 @@ const result = await this.moov

* Retrieve all of the payment methods associated with a Moov account.
*
*
* @param {string} accountID - Account on which to request bank account
* @returns {Promise<PaymentMethod[]>}
*
*
* @tag Payment methods
*/
async list(accountID) {
checkString(accountID).or(Err.AccountID);
async list(accountID) {
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);
const result = await this.moov

@@ -136,3 +136,2 @@ .got({

}
}
}

@@ -66,3 +66,3 @@ import { check, checkString } from "./helpers/checks.js";

* @property {string} suffix - Suffix of a given name. string <= 20 characters
*
*
* @tag Representatives

@@ -76,3 +76,3 @@ */

* @property {string} countryCode - string <= 1 characters
*
*
* @tag Representatives

@@ -89,3 +89,3 @@ */

* @property {string} country - string <= 2 characters
*
*
* @tag Representatives

@@ -100,3 +100,3 @@ */

* @property {string} jobTitle - string <= 64 characters
*
*
* @tag Representatives

@@ -110,3 +110,3 @@ */

* @property {number} year - 4 digit year
*
*
* @tag Representatives

@@ -119,3 +119,3 @@ */

* @property {string} lastFour - string <= 4 characters
*
*
* @tag Representatives

@@ -128,3 +128,3 @@ */

* @property {GovernmentID} itin
*
*
* @tag Representatives

@@ -142,3 +142,3 @@ */

* @property {RepresentativeResponsibilities} responsibilities - Describes the job responsibilities of an individual
*
*
* @tag Representatives

@@ -151,3 +151,3 @@ */

*/
export class Representatives {
export class Representatives {
constructor(moov) {

@@ -162,8 +162,8 @@ this.moov = moov;

* @returns {Promise<Representative>}
*
*
* @tag Representatives
*/
async create(accountID, representative) {
checkString(accountID).or(Err.AccountID);
check(representative).or(Err.MISSING_REPRESENTATIVE_ERROR_MESSAGE);
async create(accountID, representative) {
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);
check(representative).or(Err.MISSING_REPRESENTATIVE);

@@ -185,7 +185,7 @@ const result = await this.moov

* @returns {Promise<Representative[]>}
*
*
* @tag Representatives
*/
async list(accountID) {
checkString(accountID).or(Err.AccountID);
async list(accountID) {
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);

@@ -207,8 +207,8 @@ const result = await this.moov

* @returns {Promise<Representative>}
*
*
* @tag Representatives
*/
async get(accountID, representativeID) {
checkString(accountID).or(Err.AccountID);
checkString(representativeID).or(Err.RepresentativeID);
async get(accountID, representativeID) {
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);
checkString(representativeID).or(Err.MISSING_REPRESENTATIVE_ID);

@@ -230,8 +230,8 @@ const result = await this.moov

* @returns {Promise<void>}
*
*
* @tag Representatives
*/
async delete(accountID, representativeID) {
checkString(accountID).or(Err.AccountID);
checkString(representativeID).or(Err.RepresentativeID);
async delete(accountID, representativeID) {
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);
checkString(representativeID).or(Err.MISSING_REPRESENTATIVE_ID);

@@ -254,9 +254,9 @@ const result = await this.moov

* @returns {Promise<Representative>}
*
*
* @tag Representatives
*/
async update(accountID, representativeID, representative) {
checkString(accountID).or(Err.AccountID);
checkString(representativeID).or(Err.RepresentativeID);
check(representative).or(Err.MISSING_REPRESENTATIVE_ERROR_MESSAGE);
async update(accountID, representativeID, representative) {
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);
checkString(representativeID).or(Err.MISSING_REPRESENTATIVE_ID);
check(representative).or(Err.MISSING_REPRESENTATIVE);

@@ -273,2 +273,2 @@ const result = await this.moov

}
}
}

@@ -6,3 +6,2 @@ import { randomUUID } from "crypto";

/**

@@ -16,4 +15,2 @@ * @typedef CardDetails

/**

@@ -286,3 +283,3 @@ * High-level account information associated with a payment method.

async create(transfer) {
check(transfer).or(Err.MISSING_TRANSFER_ERROR_MESSAGE);
check(transfer).or(Err.MISSING_TRANSFER);

@@ -378,3 +375,3 @@ const result = await this.moov

async get(transferID) {
checkString(transferID).or(Err.TransferID);
checkString(transferID).or(Err.MISSING_TRANSFER_ID);

@@ -411,3 +408,3 @@ const result = await this.moov

async updateMetadata(transferID, metadata) {
checkString(transferID).or(Err.TransferID);
checkString(transferID).or(Err.MISSING_TRANSFER_ID);

@@ -456,3 +453,3 @@ const result = await this.moov

async getTransferOptions(transferOptionsCriteria) {
check(transferOptionsCriteria).or(Err.MISSING_TRANSFER_OPTION_CRITERIA_ERROR_MESSAGE);
check(transferOptionsCriteria).or(Err.MISSING_TRANSFER_OPTION_CRITERIA);

@@ -486,3 +483,3 @@ const result = await this.moov

async refund(transferID) {
checkString(transferID).or(Err.TransferID);
checkString(transferID).or(Err.MISSING_TRANSFER_ID);

@@ -518,3 +515,3 @@ const result = await this.moov

async listRefunds(transferID) {
checkString(transferID).or(Err.TransferID);
checkString(transferID).or(Err.MISSING_TRANSFER_ID);

@@ -548,4 +545,4 @@ const result = await this.moov

async getRefund(transferID, refundID) {
checkString(transferID).or(Err.TransferID);
checkString(refundID).or(Err.RefundID);
checkString(transferID).or(Err.MISSING_TRANSFER_ID);
checkString(refundID).or(Err.MISSING_REFUND_ID);

@@ -562,2 +559,1 @@ const result = await this.moov

}

@@ -348,6 +348,6 @@ /** @external Promise */

* @param {AccountListCriteria} criteria - Optional criteria to limit the list returned.
* @returns {Promise<Account>}
* @returns {Promise<Account[]>}
* @tag Accounts
*/
list(accountID: string, criteria: AccountListCriteria): Promise<Account>;
list(accountID: string, criteria: AccountListCriteria): Promise<Account[]>;
/**

@@ -354,0 +354,0 @@ * Retrieves details for the account with the specified ID.

@@ -155,3 +155,3 @@ /**

* @tag Capabilities
*/
*/
/**

@@ -158,0 +158,0 @@ * The Capabilities API

@@ -31,2 +31,13 @@ export type CARD_BRAND = any;

/**
* Card information collected for acquisition.
* @typedef LinkCard
* @property {string} cardNumber - All digits of the card
* @property {CardExpiration} expiration - Card expiration date
* @property {string} cardCvv - 3-4 digit card verification value
* @property {string} holderName - Full name of the card holder
* @property {CardBillingAddress} billingAddress - The billing address of the card
*
* @tag Cards
*/
/**
* Card billing address

@@ -125,2 +136,12 @@ * @typedef CardBillingAddress

/**
* Links a card to a Moov account. Only use this endpoint if you have provided Moov with a
* copy of your PCI attestation of compliance.
*
* @param {string} accountID - Account to link
* @param {LinkCard} card - Card information
* @returns {Promise<Card>}
* @tag Cards
*/
link(accountID: string, card: LinkCard): Promise<Card>;
/**
* Disables a card with the specified ID.

@@ -149,2 +170,27 @@ *

/**
* Card information collected for acquisition.
*/
export type LinkCard = {
/**
* - All digits of the card
*/
cardNumber: string;
/**
* - Card expiration date
*/
expiration: CardExpiration;
/**
* - 3-4 digit card verification value
*/
cardCvv: string;
/**
* - Full name of the card holder
*/
holderName: string;
/**
* - The billing address of the card
*/
billingAddress: CardBillingAddress;
};
/**
* Card billing address

@@ -151,0 +197,0 @@ */

export namespace Err {
const ApiKeyCredentials: string;
const AccountID: string;
const CardID: string;
const BankAccountID: string;
const RepresentativeID: string;
const PaymentMethodID: string;
const TransferID: string;
const RefundID: string;
const WalletID: string;
const PublicKey: string;
const SecretKey: string;
const Domain: string;
const Scopes: string;
const MISSING_ACCOUNT_ID_ERROR_MESSAGE: string;
const MISSING_ACCOUNT_ID: string;
const MISSING_AMOUNTS: string;
const MISSING_API_KEY_CREDENTIALS: string;
const MISSING_BANK_ACCOUNT_HOLDER_NAME: string;
const MISSING_BANK_ACCOUNT_HOLDER_TYPE: string;
const MISSING_BANK_ACCOUNT_ID: string;
const MISSING_BANK_ACCOUNT_NUMBER: string;
const MISSING_BANK_ACCOUNT_ROUTING_NUMBER: string;
const MISSING_BANK_ACCOUNT_ROUTING_NUMBER_LENGTH: string;
const MISSING_BANK_PAYLOAD: string;
const MISSING_BANK_ACCOUNT_NUMBER_ERROR_MESSAGE: string;
const MISSING_BANK_ACCOUNT_ROUTING_NUMBER_ERROR_MESSAGE: string;
const MISSING_BANK_ACCOUNT_ROUTING_NUMBER_LENGTH_ERROR_MESSAGE: string;
const MISSING_BANK_ACCOUNT_HOLDER_NAME_ERROR_MESSAGE: string;
const MISSING_BANK_ACCOUNT_HOLDER_TYPE_ERROR_MESSAGE: string;
const MISSING_CRITERIA_ERROR_MESSAGE: string;
const MISSING_EMAIL_ERROR_MESSAGE: string;
const MISSING_ENRICH_ADDRESS_SEARCH_ERROR_MESSAGE: string;
const MISSING_INSTITUTION_NAME_OR_ROUTING_ERROR_MESSAGE: string;
const MISSING_REPRESENTATIVE_ERROR_MESSAGE: string;
const MISSING_UNIQUE_ID_ERROR_MESSAGE: string;
const MISSING_CAPABILITIES: string;
const MISSING_CAPABILITY: string;
const MISSING_TRANSFER_ERROR_MESSAGE: string;
const MISSING_TRANSFER_OPTION_CRITERIA_ERROR_MESSAGE: string;
const MISSING_CARD: string;
const MISSING_CARD_ID: string;
const MISSING_COUNTRIES: string;
const MISSING_AMOUNTS: string;
const MISSING_CRITERIA: string;
const MISSING_DOMAIN: string;
const MISSING_EMAIL: string;
const MISSING_ENRICH_ADDRESS_SEARCH: string;
const MISSING_INSTITUTION_NAME_OR_ROUTING: string;
const MISSING_PAYMENT_METHOD_ID: string;
const MISSING_PUBLIC_KEY: string;
const MISSING_REFUND_ID: string;
const MISSING_REPRESENTATIVE: string;
const MISSING_REPRESENTATIVE_ID: string;
const MISSING_SCOPES: string;
const MISSING_SECRET_KEY: string;
const MISSING_TRANSFER: string;
const MISSING_TRANSFER_ID: string;
const MISSING_TRANSFER_OPTION_CRITERIA: string;
const MISSING_UNIQUE_ID: string;
const MISSING_WALLET_ID: string;
}
//# sourceMappingURL=errors.d.ts.map

@@ -282,3 +282,3 @@ /**

*
* @example
* @example
* const moov = new Moov(...);

@@ -285,0 +285,0 @@ * try {

@@ -11,3 +11,3 @@ /** @external Promise */

* @property {number} value - Quantity in the smallest unit of the specified currency. In USD this is cents, so $12.04 is 1204 and $0.99 would be 99.
*
*
* @tag Wallets

@@ -34,3 +34,2 @@ */

/**

@@ -40,3 +39,3 @@ * The Wallets API

*/
export class Wallets {
export class Wallets {
constructor(moov) {

@@ -48,12 +47,12 @@ this.moov = moov;

* Get information on a specific Moov wallet (e.g., the available balance).
*
*
* @param {string} accountID - Account on which to request wallet
* @param {string} walletID - The ID for the wallet associated with an account
* @returns {Promise<Wallet>}
*
*
* @tag Wallets
*/
async get(accountID, walletID) {
checkString(accountID).or(Err.AccountID);
checkString(walletID).or(Err.WalletID);
async get(accountID, walletID) {
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);
checkString(walletID).or(Err.MISSING_WALLET_ID);

@@ -72,10 +71,10 @@ const result = await this.moov

* List the wallets associated with a Moov account.
*
*
* @param {string} accountID - Account on which to request wallets
* @returns {Promise<Wallet[]>}
*
*
* @tag Wallets
*/
async list(accountID) {
checkString(accountID).or(Err.AccountID);
async list(accountID) {
checkString(accountID).or(Err.MISSING_ACCOUNT_ID);

@@ -91,3 +90,2 @@ const result = await this.moov

}
}
}
{
"name": "@moovio/node",
"version": "1.0.6",
"version": "1.0.7",
"description": "Node SDK for the Moov API and Dashboard",

@@ -5,0 +5,0 @@ "module": "dist/mjs/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc