0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
dkd-ibanizator generates the correct IBAN for a given account number and bank number for German bank accounts. It is possible to validate given IBAN codes. Calculates also the BIC and bank names for given German bank codes.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.15.0
~> 0.8.20
~> 4.7.3
~> 12.0.0
~> 3.6.0
~> 0.49.1
~> 1.15.0

Runtime

~> 0.2.0
~> 0.0.11
 Project Readme

dkd-ibanizator Gem Version Coverage Status

Deprecation warning

This project repository will no longer be updated. You will find a fork of the original project on GitHub maintained by zaknafain.

Summary

dkd-ibanizator calculates the IBAN for German bank accounts. The database that is used to convert a bank number to a BIC is taken from Deutsche Bundesbank.

Installation

Add this line to your application's Gemfile:

    gem 'dkd-ibanizator'

Usage

Calculate IBAN

Load dkd-ibanizator:

    require 'ibanizator'

To calculate the IBAN for some German bank accounts, just use this method:

    ibanizator = Ibanizator.new
    ibanizator.calculate_iban country_code: :de, bank_code: '12345678', account_number: '123456789'

Note: In the current version the dkd-ibanizator gem only works for German bank accounts.

Validate an IBAN

To validate the IBAN you need to check the length and after this check the checksum. For details please refer to the documentation online (e.g. http://es.wikipedia.org/wiki/IBAN).

This gem provides a simple validator for several contries. All countries that are listed in the Ibanizator::Iban::COUNTRY_CODES hash are supported at the moment.

    iban = Ibanizator.iban_from_string("DE68 2105 0170 0012 3456 78")
    iban.valid? # => true

Information provided by an IBAN

The Ibanizator::Iban class provides some handy utility methods to query information about an iban.

    iban = Ibanizator.iban_from_string("DE68 2105 0170 0012 3456 78")
    iban.country_code # => :DE

    # there is extended data for german ibans
    iban.extended_data.bank_code        # => "21050170"
    iban.extended_data.account_number   # => "12345678"
    iban.extended_data.bic              # => "NOLADE21KIE"

Find bank infos

If you need to get a bank name, bank code or a BIC from a German bank and you have either a BIC or a bank code there is a bank db.

    # find a bank by BIC
    bank_1 = Ibanizator.bank_db.bank_by_bic('MARKDEF1100')
    bank_1.name       # => 'BBk Berlin'
    bank_1.bic        # => 'MARKDEF1100'
    bank_1.bank_code  # => '10000000'

    # find a bank by bank_code (de: Bankleitzahl)
    bank_2 = Ibanizator.bank_db.bank_by_bank_code('100 000 00')
    bank_2.name       # => 'BBk Berlin'
    bank_2.bic        # => 'MARKDEF1100'
    bank_2.bank_code  # => '10000000'

    bank_3 = Ibanizator.bank_db.bank_by_bank_code('10000000')
    bank_3.name       # => 'BBk Berlin'
    bank_3.bic        # => 'MARKDEF1100'
    bank_3.bank_code  # => '10000000'

    bank_1 == bank_2  # => true
    bank_2 == bank_3  # => true

    bank_4 = Ibanizator.bank_db.bank_by_bic('OASPDE6AXXX')
    bank_4 == bank_2  # => false

Licence

The code is based on the GitHub project softwareinmotion/ibanizator and availiable under the MIT licence.