mt940 0.6.5 → 0.6.6
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.
- data/.gitignore +3 -0
- data/CHANGELOG +8 -0
- data/README.md +1 -1
- data/Rakefile +1 -1
- data/lib/mt940/banks/abnamro.rb +1 -1
- data/lib/mt940/banks/rabobank.rb +1 -1
- data/lib/mt940/base.rb +6 -2
- data/lib/mt940/transaction.rb +2 -1
- data/lib/mt940/version.rb +1 -1
- data/test/mt940_abnamro_test.rb +5 -1
- data/test/mt940_ing_test.rb +5 -1
- data/test/mt940_rabobank_test.rb +4 -0
- data/test/mt940_triodos_test.rb +4 -0
- metadata +7 -7
data/.gitignore
CHANGED
data/CHANGELOG
CHANGED
data/README.md
CHANGED
data/Rakefile
CHANGED
data/lib/mt940/banks/abnamro.rb
CHANGED
@@ -7,7 +7,7 @@ class MT940::Abnamro < MT940::Base
|
|
7
7
|
def parse_tag_61
|
8
8
|
if @line.match(/^:61:(\d{6})\d{4}(C|D)(\d+),(\d{0,2})/)
|
9
9
|
type = $2 == 'D' ? -1 : 1
|
10
|
-
@transaction = MT940::Transaction.new(:bank_account => @bank_account, :amount => type * ($3 + '.' + $4).to_f, :bank => @bank)
|
10
|
+
@transaction = MT940::Transaction.new(:bank_account => @bank_account, :amount => type * ($3 + '.' + $4).to_f, :bank => @bank, :currency => @currency)
|
11
11
|
@transaction.date = parse_date($1)
|
12
12
|
@transactions << @transaction
|
13
13
|
@tag86 = false
|
data/lib/mt940/banks/rabobank.rb
CHANGED
@@ -7,7 +7,7 @@ class MT940::Rabobank < MT940::Base
|
|
7
7
|
def parse_tag_61
|
8
8
|
if @line.match(/^:61:(\d{6})(C|D)(\d+),(\d{0,2})\w{4}\w{1}(\d{9}|NONREF)(.+)$/)
|
9
9
|
type = $2 == 'D' ? -1 : 1
|
10
|
-
@transaction = MT940::Transaction.new(:bank_account => @bank_account, :amount => type * ($3 + '.' + $4).to_f, :bank => @bank)
|
10
|
+
@transaction = MT940::Transaction.new(:bank_account => @bank_account, :amount => type * ($3 + '.' + $4).to_f, :bank => @bank, :currency => @currency)
|
11
11
|
@transaction.date = parse_date($1)
|
12
12
|
@transaction.contra_account = $5.strip
|
13
13
|
@transaction.contra_account_owner = $6.strip
|
data/lib/mt940/base.rb
CHANGED
@@ -23,7 +23,7 @@ module MT940
|
|
23
23
|
@tag86 = false
|
24
24
|
@lines.each do |line|
|
25
25
|
@line = line
|
26
|
-
@line.match(/^:(\d{2}):/) ? eval('parse_tag_'+ $1) : parse_line
|
26
|
+
@line.match(/^:(\d{2}F?):/) ? eval('parse_tag_'+ $1) : parse_line
|
27
27
|
end
|
28
28
|
@transactions
|
29
29
|
end
|
@@ -56,10 +56,14 @@ module MT940
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
+
def parse_tag_60F
|
60
|
+
@currency = @line[12..14]
|
61
|
+
end
|
62
|
+
|
59
63
|
def parse_tag_61
|
60
64
|
if @line.match(/^:61:(\d{6})(C|D)(\d+),(\d{0,2})/)
|
61
65
|
type = $2 == 'D' ? -1 : 1
|
62
|
-
@transaction = MT940::Transaction.new(:bank_account => @bank_account, :amount => type * ($3 + '.' + $4).to_f, :bank => @bank)
|
66
|
+
@transaction = MT940::Transaction.new(:bank_account => @bank_account, :amount => type * ($3 + '.' + $4).to_f, :bank => @bank, :currency => @currency)
|
63
67
|
@transaction.date = parse_date($1)
|
64
68
|
@transactions << @transaction
|
65
69
|
@tag86 = false
|
data/lib/mt940/transaction.rb
CHANGED
@@ -2,7 +2,7 @@ module MT940
|
|
2
2
|
|
3
3
|
class Transaction
|
4
4
|
|
5
|
-
attr_accessor :bank_account, :contra_account, :amount, :description, :contra_account_owner, :date, :bank
|
5
|
+
attr_accessor :bank_account, :contra_account, :amount, :description, :contra_account_owner, :date, :bank, :currency
|
6
6
|
|
7
7
|
def initialize(attributes = {})
|
8
8
|
@bank_account = attributes[:bank_account]
|
@@ -12,6 +12,7 @@ module MT940
|
|
12
12
|
@date = attributes[:date]
|
13
13
|
@contra_account = attributes[:contra_account]
|
14
14
|
@contra_account_name = attributes[:contra_account_owner]
|
15
|
+
@currency = attributes[:currency]
|
15
16
|
end
|
16
17
|
|
17
18
|
end
|
data/lib/mt940/version.rb
CHANGED
data/test/mt940_abnamro_test.rb
CHANGED
@@ -27,7 +27,7 @@ class TestMt940Abnamro < Test::Unit::TestCase
|
|
27
27
|
end
|
28
28
|
|
29
29
|
should 'have the correct description in case of a regular bank' do
|
30
|
-
assert_equal 'MYCOM DEN HAAG S-GRAVEN,PAS999
|
30
|
+
assert_equal 'MYCOM DEN HAAG S-GRAVEN,PAS999', @transactions.last.description
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
@@ -39,6 +39,10 @@ class TestMt940Abnamro < Test::Unit::TestCase
|
|
39
39
|
assert_equal 'Abnamro', @transaction.bank
|
40
40
|
end
|
41
41
|
|
42
|
+
should 'have a currency' do
|
43
|
+
assert_equal 'EUR', @transaction.currency
|
44
|
+
end
|
45
|
+
|
42
46
|
context 'Contra account' do
|
43
47
|
should 'be determined in case of a GIRO account' do
|
44
48
|
assert_equal '000428428', @transaction.contra_account
|
data/test/mt940_ing_test.rb
CHANGED
@@ -21,6 +21,10 @@ class TestMt940Ing < Test::Unit::TestCase
|
|
21
21
|
assert_equal -25.03, @transaction.amount
|
22
22
|
end
|
23
23
|
|
24
|
+
should 'have a currency' do
|
25
|
+
assert_equal 'EUR', @transaction.currency
|
26
|
+
end
|
27
|
+
|
24
28
|
should 'have a date' do
|
25
29
|
assert_equal Date.new(2010,7,22), @transaction.date
|
26
30
|
end
|
@@ -30,7 +34,7 @@ class TestMt940Ing < Test::Unit::TestCase
|
|
30
34
|
end
|
31
35
|
|
32
36
|
should 'have a description' do
|
33
|
-
assert_equal 'EJ46GREENP100610T1456 CLIEOP TMG GPHONGKONG AMSTERDAM
|
37
|
+
assert_equal 'EJ46GREENP100610T1456 CLIEOP TMG GPHONGKONG AMSTERDAM', @transactions.last.description
|
34
38
|
end
|
35
39
|
|
36
40
|
should 'return the contra_account' do
|
data/test/mt940_rabobank_test.rb
CHANGED
@@ -35,6 +35,10 @@ class TestMt940Rabobank < Test::Unit::TestCase
|
|
35
35
|
assert_equal -1213.28, @transaction.amount
|
36
36
|
end
|
37
37
|
|
38
|
+
should 'have a currency' do
|
39
|
+
assert_equal 'EUR', @transaction.currency
|
40
|
+
end
|
41
|
+
|
38
42
|
should 'have a contra_account_owner' do
|
39
43
|
assert_equal 'W.P. Jansen', @transaction.contra_account_owner
|
40
44
|
end
|
data/test/mt940_triodos_test.rb
CHANGED
@@ -21,6 +21,10 @@ class TestMt940Triodos < Test::Unit::TestCase
|
|
21
21
|
assert_equal -15.7, @transaction.amount
|
22
22
|
end
|
23
23
|
|
24
|
+
should 'have a currency' do
|
25
|
+
assert_equal 'EUR', @transaction.currency
|
26
|
+
end
|
27
|
+
|
24
28
|
should 'have a description' do
|
25
29
|
assert_equal 'ALGEMENE TUSSENREKENING KOSTEN VAN 01-10-2010 TOT EN M ET 31-12-20100390123456', @transaction.description
|
26
30
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 6
|
8
|
-
-
|
9
|
-
version: 0.6.
|
8
|
+
- 6
|
9
|
+
version: 0.6.6
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Frank Oxener
|
@@ -14,21 +14,21 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2012-
|
17
|
+
date: 2012-04-25 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
|
-
|
21
|
+
name: shoulda
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
22
24
|
requirements:
|
23
25
|
- - ">="
|
24
26
|
- !ruby/object:Gem::Version
|
25
27
|
segments:
|
26
28
|
- 0
|
27
29
|
version: "0"
|
28
|
-
requirement: *id001
|
29
|
-
name: shoulda
|
30
|
-
prerelease: false
|
31
30
|
type: :development
|
31
|
+
version_requirements: *id001
|
32
32
|
description: A basic MT940 parser with implementations for Dutch banks.
|
33
33
|
email: frank.oxener@gmail.com
|
34
34
|
executables: []
|