israeli-bank-autocomplete
v2.0.2
Published
Autocomplete for banks in israel
Downloads
36
Readme
Israeli Bank Autocomplete
Autocomplete for banks in Israel
Installation
npm i israeli-bank-autocomplete
About
This package will help with fetching the data from data.gov.il and searching in the data. The package doesn't contain the data itself. Before calling fetchNewDataFromDataGov
make sure to read the terms of use of data.gov.il.
This package uses the following data source 2202bada-4baf-45f5-aa61-8c5bad9646d3. Please review this page too.
Importing
const BankDataSource = require("israeli-bank-autocomplete");
Initialization
First get the bank-data.json
file by running
const bankDataSource = new BankDataSource();
await bankDataSource.fetchNewDataFromDataGov('<resourceId>', 1600);
fs.writeFileSync('bank-data.json', JSON.stringify(bankDataSource.exportBankData()));
This will generate the bank-data.json
. Make sure to save it, and load the data from it.
import data from './bank-data.json';
const bankDataSource = new BankDataSource(data);
or just run fetchNewDataFromDataGov
every time to create a new instance:
const bankDataSource = new BankDataSource();
await bankDataSource.fetchNewDataFromDataGov('<resourceId>', 1600);
When calling fetchNewDataFromDataGov
, make sure that you know the limits of calling data.gov.il.
The function fetchNewDataFromDataGov
needs to get the resourceId
and a limit
. The supported resourceId is 2202bada-4baf-45f5-aa61-8c5bad9646d3
, and currently a limit of 1600 will return all the results. If you pick a limit that is too low, you will get a warning.
Get autocomplete suggestions
To get bank branches based on a name or a branch code
let suggestions = bankDataSource.getAutocompleteSuggestions("חדר", { bankCode: 12 });
/*
suggestions = [
{
bankCode: 12,
bankName: 'בנק הפועלים בע"מ',
branchCode: 620,
branchName: 'חדרה',
branchAddress: 'הרברט סמואל 85 ',
city: 'חדרה',
zip: '',
postCode: '',
phone: '04-6329583',
fax: '',
freePhone: '',
accessForDisabled: 'כן',
closedDay: 'יום ו',
type: 'רגיל',
openDate: '01/01/1949',
closingDate: '',
mergeBank: '',
mergeBranch: '',
xCoordinate: '34.921286',
yCoordinate: '32.436023'
}
]
*/
The function getAutocompleteSuggestions
takes two parameters
| Argument Name | Description | Format | | ------------- | --------------- | ------------------- | | input | the users input | String | | options | options | AutocompleteOptions |
AutocompleteOptions
| Argument Name | Description | Format | | ------------- | ------------------------------------------------------- | -------------------------------- | | bankCode | get suggestions only for the given bank | Number | | inputType | get the suggestions only based on branch name/code/both | BRANCH_CODE / BRANCH_NAME / BOTH |
Get All Banks
To get all banks use the following function
let banks = bankDataSource.getAllBanks();
/*
banks = [
{ bankCode: 22, bankName: 'Citibank'},
{ bankCode: 23, bankName: 'HSBC'},
{ bankCode: 18, bankName: 'One Zero - הבנק הדיגיטלי בע"מ'},
{ bankCode: 39, bankName: 'SBI State Bank of India'},
{ bankCode: 13, bankName: 'בנק אגוד לישראל בע"מ'},
{ bankCode: 14, bankName: 'בנק אוצר החייל בע"מ'},
{ bankCode: 11, bankName: 'בנק דיסקונט לישראל בע"מ'},
{ bankCode: 31, bankName: 'בנק הבינלאומי הראשון לישראל בע"מ'},
{ bankCode: 12, bankName: 'בנק הפועלים בע"מ'},
{ bankCode: 4, bankName: 'בנק יהב לעובדי המדינה בע"מ'},
{ bankCode: 54, bankName: 'בנק ירושלים בע"מ'},
{ bankCode: 99, bankName: 'בנק ישראל'},
{ bankCode: 10, bankName: 'בנק לאומי לישראל בע"מ'},
{ bankCode: 20, bankName: 'בנק מזרחי טפחות בע"מ'},
{ bankCode: 46, bankName: 'בנק מסד בע"מ'},
{ bankCode: 17, bankName: 'בנק מרכנתיל דיסקונט בע"מ'},
{ bankCode: 52, bankName: 'בנק פועלי אגודת ישראל בע"מ'},
{ bankCode: 26, bankName: 'יובנק בע"מ'},
{ bankCode: 50, bankName: 'מרכז סליקה בנקאי בע"מ'},
{ bankCode: 59, bankName: 'שירותי בנק אוטומטיים'},
{ bankCode: 9, bankName: 'בנק הדואר'}
]
*/
Get all branches
To get all the branches use bankDataSource.getAllBranches()
.