Skip to content

Commit

Permalink
Merge pull request #106 from razorpay/release/1.3.4
Browse files Browse the repository at this point in the history
Release/1.3.4
  • Loading branch information
captn3m0 committed Mar 18, 2019
2 parents 13ac38b + 4c3ef6c commit 9cc506e
Show file tree
Hide file tree
Showing 18 changed files with 207 additions and 132 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Expand Up @@ -13,6 +13,6 @@ insert_final_newline = true
indent_style = space
indent_size = 4

[**.js]
[**.js, *.json]
indent_style = space
indent_size = 2
4 changes: 2 additions & 2 deletions LICENSE.txt → LICENSE
@@ -1,8 +1,8 @@
The MIT License (MIT)
Copyright (c) 2016 Razorpay
Copyright (c) 2019 Razorpay

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12 changes: 6 additions & 6 deletions README.md
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.3.3.svg)](https://microbadger.com/images/razorpay/ifsc:1.3.3) [![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.3.4.svg)](https://microbadger.com/images/razorpay/ifsc:1.3.4) [![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.3.3.svg)](https://microbadger.com/images/razorpay/ifsc:1.3.3) [![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.3.4.svg)](https://microbadger.com/images/razorpay/ifsc:1.3.4) [![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 Expand Up @@ -53,7 +53,7 @@ require "ifsc"

The PHP package has a dependency on the virtual package `php-http/client-implementation` which requires you to install an adapter, but we do not care which one. That is an implementation detail in your application. You do not have to use the `php-http/curl-client` if you do not want to. You may use the `php-http/guzzle6-adapter`. Read more about the virtual packages, why this is a good idea and about the flexibility it brings at the [HTTPlug docs](http://docs.php-http.org/en/latest/httplug/users.html). You can find a list of suported providers on [packagist](https://packagist.org/providers/php-http/client-implementation).

The minimum PHP version supported is 7.0
The minimum [PHP version supported is 7.1](https://secure.php.net/supported-versions.php).

## Node.js

Expand Down Expand Up @@ -112,7 +112,7 @@ ifsc.validate('KKBK0000261'); // returns true
ifsc.validate('BOTM0XEEMRA'); // returns false

ifsc.fetchDetails('KKBK0000261').then(function(res) {
console.log(res);
console.log(res);
});
// Prints the entire JSON from https://ifsc.razorpay.com/KKBK0000261
// res is an object, not string
Expand Down Expand Up @@ -263,8 +263,8 @@ The IFSC API is maintained in a separate repository at <https://github.com/razor
## License

The code in this repository is licensed under the MIT License. License
text is available in the `LICENSE.txt` file. The dataset itself
should be under public domain.
text is available in the `LICENSE` file. The dataset itself
is under public domain.

[rbi]: https://goo.gl/T9188H "goo.gl link because RBI doesn't allow you to link to their website"
[combined]: https://goo.gl/UryY8j "goo.gl link because RBI doesn't allow you to link to their website"
Expand Down
8 changes: 4 additions & 4 deletions ifsc.gemspec
Expand Up @@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)

Gem::Specification.new do |s|
s.name = 'ifsc'
s.version = '1.3.3'
s.version = '1.3.4'
s.date = '2018-11-15'
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'
Expand All @@ -17,8 +17,8 @@ Gem::Specification.new do |s|
s.homepage = 'https://ifsc.razorpay.com'
s.license = 'MIT'

s.add_runtime_dependency 'httparty', '~> 0.15'
s.add_runtime_dependency 'httparty', '~> 0.16'

s.add_development_dependency 'rake', '~> 10.5'
s.add_development_dependency 'rspec', '~> 3.6'
s.add_development_dependency 'rake', '~> 12.3'
s.add_development_dependency 'rspec', '~> 3.8'
end
2 changes: 1 addition & 1 deletion mix.exs
Expand Up @@ -4,7 +4,7 @@ defmodule IFSC.Mixfile do
def project do
[
app: :ifsc,
version: "1.3.3",
version: "1.3.4",
elixir: "~> 1.5",
start_permanent: Mix.env == :prod,
description: description(),
Expand Down
8 changes: 3 additions & 5 deletions package.json
@@ -1,8 +1,7 @@
{
"name": "ifsc",
"version": "1.3.3",
"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.",
"version": "1.3.4",
"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": {
"test": "tests"
Expand All @@ -12,8 +11,7 @@
},
"devDependencies": {},
"scripts": {
"test":
"node tests/node/validator_test.js && node tests/node/client_test.js"
"test": "node tests/node/validator_test.js && node tests/node/client_test.js"
},
"repository": {
"type": "git",
Expand Down
12 changes: 6 additions & 6 deletions scraper/Gemfile.lock
@@ -1,15 +1,15 @@
GEM
remote: https://rubygems.org/
specs:
mini_portile2 (2.3.0)
nokogiri (1.8.4)
mini_portile2 (~> 2.3.0)
mini_portile2 (2.4.0)
nokogiri (1.10.1)
mini_portile2 (~> 2.4.0)
ruby-ole (1.2.12.1)
rubyXL (3.3.30)
rubyXL (3.4.1)
nokogiri (>= 1.4.4)
rubyzip (>= 1.1.6)
rubyzip (1.2.2)
spreadsheet (1.1.8)
spreadsheet (1.2.0)
ruby-ole (>= 1.0)

PLATFORMS
Expand All @@ -21,4 +21,4 @@ DEPENDENCIES
spreadsheet

BUNDLED WITH
1.16.4
2.0.1
2 changes: 2 additions & 0 deletions scraper/scripts/bootstrap.sh
Expand Up @@ -34,6 +34,8 @@ else
cp --recursive --preserve=timestamps "$WERCKER_CACHE_DIR/sheets" .
fi

# This gives us sheets/RTGS-{0|1|2}.csv
ssconvert --export-file-per-sheet sheets/RTGS.xlsx sheets/RTGS-%n.csv

echo "Sheet Download complete, starting export"

Expand Down
59 changes: 33 additions & 26 deletions scraper/scripts/methods.rb
Expand Up @@ -91,34 +91,41 @@ def parse_sheets
def parse_rtgs
data = []

log "Parsing #RTGS.xlsx"
sheet = RubyXL::Parser.parse("sheets/RTGS.xlsx").worksheets[1]
headings = sheet.sheet_data[0]
headings = (0..9).map {|e| headings[e].value}
row_index = 0
sheet.each do |row|
row_index += 1
# sanitize row
row = (0..9).map { |e| row[e] ? row[e].value : nil}
next if row_index == 1
next if row.compact.empty?

data_to_insert = [HEADINGS_INSERT, map_data(row, headings)]
begin
x = data_to_insert.transpose.to_h
# IFSC values are in smaller case
x["IFSC"] = x["IFSC"].upcase.gsub(/[^0-9A-Za-z]/, '')
# RTGS Flag
x["RTGS"] = true
data.push x
rescue Exception => e
puts "Faced an Exception"
puts data_to_insert.to_json
puts e
exit

# The first sheet has bank codes
# the second and third are the ones we need
sheets = [1,2]
sheets.each do |sheet_id|
row_index = 0
headings = []
log "Parsing #RTGS-#{sheet_id}.csv"
headers = CSV.foreach("sheets/RTGS-#{sheet_id}.csv", encoding:'utf-8', return_headers: true) do |row|

headings = row if row_index == 0

row_index+=1

next if row_index == 1
next if row.compact.empty?

data_to_insert = [HEADINGS_INSERT, map_data(row, headings)]

begin
x = data_to_insert.transpose.to_h
# IFSC values are in smaller case
x["IFSC"] = x["IFSC"].upcase.gsub(/[^0-9A-Za-z]/, '')
# RTGS Flag
x["RTGS"] = true
data.push x
rescue Exception => e
puts "Faced an Exception"
puts data_to_insert.to_json
puts e
exit
end
puts row_index if row_index%1000 ==0
end
end
puts "[+] #{row_index} rows processed"
data
end

Expand Down
4 changes: 4 additions & 0 deletions scraper/scripts/parse_nach.rb
Expand Up @@ -13,6 +13,8 @@
# because they result in 1 bank
# having 2 different codes
IGNORED_SUBLETS = [
'RSBL0000001',
'APGV0000001',
# Typo? in this one (AKJB|AJKB)
'AKJB0000001',
# DLSC and DSCB are the same
Expand All @@ -33,6 +35,8 @@
'IPOS0000001',
# FSFB and FINF are the same
'FSFB0000001',
# Same as SHIX
'SMCB0000001',
]

doc.css('table')[0].css('tr').each do |row|
Expand Down
2 changes: 1 addition & 1 deletion src/IFSC.json

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions src/banknames.json
Expand Up @@ -612,6 +612,7 @@
"KOCX": "Konoklota Mahila Urban Co-operative Bank",
"KODX": "Kodungallur Town Co-operative Bank",
"KOEX": "KEB Hana Bank",
"KOLH": "Kolhapur Urban Co-operative Bank",
"KOSX": "Kota Nagrik Sahkari Bank Kota",
"KOTX": "Kodinar Taluka Co-operative Banking Union K",
"KOYX": "Koylanchal Urban Co-operative Bank",
Expand All @@ -623,6 +624,7 @@
"KRNX": "Karnavati Co-operative Bank",
"KRTH": "Krungthai Bank",
"KRTX": "Kranthi Co-operative Urban Bank",
"KSBK": "Kerala State Co-operative Bank",
"KSBX": "Krishna Sahakari Bank Rethare Bk",
"KSCB": "Karnataka State Co-operative Apex Bank",
"KSCX": "Kerala State Co-operative Bank",
Expand Down Expand Up @@ -747,6 +749,7 @@
"MSCI": "Maharashtra State Co-operative Bank",
"MSCX": "Manipur State Co-operative Bank",
"MSHQ": "Mashreq Bank",
"MSLM": "Muslim Co-operative Bank",
"MSNU": "Mehsana Urban Co-operative Bank",
"MSNX": "Mehsana District Central Co-operative Bank",
"MSOX": "Manorama Co-operative Bank Solapur",
Expand Down Expand Up @@ -805,6 +808,7 @@
"NILX": "Nilkanth Co-operative Bank",
"NIRX": "Nirmal Urban Co-operative Bank Nagpur",
"NIUX": "Nileshwar Co-operative Urban Bank",
"NJBK": "Nav Jeevan Co-operative Bank",
"NJCX": "Nav Jeevan Co-operative Bank",
"NJGX": "Narmada Jhabua Gramin Bank",
"NJMX": "Nashik Jillha Mahila Vikas Sahakari Bank",
Expand Down Expand Up @@ -862,6 +866,7 @@
"PBGX": "Puduvai Bharathiar Grama Bank",
"PCBL": "Patan Co-operativeeartive Bank",
"PCBX": "Parshwanath Co-operative Bank",
"PCCB": "Purulia Central Co-operative BANK",
"PCCX": "Panchkula Central Co-operative Bank",
"PCLX": "Pragathi Co-operative Bank, Bangalore",
"PCMX": "Panchsheel Mercantile Co-operative Bank",
Expand Down Expand Up @@ -991,6 +996,7 @@
"SAIX": "Sanmitra Sahakari Bank",
"SALX": "Salal Sarvodaya Nagarik Sahakari Bank",
"SAMX": "Samata Sahakari Bank",
"SANT": "Sant Sopankaka Sahakari Bank",
"SANX": "Saibaba Nagari Sahakari Bank",
"SAPX": "Shrimant Malojiraje Sahakari Bank",
"SARX": "Sardarganj Mercantile Co-operative Bank",
Expand Down Expand Up @@ -1029,6 +1035,7 @@
"SCUX": "Sudha Co-operative Urban Bank",
"SDBX": "Samata Co-operative Development Bank",
"SDCB": "Surat District Co-operative Bank",
"SDCE": "Satara District Central Co-operative Bank",
"SDCX": "Sindhudurg District Central Co-operative Bank",
"SDHX": "Solapur Siddheshwar Sahakari Bank",
"SDSX": "Satara District Central Co-operative Bank",
Expand Down

0 comments on commit 9cc506e

Please sign in to comment.