Skip to content

Commit

Permalink
Merge pull request #233 from razorpay/release/1.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Nemo committed Jul 12, 2021
2 parents f4268f5 + 8175579 commit aaa1b03
Show file tree
Hide file tree
Showing 20 changed files with 133 additions and 45 deletions.
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file. The format
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [UNRELEASED][unreleased]

## [1.6.0][1.6.0]
- Support PHP8
- Fix for some invalid IFSCs being marked as valid. Ex: `PUNB0000000` (#229)
- Update list of UPI enabled banks
- Fix all exported datasets to include correct bank name.
- Only use validated MICR codes

## [1.5.13][1.5.13]
- [upi] Vijaya Bank and Dena Gujarat Gramin Bank are no more
- [upi] 7 new banks now support UPI
Expand Down Expand Up @@ -196,7 +204,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/1.5.13...HEAD
[unreleased]: https://github.com/razorpay/ifsc/compare/1.6.0...HEAD
[1.6.0]: https://github.com/razorpay/ifsc/releases/tag/1.6.0
[1.5.13]: https://github.com/razorpay/ifsc/releases/tag/1.5.13
[1.5.12]: https://github.com/razorpay/ifsc/releases/tag/1.5.12
[1.5.11]: https://github.com/razorpay/ifsc/releases/tag/1.5.11
Expand Down
6 changes: 4 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.5.13.svg)](https://microbadger.com/images/razorpay/ifsc:1.5.13) [![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.6.0.svg)](https://microbadger.com/images/razorpay/ifsc:1.6.0) [![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.5.13.svg)](https://microbadger.com/images/razorpay/ifsc:1.5.13) [![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.6.0.svg)](https://microbadger.com/images/razorpay/ifsc:1.6.0) [![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 All @@ -24,6 +24,8 @@ The source for the dataset are the following files:
- List of NEFT IFSCs from [RBI website][combined]
- List of RTGS IFSCs from [RBI website][rtgs]
- List of ACH Live Banks from [NPCI website][ach] used for IFSC sublet branches
- List of [IMPS Live members](https://www.npci.org.in/what-we-do/imps/live-members) on the NPCI website.
- RBI maintains a [list of banks in India](https://www.rbi.org.in/commonman/english/scripts/banksinindia.aspx) and [websites of banks in India](https://www.rbi.org.in/scripts/banklinks.aspx)

#### SWIFT

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
]
},
"require": {
"php": "^7.1",
"php": "^7.1|^8.0",
"php-http/client-implementation": "^1.0",
"php-http/discovery": "^1.6",
"php-http/message-factory": "^1.0",
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.5.13'
s.date = '2021-05-10'
s.version = '1.6.0'
s.date = '2021-07-09'
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.5.13",
version: "1.6.0",
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.5.13",
"version": "1.6.0",
"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
1 change: 1 addition & 0 deletions scraper/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ source "https://rubygems.org"
gem 'nokogiri'
gem 'spreadsheet'
gem 'rubyXL'
gem 'httparty'
18 changes: 13 additions & 5 deletions scraper/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,26 +1,34 @@
GEM
remote: https://rubygems.org/
specs:
mini_portile2 (2.5.1)
nokogiri (1.11.3)
httparty (0.18.1)
mime-types (~> 3.0)
multi_xml (>= 0.5.2)
mime-types (3.3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2021.0704)
mini_portile2 (2.5.3)
multi_xml (0.6.0)
nokogiri (1.11.7)
mini_portile2 (~> 2.5.0)
racc (~> 1.4)
racc (1.5.2)
ruby-ole (1.2.12.2)
rubyXL (3.4.17)
nokogiri (>= 1.10.8)
rubyzip (>= 1.3.0)
rubyzip (2.3.0)
spreadsheet (1.2.8)
rubyzip (2.3.2)
spreadsheet (1.2.9)
ruby-ole

PLATFORMS
ruby

DEPENDENCIES
httparty
nokogiri
rubyXL
spreadsheet

BUNDLED WITH
2.2.16
2.2.22
4 changes: 2 additions & 2 deletions scraper/scripts/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ if [[ $@ == *'--no-download'* ]]; then
else
# List of sublet branches, and IMPS only branches
# Till NPCI fixes their certificate: https://twitter.com/captn3m0/status/1247806778529599496
wget --no-check-certificate --timeout=10 "https://www.npci.org.in/what-we-do/nach/live-members/live-banks" --output-document=nach.html --user-agent="Firefox"
wget --no-check-certificate --timeout=10 "https://www.npci.org.in/what-we-do/upi/live-members" --output-document=upi.html --user-agent="Firefox"
wget --no-verbose --timeout=30 "https://www.npci.org.in/what-we-do/nach/live-members/live-banks" --output-document=nach.html --user-agent="Firefox"
wget --no-verbose --timeout=30 "https://www.npci.org.in/what-we-do/upi/live-members" --output-document=upi.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
16 changes: 12 additions & 4 deletions scraper/scripts/methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,14 @@ def parse_rtgs(banks)
log "Parsing #RTGS-#{sheet_id}.csv"
headers = CSV.foreach("sheets/RTGS-#{sheet_id}.csv", encoding: 'utf-8', return_headers: false, headers: true, skip_blanks: true) do |row|
row = row.to_h
micr_match = row['MICR_CODE'].to_s.strip.match('\d{9}')
row['MICR'] = micr_match[0] if micr_match
row['BANK'] = row.delete('BANK NAME')

micr_match = row['MICR'].to_s.strip.match('\d{9}')

if micr_match
row['MICR'] = micr_match[0]
else
row['MICR'] = nil
end

if row['STATE'].to_s.strip.match('\d')
row = fix_row_alignment_for_rtgs(row)
Expand Down Expand Up @@ -290,6 +295,8 @@ def merge_dataset(neft, rtgs, imps)
combined_data['UPI'] ||= false
combined_data['MICR'] ||= nil
combined_data['SWIFT'] = nil
# Set the bank name considering sublets
combined_data['BANK'] = bank_name_from_code(combined_data['IFSC'])
combined_data.delete('DATE')

h[ifsc] = combined_data
Expand All @@ -299,6 +306,7 @@ def merge_dataset(neft, rtgs, imps)

def apply_bank_patches(dataset)
Dir.glob('../../src/patches/banks/*.yml').each do |patch|
log "Applying Bank level patch: #{patch}", :debug
data = YAML.safe_load(File.read(patch), [Symbol])
banks = data['banks']
patch = data['patch']
Expand All @@ -316,7 +324,7 @@ def apply_bank_patches(dataset)
def apply_patches(dataset)
Dir.glob('../../src/patches/ifsc/*.yml').each do |patch|
log "Applying #{patch}", :debug
data = YAML.safe_load(File.read(patch))
data = YAML.safe_load(File.read(patch), [Symbol])

case data['action'].downcase
when 'patch'
Expand Down
8 changes: 8 additions & 0 deletions scraper/scripts/utils.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require '../../src/ruby/ifsc'

def sanitize(str)
return nil if str.nil? or str.length==0
["┬ô", "┬û",'┬ö','┬Æ','┬á','┬æ','┬ù','ý','ý','┬á'].each do |pattern|
Expand All @@ -6,6 +8,8 @@ def sanitize(str)
str.gsub!('É','e')
str.gsub!('Æ','a')
str.gsub!('É','e')
# replace newlines
str.gsub!("\n", " ")
# Remove all spaces (including nbsp) at the start and end of the string
str.gsub(/\A[[:space:]]+|[[:space:]]+\z/, '')
end
Expand All @@ -28,3 +32,7 @@ def fix_row_alignment_for_rtgs(row)
row['CITY2'] = row['CITY1']
return row
end

def bank_name_from_code(code)
Razorpay::IFSC::IFSC.bank_name_for(code)
end
2 changes: 1 addition & 1 deletion src/IFSC.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/banknames.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@
"BODX": "Bagalkot District Central Co-operative Bank",
"BOFA": "Bank of America",
"BORX": "Boral Union Co-operative Bank",
"BOTM": "Bank of Tokyo Mitsubishi",
"BOTM": "MUFG Bank",
"BOTX": "Shree Botad Mercantile Co-operative Bank",
"BPCX": "Bhadgaon People's Co-operative Bank",
"BPSX": "Bilagi Pattana Sahakari Bank Niyamit",
Expand Down
39 changes: 24 additions & 15 deletions src/banks.json
Original file line number Diff line number Diff line change
Expand Up @@ -455,8 +455,7 @@
"apbs": true,
"ach_credit": true,
"ach_debit": true,
"nach_debit": true,
"upi": true
"nach_debit": true
},
"ALLX": {
"code": "ALLX",
Expand Down Expand Up @@ -600,8 +599,7 @@
"apbs": true,
"ach_credit": true,
"ach_debit": true,
"nach_debit": true,
"upi": true
"nach_debit": true
},
"ANDX": {
"code": "ANDX",
Expand Down Expand Up @@ -3761,7 +3759,8 @@
"apbs": true,
"ach_credit": true,
"ach_debit": true,
"nach_debit": false
"nach_debit": false,
"upi": true
},
"GGCX": {
"code": "GGCX",
Expand Down Expand Up @@ -5364,7 +5363,8 @@
"apbs": true,
"ach_credit": true,
"ach_debit": true,
"nach_debit": false
"nach_debit": false,
"upi": true
},
"JPCX": {
"code": "JPCX",
Expand Down Expand Up @@ -6216,7 +6216,8 @@
"apbs": true,
"ach_credit": true,
"ach_debit": true,
"nach_debit": false
"nach_debit": false,
"upi": true
},
"KNBX": {
"code": "KNBX",
Expand Down Expand Up @@ -6859,7 +6860,8 @@
"apbs": true,
"ach_credit": true,
"ach_debit": true,
"nach_debit": false
"nach_debit": false,
"upi": true
},
"LUCX": {
"code": "LUCX",
Expand Down Expand Up @@ -9747,7 +9749,8 @@
"apbs": false,
"ach_credit": false,
"ach_debit": false,
"nach_debit": true
"nach_debit": true,
"imps": false
},
"RCBX": {
"code": "RCBX",
Expand Down Expand Up @@ -9879,7 +9882,8 @@
"apbs": true,
"ach_credit": true,
"ach_debit": true,
"nach_debit": false
"nach_debit": false,
"upi": true
},
"RHMX": {
"code": "RHMX",
Expand Down Expand Up @@ -10225,7 +10229,8 @@
"apbs": true,
"ach_credit": true,
"ach_debit": true,
"nach_debit": false
"nach_debit": false,
"upi": true
},
"SAIX": {
"code": "SAIX",
Expand Down Expand Up @@ -10347,7 +10352,8 @@
"apbs": false,
"ach_credit": true,
"ach_debit": true,
"nach_debit": false
"nach_debit": false,
"upi": true
},
"SAWX": {
"code": "SAWX",
Expand Down Expand Up @@ -12335,7 +12341,8 @@
"apbs": true,
"ach_credit": true,
"ach_debit": true,
"nach_debit": false
"nach_debit": false,
"upi": true
},
"TEHX": {
"code": "TEHX",
Expand Down Expand Up @@ -13690,7 +13697,8 @@
"apbs": true,
"ach_credit": true,
"ach_debit": true,
"nach_debit": false
"nach_debit": false,
"upi": true
},
"UTKX": {
"code": "UTKX",
Expand Down Expand Up @@ -13757,7 +13765,8 @@
"apbs": true,
"ach_credit": true,
"ach_debit": true,
"nach_debit": false
"nach_debit": false,
"upi": true
},
"VARA": {
"code": "VARA",
Expand Down
8 changes: 8 additions & 0 deletions src/patches/banks/rbi-no-imps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
action: patch
patch:
:imps: false
banks:
- RBIS
- RBIN
- RBIP
Loading

0 comments on commit aaa1b03

Please sign in to comment.