-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
39 lines (39 loc) · 2.12 KB
/
Copy pathindex.js
File metadata and controls
39 lines (39 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { getCPAReturnCode, getCPAReturnCodeCategoryByCode, getCPAReturnCodesByAbbreviation, isCPAReturnCode } from './cpaCodes/returns.js';
import { getCPATransactionCode, getCPATransactionCodeCategoryByCode, getCPATransactionCodesByAbbreviation, isCPATransactionCode } from './cpaCodes/transactions.js';
/**
* Retrieves the CPA code category object.
* @param cpaCode - A CPA code.
* @returns The CPA code category object, when available.
*/
export function getCPACodeCategoryByCode(cpaCode) {
return (getCPATransactionCodeCategoryByCode(cpaCode) ??
getCPAReturnCodeCategoryByCode(cpaCode));
}
/**
* Tests if a CPA code is valid.
* @param cpaCode - A possible CPA code.
* @returns `true` when the CPA code is valid.
*/
export function isCPACode(cpaCode) {
return isCPATransactionCode(cpaCode) || isCPAReturnCode(cpaCode);
}
/**
* Retrieves a CPA code object.
* @param cpaCode - A CPA code.
* @returns The CPA Code object, when available.
*/
export function getCPACode(cpaCode) {
return getCPATransactionCode(cpaCode) ?? getCPAReturnCode(cpaCode);
}
/**
* Retrieves a list of CPA code objects that correspond to a given abbreviation.
* @param cpaCodeAbbreviation - A two or three letter CPA code abbreviation.
* @returns A list of CPA code objects.
*/
export function getCPACodesByAbbreviation(cpaCodeAbbreviation) {
const cpaCodes = getCPATransactionCodesByAbbreviation(cpaCodeAbbreviation);
cpaCodes.push(...getCPAReturnCodesByAbbreviation(cpaCodeAbbreviation));
return cpaCodes;
}
export { cpaTransactionCodeCategories, cpaTransactionCodes, cpaTransactionCodesCommercial, cpaTransactionCodesFederal, cpaTransactionCodesPreauthorized, cpaTransactionCodesProvincialLocal, getCPATransactionCodeCategoryByCode, getCPATransactionCode, getCPATransactionCodesByAbbreviation, isCPATransactionCode } from './cpaCodes/transactions.js';
export { cpaReturnCodeCategories, cpaReturnCodes, cpaReturnCodesCreditReturn, cpaReturnCodesDishonoured, cpaReturnCodesCustomerInitiated, cpaReturnCodesDefault, getCPAReturnCodeCategoryByCode, getCPAReturnCode, getCPAReturnCodesByAbbreviation, isCPAReturnCode } from './cpaCodes/returns.js';