Skip to content

Commit

Permalink
Merge pull request #206 from razorpay/release/1.5.9
Browse files Browse the repository at this point in the history
[release] 1.5.9
  • Loading branch information
ambar93 authored Dec 25, 2020
2 parents dcd7e2d + 1679383 commit 667ae41
Show file tree
Hide file tree
Showing 14 changed files with 2,384 additions and 23 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ scraper/scripts/data/
scraper/scripts/ifsc-api/
scraper/scripts/release.md
scraper/vendor
scraper/banks
src/IFSC-list.json

# Node.js
Expand Down
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [UNRELEASED][unreleased]

## [1.5.9][1.5.9]
### Added
- Initial support for SWIFT mappings. Only SBI and PNB branches are currently supported, and accuracy is not guaranteed. Feedback is welcome.

### Changed
- Metadata changes

## [1.5.8][1.5.8]
### Changed
- Only metadata changes in this release
Expand All @@ -24,7 +31,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [1.5.6][1.5.6]
### Changed

- Metadata updates

## 1.5.5
Expand Down
22 changes: 19 additions & 3 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.8.svg)](https://microbadger.com/images/razorpay/ifsc:1.5.8) [![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.5.9.svg)](https://microbadger.com/images/razorpay/ifsc:1.5.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)

[![](https://images.microbadger.com/badges/version/razorpay/ifsc:1.5.8.svg)](https://microbadger.com/images/razorpay/ifsc:1.5.8) [![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.5.9.svg)](https://microbadger.com/images/razorpay/ifsc:1.5.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)

## Dataset

Expand All @@ -25,6 +25,22 @@ The source for the dataset are the following files:
- List of RTGS IFSCs from [RBI website][rtgs]
- List of ACH Live Banks from [NPCI website][ach] used for IFSC sublet branches

#### SWIFT

SWIFT/BIC codes are supported for a few banks.

##### SBI
- https://sbi.co.in/web/nri/quick-links/swift-codes
- https://sbi.co.in/documents/16012/263663/sbinri_merged_bran_swfcodet.xlsx
- Branch codes from above are checked against the [SBI Branch Locator](https://www.sbi.co.in/web/home/locator/branch) to get the IFSC.

##### PNB
- https://pnbindia.com/downloadprocess.aspx?fid=Zb7ImdUNlz9Ge73qn1nXQg==
- https://www.pnbindia.in/document/PNB-helpdesk/bic_code.pdf

##### HDFC
- https://www.hdfcbank.com/nri-banking/correspondent-banks

## Installation

## Ruby
Expand Down Expand Up @@ -342,4 +358,4 @@ is under public domain.
[releases]: https://github.com/razorpay/ifsc/releases
[buildlist]: https://app.wercker.com/razorpay/ifsc/runs?view=runs&q=pipeline%3Abuild
[rtgs]: https://rbidocs.rbi.org.in/rdocs/RTGS/DOCs/RTGEB0815.xlsx
[ach]: https://www.npci.org.in/national-automated-clearing-live-members-1
[ach]: https://www.npci.org.in/what-we-do/nach/live-members/live-banks
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.8'
s.date = '2020-09-23'
s.version = '1.5.9'
s.date = '2020-12-25'
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.8",
version: "1.5.9",
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.8",
"version": "1.5.9",
"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
2 changes: 2 additions & 0 deletions scraper/scripts/generate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

upi_banks = parse_upi

validate_sbi_swift

banks = parse_nach
log "[NPCI] Parsed the NACH sheet, got #{banks.keys.size} banks"

Expand Down
57 changes: 54 additions & 3 deletions scraper/scripts/methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
require 'json'
require 'set'
require 'fileutils'
require 'nokogiri'
require 'open-uri'
require './methods_nach'

HEADINGS_INSERT = %w[
Expand Down Expand Up @@ -137,7 +139,7 @@ def parse_rtgs(banks)

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']
keys = ['BANK','IFSC','BRANCH','CENTRE','DISTRICT','STATE','ADDRESS','CONTACT','IMPS','RTGS','CITY','NEFT','MICR','UPI', 'SWIFT']
csv << keys
data.each do |code, ifsc_data|
sorted_data = []
Expand Down Expand Up @@ -214,6 +216,9 @@ def merge_dataset(neft, rtgs, imps)
combined_data['IMPS'] ||= true
combined_data['UPI'] ||= false
combined_data['MICR'] ||= nil
combined_data['SWIFT'] = nil
combined_data.delete('DATE')

h[ifsc] = combined_data
end
h
Expand All @@ -240,16 +245,34 @@ def apply_patches(dataset)
log "Applying #{patch}", :debug
data = YAML.safe_load(File.read(patch))

codes = data['ifsc']

case data['action'].downcase
when 'patch'
codes = data['ifsc']
patch = data['patch']
codes.each do |code|
log "Patching #{code}"
dataset[code].merge!(patch) if dataset.has_key? code
end
when 'patch_multiple'
codes = data['ifsc']
codes.each_entry do |code, patch|
log "Patching #{code}"
dataset[code].merge!(patch) if dataset.has_key? code
end
when 'patch_bank'
patch = data['patch']
all_ifsc = dataset.keys
banks = data['banks']
banks.each do |bankcode|
log "Patching #{bankcode}"
codes = all_ifsc.select {|code| code[0..3] == bankcode}
codes.each do |code|
dataset[code].merge!(patch)
end
end

when 'delete'
codes = data['ifsc']
codes.each do |code|
dataset.delete code
log "Removed #{code} from the list", :info
Expand Down Expand Up @@ -297,3 +320,31 @@ def log(msg, status = :info)
end
puts msg
end

# Downloads the SWIFT data from
# https://sbi.co.in/web/nri/quick-links/swift-codes
def validate_sbi_swift
doc = Nokogiri::HTML(open("https://sbi.co.in/web/nri/quick-links/swift-codes"))
table = doc.css('tbody')[0]
website_bics = Set.new

for row in table.css('tr')
website_bics.add row.css('td')[2].text.gsub(/[[:space:]]/, '')
end

# Validate that all of these are covered in our swift patch
patch_bics = YAML.safe_load(File.read('../../src/patches/ifsc/sbi-swift.yml'))['ifsc']
.values
.map {|x| x['SWIFT']}
.to_set

missing = (website_bics - patch_bics)
if missing.size != 0
log "[SBI] Missing SWIFT/BICs for SBI. Please match https://sbi.co.in/web/nri/quick-links/swift-codes to src/patches/ifsc/sbi-swift.yml", :critical
log "[SBI] You can use https://www.sbi.co.in/web/home/locator/branch to find IFSC from BRANCH code or guess it as SBIN00+BRANCH_CODE", :info
log "[SBI] Count of Missing BICS: #{missing.size}", :debug
log "[SBI] Missing BICS follow", :debug
log missing.to_a.join(", "), :debug
exit 1
end
end
2 changes: 1 addition & 1 deletion src/IFSC.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/patches/banks/imps-disabled-banks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Deletion of IFSC from IMPS Ecosystem
action: patch
patch:
:imps: true
:imps: false
banks:
- SBBJ
- SBHY
Expand Down
8 changes: 8 additions & 0 deletions src/patches/ifsc/hdfc-swift.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
# Source: https://www.hdfcbank.com/nri-banking/correspondent-banks
# There is no separate SWIFT code for HDFC individual branches. The above mentioned HDFC Bank Swift code can be used for remitting funds to HDFC bank anywhere in India
action: patch_bank
patch:
SWIFT: 'HDFCINBB'
banks:
- HDFC
26 changes: 16 additions & 10 deletions src/patches/ifsc/invalid-pnb.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
---
# The branch is reported differently in the NEFT and RTGS datasets
# The PNB website marks it as belonging to Himachal Pradesh, but the RTGS dataset says its in Karnataka
action: patch
patch:
BRANCH: JAISINGH PUR
CENTRE: JAISINGH PUR
DISTRICT: JAISINGH PUR
STATE: HIMACHAL PRADESH
MICR: "176024265"
ADDRESS: "VPO JAISINGH PUR DISTT. KANGRA (HP)"
action: patch_multiple
ifsc:
- PUNB0641100
# The PNB website marks it as belonging to Himachal Pradesh, but the RTGS dataset says its in Karnataka
PUNB0641100:
BRANCH: JAISINGH PUR
CENTRE: JAISINGH PUR
DISTRICT: JAISINGH PUR
STATE: HIMACHAL PRADESH
MICR: "176024265"
ADDRESS: "VPO JAISINGH PUR DISTT. KANGRA (HP)"
# The PNB website marks it as belonging to Panchkula, but the RTGS dataset says its in Pulwama.
PUNB0755600:
BRANCH: SECTOR 19 PANCHKULA
ADDRESS: S.C.O. 70 SECTOR 19
DISTRICT: PANCHKULA
STATE: HARYANA
MICR: "160024081"
Loading

0 comments on commit 667ae41

Please sign in to comment.