Skip to content

Latest commit

 

History

History
61 lines (41 loc) · 1.73 KB

README.textile

File metadata and controls

61 lines (41 loc) · 1.73 KB

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.