From 17b12500c545936c9c4eef8ced578c5d26b1d895 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sas=CC=8Ca=20Jovanic=CC=81?= Date: Tue, 4 Jun 2024 16:12:38 +0200 Subject: [PATCH] Fix for extraction of German account number Fixes #550 --- dist/ibantools.js | 2 +- src/ibantools.ts | 2 +- test/ibantools_test.js | 22 ++++++++++++++++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/dist/ibantools.js b/dist/ibantools.js index 10f8635..175ef84 100644 --- a/dist/ibantools.js +++ b/dist/ibantools.js @@ -987,7 +987,7 @@ define(["require", "exports"], function (require, exports) { IBANRegistry: true, SEPA: true, bank_identifier: '0-7', - account_indentifier: '13-22', + account_indentifier: '12-22', }, DJ: { chars: 27, diff --git a/src/ibantools.ts b/src/ibantools.ts index 6b964fb..81abc4d 100755 --- a/src/ibantools.ts +++ b/src/ibantools.ts @@ -1107,7 +1107,7 @@ export const countrySpecs: CountryMapInternal = { IBANRegistry: true, SEPA: true, bank_identifier: '0-7', - account_indentifier: '13-22', + account_indentifier: '12-22', }, DJ: { chars: 27, diff --git a/test/ibantools_test.js b/test/ibantools_test.js index d03d095..b5f043c 100644 --- a/test/ibantools_test.js +++ b/test/ibantools_test.js @@ -750,6 +750,28 @@ describe('IBANTools', function() { }); }); + describe('When calling extractIBAN() with valid German IBAN', function () { + var ext = iban.extractIBAN('DE75512108001245126199'); + it('valid should be true', function () { + expect(ext.valid).to.be.true; + }); + it('IBAN should be DE75512108001245126199', function () { + expect(ext.iban).to.equal('DE75512108001245126199'); + }); + it('BBAN should be 512108001245126199', function () { + expect(ext.bban).to.equal('512108001245126199'); + }); + it('countryCode should be DE', function () { + expect(ext.countryCode).to.equal('DE'); + }); + it('accountNumber should be 1245126199', function () { + expect(ext.accountNumber).to.equal('1245126199'); + }); + it('bankIdentifier should be 51210800', function () { + expect(ext.bankIdentifier).to.equal('51210800'); + }); + }); + describe('When calling extractIBAN() with invalid IBAN', function() { var ext = iban.extractIBAN('BR970036030510009795493P1'); it('valid should be false', function() {