Giter VIP home page Giter VIP logo

iban.js's Introduction

npm version GitHub license

This library is not maintained anymore

iban.js

IBAN and BBAN validation, formatting and conversion in Javascript. Check the demo on demo page to try it.

IBAN.js follows the ISO 13616 IBAN Registry technical specification.

Usage

IBAN.js is compatible with both commonjs and AMD module definition. It can be used as a node.js module and in the browser. It also has a bower manifest, a Typescript definition and a Meteor wrapper.

In node.js

var IBAN = require('iban');
IBAN.isValid('hello world'); // false
IBAN.isValid('BE68539007547034'); // true

In the browser

Using a module loader (AMD or commonjs) or directly through the global IBAN object:

<script src="iban.js"></script>
<script>
    // the API is now accessible from the window.IBAN global object
    IBAN.isValid('hello world'); // false
    IBAN.isValid('BE68539007547034'); // true
</script>

With TypeScript

The library is also available from the typescript language. To do this, download the definition and add a reference to this:

/// <reference path="iban.d.ts" />
IBAN.isValid('hello world');
IBAN.isValid('BE68539007547034');

With Meteor framework

A wrapper package for the Meteor framework is available here.

API

* isValid(iban)
* toBBAN(iban, separator)
* fromBBAN(countryCode, bban)
* isValidBBAN(countryCode, bban)
* printFormat(iban, separator)
* electronicFormat(iban)

iban.js's People

Contributors

laurentvb avatar itoche avatar lukaszklis avatar benhc123 avatar drewtron avatar icnagy avatar cyrilschumacher avatar davidmsync avatar johannespfeiffer avatar msalcala11 avatar paulromerolegal avatar stymaar avatar

Stargazers

Code1x1 avatar Alexander avatar Alberto avatar Rafał Więcek avatar Andreas Roussos avatar  avatar ssiefert avatar Pierre-Yves Dubreucq avatar Abdelrahman Arafat avatar  avatar  avatar Ioulian Alexeev avatar  avatar celal ertuğ avatar Benedict Allerberger avatar Michael Lefebvre avatar Rémy Boulanouar avatar Patryk Szwed avatar Carlos Gomes Martinho avatar Gafar.Yahya.Abdalkreem avatar Mohamed Saif avatar Yousuf Omer avatar Lucas Nicolas Pelloni avatar Marcin Kowalczyk avatar Jeffrey Overmeer avatar  avatar  avatar  avatar  avatar Nikita Vyatkin avatar PauMAVA avatar Lefteris Katmadas avatar Ioannis Pinakoulakis avatar Sergej Herbert avatar  avatar Alex M. avatar Michiel van der Wulp avatar  avatar Peter Bartl avatar  avatar Krzysztof Czereczon avatar Fabrice Oliver FABIYI avatar Karl Secen avatar Dante Di Domenico avatar Enrico Nemack avatar LUÍS CARLOS DE SOUZA  MENEZES avatar Tristan avatar Erdem Arslan avatar Paul Vidal avatar Juan David avatar Raphaël Bideau avatar  avatar  avatar stagas avatar Mateusz Bagiński avatar Aymeric Robini avatar Marc Veens avatar  avatar Marko avatar henryzhao avatar René Schimmelpfennig avatar Adrian Engler avatar Wolfgang Schwaiger avatar Jonas Höbenreich avatar Toni Mahilainen avatar Francisco avatar Breal  avatar Gerrit Tebrake avatar disgra avatar Piotr Błażejewicz (Peter Blazejewicz) avatar Golubov Andrey avatar Tuan Nguyen avatar Frank avatar  avatar Illia Zelenin avatar Razan Qraini avatar Upamanyu Pathare avatar René avatar Branislav Lukáč avatar David K avatar Andi Kratzel avatar Yessi Munguengui avatar  avatar Aleksei Podmogilnoi avatar Armin avatar Henk van Boeijen avatar jesusAG avatar  avatar Thomas Egain avatar Anthony Nahas avatar Timur Ercan avatar Marwann avatar Markus Lauff avatar Toan Tran avatar Nelson avatar Óscar Carretero avatar Steven avatar Jannik Schäfer avatar Kong Bunthoeurn avatar Eugen Stan avatar

Watchers

Neustradamus avatar Sebastian Schlatow avatar Gökhan Karaca avatar Johnny avatar James Cloos avatar Kuba Niewiarowski avatar Lars Kneschke avatar Viacheslav Shabelnyk avatar  avatar  avatar Samed Konak avatar Dmytro Lyfarenko avatar  avatar  avatar Wolfgang Blessen avatar Vlad Nistor avatar James Sørlie avatar Antoine Huberland avatar S. Grootendorst avatar Esteve Olm avatar edoardomarsili avatar  avatar

iban.js's Issues

this.electronicFormat is not a function

When Calling the isValid method, this is the window element, then it doesn't have an electronicFormat method.

What is this supposed to be, and what is theelectronicFormat method ?

[FR] HSBC bank IBAN invalid

Hi,

The "IBAN.isValid" method seems to work fine for French specification in general, but i encounter some invalid IBAN when i use the sample from HSBC.

Here the values from their spec:

France | FR | 27 | FR24 2002 0202 2606 0002 4M02 606

It seems that the iso7064Mod97_10 is not equals to 1.

Is this a normal behaviour?

Thanks in advance for your help.

Dutch BBAN conversion fails

Hi there,

I tried your script with several Dutch bank account numbers, but without success..
These should pass:

123456789 (IBAN should be: NL13TEST0123456789)
167140582 (IBAN should be: NL15RABO0167140582)
2445588 (IBAN should be: NL86INGB0002445588)

The code I tried:

IBAN.fromBBAN('NL','167140582')

and

IBAN.fromBBAN('NL','0167140582')

Best, Dirk

IE 8 not working

I've tested it in my own script in IE 8 and it didn't work.

I've tested your website in IE 8 and that didn't work either.

Conclusion: It doesn't work in IE8

SCRIPT438: Object doesn't support property or method 'isValid'

No CHANGELOG

Thank you very much for writing this handy module!

My only issue: When updating to new versions, there is no CHANGELOG file or list of changes in the releases tab on Github. When updating lots of packages at once, looking through commits for each of them is really painful.

Could you please consider adding one? Thank you very much in advance. 😊

bower version mismatch

bower not-cached    git://github.com/arhs/iban.js.git#*
bower resolve       git://github.com/arhs/iban.js.git#*
bower download      https://github.com/arhs/iban.js/archive/v0.0.5.tar.gz
bower extract       iban#* archive.tar.gz
bower mismatch      Version declared in the json (0.0.4) is different than the resolved one (0.0.5)
bower resolved      git://github.com/arhs/iban.js.git#0.0.5
bower install       iban#0.0.5

iban#0.0.5 bower_components\iban

https://github.com/arhs/iban.js/blob/v0.0.5/bower.json#L4 should be "version": "0.0.5",

IBAN.isValid ignores non-alphanumeric characters

E.g.

const notValidIban = 'DE893704 0044 0532 0130 __00^#&#*#*(#';

IBAN.isValid(notValidIban); // true

Looks like it considers only aphanumeric characters, here I have a valid iban, but polluted with special characters, and it's still treated as valid

Version number

Hey,

This packages is quite mature, and fairly settled as it seems (0.0.1 came out 6 years ago).
The current version is 0.0.14, which at first glance seems like this is still in early development, and potentially detours adopters.
I would suggest releasing an official 1.0.0, so the version number more clearly reflects the maturity of the library.

I would also suggest following Semver from that point on, as it's a very established versioning theme in the node community.

Cheers,
Hannes

Support custom specifications

Working with Ethereum I needed to add my own custom specifications. I currently do this by copying an existing entries from IBAN.countries to hijack, and replace all the values within it.

Ideally I would like IBAN.Specification exposed as well as the second parameter to use a passed in Specification instead of a country code for IBAN.fromBBAN.

I can make a pull request if you are interested. It is fully backward compatible. Thanks.

BIC validation

Could you possibly add the following regular expression to also validate a BIC (because mostly both fields are requested) or is that feature out of scope?

^([A-Z]{6}[A-Z2-9][A-NP-Z1-2])(X{3}|[A-WY-Z0-9][A-Z0-9]{2})?$

Known Vulnerability in demo boostrap version

When using npm audit :

/node_modules/iban/demo/bower_components/bootstrap/dist/js/bootstrap.js
↳ bootstrap 3.3.7 has known vulnerabilities: severity: medium; issue: 20184, summary: XSS in data-target attribute; twbs/bootstrap#20184
/node_modules/iban/demo/bower_components/bootstrap/dist/js/bootstrap.min.js
↳ bootstrap 3.3.7 has known vulnerabilities: severity: medium; issue: 20184, summary: XSS in data-target attribute; twbs/bootstrap#20184

Can you consider upgrading the demo bootstrap to a higher, fixed version ?

PL BBAN is in wrong format

Like title, in code I spoted new Specification("PL", 28, "F08F16", "PL61109010140000071219812874") where in Poland should be F02F08F16 for BBAN:
F02 is control sum
F08 is bank settlement number
F16 is client number

Get country code

It would be nice to be able to get the country code from an IBAN without doing .slice(0, 2) (which I only learned was true for all IBAN's by reading the source).

It could be implemented in several ways: a parse method could return an object with properties like countryCode and methods like toBBAN.

False-positive

The following string results in true:

IT66`M0306905020100000062186

I think the character:

`

should invalidate it. Most online validators show invalidity as well.

Validate iban with passing country code

Can we validate Iban bypassing country code like

const IBAN = require ( 'iban' );

let iban = 'PL61 1090 1014 0000 0712 1981 2874';
let countryCode = 'PK';

if ( IBAN.isValid ( iban , countryCode) ) {
   alert( 'Not a valid iban for country code' + countryCode );
   return false;
}
return true;

Valid BBAN is considered invalid

I have a valid BBAN but the method isValidBBAN returns false with it:

iban.toBBAN('CR25010200009074883572');
// '0102 00009074883572'

iban.isValidBBAN('0102 00009074883572');
// false

iban.isValidBBAN(iban.toBBAN('CR25010200009074883572'));
// false

Error with npm

Could you republish iban to npm? There seems to be some kind of error with it currently, some files seem to be missing and clean install ends with 404.

Just run the following to repush it with the same version number

npm publish -f

Current output of npm install iban:

npm http GET https://registry.npmjs.org/iban
npm http 200 https://registry.npmjs.org/iban
npm http GET https://registry.npmjs.org/iban/-/iban-0.0.2.tgz
npm http 404 https://registry.npmjs.org/iban/-/iban-0.0.2.tgz
npm ERR! fetch failed https://registry.npmjs.org/iban/-/iban-0.0.2.tgz
npm ERR! Error: 404 Not Found
npm ERR!     at WriteStream.<anonymous> (/Users/andris/.nvm/v0.10.25/lib/node_modules/npm/lib/utils/fetch.js:57:12)
npm ERR!     at WriteStream.EventEmitter.emit (events.js:117:20)
npm ERR!     at fs.js:1596:14
npm ERR!     at /Users/andris/.nvm/v0.10.25/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:103:5
npm ERR!     at Object.oncomplete (fs.js:107:15)
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/isaacs/npm/issues>

npm ERR! System Darwin 13.0.0
npm ERR! command "/Users/andris/.nvm/v0.10.25/bin/node" "/Users/andris/.nvm/v0.10.25/bin/npm" "install" "iban"
npm ERR! cwd /Users/andris/Desktop
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.24
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/andris/Desktop/npm-debug.log
npm ERR! not ok code 0

v1 requirements

This issue tracks the requirements for the rewrite of iban.js

  • no polyfill, written as modern js (a compiled version for older browsers could be envisioned)
  • specifications format based on the standard published by Swift (see https://www.swift.com/standards/data-standards/iban)
  • extensible (#19)
  • improved documentation
  • ignore only whitespace characters when validating an IBAN (#35)

SEPA countries IBAN

This package did not support SEPA countries IBAN. I want to validate Austria IBAN: AT61 1904 3002 3457 3201 but its return false, not validate. I have to check all SEPA county's IBAN.

Please confirm, is it true or me something doing wrong.

Thanks

No tags for released versions

Currently, there are no tags yet. This means that installing via bower using semver specifications is impossible.

A workaround is by specifying the dependency directly on a particular commit hash, but that's awkward:

{
  "dependencies": 
    {
      "iban": "[email protected]:arhs/iban.js.git#731a407833f7d347a3da8982302c36bd4818c2f0"
    }
}

So, please push tags for the released versions.

Invalid IBAN number from Ivory Coast

We have a customer with an IBAN number from Ivory Coast, this number is a valid number and renderd as valid by www.iban.com

However this libary (which we use in our software) returns that the specific IBAN number is not valid.

Note that for privacy reasons we cannot post the actual bank account number which has the issue.

On https://www.iban.com/structure.html there is a test number with the same behaviour: CI93CI0080111301134291200589

New IBAN Countries

Hello,

VA59001123000012345678 is a valid Vatican City IBAN. Are there any plans to support these new countries?

Belarus not supported

According the everything, Belarus should be supported as of v0.0.10. But when I test the example provided in the object, invalid is returned.

It seems the issue is with the test page. It doesn't appear to be using the latest version of iban.js

local account number

For instance, we are using local gb account number with sort code.
How can I validate it with this library?
iban.isValidBBAN(country name + sort code + account number) not working

Validator ignores extra characters

For me it seems that the validator is too flexible. It says that this is valid:
FI@ +425*000*151=0 == #000$ 0° 23€€€!!!!!

And altho technically it does contain valid numbers for an fictional IBAN number, that gibberish in my mind should not count as a valid IBAN.

dash is not acceptable character in IBAN

I am using iban.js to mark entered IBAN valid or invalid by using function .isValid(IBAN), I find illogical to verify IBAN valid, when you can enter non alphanumeric characters into iban. The IBAN spec does not accept non-alphanumeric charactes, so is it valid IBAN if you have them?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.