mt940 0.7.1 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG +8 -0
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/lib/mt940.rb +1 -0
- data/lib/mt940/banks/ing.rb +1 -1
- data/lib/mt940/base.rb +4 -3
- data/lib/mt940/version.rb +1 -1
- data/test/fixtures/ing_sepa.txt +13 -0
- data/test/mt940_ing_test.rb +17 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 794cd939c7e990345e04bd179fcca0b985dc7f8b
|
4
|
+
data.tar.gz: 10d1457e0f6b4fc18f483a0871175f72a43775ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f316f5881c67da96a2730633f67d62f8e08f4b38de3e234b1def293232bbd271f8900fab8ecf1eece387d5faae11e34ed218489e2eb52f3f0b8fdf7d411c7294
|
7
|
+
data.tar.gz: a913ab92d962f68b164515dd58b96d867da2b51e5250021dfbf2af5db2abbb2c323290c0ed130512c0131b14fd4e4e9fae817835a5bf47ee7607396e64b3fc29
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
* 0.8.0
|
2
|
+
- BUG FIX: correct parsing of tag 86 ING in case it doesn't contain an IBAN number
|
3
|
+
- Now with a more general IBAN regexp pattern
|
4
|
+
|
5
|
+
* 0.7.1
|
6
|
+
- Small fix, prevent invalid byte sequence in UTF-8 while reading mt940 file
|
7
|
+
- Replace more than two or more spaces with only one
|
8
|
+
|
1
9
|
* 0.7.0
|
2
10
|
- No support for Ruby 1.8.7, default 2.1.0
|
3
11
|
- I was uncomfortable with using class methods, so I introduced the Mt940::Parser and refactored. See Readme
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -5,7 +5,7 @@ MT940 (Dutch banks only)
|
|
5
5
|

|
6
6
|
</a>
|
7
7
|
|
8
|
-
Basis parser for MT940 files, see [MT940](http://nl.wikipedia.org/wiki/MT940). This library is only meant for
|
8
|
+
Basis parser for MT940 files, see [MT940](http://nl.wikipedia.org/wiki/MT940). This library is only meant for collecting the transactions. No bank statements or balance (previous or new) is determined.
|
9
9
|
|
10
10
|
The following Dutch banks are implemented with support for IBAN numbers:
|
11
11
|
|
data/lib/mt940.rb
CHANGED
data/lib/mt940/banks/ing.rb
CHANGED
data/lib/mt940/base.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
module MT940
|
2
2
|
|
3
3
|
BBAN_PATTERN = '^\d{10}'
|
4
|
-
IBAN_PATTERN = '
|
4
|
+
IBAN_PATTERN = '[a-zA-Z]{2}[0-9]{2}[a-zA-Z0-9]{4}[0-9]{7}([a-zA-Z0-9]?){0,16}'
|
5
5
|
BIC_CODE_PATTERN = MT940::BIC_CODES.values.join('|')
|
6
|
-
SEPA_PATTERN = Regexp.new "(#{
|
6
|
+
SEPA_PATTERN = Regexp.new "(#{IBAN_PATTERN})\\s+(#{BIC_CODE_PATTERN})(.+)$"
|
7
7
|
|
8
8
|
class Base
|
9
9
|
|
@@ -67,9 +67,10 @@ module MT940
|
|
67
67
|
def parse_tag_86
|
68
68
|
if @line.match(/^:86:\s?(.*)$/)
|
69
69
|
@line = $1.strip
|
70
|
+
@description, @contra_account = nil, nil
|
70
71
|
sepa? ? parse_line_after_sepa : parse_line_before_sepa
|
71
72
|
@transaction.contra_account = @contra_account
|
72
|
-
@transaction.description = @description
|
73
|
+
@transaction.description = @description || @line
|
73
74
|
end
|
74
75
|
end
|
75
76
|
|
data/lib/mt940/version.rb
CHANGED
data/test/fixtures/ing_sepa.txt
CHANGED
@@ -5,26 +5,39 @@
|
|
5
5
|
:25:0654321789
|
6
6
|
:28C:000
|
7
7
|
:60F:C120810EUR68,20
|
8
|
+
|
8
9
|
:61:120810C1,41NOV EV41411REP170112
|
9
10
|
:86:0654321789 J. Janssen Factuurnr 123456 klantnr 00123
|
11
|
+
|
10
12
|
:61:120810C1,56NOV EREF
|
11
13
|
:86:0123456789 NL69INGB0123456789 INGBNL2A J. Janssen
|
12
14
|
20120123456789 Factuurnr 123456 Klantnr 00123
|
15
|
+
|
13
16
|
:61:120810D2,13NVZ NONREF
|
14
17
|
:86:TOTAAL 1 VZ 4444444
|
18
|
+
|
15
19
|
:61:120810D1,57NVZ PREF
|
16
20
|
:86:VERZAMEL EUROBETALING M000000001111111 REMI TOTAAL 1 POSTEN
|
21
|
+
|
17
22
|
:61:120810C1,44NIC NONREF
|
18
23
|
:86:TOTAAL 1 IC 4444444
|
24
|
+
|
19
25
|
:61:120810D1,54NIC EV54541REP180112
|
20
26
|
:86:000754321 KN: EV54541REP180112
|
21
27
|
EV54541REP180112T1630 ING BANK NV INZAKE WEB?AMSTERDAM
|
28
|
+
|
22
29
|
:61:120810D1,14NIC MARF
|
23
30
|
:86:0123456789 Europese Incasso doorlopend NL69INGB0123456789 INGBNL2A
|
24
31
|
J. Jansen NL32ZZZ999999991234 MND-120123 20120501P01234785 CONTRIB
|
25
32
|
UTIE MEI 2012
|
33
|
+
|
26
34
|
:61:120810C939,60NAC NONREF
|
27
35
|
:86:0675432198 J. JANSSEN AMSTERDAM KN:3300169406045025
|
36
|
+
|
37
|
+
:61:140301D1234,00NDV NONREF
|
38
|
+
:86: Reguliere aflossing
|
39
|
+
Starters Investeri 11.22.33.444 Rest hoofdsom EUR 99.000,00
|
40
|
+
|
28
41
|
:62F:C120811EUR1005,83
|
29
42
|
:64:C120811EUR1005,83
|
30
43
|
:65:C120811EUR1005,83
|
data/test/mt940_ing_test.rb
CHANGED
@@ -57,7 +57,7 @@ class TestMt940Ing < Test::Unit::TestCase
|
|
57
57
|
end
|
58
58
|
|
59
59
|
should 'have the correct number of transactions' do
|
60
|
-
assert_equal
|
60
|
+
assert_equal 9, @transactions.size
|
61
61
|
end
|
62
62
|
|
63
63
|
context 'Transaction' do
|
@@ -86,12 +86,24 @@ class TestMt940Ing < Test::Unit::TestCase
|
|
86
86
|
assert_equal 'Ing', @transaction.bank
|
87
87
|
end
|
88
88
|
|
89
|
-
|
90
|
-
|
89
|
+
context 'With an iban number in :86' do
|
90
|
+
should 'have a description' do
|
91
|
+
assert_equal 'J. Janssen 20120123456789 Factuurnr 123456 Klantnr 00123', @transactions[1].description
|
92
|
+
end
|
93
|
+
|
94
|
+
should 'return the contra_account' do
|
95
|
+
assert_equal 'NL69INGB0123456789', @transactions[1].contra_account
|
96
|
+
end
|
91
97
|
end
|
92
98
|
|
93
|
-
|
94
|
-
|
99
|
+
context 'Without an iban number in :86' do
|
100
|
+
should 'have a description' do
|
101
|
+
assert_equal 'Reguliere aflossingStarters Investeri 11.22.33.444 Rest hoofdsom EUR 99.000,00', @transactions[8].description
|
102
|
+
end
|
103
|
+
|
104
|
+
should 'return the contra_account' do
|
105
|
+
assert_equal nil, @transactions[8].contra_account
|
106
|
+
end
|
95
107
|
end
|
96
108
|
|
97
109
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mt940
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Frank Oxener
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A basic MT940 parser with implementations for Dutch banks.
|
14
14
|
email: frank.oxener@gmail.com
|