dkd-ibanizator 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9174054e7bb5ce346dfc60614f84990aac53251a
4
+ data.tar.gz: ccb61c49d93be5787147270fe8006d3cbbe6b802
5
+ SHA512:
6
+ metadata.gz: 822eeeb600c9665be306c5fb9088cd44176a5e60505ddca12de347fbaee4d733e3f2ebab33f017d5096cd93fc7f1f3b67dae95de961c71c7a41d774c5f7e403a
7
+ data.tar.gz: eb151e5a65cc2b445b419bdf0adb4689a5493b3d4b2a03c8d3beb188d8ef8da7dee21f5cc97abafcc68937178276dad1ea260e866978e07987b05e65774152f9
data/README.md ADDED
@@ -0,0 +1,88 @@
1
+ # dkd-ibanizator [![Build Status](https://travis-ci.org/dkd/dkd-ibanizator.svg?branch=master)](https://travis-ci.org/dkd/dkd-ibanizator) [![Gem Version](https://badge.fury.io/rb/dkd-ibanizator.svg)](https://badge.fury.io/rb/dkdeploy-core)
2
+
3
+ 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](http://www.bundesbank.de/Redaktion/EN/Standardartikel/Tasks/Payment_systems/bank_sort_codes_download.html).
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'dkd-ibanizator'
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ### Calculate IBAN
16
+
17
+ Load dkd-ibanizator:
18
+
19
+ ```ruby
20
+ require 'ibanizator'
21
+ ```
22
+
23
+ To calculate the IBAN for some German bank accounts, just use this method:
24
+
25
+ ```ruby
26
+ ibanizator = Ibanizator.new
27
+ ibanizator.calculate_iban country_code: :de, bank_code: '12345678', account_number: '123456789'
28
+ ```
29
+
30
+ Note: In the current version the dkd-ibanizator gem only works for German bank accounts.
31
+
32
+ ### Validate an IBAN
33
+
34
+ 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).
35
+
36
+ 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.
37
+
38
+ ```ruby
39
+ iban = Ibanizator.iban_from_string("DE68 2105 0170 0012 3456 78")
40
+ iban.valid? # => true
41
+ ```
42
+
43
+ ### Information provided by an IBAN
44
+
45
+ The Ibanizator::Iban class provides some handy utility methods to query information about an iban.
46
+
47
+ ```ruby
48
+ iban = Ibanizator.iban_from_string("DE68 2105 0170 0012 3456 78")
49
+ iban.country_code # => :DE
50
+
51
+ # there is extended data for german ibans
52
+ iban.extended_data.bank_code # => "21050170"
53
+ iban.extended_data.account_number # => "12345678"
54
+ iban.extended_data.bic # => "NOLADE21KIE"
55
+ ```
56
+
57
+ ### Find bank infos
58
+
59
+ 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.
60
+
61
+ ```ruby
62
+ # find a bank by BIC
63
+ bank_1 = Ibanizator.bank_db.bank_by_bic('MARKDEF1100')
64
+ bank_1.name # => 'BBk Berlin'
65
+ bank_1.bic # => 'MARKDEF1100'
66
+ bank_1.bank_code # => '10000000'
67
+
68
+ # find a bank by bank_code (de: Bankleitzahl)
69
+ bank_2 = Ibanizator.bank_db.bank_by_bank_code('100 000 00')
70
+ bank_2.name # => 'BBk Berlin'
71
+ bank_2.bic # => 'MARKDEF1100'
72
+ bank_2.bank_code # => '10000000'
73
+
74
+ bank_3 = Ibanizator.bank_db.bank_by_bank_code('10000000')
75
+ bank_3.name # => 'BBk Berlin'
76
+ bank_3.bic # => 'MARKDEF1100'
77
+ bank_3.bank_code # => '10000000'
78
+
79
+ bank_1 == bank_2 # => true
80
+ bank_2 == bank_3 # => true
81
+
82
+ bank_4 = Ibanizator.bank_db.bank_by_bic('OASPDE6AXXX')
83
+ bank_4 == bank_2 # => false
84
+ ```
85
+
86
+ ## Licence
87
+
88
+ The code is based on the GitHub project [softwareinmotion/ibanizator](https://github.com/softwareinmotion/ibanizator) and availiable under the MIT licence.