2.0.2 • Published 3 months ago

israeli-bank-autocomplete v2.0.2

Weekly downloads
4
License
MIT
Repository
github
Last release
3 months ago

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 NameDescriptionFormat
inputthe users inputString
optionsoptionsAutocompleteOptions

AutocompleteOptions

Argument NameDescriptionFormat
bankCodeget suggestions only for the given bankNumber
inputTypeget the suggestions only based on branch name/code/bothBRANCH_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().

2.0.2

3 months ago

1.0.13

3 months ago

1.0.12

3 months ago

1.0.9

3 months ago

1.0.11

3 months ago

1.0.10

3 months ago

2.0.1

3 months ago

2.0.0

3 months ago

1.1.7

1 year ago

1.1.6

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.4-dev

1 year ago

1.1.3

1 year ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago