Skip to content

Commit

Permalink
Merge pull request #152 from razorpay/release/1.4.10
Browse files Browse the repository at this point in the history
Release/1.4.10
  • Loading branch information
Nemo committed Jan 2, 2020
2 parents a6611bf + ead204d commit 01a17b0
Show file tree
Hide file tree
Showing 21 changed files with 1,155 additions and 28 deletions.
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ fixture/
src/IFSC-list.json
.wercker
.phpunit.result.cache
src/patches/*
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## UNRELEASED

## [1.4.10][1.4.10] - 2019-11-20
- Metadata Updates
- Support for patches that can override data for specific IFSC codes
- NEFT Block for certain banks:
+ Bank Of Ceylon
+ Krung Thai Bank
+ Kaveri Grameena Bank
+ Kerala Gramin Bank
+ Pragathi Krishna Gramin Bank
+ Sbm Bank Mauritius Ltd

## [1.4.9][1.4.8] - 2019-11-07
- Metadata Updates

Expand Down Expand Up @@ -68,6 +79,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

[unreleased]: https://github.com/razorpay/ifsc/compare/1.4.9...HEAD

[1.4.10]: https://github.com/razorpay/ifsc/releases/tag/1.4.10
[1.4.9]: https://github.com/razorpay/ifsc/releases/tag/1.4.9
[1.4.8]: https://github.com/razorpay/ifsc/releases/tag/1.4.8
[1.4.7]: https://github.com/razorpay/ifsc/releases/tag/1.4.7
Expand Down
10 changes: 10 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,13 @@ Releases are partially automated. To draft a new release, follow these steps:
7. Tag the merge commit (don't use a prefix, just `X.Y.Z`)
8. Push the tag to GitHub.
9. Create a release on GitHub for the tag. Use `release.md` from Step 4 as the template. Replace `TODO` as applicable for the release.


## Patches

Sometimes, when you know a certain information to be incorrect in the dataset (temporarily or permanently), you might want to override what the official dataset says. For such cases, the library maintains patches in YAML format in the `patches/` directory. Each patch has 2 components:

1. Diff that must be applied (`patch`)
2. List of IFSC that it must be applied to (`ifsc`)

Using this, you can selectively correct data for various IFSC, including turning "NEFT"/"IMPS" properties on or off, or setting the right state name.
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).

[![wercker status](https://app.wercker.com/status/bc9b22047e1b8eb55ce98ba451d7b504/s/master 'wercker status')](https://app.wercker.com/project/byKey/bc9b22047e1b8eb55ce98ba451d7b504) [![](https://images.microbadger.com/badges/image/razorpay/ifsc:1.4.9.svg)](https://microbadger.com/images/razorpay/ifsc:1.4.9) [![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)
[![wercker status](https://app.wercker.com/status/bc9b22047e1b8eb55ce98ba451d7b504/s/master 'wercker status')](https://app.wercker.com/project/byKey/bc9b22047e1b8eb55ce98ba451d7b504) [![](https://images.microbadger.com/badges/image/razorpay/ifsc:1.4.10.svg)](https://microbadger.com/images/razorpay/ifsc:1.4.10) [![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:1.4.9.svg)](https://microbadger.com/images/razorpay/ifsc:1.4.9) [![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:1.4.10.svg)](https://microbadger.com/images/razorpay/ifsc:1.4.10) [![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
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
"guzzlehttp/psr7" : "^1.3",
"php-http/message" : "^1.7",
"php-http/mock-client" : "^0.3 || ^1.0",
"phpunit/phpunit" : "^6.0 || ^8.0 || ^7.0"
"phpunit/phpunit" : "^6.0 || ^8.0 || ^7.0",
"symfony/yaml": "^5.0"
},
"scripts": {
"test": "phpunit"
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 = '1.4.9'
s.date = '2019-10-14'
s.version = '1.4.10'
s.date = '2019-11-20'
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
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule IFSC.Mixfile do
def project do
[
app: :ifsc,
version: "1.4.9",
version: "1.4.10",
elixir: "~> 1.5",
start_permanent: Mix.env == :prod,
description: description(),
Expand Down
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": "1.4.9",
"version": "1.4.10",
"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
6 changes: 3 additions & 3 deletions scraper/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ GEM
remote: https://rubygems.org/
specs:
mini_portile2 (2.4.0)
nokogiri (1.10.4)
nokogiri (1.10.7)
mini_portile2 (~> 2.4.0)
ruby-ole (1.2.12.2)
rubyXL (3.4.6)
rubyXL (3.4.9)
nokogiri (>= 1.4.4)
rubyzip (>= 1.1.6)
rubyzip (>= 1.3.0)
rubyzip (2.0.0)
spreadsheet (1.2.5)
ruby-ole (>= 1.0)
Expand Down
2 changes: 1 addition & 1 deletion scraper/scripts/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ IFS=$'\n\t'
mkdir --parents data/by-bank sheets

# List of sublet branches, and IMPS only branches
wget "https://www.npci.org.in/national-automated-clearing-live-members-1" --output-document=nach.html --user-agent="Firefox"
wget --timeout=10 "https://www.npci.org.in/national-automated-clearing-live-members-1" --output-document=nach.html --user-agent="Firefox"
wget --timestamping --no-verbose --directory-prefix=sheets/ "https://rbidocs.rbi.org.in/rdocs/content/docs/68774.xlsx" || true
wget --timestamping --no-verbose --directory-prefix=sheets/ "https://rbidocs.rbi.org.in/rdocs/RTGS/DOCs/RTGEB0815.xlsx" || true

Expand Down
23 changes: 15 additions & 8 deletions scraper/scripts/generate.rb
Original file line number Diff line number Diff line change
@@ -1,26 +1,33 @@
require './methods'

imps = parse_imps
puts "[NPCI] Got #{imps.keys.size} entries"
log "[NPCI] Got #{imps.keys.size} entries"

rtgs = parse_rtgs
puts "[RTGS] Got #{rtgs.keys.size} entries"
log "[RTGS] Got #{rtgs.keys.size} entries"

neft = parse_neft
puts "[NEFT] Got #{neft.keys.size} entries"
log "[NEFT] Got #{neft.keys.size} entries"

log 'Combining the above 3 lists'
data, hash = merge_dataset(neft, rtgs, imps)
dataset = merge_dataset(neft, rtgs, imps)

puts "Got total #{hash.keys.size} entries"
log "Got total #{dataset.keys.size} entries", :info

ifsc_codes_list = rtgs.keys + neft.keys + imps.keys
dataset = apply_patches(dataset)

log 'Applied patches', :info

# We do this once, to:
# 1. Ensure the same ordering in most datasets (consistency)
# 2. Remove any future .keys calls (speed)
ifsc_codes_list = dataset.keys.sort

log 'Exporting CSV'
export_csv(data)
export_csv(dataset)

log 'Exporting JSON by Banks'
export_json_by_banks(ifsc_codes_list, hash)
export_json_by_banks(ifsc_codes_list, dataset)

log 'Exporting JSON List'
export_json_list(ifsc_codes_list)
Expand Down
34 changes: 26 additions & 8 deletions scraper/scripts/methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def parse_imps
def parse_neft
data = {}
codes = Set.new
sheets = 0..3
sheets = 0..2
sheets.each do |sheet_id|
row_index = 0
headings = []
Expand Down Expand Up @@ -111,12 +111,12 @@ def parse_rtgs

def export_csv(data)
CSV.open('data/IFSC.csv', 'wb') do |csv|
keys = data[0].keys
keys = ['BANK','IFSC','BRANCH','CENTRE','DISTRICT','STATE','ADDRESS','CONTACT','IMPS','RTGS','CITY','NEFT','MICR']
csv << keys
data.each do |row|
data.each do |code, ifsc_data|
sorted_data = []
keys.each do |key|
sorted_data << row[key]
sorted_data << ifsc_data.fetch(key, "NA")
end
csv << sorted_data
end
Expand Down Expand Up @@ -156,9 +156,7 @@ def export_json_by_banks(list, ifsc_hash)
end

def merge_dataset(neft, rtgs, imps)
data = []
h = {}

combined_set = Set.new(neft.keys) + Set.new(rtgs.keys) + Set.new(imps.keys)

combined_set.each do |ifsc|
Expand All @@ -175,10 +173,30 @@ def merge_dataset(neft, rtgs, imps)
combined_data['IMPS'] ||= true
combined_data['MICR'] ||= nil
h[ifsc] = combined_data
end
h
end

def apply_patches(dataset)
Dir.glob('../../src/patches/*.yml').each do |patch|
data = YAML.safe_load(File.read(patch))

data << combined_data
codes = data['ifsc']

case data['action'].downcase
when 'patch'
patch = data['patch']
codes.each do |code|
dataset[code].merge!(patch) if dataset.has_key? code
end
when 'delete'
codes.each do |code|
dataset.delete code
log "Removed #{code} from the list", :info
end
end
end
[data, h]
dataset
end

def export_json_list(list)
Expand Down
2 changes: 1 addition & 1 deletion src/IFSC.json

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions src/banknames.json
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@
"CORP": "Corporation Bank",
"COSB": "Cosmos Co-operative Bank",
"CPDX": "Chandrapur District Central Co-operative Bank",
"CPSN": "Chikmagalur Pattana Sahakara Bank Niyamitha",
"CRBX": "Central Co-operative Bank Ara",
"CRES": "Credit Suisse AG",
"CRLY": "Credit Agricole Corporate and Investment Bank",
Expand Down Expand Up @@ -299,6 +300,7 @@
"DICX": "District Co-operative Central Bank Visakhapatnam",
"DIUX": "Dilip Urban Co-operative Bank",
"DJCX": "Deoghar Jamtara Central Co-operative Bank Deoghar",
"DKCL": "Deoria Kasia District Co-operative Bank",
"DKSX": "Dausa Kendriya Sahkari Bank Dausa",
"DLSC": "Delhi State Co-operative Bank",
"DLXB": "Dhanlaxmi Bank",
Expand Down Expand Up @@ -433,6 +435,7 @@
"IDIB": "Indian Bank",
"IDUK": "Idukki District Co-operative Bank",
"IDUX": "Idukki District Co-operative Bank",
"ILCB": "Ilkal Co-operative Bank",
"IMPX": "Imphal Urban Co-operative Bank",
"INCX": "Indapur Urban Co-operative Bank",
"INDB": "Indusind Bank",
Expand Down Expand Up @@ -1313,6 +1316,7 @@
"UNMX": "United Mercantile Co-operative Bank",
"UNSX": "Unava Nagrik Sahakari Bank",
"UOVB": "United Overseas Bank",
"UPCB": "Uttar Pradesh Co-operative Bank",
"UPCX": "Uttar Pradesh Co-operative Bank",
"URBN": "Urban Co-operative Bank Perinthalmanna",
"URCX": "Urban Co Operativa Bank Siddharthnagar",
Expand Down
22 changes: 22 additions & 0 deletions src/banks.json
Original file line number Diff line number Diff line change
Expand Up @@ -2606,6 +2606,17 @@
"ach_debit": false,
"nach_debit": false
},
"CPSN": {
"code": "CPSN",
"type": "O-UCB",
"ifsc": "UTIB0SCPSBN",
"micr": "577815102",
"iin": null,
"apbs": false,
"ach_credit": true,
"ach_debit": false,
"nach_debit": false
},
"CRBX": {
"code": "CRBX",
"type": "DCCB",
Expand Down Expand Up @@ -3134,6 +3145,17 @@
"ach_debit": false,
"nach_debit": false
},
"DKCL": {
"code": "DKCL",
"type": "O-UCB",
"ifsc": "ICIC00DKDCB",
"micr": "274862001",
"iin": null,
"apbs": false,
"ach_credit": true,
"ach_debit": false,
"nach_debit": false
},
"DKSX": {
"code": "DKSX",
"type": "O-UCB",
Expand Down
6 changes: 6 additions & 0 deletions src/patches/invalid-ifsc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
action: delete
# The current RTGS File from RBI
# contains an invalid entry
ifsc:
- "BANKOFBAROD"
Loading

0 comments on commit 01a17b0

Please sign in to comment.