• Stars
    star
    562
  • Rank 79,281 (Top 2 %)
  • Language
    JavaScript
  • Created over 9 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

根据银行卡卡号查询银行类型和卡类型

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

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年全国银行的卡集合,所以卡规则需要不断完善。可在模块中收集用户新卡规则,但是会涉及用户隐私及安全问题,及时收集,也只会收集部分够认证的卡位即可。

More Repositories

1

idcard

校验身份证是否合法,获取身份证详细信息
JavaScript
224
star
2

phone-service

手机号查询运营商,查询归属地
JavaScript
72
star
3

wechat-develop

微信公众平台接入例子
48
star
4

weixin_js

JavaScript
41
star
5

redlock-node

a simple redis lock base on nodejs.
JavaScript
34
star
6

access-token-api

A simple api access token support count and ttl,which base on nodejs. It can protect your api,prevent CSRF attacks, api called count with ttl.
JavaScript
26
star
7

wechat-develop-code

微信开放平台接入Code Demo
JavaScript
25
star
8

yeepay

易宝支付 - 一键支付sdk
JavaScript
22
star
9

vue-2.0-vue-router-2.0-vuex-2.0-

vue(2.0)+vue-router(2.0)+vuex(2.0)+webpack demo
JavaScript
20
star
10

n-pay

支付聚合平台
JavaScript
15
star
11

red_package_rain

红包雨
JavaScript
8
star
12

random

a simple probability generator, support nodejs and browser .(按权重随机概率元素,支持服务端&浏览器)
JavaScript
8
star
13

avoid-multi-request-from-client-

JavaScript
7
star
14

npm

如何发布&管理npm包
5
star
15

linux-qq

linux qq and wechat client
5
star
16

oauth2-wechat-develop

以接入微信开放平台为例讲解oauth2原理
4
star
17

n-crypto

加密解密模块,MD5,RSA
JavaScript
4
star
18

web-frontend-interview

广州财略金融信息科技有限公司前端机试题
3
star
19

store-ttl

a simple key value store that support ttl, and you can custom setter,getter,remove function such as redis.
JavaScript
3
star
20

gulp-custom-css-urls

a plugin for gulp to custom you image url inline css file, and support output image file, then you can upload image file to Cloud CDN.
JavaScript
3
star
21

gulp-cdn-service

a gulp plugin for upload file to cdn server , currently only supports qiniu.
JavaScript
3
star
22

baofoo

宝付认证支付 SDK
JavaScript
2
star
23

sencha-mvc-demo

sencha-mvc-demo
JavaScript
2
star
24

wechat-develop-local-debug

微信开放平台接入本地调试
2
star
25

static-file-manage

node 项目中 进行静态文件管理
2
star
26

chrome-open-direct

google research link open direct (chrome搜索结果直接打开,避免经过google跳转)
JavaScript
2
star
27

minievent

事件触发
JavaScript
2
star
28

karma-demo

karma unit test demo
JavaScript
2
star
29

union_flow

联通流量专区充值接口
JavaScript
2
star
30

angular-wepack-gulp-demo

JavaScript
2
star
31

weixin-wrap

微信授权&api
JavaScript
2
star
32

protractor-scenario

protractor scenario test
JavaScript
2
star
33

cross-demo

JavaScript
2
star
34

karma-unit

karma unit test demo
JavaScript
2
star
35

pay-plugin

第三方支付插件(目前集成了连连支付,易宝支付,PP钱包)
JavaScript
2
star
36

imageloader

image preload and update loading status. 图片预加载,显示图片加载进度。
JavaScript
2
star
37

angular-slider

JavaScript
1
star
38

llpayauth

连连实名认证,连连支付网+,SDK,Nodejs,Auth,realName.
JavaScript
1
star
39

vim

1
star
40

SoftKeyboardPlugin

Java
1
star
41

aes-bcrypt

aes-bcrypt
JavaScript
1
star
42

link

1
star
43

code-snippet

JavaScript
1
star
44

hexo-github-page

CSS
1
star
45

navyxie.github.io

navy github home
HTML
1
star
46

liusha

流沙流量充值接口
JavaScript
1
star
47

webpack

JavaScript
1
star
48

note

1
star
49

yeepay-realname

JavaScript
1
star
50

Phaser-demo

1
star
51

paypalm-flashbean

pp钱包支付 闪豆支付
JavaScript
1
star
52

hapi-demo

JavaScript
1
star
53

shell

Shell
1
star
54

paypalm

pp钱包支付
JavaScript
1
star
55

phantomjs-demo

phantomjs demo
JavaScript
1
star
56

threejs-demo

JavaScript
1
star
57

global-node-moduel

how to write a global node moduel
JavaScript
1
star
58

front-end-lesson

考拉前端入门速成班
HTML
1
star
59

how-to-plugin-development

如何进行插件化开发?插件化开发可提高代码可读性,提高代码可维护性,降低代码低耦性,提高代码质量。
1
star
60

css-layout

HTML
1
star
61

plugin-dev

简易化的插件开发管理工具
JavaScript
1
star
62

async-lock

a simple node async lock that support ttl base memory database such as redis.(node异步锁)
JavaScript
1
star
63

travis-coveralls-demo

travis-ci and coveralls.io demo
1
star
64

design-pattern

javascript design pattern
JavaScript
1
star
65

react-native-note

react-native note
1
star
66

error

frontend error monitor,前端页面出错监控。
JavaScript
1
star
67

eggjs-example

JavaScript
1
star
68

angular-single-app

JavaScript
1
star
69

webpack-vue

webpack vue demo
JavaScript
1
star
70

njs

navy js
JavaScript
1
star
71

concurrent-waterfall

简单的并发流控制
JavaScript
1
star
72

react-demo

react demo js
JavaScript
1
star
73

es6_demo

es6
JavaScript
1
star
74

withdraw-plugin

提现插件
JavaScript
1
star
75

html-tpl

JavaScript
1
star
76

frontend-develop-deploy

前端的开发与部属
1
star