Skip to content

Commit

Permalink
Merge pull request #279 from razorpay/release/2.0.7
Browse files Browse the repository at this point in the history
Release: v2.0.7
  • Loading branch information
Nemo authored May 9, 2022
2 parents 9ed0119 + bd15ef4 commit 1c55e3d
Show file tree
Hide file tree
Showing 54 changed files with 5,997 additions and 4,200 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ jobs:
go:
strategy:
matrix:
go: ["^1.16.0", "^1.17.0"]
go: ["^1.16.0", "^1.17.0", "^1.18.0"]
name: Go
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}
- run: make go-test
- run: ./tests/constants.sh
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [UNRELEASED][unreleased]

## [2.0.7][2.0.7]
## Changed
- Dependency Updates
- Updated metadata
- All constant files are now automatically generated
- `IXXX` as custom bank code for "Indrayani Co-operative Bank"
- NPCI does not publish bank type any more, so these are now maintained in this repository as patches
- Minor bank name updates
- Support for Go 1.18

## [2.0.6][2.0.6]
## Changed
- Updated Metadata
Expand Down Expand Up @@ -243,7 +253,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Removes some data formats (YAML/Large JSON) for cleaner code. If you were using them, please let create an issue.

[unreleased]: https://github.com/razorpay/ifsc/compare/2.0.6...HEAD
[unreleased]: https://github.com/razorpay/ifsc/compare/2.0.7...HEAD
[2.0.6]: https://github.com/razorpay/ifsc/releases/tag/2.0.7
[2.0.6]: https://github.com/razorpay/ifsc/releases/tag/2.0.6
[2.0.5]: https://github.com/razorpay/ifsc/releases/tag/2.0.5
[2.0.4]: https://github.com/razorpay/ifsc/releases/tag/2.0.4
Expand Down
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ file, here are a few guidelines:
7. Try not to leave any unexpanded abbreviations in the name
8. Also ensure that the 4 character code is committed to `Bank.php`
9. No period after `Co-operative`
10. Grameen is spelled three ways: Grameen/Gramin/Grameena. Check the RBI List for the corresponding bank [here](https://m.rbi.org.in/scripts/Bs_viewcontent.aspx?Id=3657).
11. `Sahakari`, not `sahkari`.

## Code Guidelines

Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ go-test:
go test -tags=unit -timeout 2m -coverprofile=coverage.cov -v ./...

generate-constants:
go run ./src/go/generator/main.go
go run ./src/go/generator/main.go ./src/go/generator/constants.template ./src/go/constants.go
go run ./src/go/generator/main.go ./src/php/Bank.php.tpl ./src/php/Bank.php
go run ./src/go/generator/main.go ./src/ruby/bank.rb.tpl ./src/ruby/bank.rb
go run ./src/go/generator/main.go ./src/node/bank.js.tpl ./src/node/bank.js
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ This is part of the IFSC toolset released by Razorpay.
You can find more details about the entire release at
[ifsc.razorpay.com](https://ifsc.razorpay.com).

[![](https://images.microbadger.com/badges/image/razorpay/ifsc:2.0.6.svg)](https://microbadger.com/images/razorpay/ifsc:2.0.6) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
[![](https://images.microbadger.com/badges/image/razorpay/ifsc:2.0.7.svg)](https://microbadger.com/images/razorpay/ifsc:2.0.7) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)

[![](https://images.microbadger.com/badges/version/razorpay/ifsc:2.0.6.svg)](https://microbadger.com/images/razorpay/ifsc:2.0.6) [![npm version](https://badge.fury.io/js/ifsc.svg)](https://badge.fury.io/js/ifsc) [![Gem Version](https://badge.fury.io/rb/ifsc.svg)](https://badge.fury.io/rb/ifsc) [![PHP version](https://badge.fury.io/ph/razorpay%2Fifsc.svg)](https://badge.fury.io/ph/razorpay%2Fifsc) [![Hex pm](http://img.shields.io/hexpm/v/ifsc.svg)](https://hex.pm/packages/ifsc)
[![](https://images.microbadger.com/badges/version/razorpay/ifsc:2.0.7.svg)](https://microbadger.com/images/razorpay/ifsc:2.0.7) [![npm version](https://badge.fury.io/js/ifsc.svg)](https://badge.fury.io/js/ifsc) [![Gem Version](https://badge.fury.io/rb/ifsc.svg)](https://badge.fury.io/rb/ifsc) [![PHP version](https://badge.fury.io/ph/razorpay%2Fifsc.svg)](https://badge.fury.io/ph/razorpay%2Fifsc) [![Hex pm](http://img.shields.io/hexpm/v/ifsc.svg)](https://hex.pm/packages/ifsc)

## Dataset

Expand Down
4 changes: 2 additions & 2 deletions ifsc.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)

Gem::Specification.new do |s|
s.name = 'ifsc'
s.version = '2.0.6'
s.date = '2022-01-25'
s.version = '2.0.7'
s.date = '2022-03-21'
s.summary = 'IFSC code database to help you validate IFSC codes'
s.description = 'A simple gem by @razorpay to help you validate your IFSC codes. IFSC codes are bank codes within India'
s.authors = ['Abhay Rana', 'Nihal Gonsalves']
Expand Down
32 changes: 16 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ifsc",
"version": "2.0.6",
"version": "2.0.7",
"description": "This is part of the IFSC toolset released by Razorpay. You can find more details about the entire release at [ifsc.razorpay.com](https://ifsc.razorpay.com). Includes only a validation library as of now.",
"main": "src/node/index.js",
"directories": {
Expand Down
10 changes: 5 additions & 5 deletions scraper/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ GEM
mime-types (3.4.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2022.0105)
mini_portile2 (2.7.1)
mini_portile2 (2.8.0)
multi_xml (0.6.0)
nokogiri (1.13.1)
mini_portile2 (~> 2.7.0)
nokogiri (1.13.6)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
racc (1.6.0)
ruby-ole (1.2.12.2)
rubyXL (3.4.20)
rubyXL (3.4.23)
nokogiri (>= 1.10.8)
rubyzip (>= 1.3.0)
rubyzip (2.3.2)
Expand All @@ -31,4 +31,4 @@ DEPENDENCIES
spreadsheet

BUNDLED WITH
2.2.26
2.3.11
42 changes: 42 additions & 0 deletions scraper/scripts/iso3166.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
ISO3166_MAP = {
# https://en.wikipedia.org/wiki/States_and_union_territories_of_India
# 28 States
'ANDHRA PRADESH' => 'IN-AP',
'ARUNACHAL PRADESH' => 'IN-AR',
'ASSAM' => 'IN-AS',
'BIHAR' => 'IN-BR',
'CHHATTISGARH' => 'IN-CT',
'GOA' => 'IN-GA',
'GUJARAT' => 'IN-GJ',
'HARYANA' => 'IN-HR',
'HIMACHAL PRADESH' => 'IN-HP',
'JHARKHAND' => 'IN-JH',
'KARNATAKA' => 'IN-KA',
'KERALA' => 'IN-KL',
'MADHYA PRADESH' => 'IN-MP',
'MAHARASHTRA' => 'IN-MH',
'MANIPUR' => 'IN-MN',
'MEGHALAYA' => 'IN-ML',
'MIZORAM' => 'IN-MZ',
'NAGALAND' => 'IN-NL',
'ODISHA' => 'IN-OR',
'PUNJAB' => 'IN-PB',
'RAJASTHAN' => 'IN-RJ',
'SIKKIM' => 'IN-SK',
'TAMIL NADU' => 'IN-TN',
'TELANGANA' => 'IN-TG',
'TRIPURA' => 'IN-TR',
'UTTAR PRADESH' => 'IN-UP',
'UTTARAKHAND' => 'IN-UT',
'WEST BENGAL' => 'IN-WB',
# 8 Union Territories
# https://en.wikipedia.org/wiki/Union_territory
'ANDAMAN AND NICOBAR ISLANDS' => 'IN-AN',
'CHANDIGARH' => 'IN-CH',
'DADRA AND NAGAR HAVELI AND DAMAN AND DIU' => 'IN-DH',
'DELHI' => 'IN-DL',
'JAMMU AND KASHMIR' => 'IN-JK',
'LADAKH' => 'IN-LA',
'LAKSHADWEEP' => 'IN-LD',
'PUDUCHERRY' => 'IN-PY'
}
52 changes: 37 additions & 15 deletions scraper/scripts/methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
require 'open-uri'
require './methods_nach'
require './utils'
require './iso3166'

HEADINGS_INSERT = %w[
BANK
Expand All @@ -27,17 +28,18 @@ def parse_imps(banks)
banks.each do |code, row|
next unless row[:ifsc] && row[:ifsc].strip.to_s.length == 11

# These are virtual branches, so we fix them to NPCI HQ for now
data[row[:ifsc]] = {
'BANK' => banknames[code],
'IFSC' => row[:ifsc],
'BRANCH' => "#{banknames[code]} IMPS",
'CENTRE' => 'NA',
'DISTRICT' => 'NA',
'STATE' => 'NA',
'STATE' => 'MAHARASHTRA',
'ADDRESS' => 'NA',
'CONTACT' => nil,
'IMPS' => true,
'CITY' => 'NA',
'CITY' => 'MUMBAI',
'UPI' => banks[code][:upi] ? true : false
}
end
Expand All @@ -46,32 +48,38 @@ def parse_imps(banks)

# TODO: Return state/UT ISO code and use that instead
def fix_state!(row)
possible_state = row['STATE'].upcase
final_state = nil
return unless row['STATE']
possible_state = final_state = row['STATE'].upcase
map = {
/ANDAMAN/ => 'ANDAMAN AND NICOBAR ISLAND',
/ANDAMAN/ => 'ANDAMAN AND NICOBAR ISLANDS',
/BANGALORE/ => 'KARNATAKA',
/BARDEZ/ => 'GOA',
/BHUSAWAL/ => 'MAHARASHTRA',
/BTM/ => 'KARNATAKA',
/BULDHANA/ => 'MAHARASHTRA',
/BUNDI/ => 'RAJASTHAN',
/RAJAS/ => 'RAJASTHAN',
/KARANATAKA/ => 'KARNATAKA',
/CARMELARAM/ => 'KARNATAKA',
# Chandigarh is not a state, but the branches there are ambigous b/w Haryana and Punjab
# /CHANDIGARH/ => 'PUNJAB',
/CHEMBUR/ => 'PUNJAB',
/CHENNAI/ => 'TAMIL NADU',
/CHHATIS/ => 'CHHATTISGARH',
# Double H, Single T
/CHHATISHGARH/ => 'CHHATTISGARH',
# Single H, Double T
/CHATTISGARH/ => 'CHHATTISGARH',
/DADRA/ => 'DADRA AND NAGAR HAVELI AND DAMAN AND DIU',
/DAHEGAM/ => 'GUJARAT',
/DAHEJ/ => 'GUJARAT',
/DELHI/ => 'DELHI',
/DINDORI/ => 'MADHYA PRADESH',
/MADHYAPRADESH/ => 'MADHYA PRADESH',
# Do not use DAMAN as that clashes with ANDAMAN
/DIU/ => 'DADRA AND NAGAR HAVELI AND DAMAN AND DIU',
/GOA/ => 'GOA',
/HIMANCHAL/ => 'HIMACHAL PRADESH',
/HIMACHAL/ => 'HIMACHAL PRADESH',
/HYDERABAD/ => 'ANDHRA PRADESH',
/IDAR/ => 'ANDHRA PRADESH',
Expand All @@ -89,13 +97,16 @@ def fix_state!(row)
/UTTARA/ => 'UTTARAKHAND',
/UTTARPRADESH/ => 'UTTAR PRADESH',
/WEST/ => 'WEST BENGAL',
/CHURU/ => 'RAJASTHAN'
/CHURU/ => 'RAJASTHAN',
/AHMEDABAD/ => 'GUJARAT',
/GUJRAT/ => 'GUJARAT',
/HARKHAND/ => 'JHARKHAND',
/JHAGRAKHAND/ => 'JHARKHAND',
/ORISSA/ => 'ODISHA',
/PUNE/ => 'MAHARASHTRA',
/TELENGANA/ => 'TELANGANA',
/PANJAB/ => 'PUNJAB'
}
map.each_pair do |r, state|
if r.match? possible_state
final_state = state
end
end

if possible_state.size == 2
final_state = {
Expand All @@ -104,11 +115,17 @@ def fix_state!(row)
"TN" => "TELANGANA",
"MH" => "MAHARASHTRA",
"CG" => "CHHATTISGARH",

}[possible_state]
else
map.each_pair do |r, state|
if r.match? possible_state
final_state = state
end
end
end
if final_state and final_state != row['STATE']
log "#{row['IFSC']}: Setting State=(#{final_state}) instead of (#{possible_state})"

if final_state != row['STATE']
log "#{row['IFSC']}: Setting State=(#{final_state}) instead of (#{row['STATE']})"
row['STATE'] = final_state
end
end
Expand Down Expand Up @@ -165,6 +182,10 @@ def parse_csv(files, banks, additional_attributes = {})
headers = CSV.foreach("sheets/#{file}.csv", encoding: 'utf-8', return_headers: false, headers: true, skip_blanks: true) do |row|
row = row.to_h

# BDBL0001094 RTGS sheet, so it gets overridden with data from NEFT sheet
if row['STATE'] == '0'
row['STATE'] = nil
end

# Some column is missing, and the STATE column has shifted by one.
if row['STATE'].to_s.strip.match('\d')
Expand Down Expand Up @@ -239,7 +260,7 @@ def parse_csv(files, banks, additional_attributes = {})

def export_csv(data)
CSV.open('data/IFSC.csv', 'wb') do |csv|
keys = ['BANK','IFSC','BRANCH','CENTRE','DISTRICT','STATE','ADDRESS','CONTACT','IMPS','RTGS','CITY','NEFT','MICR','UPI','SWIFT']
keys = ['BANK','IFSC','BRANCH','CENTRE','DISTRICT','STATE','ADDRESS','CONTACT','IMPS','RTGS','CITY','ISO3166','NEFT','MICR','UPI','SWIFT']
csv << keys
data.each do |code, ifsc_data|
sorted_data = []
Expand Down Expand Up @@ -320,6 +341,7 @@ def merge_dataset(neft, rtgs, imps)
# Set the bank name considering sublets
combined_data['BANK'] = bank_name_from_code(combined_data['IFSC'])
combined_data.delete('DATE')
combined_data['ISO3166'] = ISO3166_MAP[combined_data['STATE']]

h[ifsc] = combined_data
end
Expand Down
Loading

0 comments on commit 1c55e3d

Please sign in to comment.