@temboplus/frontend-core 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +126 -25
- package/esm/deps/jsr.io/@std/internal/1.0.5/assertion_state.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/testing/1.0.9/_test_suite.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/testing/1.0.9/bdd.d.ts.map +1 -0
- package/esm/mod.d.ts +2 -0
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +2 -0
- package/esm/src/config/config_service.d.ts +11 -0
- package/esm/src/config/config_service.d.ts.map +1 -0
- package/esm/src/config/config_service.js +19 -0
- package/esm/src/config/index.d.ts +2 -0
- package/esm/src/config/index.d.ts.map +1 -0
- package/esm/src/config/index.js +1 -0
- package/esm/src/{models/bank/banks.d.ts → data/banks_tz.d.ts} +1 -1
- package/esm/src/data/banks_tz.d.ts.map +1 -0
- package/esm/src/data/countries.d.ts +6 -0
- package/esm/src/data/countries.d.ts.map +1 -0
- package/esm/src/data/countries.js +974 -0
- package/esm/src/data/currencies.d.ts +1901 -0
- package/esm/src/data/currencies.d.ts.map +1 -0
- package/esm/src/data/currencies.js +1073 -0
- package/esm/src/data/phone_patterns.d.ts +3809 -0
- package/esm/src/data/phone_patterns.d.ts.map +1 -0
- package/esm/src/data/phone_patterns.js +2325 -0
- package/esm/src/models/amount/amount.d.ts +10 -12
- package/esm/src/models/amount/amount.d.ts.map +1 -1
- package/esm/src/models/amount/amount.js +58 -96
- package/esm/src/models/bank/bank.d.ts +58 -53
- package/esm/src/models/bank/bank.d.ts.map +1 -1
- package/esm/src/models/bank/bank.js +49 -84
- package/esm/src/models/bank/index.d.ts +1 -1
- package/esm/src/models/bank/index.d.ts.map +1 -1
- package/esm/src/models/bank/index.js +1 -1
- package/esm/src/models/bank/service.d.ts +106 -0
- package/esm/src/models/bank/service.d.ts.map +1 -0
- package/esm/src/models/bank/service.js +240 -0
- package/esm/src/models/country/country.d.ts +568 -0
- package/esm/src/models/country/country.d.ts.map +1 -0
- package/esm/src/models/country/country.js +165 -0
- package/esm/src/models/country/country.test.d.ts.map +1 -0
- package/esm/src/models/country/index.d.ts +3 -0
- package/esm/src/models/country/index.d.ts.map +1 -0
- package/esm/src/models/country/index.js +2 -0
- package/esm/src/models/country/service.d.ts +75 -0
- package/esm/src/models/country/service.d.ts.map +1 -0
- package/esm/src/models/country/service.js +267 -0
- package/esm/src/models/currency/currency.d.ts +341 -0
- package/esm/src/models/currency/currency.d.ts.map +1 -0
- package/esm/src/models/currency/currency.js +225 -0
- package/esm/src/models/currency/currency.test.d.ts.map +1 -0
- package/esm/src/models/currency/index.d.ts +3 -0
- package/esm/src/models/currency/index.d.ts.map +1 -0
- package/esm/src/models/currency/index.js +2 -0
- package/esm/src/models/currency/service.d.ts +96 -0
- package/esm/src/models/currency/service.d.ts.map +1 -0
- package/esm/src/models/currency/service.js +194 -0
- package/esm/src/models/index.d.ts +2 -0
- package/esm/src/models/index.d.ts.map +1 -1
- package/esm/src/models/index.js +2 -0
- package/esm/src/models/phone_number/format.d.ts +14 -0
- package/esm/src/models/phone_number/format.d.ts.map +1 -0
- package/esm/src/models/phone_number/format.js +14 -0
- package/esm/src/models/phone_number/global/phone_number.d.ts +160 -0
- package/esm/src/models/phone_number/global/phone_number.d.ts.map +1 -0
- package/esm/src/models/phone_number/global/phone_number.js +453 -0
- package/esm/src/models/phone_number/global/phone_number.test.d.ts.map +1 -0
- package/esm/src/models/phone_number/global/service.d.ts +260 -0
- package/esm/src/models/phone_number/global/service.d.ts.map +1 -0
- package/esm/src/models/phone_number/global/service.js +477 -0
- package/esm/src/models/phone_number/global/service.test.d.ts.map +1 -0
- package/esm/src/models/phone_number/index.d.ts +5 -3
- package/esm/src/models/phone_number/index.d.ts.map +1 -1
- package/esm/src/models/phone_number/index.js +5 -3
- package/esm/src/models/phone_number/{antd_validator.d.ts → tz/antd_validator.d.ts} +2 -2
- package/esm/src/models/phone_number/tz/antd_validator.d.ts.map +1 -0
- package/esm/src/models/phone_number/{antd_validator.js → tz/antd_validator.js} +2 -2
- package/esm/src/models/phone_number/tz/antdvalidator.test.d.ts.map +1 -0
- package/esm/src/models/phone_number/tz/network_operator.d.ts.map +1 -0
- package/{script/src/models/phone_number → esm/src/models/phone_number/tz}/phone_number.d.ts +46 -29
- package/esm/src/models/phone_number/tz/phone_number.d.ts.map +1 -0
- package/esm/src/models/phone_number/{phone_number.js → tz/phone_number.js} +87 -41
- package/esm/src/models/phone_number/tz/phone_number.test.d.ts.map +1 -0
- package/esm/src/reports/index.d.ts +2 -0
- package/esm/src/reports/index.d.ts.map +1 -0
- package/esm/src/reports/index.js +1 -0
- package/esm/src/reports/report_manager.d.ts +144 -0
- package/esm/src/reports/report_manager.d.ts.map +1 -0
- package/esm/src/reports/report_manager.js +315 -0
- package/package.json +4 -3
- package/script/deps/jsr.io/@std/internal/1.0.5/assertion_state.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/testing/1.0.9/_test_suite.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/testing/1.0.9/bdd.d.ts.map +1 -0
- package/script/mod.d.ts +2 -0
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +2 -0
- package/script/src/config/config_service.d.ts +11 -0
- package/script/src/config/config_service.d.ts.map +1 -0
- package/script/src/config/config_service.js +23 -0
- package/script/src/config/index.d.ts +2 -0
- package/script/src/config/index.d.ts.map +1 -0
- package/script/src/config/index.js +17 -0
- package/script/src/{models/bank/banks.d.ts → data/banks_tz.d.ts} +1 -1
- package/script/src/data/banks_tz.d.ts.map +1 -0
- package/script/src/data/countries.d.ts +6 -0
- package/script/src/data/countries.d.ts.map +1 -0
- package/script/src/data/countries.js +976 -0
- package/script/src/data/currencies.d.ts +1901 -0
- package/script/src/data/currencies.d.ts.map +1 -0
- package/script/src/data/currencies.js +1075 -0
- package/script/src/data/phone_patterns.d.ts +3809 -0
- package/script/src/data/phone_patterns.d.ts.map +1 -0
- package/script/src/data/phone_patterns.js +2327 -0
- package/script/src/models/amount/amount.d.ts +10 -12
- package/script/src/models/amount/amount.d.ts.map +1 -1
- package/script/src/models/amount/amount.js +60 -98
- package/script/src/models/bank/bank.d.ts +58 -53
- package/script/src/models/bank/bank.d.ts.map +1 -1
- package/script/src/models/bank/bank.js +49 -87
- package/script/src/models/bank/index.d.ts +1 -1
- package/script/src/models/bank/index.d.ts.map +1 -1
- package/script/src/models/bank/index.js +1 -1
- package/script/src/models/bank/service.d.ts +106 -0
- package/script/src/models/bank/service.d.ts.map +1 -0
- package/script/src/models/bank/service.js +247 -0
- package/script/src/models/country/country.d.ts +568 -0
- package/script/src/models/country/country.d.ts.map +1 -0
- package/script/src/models/country/country.js +169 -0
- package/script/src/models/country/country.test.d.ts.map +1 -0
- package/script/src/models/country/index.d.ts +3 -0
- package/script/src/models/country/index.d.ts.map +1 -0
- package/script/src/models/country/index.js +18 -0
- package/script/src/models/country/service.d.ts +75 -0
- package/script/src/models/country/service.d.ts.map +1 -0
- package/script/src/models/country/service.js +274 -0
- package/script/src/models/currency/currency.d.ts +341 -0
- package/script/src/models/currency/currency.d.ts.map +1 -0
- package/script/src/models/currency/currency.js +229 -0
- package/script/src/models/currency/currency.test.d.ts.map +1 -0
- package/script/src/models/currency/index.d.ts +3 -0
- package/script/src/models/currency/index.d.ts.map +1 -0
- package/script/src/models/currency/index.js +18 -0
- package/script/src/models/currency/service.d.ts +96 -0
- package/script/src/models/currency/service.d.ts.map +1 -0
- package/script/src/models/currency/service.js +201 -0
- package/script/src/models/index.d.ts +2 -0
- package/script/src/models/index.d.ts.map +1 -1
- package/script/src/models/index.js +2 -0
- package/script/src/models/phone_number/format.d.ts +14 -0
- package/script/src/models/phone_number/format.d.ts.map +1 -0
- package/script/src/models/phone_number/format.js +17 -0
- package/script/src/models/phone_number/global/phone_number.d.ts +160 -0
- package/script/src/models/phone_number/global/phone_number.d.ts.map +1 -0
- package/script/src/models/phone_number/global/phone_number.js +457 -0
- package/script/src/models/phone_number/global/phone_number.test.d.ts.map +1 -0
- package/script/src/models/phone_number/global/service.d.ts +260 -0
- package/script/src/models/phone_number/global/service.d.ts.map +1 -0
- package/script/src/models/phone_number/global/service.js +485 -0
- package/script/src/models/phone_number/global/service.test.d.ts.map +1 -0
- package/script/src/models/phone_number/index.d.ts +5 -3
- package/script/src/models/phone_number/index.d.ts.map +1 -1
- package/script/src/models/phone_number/index.js +5 -3
- package/script/src/models/phone_number/{antd_validator.d.ts → tz/antd_validator.d.ts} +2 -2
- package/script/src/models/phone_number/tz/antd_validator.d.ts.map +1 -0
- package/script/src/models/phone_number/{antd_validator.js → tz/antd_validator.js} +1 -1
- package/script/src/models/phone_number/tz/antdvalidator.test.d.ts.map +1 -0
- package/script/src/models/phone_number/tz/network_operator.d.ts.map +1 -0
- package/{esm/src/models/phone_number → script/src/models/phone_number/tz}/phone_number.d.ts +46 -29
- package/script/src/models/phone_number/tz/phone_number.d.ts.map +1 -0
- package/script/src/models/phone_number/{phone_number.js → tz/phone_number.js} +89 -43
- package/script/src/models/phone_number/tz/phone_number.test.d.ts.map +1 -0
- package/script/src/reports/index.d.ts +2 -0
- package/script/src/reports/index.d.ts.map +1 -0
- package/script/src/reports/index.js +17 -0
- package/script/src/reports/report_manager.d.ts +144 -0
- package/script/src/reports/report_manager.d.ts.map +1 -0
- package/script/src/reports/report_manager.js +325 -0
- package/esm/src/models/bank/banks.d.ts.map +0 -1
- package/esm/src/models/bank/utils.d.ts +0 -25
- package/esm/src/models/bank/utils.d.ts.map +0 -1
- package/esm/src/models/bank/utils.js +0 -35
- package/esm/src/models/phone_number/antd_validator.d.ts.map +0 -1
- package/esm/src/models/phone_number/antdvalidator.test.d.ts.map +0 -1
- package/esm/src/models/phone_number/network_operator.d.ts.map +0 -1
- package/esm/src/models/phone_number/phone_number.d.ts.map +0 -1
- package/esm/src/models/phone_number/phone_number.test.d.ts.map +0 -1
- package/script/src/models/bank/banks.d.ts.map +0 -1
- package/script/src/models/bank/utils.d.ts +0 -25
- package/script/src/models/bank/utils.d.ts.map +0 -1
- package/script/src/models/bank/utils.js +0 -41
- package/script/src/models/phone_number/antd_validator.d.ts.map +0 -1
- package/script/src/models/phone_number/antdvalidator.test.d.ts.map +0 -1
- package/script/src/models/phone_number/network_operator.d.ts.map +0 -1
- package/script/src/models/phone_number/phone_number.d.ts.map +0 -1
- package/script/src/models/phone_number/phone_number.test.d.ts.map +0 -1
- /package/esm/src/{models/bank/banks.js → data/banks_tz.js} +0 -0
- /package/esm/src/models/phone_number/{network_operator.d.ts → tz/network_operator.d.ts} +0 -0
- /package/esm/src/models/phone_number/{network_operator.js → tz/network_operator.js} +0 -0
- /package/script/src/{models/bank/banks.js → data/banks_tz.js} +0 -0
- /package/script/src/models/phone_number/{network_operator.d.ts → tz/network_operator.d.ts} +0 -0
- /package/script/src/models/phone_number/{network_operator.js → tz/network_operator.js} +0 -0
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.Bank = void 0;
|
|
7
|
-
const
|
|
4
|
+
const service_js_1 = require("./service.js");
|
|
8
5
|
/**
|
|
9
6
|
* Represents a bank with essential details.
|
|
10
7
|
* @class Bank
|
|
11
8
|
*/
|
|
12
9
|
class Bank {
|
|
13
10
|
/**
|
|
14
|
-
* Creates a new Bank instance.
|
|
11
|
+
* Creates a new Bank instance. Private constructor - only BankService can create instances.
|
|
12
|
+
* Clients should use static methods like Bank.from() or Bank.CRDB instead.
|
|
13
|
+
*
|
|
15
14
|
* @param {string} _fullName - The full name of the bank
|
|
16
15
|
* @param {string} _shortName - The short name or abbreviated name of the bank
|
|
17
16
|
* @param {string} _swiftCode - The SWIFT code associated with the bank
|
|
@@ -35,6 +34,11 @@ class Bank {
|
|
|
35
34
|
writable: true,
|
|
36
35
|
value: _swiftCode
|
|
37
36
|
});
|
|
37
|
+
// Make sure only BankService can create Bank instances
|
|
38
|
+
const callerIsService = new Error().stack?.includes("BankService");
|
|
39
|
+
if (!callerIsService) {
|
|
40
|
+
throw new Error("Bank instances cannot be created directly. Use Bank.from() or access via Bank.CRDB, Bank.NMB, etc.");
|
|
41
|
+
}
|
|
38
42
|
}
|
|
39
43
|
/**
|
|
40
44
|
* Gets the full name of the bank.
|
|
@@ -70,7 +74,7 @@ class Bank {
|
|
|
70
74
|
* @returns {Bank | undefined} The bank corresponding to the SWIFT code or `undefined` if not found.
|
|
71
75
|
*/
|
|
72
76
|
static fromSWIFTCode(swiftCode) {
|
|
73
|
-
return
|
|
77
|
+
return service_js_1.BankService.getInstance().fromSWIFTCode(swiftCode);
|
|
74
78
|
}
|
|
75
79
|
/**
|
|
76
80
|
* Retrieves a bank by its short or full name.
|
|
@@ -78,19 +82,19 @@ class Bank {
|
|
|
78
82
|
* @returns {Bank | undefined} The bank corresponding to the full name or `undefined` if not found.
|
|
79
83
|
*/
|
|
80
84
|
static fromBankName(bankName) {
|
|
81
|
-
return
|
|
82
|
-
|
|
85
|
+
return service_js_1.BankService.getInstance().fromBankName(bankName);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Returns all available banks.
|
|
89
|
+
* @returns {Bank[]} Array of all banks
|
|
90
|
+
*/
|
|
91
|
+
static getAll() {
|
|
92
|
+
return service_js_1.BankService.getInstance().getAll();
|
|
83
93
|
}
|
|
84
94
|
/**
|
|
85
95
|
* Validates if a given SWIFT/BIC (Bank Identifier Code) is valid
|
|
86
|
-
*
|
|
87
|
-
* @
|
|
88
|
-
* Should be in the format of 8 or 11 characters (e.g., 'NMIBTZTZ' or 'CRDBTZTZXXX').
|
|
89
|
-
*
|
|
90
|
-
* @returns {boolean} Returns true if:
|
|
91
|
-
* - The SWIFT code is not null/undefined
|
|
92
|
-
* - The SWIFT code successfully creates a valid Bank instance
|
|
93
|
-
* Returns false otherwise.
|
|
96
|
+
* @param swiftCode The SWIFT/BIC code to validate
|
|
97
|
+
* @returns True if the SWIFT code is valid
|
|
94
98
|
*/
|
|
95
99
|
static isValidSwiftCode(swiftCode) {
|
|
96
100
|
if (!swiftCode)
|
|
@@ -100,14 +104,8 @@ class Bank {
|
|
|
100
104
|
}
|
|
101
105
|
/**
|
|
102
106
|
* Validates if a given bank name is valid
|
|
103
|
-
*
|
|
104
|
-
* @
|
|
105
|
-
* Should be either 'CRDB' or 'NMB'.
|
|
106
|
-
*
|
|
107
|
-
* @returns {boolean} Returns true if:
|
|
108
|
-
* - The bank name is not null/undefined
|
|
109
|
-
* - The bank name successfully creates a valid Bank instance
|
|
110
|
-
* Returns false otherwise.
|
|
107
|
+
* @param bankName The bank name to validate
|
|
108
|
+
* @returns True if the bank name is valid
|
|
111
109
|
*/
|
|
112
110
|
static isValidBankName(bankName) {
|
|
113
111
|
if (!bankName)
|
|
@@ -115,22 +113,14 @@ class Bank {
|
|
|
115
113
|
const bank = Bank.fromBankName(bankName);
|
|
116
114
|
return !!bank;
|
|
117
115
|
}
|
|
118
|
-
/**
|
|
119
|
-
* Gets all banks from the JSON data.
|
|
120
|
-
* @returns {Bank[]} Array of all banks
|
|
121
|
-
*/
|
|
122
|
-
static getAll() {
|
|
123
|
-
const data = JSON.parse(JSON.stringify(banks_js_1.default));
|
|
124
|
-
return data.map((b) => new Bank(b.fullName, b.shortName, b.swiftCode));
|
|
125
|
-
}
|
|
126
116
|
/**
|
|
127
117
|
* Checks the validity of the bank data
|
|
128
118
|
* @returns true if the bank information is available and valid
|
|
129
119
|
*/
|
|
130
120
|
validate() {
|
|
131
121
|
try {
|
|
132
|
-
return (Bank.fromBankName(this._fullName) !== undefined
|
|
133
|
-
Bank.fromBankName(this._shortName) !== undefined
|
|
122
|
+
return (Bank.fromBankName(this._fullName) !== undefined ||
|
|
123
|
+
Bank.fromBankName(this._shortName) !== undefined ||
|
|
134
124
|
Bank.fromSWIFTCode(this._swiftCode) !== undefined);
|
|
135
125
|
}
|
|
136
126
|
catch (_) {
|
|
@@ -139,14 +129,8 @@ class Bank {
|
|
|
139
129
|
}
|
|
140
130
|
/**
|
|
141
131
|
* Attempts to create a Bank instance from a bank name or SWIFT code
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
* @param {string} input - The bank name or SWIFT code
|
|
145
|
-
* @returns {Bank | undefined} A Bank instance if valid input, undefined otherwise
|
|
146
|
-
*
|
|
147
|
-
* @example
|
|
148
|
-
* const bank = Bank.from('CORUTZTZ'); // From SWIFT code
|
|
149
|
-
* const sameBank = Bank.from('CRDB'); // From bank name
|
|
132
|
+
* @param input The bank name or SWIFT code
|
|
133
|
+
* @returns A Bank instance if valid input, undefined otherwise
|
|
150
134
|
*/
|
|
151
135
|
static from(input) {
|
|
152
136
|
if (Bank.canConstruct(input)) {
|
|
@@ -161,15 +145,8 @@ class Bank {
|
|
|
161
145
|
}
|
|
162
146
|
/**
|
|
163
147
|
* Validates if the input can be used to construct a valid Bank instance
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
* @param {string | null | undefined} input - The bank name or SWIFT code to validate
|
|
167
|
-
* @returns {boolean} True if input can construct a valid bank, false otherwise
|
|
168
|
-
*
|
|
169
|
-
* @example
|
|
170
|
-
* Bank.canConstruct('CORUTZTZ'); // true
|
|
171
|
-
* Bank.canConstruct(''); // false
|
|
172
|
-
* Bank.canConstruct(null); // false
|
|
148
|
+
* @param input The bank name or SWIFT code to validate
|
|
149
|
+
* @returns True if input can construct a valid bank, false otherwise
|
|
173
150
|
*/
|
|
174
151
|
static canConstruct(input) {
|
|
175
152
|
if (!input || typeof input !== "string")
|
|
@@ -182,20 +159,9 @@ class Bank {
|
|
|
182
159
|
return bankFromSwift !== undefined || bankFromName !== undefined;
|
|
183
160
|
}
|
|
184
161
|
/**
|
|
185
|
-
* Checks if an unknown value is a Bank instance
|
|
186
|
-
*
|
|
187
|
-
*
|
|
188
|
-
* @param {unknown} obj - The value to validate
|
|
189
|
-
* @returns {obj is Bank} Type predicate indicating if the value is a valid Bank
|
|
190
|
-
*
|
|
191
|
-
* @example
|
|
192
|
-
* const maybeBank = JSON.parse(someData);
|
|
193
|
-
* if (Bank.is(maybeBank)) {
|
|
194
|
-
* console.log(maybeBank.fullName); // maybeBank is typed as Bank
|
|
195
|
-
* }
|
|
196
|
-
*
|
|
197
|
-
* @see {@link Bank.fromSWIFTCode} for creating instances from SWIFT codes
|
|
198
|
-
* @see {@link Bank.fromBankName} for creating instances from bank names
|
|
162
|
+
* Checks if an unknown value is a Bank instance
|
|
163
|
+
* @param obj The value to validate
|
|
164
|
+
* @returns Type predicate indicating if the value is a valid Bank
|
|
199
165
|
*/
|
|
200
166
|
static is(obj) {
|
|
201
167
|
if (!obj || typeof obj !== "object")
|
|
@@ -209,28 +175,24 @@ class Bank {
|
|
|
209
175
|
if (typeof maybeBank._swiftCode !== "string")
|
|
210
176
|
return false;
|
|
211
177
|
// Validate against known banks
|
|
212
|
-
const bankFromSwift = Bank.
|
|
213
|
-
|
|
214
|
-
const bankFromName2 = Bank.from(maybeBank._shortName);
|
|
215
|
-
return Boolean(bankFromSwift &&
|
|
216
|
-
bankFromName &&
|
|
217
|
-
bankFromName2 &&
|
|
218
|
-
compare(bankFromName, bankFromName2) &&
|
|
219
|
-
compare(bankFromSwift, bankFromName) &&
|
|
220
|
-
compare(bankFromSwift, bankFromName2));
|
|
178
|
+
const bankFromSwift = Bank.fromSWIFTCode(maybeBank._swiftCode);
|
|
179
|
+
return Boolean(bankFromSwift);
|
|
221
180
|
}
|
|
222
181
|
}
|
|
223
182
|
exports.Bank = Bank;
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
183
|
+
// Initialize static properties by applying the references from BankService.
|
|
184
|
+
// zero-timeout to defer the initialization until after both modules have been fully loaded.
|
|
185
|
+
// The setTimeout pushes the initialization code to the end of the JavaScript event loop,
|
|
186
|
+
// which happens after all modules are loaded.
|
|
187
|
+
setTimeout(() => {
|
|
188
|
+
try {
|
|
189
|
+
const staticRefs = service_js_1.BankService.getInstance().getStaticReferences();
|
|
190
|
+
staticRefs.forEach((bank, key) => {
|
|
191
|
+
// deno-lint-ignore no-explicit-any
|
|
192
|
+
Bank[key] = bank;
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
catch (error) {
|
|
196
|
+
console.error("Failed to initialize Bank static properties:", error);
|
|
197
|
+
}
|
|
198
|
+
}, 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/models/bank/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/models/bank/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC"}
|
|
@@ -14,6 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./utils.js"), exports);
|
|
18
17
|
__exportStar(require("./bank.js"), exports);
|
|
19
18
|
__exportStar(require("./antd_validator.js"), exports);
|
|
19
|
+
__exportStar(require("./service.js"), exports);
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { Bank } from "./bank.js";
|
|
2
|
+
/**
|
|
3
|
+
* Regex pattern to validate SWIFT codes.
|
|
4
|
+
* The SWIFT code must follow the format: XXXX XX XX XXX (optional last part for branches).
|
|
5
|
+
* @constant {RegExp}
|
|
6
|
+
*/
|
|
7
|
+
export declare const SWIFT_CODE_REGEX: RegExp;
|
|
8
|
+
/**
|
|
9
|
+
* Service for managing bank data.
|
|
10
|
+
* @class BankService
|
|
11
|
+
*/
|
|
12
|
+
export declare class BankService {
|
|
13
|
+
private static instance;
|
|
14
|
+
private bankList;
|
|
15
|
+
private bankRecord;
|
|
16
|
+
private banksByName;
|
|
17
|
+
private banksByShortName;
|
|
18
|
+
private staticReferences;
|
|
19
|
+
private constructor();
|
|
20
|
+
/**
|
|
21
|
+
* Gets the singleton instance of BankService.
|
|
22
|
+
* Creates the instance if it doesn't exist.
|
|
23
|
+
* @static
|
|
24
|
+
* @returns {BankService} The singleton instance
|
|
25
|
+
*/
|
|
26
|
+
static getInstance(): BankService;
|
|
27
|
+
/**
|
|
28
|
+
* Initializes the service with bank data.
|
|
29
|
+
* Should be called once when your application starts.
|
|
30
|
+
*/
|
|
31
|
+
private initialize;
|
|
32
|
+
/**
|
|
33
|
+
* Gets all banks.
|
|
34
|
+
* @returns {Bank[]} Array of all banks
|
|
35
|
+
*/
|
|
36
|
+
getAll(): Bank[];
|
|
37
|
+
/**
|
|
38
|
+
* Gets all banks as a record.
|
|
39
|
+
* @returns {Record<string, Bank>} Record of bank SWIFT codes and bank objects
|
|
40
|
+
*/
|
|
41
|
+
getAllAsRecord(): Record<string, Bank>;
|
|
42
|
+
/**
|
|
43
|
+
* Gets static bank references to be used by the Bank class.
|
|
44
|
+
* @returns {Map<string, Bank>} Map of static references
|
|
45
|
+
*/
|
|
46
|
+
getStaticReferences(): Map<string, Bank>;
|
|
47
|
+
/**
|
|
48
|
+
* Retrieves a bank by its SWIFT code.
|
|
49
|
+
* @param {string} swiftCode The SWIFT code of the bank.
|
|
50
|
+
* @returns {Bank | undefined} The bank corresponding to the SWIFT code or `undefined` if not found.
|
|
51
|
+
*/
|
|
52
|
+
fromSWIFTCode(swiftCode: string): Bank | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* Retrieves a bank by its name.
|
|
55
|
+
* @param {string} bankName The name of the bank.
|
|
56
|
+
* @returns {Bank | undefined} The bank corresponding to the name or `undefined` if not found.
|
|
57
|
+
*/
|
|
58
|
+
fromBankName(bankName: string): Bank | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* Validates if a given SWIFT/BIC (Bank Identifier Code) is valid.
|
|
61
|
+
* @param {string | null | undefined} swiftCode - The SWIFT/BIC code to validate.
|
|
62
|
+
* @returns {boolean} Returns true if the SWIFT code is valid, false otherwise.
|
|
63
|
+
*/
|
|
64
|
+
isValidSwiftCode(swiftCode?: string | null): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Validates if a given bank name is valid.
|
|
67
|
+
* @param {string | null | undefined} bankName - The bank name to validate.
|
|
68
|
+
* @returns {boolean} Returns true if the bank name is valid, false otherwise.
|
|
69
|
+
*/
|
|
70
|
+
isValidBankName(bankName?: string | null): boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Searches for banks that match the given search term.
|
|
73
|
+
* @param {string} searchTerm - The partial name or SWIFT code to search for.
|
|
74
|
+
* @param {number} [limit=10] - Maximum number of results to return.
|
|
75
|
+
* @returns {Bank[]} Array of matching banks, limited to specified count.
|
|
76
|
+
*/
|
|
77
|
+
search(searchTerm: string, limit?: number): Bank[];
|
|
78
|
+
/**
|
|
79
|
+
* Compares two Bank instances for equality by checking their full name, short name, and SWIFT code
|
|
80
|
+
*
|
|
81
|
+
* @param {Bank} bank1 - First bank to compare
|
|
82
|
+
* @param {Bank} bank2 - Second bank to compare
|
|
83
|
+
* @returns {boolean} True if banks are equal, false otherwise
|
|
84
|
+
* @private
|
|
85
|
+
*/
|
|
86
|
+
compare(bank1: Bank, bank2: Bank): boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Retrieves all SWIFT codes from the TZ_BANKS list.
|
|
89
|
+
* @returns {string[]} A list of all SWIFT codes in uppercase.
|
|
90
|
+
*/
|
|
91
|
+
getAllSwiftCodes(): string[];
|
|
92
|
+
/**
|
|
93
|
+
* Checks whether a given SWIFT code is in the correct format.
|
|
94
|
+
* @param {string} swiftCode The SWIFT code to check.
|
|
95
|
+
* @returns {boolean} `true` if the SWIFT code matches the expected format; `false` otherwise.
|
|
96
|
+
*/
|
|
97
|
+
isValidSwiftCodeFormat(swiftCode: string): boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Validates whether a given SWIFT code is correct.
|
|
100
|
+
* It checks both the SWIFT code format and if the SWIFT code exists in the list of valid codes.
|
|
101
|
+
* @param {string} [swiftCode] The SWIFT code to validate.
|
|
102
|
+
* @returns {boolean} `true` if valid, otherwise `false`.
|
|
103
|
+
*/
|
|
104
|
+
validateSWIFTCode: (swiftCode?: string) => boolean;
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../src/src/models/bank/service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,QAAgD,CAAC;AAE9E;;;GAGG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAc;IACrC,OAAO,CAAC,QAAQ,CAAc;IAC9B,OAAO,CAAC,UAAU,CAA4B;IAC9C,OAAO,CAAC,WAAW,CAA4B;IAC/C,OAAO,CAAC,gBAAgB,CAA4B;IAGpD,OAAO,CAAC,gBAAgB,CAAgC;IAExD,OAAO;IAEP;;;;;OAKG;IACH,MAAM,CAAC,WAAW,IAAI,WAAW;IAQjC;;;OAGG;IACH,OAAO,CAAC,UAAU;IA0ClB;;;OAGG;IACH,MAAM,IAAI,IAAI,EAAE;IAIhB;;;OAGG;IACH,cAAc,IAAI,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC;IAItC;;;OAGG;IACH,mBAAmB,IAAI,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC;IAIxC;;;;OAIG;IACH,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS;IAKlD;;;;OAIG;IACH,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS;IAqChD;;;;OAIG;IACH,gBAAgB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO;IAKpD;;;;OAIG;IACH,eAAe,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO;IAKlD;;;;;OAKG;IACH,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,GAAE,MAAW,GAAG,IAAI,EAAE;IAetD;;;;;;;OAOG;IACH,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,GAAG,OAAO;IAQ1C;;;OAGG;IACH,gBAAgB,IAAI,MAAM,EAAE;IAI5B;;;;OAIG;IACH,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAIlD;;;;;OAKG;IACH,iBAAiB,eAAgB,MAAM,KAAG,OAAO,CAQ/C;CACH"}
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.BankService = exports.SWIFT_CODE_REGEX = void 0;
|
|
7
|
+
const bank_js_1 = require("./bank.js");
|
|
8
|
+
const banks_tz_js_1 = __importDefault(require("../../data/banks_tz.js"));
|
|
9
|
+
/**
|
|
10
|
+
* Regex pattern to validate SWIFT codes.
|
|
11
|
+
* The SWIFT code must follow the format: XXXX XX XX XXX (optional last part for branches).
|
|
12
|
+
* @constant {RegExp}
|
|
13
|
+
*/
|
|
14
|
+
exports.SWIFT_CODE_REGEX = /^[A-Z]{4}[A-Z]{2}[A-Z0-9]{2}([A-Z0-9]{3})?$/;
|
|
15
|
+
/**
|
|
16
|
+
* Service for managing bank data.
|
|
17
|
+
* @class BankService
|
|
18
|
+
*/
|
|
19
|
+
class BankService {
|
|
20
|
+
constructor() {
|
|
21
|
+
Object.defineProperty(this, "bankList", {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
configurable: true,
|
|
24
|
+
writable: true,
|
|
25
|
+
value: []
|
|
26
|
+
});
|
|
27
|
+
Object.defineProperty(this, "bankRecord", {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
configurable: true,
|
|
30
|
+
writable: true,
|
|
31
|
+
value: {}
|
|
32
|
+
});
|
|
33
|
+
Object.defineProperty(this, "banksByName", {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
configurable: true,
|
|
36
|
+
writable: true,
|
|
37
|
+
value: {}
|
|
38
|
+
});
|
|
39
|
+
Object.defineProperty(this, "banksByShortName", {
|
|
40
|
+
enumerable: true,
|
|
41
|
+
configurable: true,
|
|
42
|
+
writable: true,
|
|
43
|
+
value: {}
|
|
44
|
+
});
|
|
45
|
+
// Static references for direct access through Bank class
|
|
46
|
+
Object.defineProperty(this, "staticReferences", {
|
|
47
|
+
enumerable: true,
|
|
48
|
+
configurable: true,
|
|
49
|
+
writable: true,
|
|
50
|
+
value: new Map()
|
|
51
|
+
});
|
|
52
|
+
/**
|
|
53
|
+
* Validates whether a given SWIFT code is correct.
|
|
54
|
+
* It checks both the SWIFT code format and if the SWIFT code exists in the list of valid codes.
|
|
55
|
+
* @param {string} [swiftCode] The SWIFT code to validate.
|
|
56
|
+
* @returns {boolean} `true` if valid, otherwise `false`.
|
|
57
|
+
*/
|
|
58
|
+
Object.defineProperty(this, "validateSWIFTCode", {
|
|
59
|
+
enumerable: true,
|
|
60
|
+
configurable: true,
|
|
61
|
+
writable: true,
|
|
62
|
+
value: (swiftCode) => {
|
|
63
|
+
if (!swiftCode)
|
|
64
|
+
return false;
|
|
65
|
+
const normalizedCode = swiftCode.trim().toUpperCase();
|
|
66
|
+
return (this.isValidSwiftCodeFormat(normalizedCode) &&
|
|
67
|
+
this.getAllSwiftCodes().includes(normalizedCode));
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Gets the singleton instance of BankService.
|
|
73
|
+
* Creates the instance if it doesn't exist.
|
|
74
|
+
* @static
|
|
75
|
+
* @returns {BankService} The singleton instance
|
|
76
|
+
*/
|
|
77
|
+
static getInstance() {
|
|
78
|
+
if (!BankService.instance) {
|
|
79
|
+
BankService.instance = new BankService();
|
|
80
|
+
BankService.instance.initialize();
|
|
81
|
+
}
|
|
82
|
+
return BankService.instance;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Initializes the service with bank data.
|
|
86
|
+
* Should be called once when your application starts.
|
|
87
|
+
*/
|
|
88
|
+
initialize() {
|
|
89
|
+
try {
|
|
90
|
+
const data = JSON.parse(JSON.stringify(banks_tz_js_1.default));
|
|
91
|
+
const banks = Object.values(data).map((b) => new bank_js_1.Bank(b.fullName, b.shortName, b.swiftCode));
|
|
92
|
+
const swiftCodeRecord = {};
|
|
93
|
+
const nameRecord = {};
|
|
94
|
+
const shortNameRecord = {};
|
|
95
|
+
banks.forEach((bank) => {
|
|
96
|
+
// Populate records
|
|
97
|
+
swiftCodeRecord[bank.swiftCode.toUpperCase()] = bank;
|
|
98
|
+
nameRecord[bank.fullName.toUpperCase()] = bank;
|
|
99
|
+
shortNameRecord[bank.shortName.toUpperCase()] = bank;
|
|
100
|
+
// Add to static references with uppercase short name
|
|
101
|
+
const shortName = bank.shortName.toUpperCase();
|
|
102
|
+
this.staticReferences.set(shortName, bank);
|
|
103
|
+
// Handle bank names with spaces (like "GT BANK")
|
|
104
|
+
if (shortName.includes(" ")) {
|
|
105
|
+
const noSpaceName = shortName.replace(/\s+/g, "_");
|
|
106
|
+
this.staticReferences.set(noSpaceName, bank);
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
this.bankRecord = swiftCodeRecord;
|
|
110
|
+
this.banksByName = nameRecord;
|
|
111
|
+
this.banksByShortName = shortNameRecord;
|
|
112
|
+
this.bankList = banks;
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
console.error("Failed to initialize BankService:", error);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Gets all banks.
|
|
120
|
+
* @returns {Bank[]} Array of all banks
|
|
121
|
+
*/
|
|
122
|
+
getAll() {
|
|
123
|
+
return this.bankList;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Gets all banks as a record.
|
|
127
|
+
* @returns {Record<string, Bank>} Record of bank SWIFT codes and bank objects
|
|
128
|
+
*/
|
|
129
|
+
getAllAsRecord() {
|
|
130
|
+
return this.bankRecord;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Gets static bank references to be used by the Bank class.
|
|
134
|
+
* @returns {Map<string, Bank>} Map of static references
|
|
135
|
+
*/
|
|
136
|
+
getStaticReferences() {
|
|
137
|
+
return this.staticReferences;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Retrieves a bank by its SWIFT code.
|
|
141
|
+
* @param {string} swiftCode The SWIFT code of the bank.
|
|
142
|
+
* @returns {Bank | undefined} The bank corresponding to the SWIFT code or `undefined` if not found.
|
|
143
|
+
*/
|
|
144
|
+
fromSWIFTCode(swiftCode) {
|
|
145
|
+
if (!swiftCode || typeof swiftCode !== "string")
|
|
146
|
+
return;
|
|
147
|
+
return this.bankRecord[swiftCode.toUpperCase()];
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Retrieves a bank by its name.
|
|
151
|
+
* @param {string} bankName The name of the bank.
|
|
152
|
+
* @returns {Bank | undefined} The bank corresponding to the name or `undefined` if not found.
|
|
153
|
+
*/
|
|
154
|
+
fromBankName(bankName) {
|
|
155
|
+
if (!bankName || typeof bankName !== "string")
|
|
156
|
+
return;
|
|
157
|
+
// First try shortname exact match
|
|
158
|
+
const bankByShortName = this.banksByShortName[bankName.toUpperCase()];
|
|
159
|
+
if (bankByShortName)
|
|
160
|
+
return bankByShortName;
|
|
161
|
+
// Next try fullname exact match
|
|
162
|
+
const bankByName = this.banksByName[bankName.toUpperCase()];
|
|
163
|
+
if (bankByName)
|
|
164
|
+
return bankByName;
|
|
165
|
+
// If not found, try more lenient matching on full name
|
|
166
|
+
for (const [name, bankObj] of Object.entries(this.banksByName)) {
|
|
167
|
+
if (bankName.toUpperCase() === name.toUpperCase()) {
|
|
168
|
+
return bankObj;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
// Try lenient matching on short name
|
|
172
|
+
for (const [shortName, bankObj] of Object.entries(this.banksByShortName)) {
|
|
173
|
+
if (bankName.toUpperCase() === shortName.toUpperCase()) {
|
|
174
|
+
return bankObj;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
// Legacy fallback - case insensitive exact match
|
|
178
|
+
return this.bankList.find((bank) => bank.fullName.toLowerCase() === bankName.toLowerCase() ||
|
|
179
|
+
bankName.toLowerCase() === bank.shortName.toLowerCase());
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Validates if a given SWIFT/BIC (Bank Identifier Code) is valid.
|
|
183
|
+
* @param {string | null | undefined} swiftCode - The SWIFT/BIC code to validate.
|
|
184
|
+
* @returns {boolean} Returns true if the SWIFT code is valid, false otherwise.
|
|
185
|
+
*/
|
|
186
|
+
isValidSwiftCode(swiftCode) {
|
|
187
|
+
if (!swiftCode)
|
|
188
|
+
return false;
|
|
189
|
+
return !!this.fromSWIFTCode(swiftCode);
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Validates if a given bank name is valid.
|
|
193
|
+
* @param {string | null | undefined} bankName - The bank name to validate.
|
|
194
|
+
* @returns {boolean} Returns true if the bank name is valid, false otherwise.
|
|
195
|
+
*/
|
|
196
|
+
isValidBankName(bankName) {
|
|
197
|
+
if (!bankName)
|
|
198
|
+
return false;
|
|
199
|
+
return !!this.fromBankName(bankName);
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Searches for banks that match the given search term.
|
|
203
|
+
* @param {string} searchTerm - The partial name or SWIFT code to search for.
|
|
204
|
+
* @param {number} [limit=10] - Maximum number of results to return.
|
|
205
|
+
* @returns {Bank[]} Array of matching banks, limited to specified count.
|
|
206
|
+
*/
|
|
207
|
+
search(searchTerm, limit = 10) {
|
|
208
|
+
if (!searchTerm || typeof searchTerm !== "string")
|
|
209
|
+
return [];
|
|
210
|
+
const term = searchTerm.toLowerCase().trim();
|
|
211
|
+
if (term.length === 0)
|
|
212
|
+
return [];
|
|
213
|
+
const results = this.bankList.filter((bank) => bank.fullName.toLowerCase().includes(term) ||
|
|
214
|
+
bank.shortName.toLowerCase().includes(term) ||
|
|
215
|
+
bank.swiftCode.toLowerCase().includes(term));
|
|
216
|
+
return results.slice(0, limit);
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Compares two Bank instances for equality by checking their full name, short name, and SWIFT code
|
|
220
|
+
*
|
|
221
|
+
* @param {Bank} bank1 - First bank to compare
|
|
222
|
+
* @param {Bank} bank2 - Second bank to compare
|
|
223
|
+
* @returns {boolean} True if banks are equal, false otherwise
|
|
224
|
+
* @private
|
|
225
|
+
*/
|
|
226
|
+
compare(bank1, bank2) {
|
|
227
|
+
return (bank1.fullName === bank2.fullName &&
|
|
228
|
+
bank1.shortName === bank2.shortName &&
|
|
229
|
+
bank1.swiftCode === bank2.swiftCode);
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Retrieves all SWIFT codes from the TZ_BANKS list.
|
|
233
|
+
* @returns {string[]} A list of all SWIFT codes in uppercase.
|
|
234
|
+
*/
|
|
235
|
+
getAllSwiftCodes() {
|
|
236
|
+
return this.bankList.map((bank) => bank.swiftCode.toUpperCase());
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Checks whether a given SWIFT code is in the correct format.
|
|
240
|
+
* @param {string} swiftCode The SWIFT code to check.
|
|
241
|
+
* @returns {boolean} `true` if the SWIFT code matches the expected format; `false` otherwise.
|
|
242
|
+
*/
|
|
243
|
+
isValidSwiftCodeFormat(swiftCode) {
|
|
244
|
+
return exports.SWIFT_CODE_REGEX.test(swiftCode);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
exports.BankService = BankService;
|