npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

seanyu-bankcard

v2.0.7

Published

'query bankcard infomation by bankcard NO.'

Downloads

13

Readme

通过银行卡号查询银行类型和银行卡类型

Build Status via Travis CI Coverage Status NPM version

建议升级使用1.0.0+的版本,该版本不向下兼容,即不再支持getBankInfoByCardNoAsync,getBankInfoByCardNo这两个API,旧版本用户请升级并使用 getBankBin API替换

2.0.0版本开始支持promise写法

npm install bankcardinfo

成功获取卡bin信息时,返回值为json对象

{
	bankName:"中国工商银行",
	bankCode:"ICBC",
	cardType:"DC",
	cardTypeName:"储蓄卡"
}

API

getBankBin

传入卡号,异步返回。当第一个参数为空时,表示获取卡bin信息成功(标准API)

var BIN = require('bankcardinfo');
//callback 方式调用
BIN.getBankBin('6227003320240034988',function(err,data){
	if(!err){
		//todo 
		{
			bankName:"中国工商银行",
			bankCode:"ICBC",
			cardType:"DC",
			cardTypeName:"储蓄卡"
		}
	}
})
// promise 方式调用, 2.0.0 及以上版本支持
BIN.getBankBin('6227003320240034988')
	.then(function (data) {

	})
	.catch(function (err) {

	})

0.3.3版本以下API(存在并发请求的Bug,建议升级到1.0.0+)

getBankInfoByCardNoAsync

传入卡号,异步返回。只返回一个参数,当非空时,表示获取卡bin信息成功(非标准API)

var BIN = require('bankcardinfo');
BIN.getBankInfoByCardNoAsync('6227003320240034988',function(data){
	if(data){
		//todo 
		//data 
	}
})

getBankInfoByCardNo

传入卡号,同步返回。当返回值非空时,表示获取卡bin信息成功

var BIN = require('bankcardinfo');
var binData = BIN.getBankInfoByCardNo('6227003320240034988');
if(binData){
	//todo
}

小结

  1. 优先使用系统自带的获取卡bin信息(2013年国内银行卡集)
  2. 当系统自带的规则获取不到卡bin时,会调用支付宝的接口来获取,测试地址
  3. 支持AMD & CMD
  4. 可在browser端使用,直接引入index.js文件,建议在服务端使用。

未来

由于模块自带的卡bin获取规则是2013年全国银行的卡集合,所以卡规则需要不断完善。可在模块中收集用户新卡规则,但是会涉及用户隐私及安全问题,及时收集,也只会收集部分够认证的卡位即可。