razorpay / ifsc
Razorpay IFSC 码库
Requires
- php: ^7.1|^8.0
- php-http/client-implementation: ^1.0
- php-http/discovery: ^1.14
- php-http/message-factory: ^1.0
- psr/http-message: ^1.0
Requires (Dev)
- guzzlehttp/psr7: ^2.0
- php-http/message: ^1.11
- php-http/mock-client: ^1.4
- phpunit/phpunit: ^9.0
- symfony/yaml: ^5.0
- dev-master
- v2.0.34
- v2.0.33
- v2.0.32
- v2.0.31
- v2.0.30
- v2.0.29
- v2.0.28
- v2.0.27
- v2.0.26
- v2.0.25
- v2.0.24
- v2.0.23
- v2.0.22
- v2.0.21
- v2.0.20
- v2.0.19
- v2.0.18
- v2.0.17
- v2.0.16
- v2.0.14
- v2.0.13
- v2.0.12
- v2.0.11
- v2.0.10
- v2.0.9
- v2.0.8
- v2.0.7
- v2.0.6
- v2.0.5
- v2.0.4
- v2.0.3
- v2.0.2
- v2.0.1
- v2.0.0
- v2.0.0-beta
- v2.0.0-alpha2
- v2.0.0-alpha
- 1.6.1
- 1.6.0
- 1.5.13
- 1.5.12
- 1.5.11
- 1.5.10
- 1.5.9
- 1.5.8
- 1.5.7
- 1.5.6
- 1.5.5
- 1.5.4
- 1.5.3
- 1.5.2
- 1.5.1
- 1.5.0
- 1.4.10
- 1.4.9
- 1.4.8
- 1.4.7
- 1.4.6
- 1.4.5
- 1.4.4
- 1.4.3
- 1.4.2
- 1.4.1
- 1.4.0
- 1.3.4
- 1.3.3
- 1.3.2
- 1.3.1
- 1.3.0
- 1.2.3
- 1.2.2
- 1.2.1
- 1.2.0
- 1.1.8
- 1.1.7
- 1.1.6
- 1.1.5
- 1.1.4
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.15
- 1.0.14
- 1.0.13
- 1.0.12
- 1.0.11
- 1.0.10
- 1.0.9
- 1.0.8
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- 0.2.12
- 0.2.11
- 0.2.10
- 0.2.9
- 0.2.8
- 0.2.7
- 0.2.6
- 0.2.5
- 0.2.4
- 0.2.3
- 0.2.2
- 0.2.1
- 0.2.0
- 0.1.8
- 0.1.7
- 0.1.6
- 0.1.5
- 0.1.4
- 0.1.3
- 0.1.2
- 0.1.1
- 0.1.0
- dev-release/2.0.34
- dev-Release/2.0.33
- dev-Release/2.0.32
- dev-IFSC-XNSE-manually-adding
- dev-release/2.0.31
- dev-release/2.0.30
- dev-release/2.0.29
- dev-test_1
- dev-release/2.0.28
- dev-release/2.0.27
- dev-release/2.0.26
- dev-release/2.0.25
- dev-release/2.0.24
- dev-release/2.0.23
- dev-release/2.0.22
- dev-release/2.0.21
- dev-security_akto_integration_1699636023
- dev-release/2.0.20
- dev-release/2.0.19
- dev-release/2.0.18
- dev-release/2.0.17
- dev-dependabot/bundler/scraper/nokogiri-1.15.4
- dev-release/2.0.16
- dev-release/2.0.15
- dev-documentation
- dev-release/2.0.14
- dev-release/2.0.13
- dev-dependabot/go_modules/github.com/stretchr/testify-1.8.4
- dev-dependabot/composer/psr/http-message-tw-1.0or-tw-2.0
- dev-release/2.0.12
- dev-fixing_script_failure
- dev-dummy_20feb
- dev-changes-in-pull_request_template
- dev-dependabot/bundler/scraper/httparty-0.21.0
- dev-district_cleaner
- dev-shivamrazorpay-patch-1
- dev-release/2.0.11
- dev-update_readme
- dev-refactor_ifsc
- dev-sublet-improvements
- dev-release/2.0.10
- dev-bank_name_const
- dev-test-onboarding
- dev-semgrep
- dev-sonarCoverage
- dev-release/2.0.2
- dev-release/2.0.1
- dev-release/1.6.1
- dev-zeroes-in-ifsc
- dev-add-new-ifscs
- dev-adding_ausf
- dev-release/1.5.8
- dev-updates
- dev-release/1.5.2
- dev-release/1.5.1
- dev-elixir-tests
- dev-nbin-possible-changes
- dev-fix-datatype-string
- dev-regex
This package is auto-updated.
Last update: 2024-09-23 12:37:01 UTC
README
这是 Razorpay 发布的 IFSC 工具集的一部分。您可以在 ifsc.razorpay.com 上找到有关整个发布的更多详细信息。
数据集
如果您只想查找数据集,请转到 发布 部分,并下载最新版本。
GitHub 上的最新 scraper
工作流程应会发布一个 release-artifact
。
源代码
以下列出了各种官方来源,其中目前使用的是带有†标记的
- 来自 RBI 网站† 的 NEFT IFSC 列表
- 来自 RBI 网站† 的 RTGS IFSC 列表
- RBI 维护了几个列表
- 印度的银行列表
- 印度银行的网站.
- ECS/NEFT/RTGS/移动银行按银行划分的量
- 获准提供移动银行的银行列表
- NPCI 网站有多个列表
SWIFT
支持少数银行的 SWIFT/BIC 码。
SBI
- https://sbi.co.in/web/nri/quick-links/swift-codes†
- https://sbi.co.in/documents/16012/263663/sbinri_merged_bran_swfcodet.xlsx†
- 上面的分支代码与 SBI 分支定位器 进行核对以获取 IFSC。
PNB
- https://pnbindia.com/downloadprocess.aspx?fid=Zb7ImdUNlz9Ge73qn1nXQg==†
- https://www.pnbindia.in/document/PNB-helpdesk/bic_code.pdf†
HDFC
安装
Ruby
将此行添加到您的应用程序的 Gemfile 中
gem "ifsc"
然后执行
$ bundle
或者自行安装
$ gem install ifsc
在您的 Ruby 程序内部
require "ifsc"
...以将其作为依赖项拉入。
PHP
composer require php-http/curl-client razorpay/ifsc
PHP 包依赖于虚拟包 php-http/client-implementation
,这要求您安装一个适配器,但我们不关心您安装哪个。这是您应用程序中的一个实现细节。如果您不想使用 php-http/curl-client
,也可以不使用它。您可以使用 php-http/guzzle6-adapter
。有关虚拟包的更多信息,为什么这是一个好主意以及它带来的灵活性,请参阅 HTTPlug 文档。您可以在 Packagist 上找到支持的提供者列表。
支持的最低PHP版本是7.3。PHP版本可以安装PHP>=7.1。
Node.js
$ npm install ifsc
Go
此包与模块模式的现代Go版本兼容,已安装Go
go get github.com/razorpay/ifsc/v2
将解析并将包及其依赖项添加到当前开发模块
或者,如果您在包中使用import,也可以达到相同的效果
import "github.com/razorpay/ifsc/v2/src/go"
然后不带参数运行go get。
最后,要使用此仓库的顶级版本,请使用以下命令
go get github.com/razorpay/ifsc/v2@master
支持矩阵
仅考虑每个SDK的最新版本。
API文档
该仓库目前托管了5个模块的源代码:PHP/Node.js/Ruby/Go。以下是对API的文档
PHP
<?php use Razorpay\IFSC\Bank; use Razorpay\IFSC\IFSC; use Razorpay\IFSC\Client; IFSC::validate('KKBK0000261'); // Returns true IFSC::validate('BOTM0XEEMRA'); // Returns false IFSC::validateBankCode('PUNB'); // Returns true IFSC::validateBankCode('ABCD'); // Returns false IFSC::getBankName('PUNB'); // Returns 'Punjab National Bank' IFSC::getBankName('ABCD'); // Returns null IFSC::getBankName(Bank::PUNB); //Returns Punjab National Bank Bank::getDetails(Bank::PUNB); Bank::getDetails('PUNB'); // Returns an array: // [ // 'code' => 'PUNB', // 'type' => 'PSB', // 'ifsc' => 'PUNB0244200', // 'micr' => '110024001', // 'iin' => '508568', // 'apbs' => true, // 'ach_credit' => true, // 'ach_debit' => true, // 'nach_debit' => true, // 'name' => 'Punjab National Bank', // 'bank_code' => '024', // 'upi' => true // ] $client = new Client(); $res = $client->lookupIFSC('KKBK0000261'); echo $res->bank; // 'KOTAK MAHINDRA BANK LIMITED' echo $res->branch; // 'GURGAON' echo $res->address; // 'KOTAK MAHINDRA BANK LTD. UNIT NO. 8&9, SEWA CORPORATE PARK, MG ROAD, REVENUE STATE OF SARHAUL TEHSIL, DISTT,- GURGAON- 122001' echo $res->contact; // '4131000' echo $res->city; // 'GURGAON' echo $res->district; // 'GURGAON' echo $res->state; // 'HARYANA' echo $res->centre; // 'GURGAON' echo $res->getBankCode(); // KKBK echo $res->getBankName(); // 'Kotak Mahindra Bank' echo $res->micr; // '110485003' // Boolean fields: $res->upi, $res->rtgs, $res->neft, res->imps // You will get a SWIFT code where possible: echo $client->lookupIFSC('https://ifsc.razorpay.com/HDFC0CAGSBK')->swift; // 'HDFCINBB' // lookupIFSC may throw `Razorpay\IFSC\Exception\ServerError` // in case of server not responding in time // or Razorpay\IFSC\Exception\InvalidCode in case // the IFSC code is invalid
Node.js
var ifsc = require('ifsc'); ifsc.validate('KKBK0000261'); // returns true ifsc.validate('BOTM0XEEMRA'); // returns false ifsc.fetchDetails('KKBK0000261').then(function(res) { console.log(res); // { // MICR: '560226263', // BRANCH: 'THE AGS EMPLOYEES COOP BANK LTD', // ADDRESS: 'SANGMESH BIRADAR BANGALORE', // STATE: 'KARNATAKA', // CONTACT: '+91802265658', // UPI: true, // RTGS: true, // CITY: 'BANGALORE', // CENTRE: 'BANGALORE URBAN', // DISTRICT: 'BANGALORE URBAN', // NEFT: true, // IMPS: true, // SWIFT: 'HDFCINBB', // BANK: 'HDFC Bank', // BANKCODE: 'HDFC', // IFSC: 'HDFC0CAGSBK' // } }); console.log(ifsc.bank.PUNB); // prints PUNB // Prints the entire JSON from https://ifsc.razorpay.com/KKBK0000261 // res is an object, not string
Ruby
确保您的代码中包含require 'ifsc'
。离线验证代码。(记得保持gem最新!)
# valid? Razorpay::IFSC::IFSC.valid? 'KKBK0000261' # => true Razorpay::IFSC::IFSC.valid? 'BOTM0XEEMRA' # => false # validate! Razorpay::IFSC::IFSC.validate! 'KKBK0000261' # => true Razorpay::IFSC::IFSC.validate! 'BOTM0XEEMRA' # => Razorpay::IFSC::InvalidCodeError # bank_name_for(code) gets you the bank name offline Razorpay::IFSC::IFSC.bank_name_for 'PUNB0026200' -> "Punjab National Bank" Razorpay::IFSC::IFSC.bank_name_for 'KSCB0006001' -> "Tumkur District Central Bank" # get_details gets you the bank details from `banks.json` Razorpay::IFSC::Bank.get_details 'PUNB' { code: 'PUNB', type: 'PSB', ifsc: 'PUNB0244200', micr: '110024001', bank_code: '024', iin: '508568', apbs: true, ach_credit: true, ach_debit: true, nach_debit: true } # constants Razorpay::IFSC::Bank::PUNB 'PUNB'
在线验证并从服务器检索详细信息
如果在调用code.get
之前调用code.valid?
,则验证将离线执行。
# 1. using find code = Razorpay::IFSC::IFSC.find 'KKBK0000261' # 2. using new(...).get code = Razorpay::IFSC::IFSC.new 'KKBK0000261' code.get # result code.valid? # => true code.bank # => "Kotak Mahindra Bank" code.branch # => "GURGAON" code.address # => "KOTAK MAHINDRA BANK LTD. UNIT NO. 8&9, SEWA CORPORATE PARK, MG ROAD, REVENUE STATE OF SARHAUL TEHSIL, DISTT,- GURGAON- 122001" code.contact # => "4131000" code.city # => "GURGAON" code.district # => "GURGAON" code.state # => "HARYANA" code.centre # => GURGAON code.neft # => true code.upi # => true code.imps # => true code.rtgs # => true code.swift # => ""
子租赁分支
您可以使用code.bank_name
方法获取考虑子租赁分支的银行名称。
code = Razorpay::IFSC::IFSC.find 'HDFC0CKUB01' code.bank_name "Khamgaon Urban Co-operative Bank"
此操作离线进行,不需要网络调用。此信息存储在2个文件中
src/sublet.json
- 从NPCI网站自动生成src/custom-sublets.json
- 手动维护。覆盖范围不是100%。欢迎PR。
子租赁(或子会员)分支是大银行的IFSC代码,但租赁给小银行。在某些情况下,整个范围都租给特定银行。例如,所有以YESB0TSS
开头的IFSC都属于Satara Shakari Bank
。这些在custom-sublets.json
中手动维护。
错误处理
# all these `Razorpay::IFSC::InvalidCodeError` for an invalid code Razorpay::IFSC::IFSC.validate! '...' Razorpay::IFSC::IFSC.find '...' code = Razorpay::IFSC::IFSC.new '...'; code.get # these raise `Razorpay::IFSC::ServerError` if there is an error # communicating with the server Razorpay::IFSC::IFSC.find '...' code = Razorpay::IFSC::IFSC.new '...'; code.get
Go
package main import ( ifsc "github.com/razorpay/ifsc/v2/src/go" ) // todo: change funcs not required to lower case. func main() { ifsc.Validate("KKBK0000261") // Returns true ifsc.Validate("BOTM0XEEMRA") // Returns false ifsc.ValidateBankCode("PUNB") // Returns true ifsc.ValidateBankCode("ABCD") // Returns false ifsc.GetBankName("PUNB") // Returns "Punjab National Bank", nil ifsc.GetBankName("ABCD") // Returns "", errors.New(invalid bank code) ifsc.GetBankName(ifsc.HDFC) // Returns "HDFC Bank", nil ifsc.GetBankDetails("PUNB") // or ifsc.GetBankDetails(ifsc.PUNB) /* Returns (*ifsc.Bank){ Name : "Punjab National Bank", BankCode : "024", Code : "PUNB", Type : "PSB", IFSC : "PUNB0244200", MICR : "110024001", IIN : "508568", APBS : true, AchCredit : true, AchDebit : true, NachDebit : true, Upi : true }), nil */ ifsc.LookUP("KKBK0000261") /* Returns (*ifsc.IFSCResponse)({ Bank : "Kotak Mahindra Bank", Branch : "GURGAON", Address : "KOTAK MAHINDRA BANK LTD. UNIT NO. 8&9, SEWA CORPORATE PARK, MG ROAD, REVENUE STATE OF SARHAUL TEHSIL, DISTT,- GURGAON- 122001", Contact : "4131000", City : "GURGAON", District : "GURGAON", State : "HARYANA", IFSC : "KKBK0000261", BankCode : "KKBK" }), nil */ }
代码说明
这两个包都附带一个300kb的JSON文件,其中包含整个IFSC代码列表,以压缩但可读的格式。
银行代码和名称列表是手动维护的,但通过测试验证,以确保与最新的RBI出版物准确无误。这使得我们可以在不担心它们在新构建中被删除的情况下,将旧银行代码添加到名称列表中。
API开发
IFSC API维护在https://github.com/razorpay/ifsc-api的单独仓库中。
许可证
该仓库中的代码受MIT许可证的许可。许可证文本可在LICENSE
文件中找到。数据集本身属于公共领域。