Checking german BIC/Account #s
C Ruby
Switch branches/tags
Pull request Compare This branch is 35 commits ahead of provideal:master.
Latest commit 7f2b81a May 26, 2013 @jeanmartin version 0.4.4

README.textile

KontoCheck

Check whether a certain bic/account-no-combination can possibly be valid for a German bank.

It uses the C library konto_check (see http://sourceforge.net/projects/kontocheck/) by
Michael Plugge.

Example

An example tends to tell more than a 1000 words:

>> require "konto_check"
true

>> KontoCheck::init("./blz.lut")
true

# konto_check?(blz, ktno) => true/false (valid/invalid)
>> KontoCheck::konto_check?("52250030", "52001")
true

>> KontoCheck::konto_check?("52250030", "52002")
false

# ISO-8859-1 encoded name of bank
>> KontoCheck::bank_name("10010010")
"Postbank"

# there is more, RTFS or wait for/help creating more examples...

Short ‘Documentation’

KontoCheck::konto_check?(<blz>, <kto>)

check whether the given account number kto can possibly be
a valid number of the bank with the bic blz.

KontoCheck::init(<lut_file>)

initialize the underlying C library konto_check with bank
information from the LUT file lut_file.
The LUT file can be created from the plain text file
found at: http://www.bundesbank.de/zahlungsverkehr/zahlungsverkehr_bankleitzahlen_download.php
This file is updated every three months, so be sure to
replace (and regenerate) it regularly.

There will be a rake task to update the LUT file soon.

KontoCheck::bank_name(<blz>)

returns the name of the bank as a (ISO-8859-1 encoded)
string or raises a runtime error with a short error message
if an error occurred (invalid blz, blz too short, etc.).
This may be changed in the future to simply return nil (should be discussed).

License

Since the original http://www.informatik.hs-mannheim.de/konto_check/ is
licensed under LGPL, so is this module.