All Projects → ramoona → Banks Db

ramoona / Banks Db

Community driven database to get bank info (name, brand color etc.) by bankcard prefix (BIN)

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to Banks Db

gb banking
FiveM Extended Banking Script
Stars: ✭ 14 (-97.92%)
Mutual labels:  bank
Loan-calculator-bank-payment
Loan Calculator a small web application encoded in HTML, PHP, JS, and CSS. If you want to earn from BANK NICHE then you can use Loan Calculator script.
Stars: ✭ 32 (-95.24%)
Mutual labels:  bank
laravel-multi-payment
Laravel online gateway payment package with multi driver support
Stars: ✭ 22 (-96.73%)
Mutual labels:  bank
promptpay
Thai QR PromptPay Generator
Stars: ✭ 24 (-96.43%)
Mutual labels:  bank
iran-sheba
Validate and Recognize IBAN in Iran
Stars: ✭ 23 (-96.58%)
Mutual labels:  bank
bian
The Banking Industry Architecture Network e.V. (BIAN) model in Archimate 3
Stars: ✭ 48 (-92.86%)
Mutual labels:  bank
py-persian-tools
An anthology of a variety of tools for the Persian language in Python
Stars: ✭ 106 (-84.23%)
Mutual labels:  bank
bocfx
中国银行外汇牌价爬虫 / API (Bank of China - Foreign Exchange - Spider/ API)
Stars: ✭ 30 (-95.54%)
Mutual labels:  bank
discord-revolut
A Discord bot who monitor your Business Revolut account
Stars: ✭ 15 (-97.77%)
Mutual labels:  bank
BankApplication
🏦 Banking System Management
Stars: ✭ 84 (-87.5%)
Mutual labels:  bank
Subbranch-China
银行、支行名称。中国各地区各银行支行名称数据爬虫,数据来源微信商户平台,已经整理可直接导入的sql文件
Stars: ✭ 31 (-95.39%)
Mutual labels:  bank
ebics-java-client
Java open source EBICS client - Support for French, German and Swiss banks
Stars: ✭ 30 (-95.54%)
Mutual labels:  bank
open-psd2
An open source framework for using banking API's built for PSD2 regulation.
Stars: ✭ 20 (-97.02%)
Mutual labels:  bank
turkish banks
All Turkish Banks and Their Branches
Stars: ✭ 28 (-95.83%)
Mutual labels:  bank
up-bank-api
💎 Typed python client for Up's banking API
Stars: ✭ 20 (-97.02%)
Mutual labels:  bank
smart-cnab
A package for general manipulation of CNAB files, generation of remittances and parsing of returns using a normalized fields structure.
Stars: ✭ 11 (-98.36%)
Mutual labels:  bank
node-ebics-client
Node.js EBICS Client - compliant with ISO 20022
Stars: ✭ 46 (-93.15%)
Mutual labels:  bank
Finance
A self hosted app to help you get a better understanding of your personal finances.
Stars: ✭ 313 (-53.42%)
Mutual labels:  bank
persian-tools-rs
An anthology of a variety of tools for the Persian language in Rust
Stars: ✭ 17 (-97.47%)
Mutual labels:  bank
bunq2ifttt
bunq2IFTTT creates a self-hosted interface between the bunq banking API and IFTTT.
Stars: ✭ 20 (-97.02%)
Mutual labels:  bank

Banks DB

Build Status Latest Stable Version NPM Downloads

Returns bank's name and brand color by bankcard prefix (BIN).

It is useful on billing pages to use bank’s brand color when user starts to type card number.

banks-db usage example

It's a community driven database, so it can potentially contains mistakes. It's not a problem for UX enhancement, but you must not use Banks DB in your billing logic.

Demo

Try your card prefix in our demo. Note that only first 6 digits of card number are required.

Usage

PostCSS

With postcss-banks-db and postcss-contrast you can generate CSS for each bank:

.billing-form {
    transition: background .6s, color .6s;
    background: #eee;
}
@banks-db-template {
    .billing-form.is-%code% {
        background-color: %color%;
        color: contrast(%color%);
    }
}

And then switch bank’s style in JS:

import banksDB from 'banks-db';

const bank = banksDB(cardNumberField.value);
if ( bank.code ) {
  billingForm.className = 'billing-form is-' + (bank.code || 'other');
  bankName.innerText = bank.country === 'ru' ? bank.localTitle : bank.engTitle;
} else {
  billingForm.className = 'billing-form';
  bankName.innerText = '';
}

CSS-in-JS

import contrast from 'contrast';
import banksDB  from 'banks-db';

BillingForm  = ({ cardNumber }) => {
  const title, color;
  const bank = banksDB(this.props.cardNumber);
  if ( bank.code ) {
    title = bank.country === 'ru' ? bank.localTitle : bank.engTitle;
    color = bank.color;
  } else {
    title = '';
    color = '#eee';
  }
  return (
    <div style={{
      transition: 'background .6s, color .6s',
      background: color,
      color:      contrast(color) === 'light' ? 'black' : 'white'
    }}>
      <h2>{ title }</h2>
      
    </div>
  );
}

Other Best Practices

See also best practices for billing forms:

API

There are two options to use BanksDB depends of whether you need specific countries or not.

If you need banks for all countries

Library exports banksDB function. It accepts bankcard number and returns bank object.

var banksDB = require('banks-db');
var bank    = banksDB('5275 9400 0000 0000');
console.log(bank.code) //=> 'ru-citibank'
console.log(bank.type) //=> 'mastercard'

If database doesn't contain some bank prefix, bank object will have only type field.

var unknown = banksDB('4111 1111 1111 1111');
console.log(bank.code) //=> undefined
console.log(bank.type) //=> 'visa'

You can also get banks database by banksDB.data:

for ( let bank of banksDB.data ) {
    console.log(bank);
}

If you need only banks for specific countries

Instead of banks-db use banks-db/core:

var banksDBCore = require('banks-db/core');

Then require desired countries from banks-db/banks by two letters code:

var banksOfRussia = require('banks-db/banks/ru');
var banksOfChina = require('banks-db/banks/cn');

All that left is to call banksDBCore with your countries data to initialize. banksDBCore is a function that accepts one argument with banks data for countries that you've specified, and returns an instance of BanksDB object with findBank method and data property.

var BanksDB = banksDBCore([banksOfRussia, banksOfChina]);
// var BanksDB = banksDBCore(banksOfRussia); no need for an array if there's only one country

That's it! Ready to use:

var bank = BanksDB.findBank('5275 9400 0000 0000');
var data = BanksDB.data;

Bank Object

  • type: bankcard type. For example, 'visa' or 'mastercard'. Banks DB will return it even if bank is unknown.
  • code: unique code, contains country and name. For example, you can use it to generate CSS selectors for each bank.
  • color: bank's brand color in HEX-format.
  • localTitle: bank's title in local language.
  • engTitle: international bank's title.
  • name: short bank's name (not unique). For example, 'citibank'.
  • country: bank's operation country. For example, you can use it to display localTitle for local banks and engTitle for others.
  • url: bank's website URL.

Contributing

In case your bankcard doesn't work, please check if your bank already in Banks DB:

  • If your bank is already included, you can open an issue with your prefix (NOT full number of your card, just first 5 or 6 symbols) or send a pull request.
  • Otherwise you can add a new bank (see contributing guide).

Changelog

See CHANGELOG.md or release notes (with commits history).

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].