GithubHelp home page GithubHelp logo

ibanizator's Introduction

ibanizator Tests

ibanizator calculates the iban for german 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 'ibanizator'

Usage

Calculate IBAN

To calculate the iban for some german accounts, just use this method:

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

In the current version the ibanizator gem only works for german 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. Wikipedia).

This gem provides a simple validator for several contries. All countries that are listed in the Ibanizator::Iban::LENGTHS 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 availiable under the MIT-Licence

ibanizator's People

Contributors

fsmanuel avatar geniustimo avatar jalyna avatar jgantner avatar leenno avatar mikelieser avatar phoet avatar skorth avatar zaknafain avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ibanizator's Issues

Outdated blz file

Hello,
blz files seems to be outdated so:

  • where do you get it from? Or can you update gem ?

BIC lookup

Hi, thank you for a good gem.

I have a question about the BIC lookup:

As the gem works today it does the BIC lookup dependent on the blz (bank code). Since a blz can point to different branches/offices of a bank it might not pick the correct one. The hash of blz -> BIC will only store the last blz with the same number. Will this work? Will the bank fix that issue internally when you do a payment?

Update to last www.bundesbank.de files

Hello there! I was wondering if it would be possible to check if the latest Bundesbank files have been incorporated into the library. It seems like the last release was about a year ago, so I just wanted to inquire if an update is in progress or planned. Thank you!

Maintainer needed

I'm currently not able to maintain the project as it should be maintained. If someone is willing to help I'd be happy to welcome any help.

The project should be updated regularly and published to ruby gems whenever new releases of the BLZ/Iban information gets published.

Returns wrong bank name for bic PBNKDEFFXXX

Hi,

with v0.3.4 the correct bank name for bic PBNKDEFFXXX should be "Postbank Frankfurt" (see http://bank-code.net/swift-code/PBNKDEFFXXX.html).

[1] pry(main)> iban = Ibanizator.iban_from_string("DE09500100600175890604")
=> #<Ibanizator::Iban iban_string="DE09500100600175890604">
[2] pry(main)> iban.extended_data.bic
=> "PBNKDEFFXXX"
[3] pry(main)> bic = iban.extended_data.bic
=> "PBNKDEFFXXX"
[4] pry(main)> bank = Ibanizator.bank_db.bank_by_bic(bic)
=> #<Ibanizator::Bank bic="PBNKDEFFXXX" name="Postbank Leipzig" bank_code="86010090">
[5] pry(main)> bank.name
=> "Postbank Leipzig"

Fix bundler-dependency to resolve travis CI issues

The latest pull requests led to travis failures due to the requiremend to a specific bundler version in the 1.15.x version range. It should be updated and tested with a more recent bundler version.

The related Issues are #18 and #15.

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.