zilverline-mt940 1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.document +5 -0
- data/.gitignore +52 -0
- data/.ruby-version +1 -0
- data/CHANGELOG +56 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +26 -0
- data/LICENSE.txt +20 -0
- data/README.md +75 -0
- data/Rakefile +9 -0
- data/lib/mt940.rb +10 -0
- data/lib/mt940/bank_statement.rb +13 -0
- data/lib/mt940/banks/abnamro.rb +76 -0
- data/lib/mt940/banks/ing.rb +84 -0
- data/lib/mt940/banks/rabobank.rb +770 -0
- data/lib/mt940/banks/triodos.rb +20 -0
- data/lib/mt940/base.rb +165 -0
- data/lib/mt940/structured_format.rb +16 -0
- data/lib/mt940/transaction.rb +23 -0
- data/lib/mt940/version.rb +3 -0
- data/mt940.gemspec +32 -0
- data/spec/fixtures/abnamro.txt +41 -0
- data/spec/fixtures/abnamro_structured.txt +54 -0
- data/spec/fixtures/ing.txt +24 -0
- data/spec/fixtures/ing_structured.txt +31 -0
- data/spec/fixtures/rabobank.txt +140 -0
- data/spec/fixtures/rabobank_mt940_structured.txt +48 -0
- data/spec/fixtures/rabobank_mt940_structured_dutch_tax.txt +10 -0
- data/spec/fixtures/rabobank_mt940_structured_multi_line.txt +14 -0
- data/spec/fixtures/rabobank_mt940_structured_savings_account.txt +11 -0
- data/spec/fixtures/rabobank_mt940_structured_to_savings_account.txt +10 -0
- data/spec/fixtures/rabobank_with_debet_previous_balance.txt +6 -0
- data/spec/fixtures/triodos.txt +14 -0
- data/spec/fixtures/two_accounts.txt +29 -0
- data/spec/fixtures/unknown.txt +22 -0
- data/spec/mt940_abnamro_spec.rb +244 -0
- data/spec/mt940_base_spec.rb +48 -0
- data/spec/mt940_ing_spec.rb +227 -0
- data/spec/mt940_rabobank_spec.rb +376 -0
- data/spec/mt940_triodos_spec.rb +58 -0
- data/spec/mt940_two_accounts_spec.rb +49 -0
- data/spec/spec_helper.rb +4 -0
- metadata +137 -0
@@ -0,0 +1,58 @@
|
|
1
|
+
require_relative 'spec_helper'
|
2
|
+
|
3
|
+
describe "Triodos" do
|
4
|
+
|
5
|
+
before :each do
|
6
|
+
@file_name = File.dirname(__FILE__) + '/fixtures/triodos.txt'
|
7
|
+
@bank_statements = MT940::Base.parse_mt940(@file_name)["390123456"]
|
8
|
+
@transactions = @bank_statements.flat_map(&:transactions)
|
9
|
+
@transaction = @transactions.first
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'have the correct number of transactions' do
|
13
|
+
@transactions.size.should == 2
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'get the opening balance and date' do
|
17
|
+
@bank_statements.first.previous_balance.amount.should ==4975.09
|
18
|
+
@bank_statements.first.previous_balance.date.should == Date.new(2011, 1, 1)
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'get the closing balance and date' do
|
22
|
+
@bank_statements.first.new_balance.amount.should == 4370.79
|
23
|
+
@bank_statements.first.new_balance.date.should == Date.new(2011, 2, 1)
|
24
|
+
end
|
25
|
+
|
26
|
+
context 'Transaction' do
|
27
|
+
|
28
|
+
it 'have a bank_account' do
|
29
|
+
@transaction.bank_account.should == '390123456'
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'have an amount' do
|
33
|
+
@transaction.amount.should == -15.7
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'have a currency' do
|
37
|
+
@transaction.currency.should == 'EUR'
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'have a description' do
|
41
|
+
@transaction.description.should == 'ALGEMENE TUSSENREKENING KOSTEN VAN 01-10-2010 TOT EN M ET 31-12-20100390123456'
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'have a date' do
|
45
|
+
@transaction.date.should == Date.new(2011,1,1)
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'return its bank' do
|
49
|
+
@transaction.bank.should == 'Triodos'
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'return the contra_account' do
|
53
|
+
@transaction.contra_account.should == '987654321'
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require_relative 'spec_helper'
|
2
|
+
|
3
|
+
describe "two accounts" do
|
4
|
+
before :each do
|
5
|
+
@file_name = File.dirname(__FILE__) + '/fixtures/two_accounts.txt'
|
6
|
+
@bank_statements = MT940::Base.parse_mt940(@file_name)
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'have the correct number of bank accounts' do
|
10
|
+
@bank_statements.size.should == 4
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'have the opening balance of bank account' do
|
14
|
+
@bank_statements["156750961"].first.previous_balance.amount.should == 9265.12
|
15
|
+
@bank_statements["156750961"].first.previous_balance.date.should == Date.new(2012, 9, 17)
|
16
|
+
|
17
|
+
@bank_statements["991430727"].first.previous_balance.amount.should == 352.84
|
18
|
+
@bank_statements["991430727"].first.previous_balance.date.should == Date.new(2012, 10, 23)
|
19
|
+
|
20
|
+
@bank_statements["3462483153"].first.previous_balance.amount.should == 5000
|
21
|
+
@bank_statements["3462483153"].first.previous_balance.date.should == Date.new(2012, 11, 1)
|
22
|
+
|
23
|
+
@bank_statements["132576155"].first.previous_balance.amount.should == -12
|
24
|
+
@bank_statements["132576155"].first.previous_balance.date.should == Date.new(2012, 10, 26)
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'have a closing balance of a bank account' do
|
28
|
+
@bank_statements["156750961"].last.new_balance.amount.should == 2666.37
|
29
|
+
@bank_statements["156750961"].last.new_balance.date.should == Date.new(2012, 9, 18)
|
30
|
+
|
31
|
+
@bank_statements["991430727"].last.new_balance.amount.should == 352.84
|
32
|
+
@bank_statements["991430727"].last.new_balance.date.should == Date.new(2012, 10, 24)
|
33
|
+
|
34
|
+
@bank_statements["3462483153"].last.new_balance.amount.should == 5000
|
35
|
+
@bank_statements["3462483153"].last.new_balance.date.should == Date.new(2012, 11, 1)
|
36
|
+
|
37
|
+
@bank_statements["132576155"].last.new_balance.amount.should == 238
|
38
|
+
@bank_statements["132576155"].last.new_balance.date.should == Date.new(2012, 10, 29)
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'have the number of transactions of bank account' do
|
42
|
+
@bank_statements["156750961"].flat_map(&:transactions).size.should == 2
|
43
|
+
@bank_statements["991430727"].flat_map(&:transactions).size.should == 0
|
44
|
+
|
45
|
+
@bank_statements["3462483153"].flat_map(&:transactions).size.should == 0
|
46
|
+
@bank_statements["132576155"].flat_map(&:transactions).size.should == 1
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: zilverline-mt940
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '1.0'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Lars Vonk
|
8
|
+
- Michael Franken
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2014-04-11 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ! '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
version_requirements: !ruby/object:Gem::Requirement
|
21
|
+
requirements:
|
22
|
+
- - ! '>='
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: '0'
|
25
|
+
type: :development
|
26
|
+
prerelease: false
|
27
|
+
name: rspec
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
version_requirements: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - ! '>='
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
type: :development
|
40
|
+
prerelease: false
|
41
|
+
name: rake
|
42
|
+
description: An extended MT940 parser with implementations for Dutch banks. Based
|
43
|
+
on basic parser from http://github.com/dovadi/mt940
|
44
|
+
email: lvonk@zilverline.com mfranken@zilverline.com
|
45
|
+
executables: []
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files:
|
48
|
+
- LICENSE.txt
|
49
|
+
- README.md
|
50
|
+
files:
|
51
|
+
- .document
|
52
|
+
- .gitignore
|
53
|
+
- .ruby-version
|
54
|
+
- CHANGELOG
|
55
|
+
- Gemfile
|
56
|
+
- Gemfile.lock
|
57
|
+
- LICENSE.txt
|
58
|
+
- README.md
|
59
|
+
- Rakefile
|
60
|
+
- lib/mt940.rb
|
61
|
+
- lib/mt940/bank_statement.rb
|
62
|
+
- lib/mt940/banks/abnamro.rb
|
63
|
+
- lib/mt940/banks/ing.rb
|
64
|
+
- lib/mt940/banks/rabobank.rb
|
65
|
+
- lib/mt940/banks/triodos.rb
|
66
|
+
- lib/mt940/base.rb
|
67
|
+
- lib/mt940/structured_format.rb
|
68
|
+
- lib/mt940/transaction.rb
|
69
|
+
- lib/mt940/version.rb
|
70
|
+
- mt940.gemspec
|
71
|
+
- spec/fixtures/abnamro.txt
|
72
|
+
- spec/fixtures/abnamro_structured.txt
|
73
|
+
- spec/fixtures/ing.txt
|
74
|
+
- spec/fixtures/ing_structured.txt
|
75
|
+
- spec/fixtures/rabobank.txt
|
76
|
+
- spec/fixtures/rabobank_mt940_structured.txt
|
77
|
+
- spec/fixtures/rabobank_mt940_structured_dutch_tax.txt
|
78
|
+
- spec/fixtures/rabobank_mt940_structured_multi_line.txt
|
79
|
+
- spec/fixtures/rabobank_mt940_structured_savings_account.txt
|
80
|
+
- spec/fixtures/rabobank_mt940_structured_to_savings_account.txt
|
81
|
+
- spec/fixtures/rabobank_with_debet_previous_balance.txt
|
82
|
+
- spec/fixtures/triodos.txt
|
83
|
+
- spec/fixtures/two_accounts.txt
|
84
|
+
- spec/fixtures/unknown.txt
|
85
|
+
- spec/mt940_abnamro_spec.rb
|
86
|
+
- spec/mt940_base_spec.rb
|
87
|
+
- spec/mt940_ing_spec.rb
|
88
|
+
- spec/mt940_rabobank_spec.rb
|
89
|
+
- spec/mt940_triodos_spec.rb
|
90
|
+
- spec/mt940_two_accounts_spec.rb
|
91
|
+
- spec/spec_helper.rb
|
92
|
+
homepage: https://github.com/zilverline/mt940
|
93
|
+
licenses:
|
94
|
+
- MIT
|
95
|
+
metadata: {}
|
96
|
+
post_install_message:
|
97
|
+
rdoc_options: []
|
98
|
+
require_paths:
|
99
|
+
- lib
|
100
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ! '>='
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
requirements: []
|
111
|
+
rubyforge_project: mt940
|
112
|
+
rubygems_version: 2.0.6
|
113
|
+
signing_key:
|
114
|
+
specification_version: 4
|
115
|
+
summary: MT940 parser
|
116
|
+
test_files:
|
117
|
+
- spec/fixtures/abnamro.txt
|
118
|
+
- spec/fixtures/abnamro_structured.txt
|
119
|
+
- spec/fixtures/ing.txt
|
120
|
+
- spec/fixtures/ing_structured.txt
|
121
|
+
- spec/fixtures/rabobank.txt
|
122
|
+
- spec/fixtures/rabobank_mt940_structured.txt
|
123
|
+
- spec/fixtures/rabobank_mt940_structured_dutch_tax.txt
|
124
|
+
- spec/fixtures/rabobank_mt940_structured_multi_line.txt
|
125
|
+
- spec/fixtures/rabobank_mt940_structured_savings_account.txt
|
126
|
+
- spec/fixtures/rabobank_mt940_structured_to_savings_account.txt
|
127
|
+
- spec/fixtures/rabobank_with_debet_previous_balance.txt
|
128
|
+
- spec/fixtures/triodos.txt
|
129
|
+
- spec/fixtures/two_accounts.txt
|
130
|
+
- spec/fixtures/unknown.txt
|
131
|
+
- spec/mt940_abnamro_spec.rb
|
132
|
+
- spec/mt940_base_spec.rb
|
133
|
+
- spec/mt940_ing_spec.rb
|
134
|
+
- spec/mt940_rabobank_spec.rb
|
135
|
+
- spec/mt940_triodos_spec.rb
|
136
|
+
- spec/mt940_two_accounts_spec.rb
|
137
|
+
- spec/spec_helper.rb
|