mt940_parser 1.4.1 → 1.5.3
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 +5 -5
- data/.document +1 -1
- data/.specification +25 -26
- data/.travis.yml +9 -1
- data/{README.rdoc → README.md} +7 -5
- data/Rakefile +1 -2
- data/VERSION +1 -1
- data/lib/mt940.rb +36 -8
- data/lib/mt940/customer_statement_message.rb +2 -2
- data/lib/mt940/version.rb +1 -1
- data/mt940_parser.gemspec +23 -29
- data/test/fixtures/colon_in_descriptor.txt +3 -0
- data/test/fixtures/colon_in_descriptor.yml +13 -0
- data/test/fixtures/currency_in_25.yml +2 -4
- data/test/fixtures/sepa_mt9401.yml +52 -104
- data/test/test_account_identifier.rb +32 -0
- data/test/test_customer_statement_message.rb +5 -1
- data/test/{helper.rb → test_helper.rb} +0 -8
- data/test/test_mt940.rb +2 -1
- metadata +17 -28
- data/VERSION.yml +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: '092f1e507213d85a4c94c5685e55a49c7dc9246ee6188c4c5d2cc7609355fa31'
|
4
|
+
data.tar.gz: 021d003331e57253a8e05e20847ebcdb0bbfbc173062960014cb99cf4cae081b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54df6bec1b0ed2b7e6e8b63b3ef710ab886b78df5da253e977ad68f893d5118c8f189faaeca400305f01cf34fdd8368a12ccdf6934aca454a1a702e71ae63533
|
7
|
+
data.tar.gz: ac777c871fd6c0fd1e51461cf5ee2509085197e7036cda2aa297ebe05dfa90d473e61c45da9633f63c8670e3d30cd6e94001ce39a833dbc70b2157658c9a0190
|
data/.document
CHANGED
data/.specification
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: mt940
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
4
|
hash: 23
|
5
|
-
segments:
|
5
|
+
segments:
|
6
6
|
- 1
|
7
7
|
- 0
|
8
8
|
- 0
|
@@ -10,58 +10,57 @@ version: !ruby/object:Gem::Version
|
|
10
10
|
platform: ruby
|
11
11
|
authors: []
|
12
12
|
|
13
|
-
autorequire:
|
13
|
+
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
17
|
date: 2010-03-24 00:00:00 +01:00
|
18
|
-
default_executable:
|
18
|
+
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|
21
|
-
description:
|
22
|
-
email:
|
21
|
+
description:
|
22
|
+
email:
|
23
23
|
executables: []
|
24
24
|
|
25
25
|
extensions: []
|
26
26
|
|
27
27
|
extra_rdoc_files: []
|
28
28
|
|
29
|
-
files:
|
29
|
+
files:
|
30
30
|
- lib
|
31
31
|
- lib/mt940.rb
|
32
|
-
has_rdoc:
|
33
|
-
homepage:
|
32
|
+
has_rdoc: false
|
33
|
+
homepage:
|
34
34
|
licenses: []
|
35
35
|
|
36
|
-
post_install_message:
|
36
|
+
post_install_message:
|
37
37
|
rdoc_options: []
|
38
38
|
|
39
|
-
require_paths:
|
39
|
+
require_paths:
|
40
40
|
- lib
|
41
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
42
|
-
requirements:
|
41
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
42
|
+
requirements:
|
43
43
|
- - ">="
|
44
|
-
- !ruby/object:Gem::Version
|
44
|
+
- !ruby/object:Gem::Version
|
45
45
|
hash: 3
|
46
|
-
segments:
|
46
|
+
segments:
|
47
47
|
- 0
|
48
48
|
version: "0"
|
49
|
-
version:
|
50
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
49
|
+
version:
|
50
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
52
|
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
53
|
+
- !ruby/object:Gem::Version
|
54
54
|
hash: 3
|
55
|
-
segments:
|
55
|
+
segments:
|
56
56
|
- 0
|
57
57
|
version: "0"
|
58
|
-
version:
|
58
|
+
version:
|
59
59
|
requirements: []
|
60
60
|
|
61
|
-
rubyforge_project:
|
61
|
+
rubyforge_project:
|
62
62
|
rubygems_version: 1.3.7
|
63
|
-
signing_key:
|
63
|
+
signing_key:
|
64
64
|
specification_version: 3
|
65
|
-
summary:
|
65
|
+
summary:
|
66
66
|
test_files: []
|
67
|
-
|
data/.travis.yml
CHANGED
data/{README.rdoc → README.md}
RENAMED
@@ -1,12 +1,14 @@
|
|
1
|
-
=
|
1
|
+
[](http://badge.fury.io/rb/mt940_parser) [](http://travis-ci.org/betterplace/mt940_parser)
|
2
2
|
|
3
|
-
|
3
|
+
# mt940_parser
|
4
|
+
|
5
|
+
This is a library to parse account statements which are formatted as SWIFT mt940.
|
4
6
|
|
5
7
|
See the following link for documentation of the format.
|
6
8
|
http://www.google.de/url?sa=t&source=web&cd=1&ved=0CBwQFjAA&url=http%3A%2F%2Fmartin.hinner.info%2Fbankconvert%2Fswift_mt940_942.pdf&ei=alO_TObpPNGRswbD15WqDQ&usg=AFQjCNHkVGOfzofgKkk6dEkynAho02S2cg
|
7
9
|
|
8
|
-
|
9
|
-
|
10
|
+
## Note on Patches/Pull Requests
|
11
|
+
|
10
12
|
* Fork the project.
|
11
13
|
* Make your feature addition or bug fix.
|
12
14
|
* Add tests for it. This is important so I don't break it in a
|
@@ -15,6 +17,6 @@ http://www.google.de/url?sa=t&source=web&cd=1&ved=0CBwQFjAA&url=http%3A%2F%2Fmar
|
|
15
17
|
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
16
18
|
* Send me a pull request. Bonus points for topic branches.
|
17
19
|
|
18
|
-
|
20
|
+
## Copyright
|
19
21
|
|
20
22
|
Copyright (c) 2010 Thies C. Arntzen. See LICENSE for details.
|
data/Rakefile
CHANGED
@@ -18,11 +18,10 @@ GemHadar do
|
|
18
18
|
ignore '.*.sw[pon]', 'pkg', 'Gemfile.lock', '.rvmrc', 'coverage',
|
19
19
|
'.DS_Store', '.ruby-gemset', '.ruby-version', '.bundle', '.AppleDouble'
|
20
20
|
|
21
|
-
readme 'README.
|
21
|
+
readme 'README.md'
|
22
22
|
licenses 'MIT'
|
23
23
|
|
24
24
|
development_dependency 'test-unit'
|
25
|
-
development_dependency 'simplecov'
|
26
25
|
end
|
27
26
|
|
28
27
|
task :default => :test
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.5.3
|
data/lib/mt940.rb
CHANGED
@@ -2,6 +2,8 @@ require 'mt940/version'
|
|
2
2
|
require 'mt940/errors'
|
3
3
|
require 'mt940/customer_statement_message'
|
4
4
|
require 'bigdecimal'
|
5
|
+
require 'bigdecimal/util'
|
6
|
+
require 'date'
|
5
7
|
|
6
8
|
class MT940
|
7
9
|
class Field
|
@@ -13,12 +15,12 @@ class MT940
|
|
13
15
|
class << self
|
14
16
|
|
15
17
|
def for(line)
|
16
|
-
if line.match(/^:(\d{2
|
18
|
+
if line.match(/^:(\d{2})(\w)?:(.*)$/)
|
17
19
|
number, modifier, content = $1, $2, $3
|
18
20
|
klass = {
|
19
21
|
'20' => Job,
|
20
22
|
'21' => Reference,
|
21
|
-
'25' =>
|
23
|
+
'25' => AccountIdentification,
|
22
24
|
'28' => Statement,
|
23
25
|
'60' => AccountBalance,
|
24
26
|
'61' => StatementLine,
|
@@ -48,17 +50,17 @@ class MT940
|
|
48
50
|
def parse_amount_in_cents(amount)
|
49
51
|
amount =~ /\A(\d+)(,\d*)?\z/ or
|
50
52
|
raise Errors::InvalidAmountFormatError, "invalid amount #{amount.inspect}"
|
51
|
-
(100 *
|
53
|
+
(100 * amount.sub(',', '.').sub(/\.\z/, '').to_d).floor
|
52
54
|
end
|
53
55
|
|
54
56
|
def parse_date(date)
|
55
57
|
date.match(DATE)
|
56
|
-
Date.new("20#{$1}".to_i, $2.to_i, $3.to_i)
|
58
|
+
::Date.new("20#{$1}".to_i, $2.to_i, $3.to_i)
|
57
59
|
end
|
58
60
|
|
59
61
|
def parse_entry_date(raw_entry_date, value_date)
|
60
62
|
raw_entry_date.match(SHORT_DATE)
|
61
|
-
entry_date = Date.new(value_date.year, $1.to_i, $2.to_i)
|
63
|
+
entry_date = ::Date.new(value_date.year, $1.to_i, $2.to_i)
|
62
64
|
unless entry_date.year == value_date.year
|
63
65
|
raise "Unhandled case: value date and entry date are in different years"
|
64
66
|
end
|
@@ -80,6 +82,30 @@ class MT940
|
|
80
82
|
end
|
81
83
|
|
82
84
|
# 25
|
85
|
+
class AccountIdentification < Field
|
86
|
+
attr_reader :account_identifier
|
87
|
+
CONTENT = /(.{1,35})/ #any 35 chars (35x from the docs)
|
88
|
+
|
89
|
+
def parse_content(content)
|
90
|
+
content.match(CONTENT)
|
91
|
+
@account_identifier = $1
|
92
|
+
end
|
93
|
+
|
94
|
+
# fail over to the old Account class
|
95
|
+
def method_missing(method, *args, &block)
|
96
|
+
@fail_over_implementation ||= Account.new(@modifier, @content)
|
97
|
+
value = @fail_over_implementation.send(method)
|
98
|
+
warn "[DEPRECATION]:"
|
99
|
+
warn "You used '#{method}' on the Account/AccountIdentification class"
|
100
|
+
warn "This field is not part of the MT940 specification but implementation specific"
|
101
|
+
warn "Please use the 'account_identifier' and parse yourself."
|
102
|
+
|
103
|
+
value
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
# 25 - Legacy
|
108
|
+
# This class is deprecated as it does not match the spec.
|
83
109
|
class Account < Field
|
84
110
|
attr_reader :bank_code, :account_number, :account_currency
|
85
111
|
|
@@ -141,7 +167,7 @@ class MT940
|
|
141
167
|
when 'ALT', '0'
|
142
168
|
nil
|
143
169
|
when DATE
|
144
|
-
Date.new("20#{$1}".to_i, $2.to_i, $3.to_i)
|
170
|
+
::Date.new("20#{$1}".to_i, $2.to_i, $3.to_i)
|
145
171
|
end
|
146
172
|
end
|
147
173
|
end
|
@@ -246,8 +272,10 @@ class MT940
|
|
246
272
|
class << self
|
247
273
|
def parse(text)
|
248
274
|
new_text = text.encode('UTF-8').strip
|
249
|
-
new_text << "\r\n" if new_text
|
250
|
-
raw_sheets = new_text.split(/^-\s*\r\n/).map
|
275
|
+
new_text << "\r\n" if new_text.end_with?('-')
|
276
|
+
raw_sheets = new_text.split(/^-\s*\r\n/).map do |sheet|
|
277
|
+
sheet.gsub(/\r\n(?!:\d{2}\w?:)/, '')
|
278
|
+
end
|
251
279
|
sheets = raw_sheets.map { |raw_sheet| parse_sheet(raw_sheet) }
|
252
280
|
end
|
253
281
|
|
@@ -4,7 +4,7 @@
|
|
4
4
|
class MT940
|
5
5
|
class CustomerStatementMessage
|
6
6
|
|
7
|
-
attr_reader :statement_lines
|
7
|
+
attr_reader :account, :statement_lines
|
8
8
|
|
9
9
|
def self.parse_file(file)
|
10
10
|
self.parse(File.read(file))
|
@@ -16,7 +16,7 @@ class MT940
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def initialize(lines)
|
19
|
-
@account = lines.find { |line| line.class == MT940::
|
19
|
+
@account = lines.find { |line| line.class == MT940::AccountIdentification }
|
20
20
|
@statement_lines = []
|
21
21
|
lines.each_with_index do |line, i|
|
22
22
|
next unless line.class == MT940::StatementLine
|
data/lib/mt940/version.rb
CHANGED
data/mt940_parser.gemspec
CHANGED
@@ -1,40 +1,34 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: mt940_parser 1.
|
2
|
+
# stub: mt940_parser 1.5.3 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
|
-
s.name = "mt940_parser"
|
6
|
-
s.version = "1.
|
5
|
+
s.name = "mt940_parser".freeze
|
6
|
+
s.version = "1.5.3"
|
7
7
|
|
8
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
9
|
-
s.require_paths = ["lib"]
|
10
|
-
s.authors = ["Thies C. Arntzen", "Phillip Oertel"]
|
11
|
-
s.date = "
|
12
|
-
s.description = "Ruby library that parses account statements in the SWIFT MT940 format."
|
13
|
-
s.email = "developers@betterplace.org"
|
14
|
-
s.extra_rdoc_files = ["README.
|
15
|
-
s.files = [".document", ".gitignore", ".specification", ".travis.yml", "Gemfile", "LICENSE", "README.
|
16
|
-
s.homepage = "http://github.com/betterplace/mt940_parser"
|
17
|
-
s.licenses = ["MIT"]
|
18
|
-
s.rdoc_options = ["--title", "Mt940Parser - MT940 parses account statements in the SWIFT MT940 format.", "--main", "README.
|
19
|
-
s.rubygems_version = "2.
|
20
|
-
s.summary = "MT940 parses account statements in the SWIFT MT940 format."
|
21
|
-
s.test_files = ["test/test_customer_statement_message.rb", "test/test_mt940.rb"]
|
8
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
9
|
+
s.require_paths = ["lib".freeze]
|
10
|
+
s.authors = ["Thies C. Arntzen".freeze, "Phillip Oertel".freeze]
|
11
|
+
s.date = "2021-06-17"
|
12
|
+
s.description = "Ruby library that parses account statements in the SWIFT MT940 format.".freeze
|
13
|
+
s.email = "developers@betterplace.org".freeze
|
14
|
+
s.extra_rdoc_files = ["README.md".freeze, "lib/mt940.rb".freeze, "lib/mt940/customer_statement_message.rb".freeze, "lib/mt940/errors.rb".freeze, "lib/mt940/version.rb".freeze]
|
15
|
+
s.files = [".document".freeze, ".gitignore".freeze, ".specification".freeze, ".travis.yml".freeze, "Gemfile".freeze, "LICENSE".freeze, "README.md".freeze, "Rakefile".freeze, "VERSION".freeze, "docs/0E0Y00DNY.pdf".freeze, "docs/FinTS_4.0_Formals.pdf".freeze, "docs/FinTS_4.0_Messages_Finanzdatenformate.pdf".freeze, "docs/MT940_Deutschland_Structure2002.pdf".freeze, "docs/SEPA_20MT940__Schnittstellenbeschreibung.pdf".freeze, "docs/mt940.pdf".freeze, "docs/swift_mt940_942.pdf".freeze, "docs/uebersicht_der_geschaeftsvorfallcodes_und_buchungs_textschluessel.pdf".freeze, "lib/mt940.rb".freeze, "lib/mt940/customer_statement_message.rb".freeze, "lib/mt940/errors.rb".freeze, "lib/mt940/version.rb".freeze, "mt940_parser.gemspec".freeze, "test/fixtures/amount_formats.txt".freeze, "test/fixtures/amount_formats.yml".freeze, "test/fixtures/colon_in_descriptor.txt".freeze, "test/fixtures/colon_in_descriptor.yml".freeze, "test/fixtures/currency_in_25.txt".freeze, "test/fixtures/currency_in_25.yml".freeze, "test/fixtures/empty_86.txt".freeze, "test/fixtures/empty_86.yml".freeze, "test/fixtures/empty_entry_date.txt".freeze, "test/fixtures/empty_entry_date.yml".freeze, "test/fixtures/empty_line.txt".freeze, "test/fixtures/empty_line.yml".freeze, "test/fixtures/missing_crlf_at_end.txt".freeze, "test/fixtures/missing_crlf_at_end.yml".freeze, "test/fixtures/sepa_mt9401.txt".freeze, "test/fixtures/sepa_mt9401.yml".freeze, "test/fixtures/sepa_snippet.txt".freeze, "test/fixtures/sepa_snippet_broken.txt".freeze, "test/fixtures/with_binary_character.txt".freeze, "test/fixtures/with_binary_character.yml".freeze, "test/test_account_identifier.rb".freeze, "test/test_customer_statement_message.rb".freeze, "test/test_helper.rb".freeze, "test/test_mt940.rb".freeze]
|
16
|
+
s.homepage = "http://github.com/betterplace/mt940_parser".freeze
|
17
|
+
s.licenses = ["MIT".freeze]
|
18
|
+
s.rdoc_options = ["--title".freeze, "Mt940Parser - MT940 parses account statements in the SWIFT MT940 format.".freeze, "--main".freeze, "README.md".freeze]
|
19
|
+
s.rubygems_version = "3.2.3".freeze
|
20
|
+
s.summary = "MT940 parses account statements in the SWIFT MT940 format.".freeze
|
21
|
+
s.test_files = ["test/test_account_identifier.rb".freeze, "test/test_customer_statement_message.rb".freeze, "test/test_helper.rb".freeze, "test/test_mt940.rb".freeze]
|
22
22
|
|
23
23
|
if s.respond_to? :specification_version then
|
24
24
|
s.specification_version = 4
|
25
|
+
end
|
25
26
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
30
|
-
else
|
31
|
-
s.add_dependency(%q<gem_hadar>, ["~> 1.0.0"])
|
32
|
-
s.add_dependency(%q<test-unit>, [">= 0"])
|
33
|
-
s.add_dependency(%q<simplecov>, [">= 0"])
|
34
|
-
end
|
27
|
+
if s.respond_to? :add_runtime_dependency then
|
28
|
+
s.add_development_dependency(%q<gem_hadar>.freeze, ["~> 1.11.0"])
|
29
|
+
s.add_development_dependency(%q<test-unit>.freeze, [">= 0"])
|
35
30
|
else
|
36
|
-
s.add_dependency(%q<gem_hadar
|
37
|
-
s.add_dependency(%q<test-unit
|
38
|
-
s.add_dependency(%q<simplecov>, [">= 0"])
|
31
|
+
s.add_dependency(%q<gem_hadar>.freeze, ["~> 1.11.0"])
|
32
|
+
s.add_dependency(%q<test-unit>.freeze, [">= 0"])
|
39
33
|
end
|
40
34
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
---
|
2
|
+
- - !ruby/object:MT940::StatementLineInformation
|
3
|
+
modifier:
|
4
|
+
content: '166?20Spende abcdefghijklmnopqrstuvwxyzabcde Verwendungszweck: ?701234567
|
5
|
+
Betterplace?30ABCDEFGH?31DE12345678912345789012?32Abcdefg Hijklmnop'
|
6
|
+
code: 166
|
7
|
+
bank_code: ABCDEFGH
|
8
|
+
account_number: DE12345678912345789012
|
9
|
+
not_implemented_fields:
|
10
|
+
- - '70'
|
11
|
+
- 1234567 Betterplace
|
12
|
+
details: 'Spende abcdefghijklmnopqrstuvwxyzabcde Verwendungszweck: '
|
13
|
+
account_holder: Abcdefg Hijklmnop
|
@@ -3,12 +3,10 @@
|
|
3
3
|
modifier:
|
4
4
|
content: T089413946000001
|
5
5
|
reference: T089413946000001
|
6
|
-
- !ruby/object:MT940::
|
6
|
+
- !ruby/object:MT940::AccountIdentification
|
7
7
|
modifier:
|
8
8
|
content: 50880050/0194774600888
|
9
|
-
|
10
|
-
account_number: 0194774600888
|
11
|
-
account_currency:
|
9
|
+
account_identifier: 50880050/0194774600888
|
12
10
|
- !ruby/object:MT940::Statement
|
13
11
|
modifier: C
|
14
12
|
content: 00004/00001
|
@@ -192,12 +190,10 @@
|
|
192
190
|
modifier:
|
193
191
|
content: T089413956000001
|
194
192
|
reference: T089413956000001
|
195
|
-
- !ruby/object:MT940::
|
193
|
+
- !ruby/object:MT940::AccountIdentification
|
196
194
|
modifier:
|
197
195
|
content: 50880050/0194777100888
|
198
|
-
|
199
|
-
account_number: 0194777100888
|
200
|
-
account_currency:
|
196
|
+
account_identifier: 50880050/0194777100888
|
201
197
|
- !ruby/object:MT940::Statement
|
202
198
|
modifier: C
|
203
199
|
content: 00004/00001
|
@@ -297,12 +293,10 @@
|
|
297
293
|
modifier:
|
298
294
|
content: T089413966000001
|
299
295
|
reference: T089413966000001
|
300
|
-
- !ruby/object:MT940::
|
296
|
+
- !ruby/object:MT940::AccountIdentification
|
301
297
|
modifier:
|
302
298
|
content: 50880050/0194778300888
|
303
|
-
|
304
|
-
account_number: 0194778300888
|
305
|
-
account_currency:
|
299
|
+
account_identifier: 50880050/0194778300888
|
306
300
|
- !ruby/object:MT940::Statement
|
307
301
|
modifier: C
|
308
302
|
content: 00004/00001
|
@@ -477,12 +471,10 @@
|
|
477
471
|
modifier:
|
478
472
|
content: T089413976000001
|
479
473
|
reference: T089413976000001
|
480
|
-
- !ruby/object:MT940::
|
474
|
+
- !ruby/object:MT940::AccountIdentification
|
481
475
|
modifier:
|
482
476
|
content: 50880050/0194779500888
|
483
|
-
|
484
|
-
account_number: 0194779500888
|
485
|
-
account_currency:
|
477
|
+
account_identifier: 50880050/0194779500888
|
486
478
|
- !ruby/object:MT940::Statement
|
487
479
|
modifier: C
|
488
480
|
content: 00004/00001
|
@@ -605,12 +597,10 @@
|
|
605
597
|
modifier:
|
606
598
|
content: T089413986000001
|
607
599
|
reference: T089413986000001
|
608
|
-
- !ruby/object:MT940::
|
600
|
+
- !ruby/object:MT940::AccountIdentification
|
609
601
|
modifier:
|
610
602
|
content: 50880050/0194780100888
|
611
|
-
|
612
|
-
account_number: 0194780100888
|
613
|
-
account_currency:
|
603
|
+
account_identifier: 50880050/0194780100888
|
614
604
|
- !ruby/object:MT940::Statement
|
615
605
|
modifier: C
|
616
606
|
content: 00004/00001
|
@@ -751,12 +741,10 @@
|
|
751
741
|
modifier:
|
752
742
|
content: T089413996000001
|
753
743
|
reference: T089413996000001
|
754
|
-
- !ruby/object:MT940::
|
744
|
+
- !ruby/object:MT940::AccountIdentification
|
755
745
|
modifier:
|
756
746
|
content: 50880050/0194780101888
|
757
|
-
|
758
|
-
account_number: 0194780101888
|
759
|
-
account_currency:
|
747
|
+
account_identifier: 50880050/0194780101888
|
760
748
|
- !ruby/object:MT940::Statement
|
761
749
|
modifier: C
|
762
750
|
content: 00004/00001
|
@@ -818,12 +806,10 @@
|
|
818
806
|
modifier:
|
819
807
|
content: T089414006000001
|
820
808
|
reference: T089414006000001
|
821
|
-
- !ruby/object:MT940::
|
809
|
+
- !ruby/object:MT940::AccountIdentification
|
822
810
|
modifier:
|
823
811
|
content: 50880050/0194781300888
|
824
|
-
|
825
|
-
account_number: 0194781300888
|
826
|
-
account_currency:
|
812
|
+
account_identifier: 50880050/0194781300888
|
827
813
|
- !ruby/object:MT940::Statement
|
828
814
|
modifier: C
|
829
815
|
content: 00004/00001
|
@@ -985,12 +971,10 @@
|
|
985
971
|
modifier:
|
986
972
|
content: T089414006000002
|
987
973
|
reference: T089414006000002
|
988
|
-
- !ruby/object:MT940::
|
974
|
+
- !ruby/object:MT940::AccountIdentification
|
989
975
|
modifier:
|
990
976
|
content: 50880050/0194781300888
|
991
|
-
|
992
|
-
account_number: 0194781300888
|
993
|
-
account_currency:
|
977
|
+
account_identifier: 50880050/0194781300888
|
994
978
|
- !ruby/object:MT940::Statement
|
995
979
|
modifier: C
|
996
980
|
content: 00004/00002
|
@@ -1158,12 +1142,10 @@
|
|
1158
1142
|
modifier:
|
1159
1143
|
content: T089414016000001
|
1160
1144
|
reference: T089414016000001
|
1161
|
-
- !ruby/object:MT940::
|
1145
|
+
- !ruby/object:MT940::AccountIdentification
|
1162
1146
|
modifier:
|
1163
1147
|
content: 50880050/0194782500888
|
1164
|
-
|
1165
|
-
account_number: 0194782500888
|
1166
|
-
account_currency:
|
1148
|
+
account_identifier: 50880050/0194782500888
|
1167
1149
|
- !ruby/object:MT940::Statement
|
1168
1150
|
modifier: C
|
1169
1151
|
content: 00004/00001
|
@@ -1383,12 +1365,10 @@
|
|
1383
1365
|
modifier:
|
1384
1366
|
content: T089414016000002
|
1385
1367
|
reference: T089414016000002
|
1386
|
-
- !ruby/object:MT940::
|
1368
|
+
- !ruby/object:MT940::AccountIdentification
|
1387
1369
|
modifier:
|
1388
1370
|
content: 50880050/0194782500888
|
1389
|
-
|
1390
|
-
account_number: 0194782500888
|
1391
|
-
account_currency:
|
1371
|
+
account_identifier: 50880050/0194782500888
|
1392
1372
|
- !ruby/object:MT940::Statement
|
1393
1373
|
modifier: C
|
1394
1374
|
content: 00004/00002
|
@@ -1490,12 +1470,10 @@
|
|
1490
1470
|
modifier:
|
1491
1471
|
content: T089414026000001
|
1492
1472
|
reference: T089414026000001
|
1493
|
-
- !ruby/object:MT940::
|
1473
|
+
- !ruby/object:MT940::AccountIdentification
|
1494
1474
|
modifier:
|
1495
1475
|
content: 50880050/0194783700888
|
1496
|
-
|
1497
|
-
account_number: 0194783700888
|
1498
|
-
account_currency:
|
1476
|
+
account_identifier: 50880050/0194783700888
|
1499
1477
|
- !ruby/object:MT940::Statement
|
1500
1478
|
modifier: C
|
1501
1479
|
content: 00004/00001
|
@@ -1685,12 +1663,10 @@
|
|
1685
1663
|
modifier:
|
1686
1664
|
content: T089414026000002
|
1687
1665
|
reference: T089414026000002
|
1688
|
-
- !ruby/object:MT940::
|
1666
|
+
- !ruby/object:MT940::AccountIdentification
|
1689
1667
|
modifier:
|
1690
1668
|
content: 50880050/0194783700888
|
1691
|
-
|
1692
|
-
account_number: 0194783700888
|
1693
|
-
account_currency:
|
1669
|
+
account_identifier: 50880050/0194783700888
|
1694
1670
|
- !ruby/object:MT940::Statement
|
1695
1671
|
modifier: C
|
1696
1672
|
content: 00004/00002
|
@@ -1878,12 +1854,10 @@
|
|
1878
1854
|
modifier:
|
1879
1855
|
content: T089414036000001
|
1880
1856
|
reference: T089414036000001
|
1881
|
-
- !ruby/object:MT940::
|
1857
|
+
- !ruby/object:MT940::AccountIdentification
|
1882
1858
|
modifier:
|
1883
1859
|
content: 50880050/0194784900888
|
1884
|
-
|
1885
|
-
account_number: 0194784900888
|
1886
|
-
account_currency:
|
1860
|
+
account_identifier: 50880050/0194784900888
|
1887
1861
|
- !ruby/object:MT940::Statement
|
1888
1862
|
modifier: C
|
1889
1863
|
content: 00004/00001
|
@@ -2068,12 +2042,10 @@
|
|
2068
2042
|
modifier:
|
2069
2043
|
content: T089414036000002
|
2070
2044
|
reference: T089414036000002
|
2071
|
-
- !ruby/object:MT940::
|
2045
|
+
- !ruby/object:MT940::AccountIdentification
|
2072
2046
|
modifier:
|
2073
2047
|
content: 50880050/0194784900888
|
2074
|
-
|
2075
|
-
account_number: 0194784900888
|
2076
|
-
account_currency:
|
2048
|
+
account_identifier: 50880050/0194784900888
|
2077
2049
|
- !ruby/object:MT940::Statement
|
2078
2050
|
modifier: C
|
2079
2051
|
content: 00004/00002
|
@@ -2173,12 +2145,10 @@
|
|
2173
2145
|
modifier:
|
2174
2146
|
content: T089414046000001
|
2175
2147
|
reference: T089414046000001
|
2176
|
-
- !ruby/object:MT940::
|
2148
|
+
- !ruby/object:MT940::AccountIdentification
|
2177
2149
|
modifier:
|
2178
2150
|
content: 50880050/0194784901888
|
2179
|
-
|
2180
|
-
account_number: 0194784901888
|
2181
|
-
account_currency:
|
2151
|
+
account_identifier: 50880050/0194784901888
|
2182
2152
|
- !ruby/object:MT940::Statement
|
2183
2153
|
modifier: C
|
2184
2154
|
content: 00003/00001
|
@@ -2245,12 +2215,10 @@
|
|
2245
2215
|
modifier:
|
2246
2216
|
content: T089414056000001
|
2247
2217
|
reference: T089414056000001
|
2248
|
-
- !ruby/object:MT940::
|
2218
|
+
- !ruby/object:MT940::AccountIdentification
|
2249
2219
|
modifier:
|
2250
2220
|
content: 50880050/0194785000888
|
2251
|
-
|
2252
|
-
account_number: 0194785000888
|
2253
|
-
account_currency:
|
2221
|
+
account_identifier: 50880050/0194785000888
|
2254
2222
|
- !ruby/object:MT940::Statement
|
2255
2223
|
modifier: C
|
2256
2224
|
content: 00004/00001
|
@@ -2421,12 +2389,10 @@
|
|
2421
2389
|
modifier:
|
2422
2390
|
content: T089414056000002
|
2423
2391
|
reference: T089414056000002
|
2424
|
-
- !ruby/object:MT940::
|
2392
|
+
- !ruby/object:MT940::AccountIdentification
|
2425
2393
|
modifier:
|
2426
2394
|
content: 50880050/0194785000888
|
2427
|
-
|
2428
|
-
account_number: 0194785000888
|
2429
|
-
account_currency:
|
2395
|
+
account_identifier: 50880050/0194785000888
|
2430
2396
|
- !ruby/object:MT940::Statement
|
2431
2397
|
modifier: C
|
2432
2398
|
content: 00004/00002
|
@@ -2594,12 +2560,10 @@
|
|
2594
2560
|
modifier:
|
2595
2561
|
content: T089414056000003
|
2596
2562
|
reference: T089414056000003
|
2597
|
-
- !ruby/object:MT940::
|
2563
|
+
- !ruby/object:MT940::AccountIdentification
|
2598
2564
|
modifier:
|
2599
2565
|
content: 50880050/0194785000888
|
2600
|
-
|
2601
|
-
account_number: 0194785000888
|
2602
|
-
account_currency:
|
2566
|
+
account_identifier: 50880050/0194785000888
|
2603
2567
|
- !ruby/object:MT940::Statement
|
2604
2568
|
modifier: C
|
2605
2569
|
content: 00004/00003
|
@@ -2696,12 +2660,10 @@
|
|
2696
2660
|
modifier:
|
2697
2661
|
content: T089414066000001
|
2698
2662
|
reference: T089414066000001
|
2699
|
-
- !ruby/object:MT940::
|
2663
|
+
- !ruby/object:MT940::AccountIdentification
|
2700
2664
|
modifier:
|
2701
2665
|
content: 50880050/0194785001888
|
2702
|
-
|
2703
|
-
account_number: 0194785001888
|
2704
|
-
account_currency:
|
2666
|
+
account_identifier: 50880050/0194785001888
|
2705
2667
|
- !ruby/object:MT940::Statement
|
2706
2668
|
modifier: C
|
2707
2669
|
content: 00004/00001
|
@@ -2763,12 +2725,10 @@
|
|
2763
2725
|
modifier:
|
2764
2726
|
content: T089414076000001
|
2765
2727
|
reference: T089414076000001
|
2766
|
-
- !ruby/object:MT940::
|
2728
|
+
- !ruby/object:MT940::AccountIdentification
|
2767
2729
|
modifier:
|
2768
2730
|
content: 50880050/0194786200888
|
2769
|
-
|
2770
|
-
account_number: 0194786200888
|
2771
|
-
account_currency:
|
2731
|
+
account_identifier: 50880050/0194786200888
|
2772
2732
|
- !ruby/object:MT940::Statement
|
2773
2733
|
modifier: C
|
2774
2734
|
content: 00004/00001
|
@@ -2891,12 +2851,10 @@
|
|
2891
2851
|
modifier:
|
2892
2852
|
content: T089414086000001
|
2893
2853
|
reference: T089414086000001
|
2894
|
-
- !ruby/object:MT940::
|
2854
|
+
- !ruby/object:MT940::AccountIdentification
|
2895
2855
|
modifier:
|
2896
2856
|
content: 50880050/0194787400888
|
2897
|
-
|
2898
|
-
account_number: 0194787400888
|
2899
|
-
account_currency:
|
2857
|
+
account_identifier: 50880050/0194787400888
|
2900
2858
|
- !ruby/object:MT940::Statement
|
2901
2859
|
modifier: C
|
2902
2860
|
content: 00004/00001
|
@@ -3043,12 +3001,10 @@
|
|
3043
3001
|
modifier:
|
3044
3002
|
content: T089414096000001
|
3045
3003
|
reference: T089414096000001
|
3046
|
-
- !ruby/object:MT940::
|
3004
|
+
- !ruby/object:MT940::AccountIdentification
|
3047
3005
|
modifier:
|
3048
3006
|
content: 50880050/0194791600888
|
3049
|
-
|
3050
|
-
account_number: 0194791600888
|
3051
|
-
account_currency:
|
3007
|
+
account_identifier: 50880050/0194791600888
|
3052
3008
|
- !ruby/object:MT940::Statement
|
3053
3009
|
modifier: C
|
3054
3010
|
content: 00004/00001
|
@@ -3264,12 +3220,10 @@
|
|
3264
3220
|
modifier:
|
3265
3221
|
content: T089414106000001
|
3266
3222
|
reference: T089414106000001
|
3267
|
-
- !ruby/object:MT940::
|
3223
|
+
- !ruby/object:MT940::AccountIdentification
|
3268
3224
|
modifier:
|
3269
3225
|
content: 50880050/0194791601888
|
3270
|
-
|
3271
|
-
account_number: 0194791601888
|
3272
|
-
account_currency:
|
3226
|
+
account_identifier: 50880050/0194791601888
|
3273
3227
|
- !ruby/object:MT940::Statement
|
3274
3228
|
modifier: C
|
3275
3229
|
content: 00004/00001
|
@@ -3385,12 +3339,10 @@
|
|
3385
3339
|
modifier:
|
3386
3340
|
content: T089414116000001
|
3387
3341
|
reference: T089414116000001
|
3388
|
-
- !ruby/object:MT940::
|
3342
|
+
- !ruby/object:MT940::AccountIdentification
|
3389
3343
|
modifier:
|
3390
3344
|
content: 50880050/0194798900888
|
3391
|
-
|
3392
|
-
account_number: 0194798900888
|
3393
|
-
account_currency:
|
3345
|
+
account_identifier: 50880050/0194798900888
|
3394
3346
|
- !ruby/object:MT940::Statement
|
3395
3347
|
modifier: C
|
3396
3348
|
content: 00004/00001
|
@@ -3448,12 +3400,10 @@
|
|
3448
3400
|
modifier:
|
3449
3401
|
content: T089414126000001
|
3450
3402
|
reference: T089414126000001
|
3451
|
-
- !ruby/object:MT940::
|
3403
|
+
- !ruby/object:MT940::AccountIdentification
|
3452
3404
|
modifier:
|
3453
3405
|
content: 50880050/0194799000888
|
3454
|
-
|
3455
|
-
account_number: 0194799000888
|
3456
|
-
account_currency:
|
3406
|
+
account_identifier: 50880050/0194799000888
|
3457
3407
|
- !ruby/object:MT940::Statement
|
3458
3408
|
modifier: C
|
3459
3409
|
content: 00004/00001
|
@@ -3511,12 +3461,10 @@
|
|
3511
3461
|
modifier:
|
3512
3462
|
content: T089414136000001
|
3513
3463
|
reference: T089414136000001
|
3514
|
-
- !ruby/object:MT940::
|
3464
|
+
- !ruby/object:MT940::AccountIdentification
|
3515
3465
|
modifier:
|
3516
3466
|
content: 50880050/0194804000888
|
3517
|
-
|
3518
|
-
account_number: 0194804000888
|
3519
|
-
account_currency:
|
3467
|
+
account_identifier: 50880050/0194804000888
|
3520
3468
|
- !ruby/object:MT940::Statement
|
3521
3469
|
modifier: C
|
3522
3470
|
content: 00001/00001
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require_relative 'test_helper'
|
2
|
+
|
3
|
+
class TestAccountIdentification < Test::Unit::TestCase
|
4
|
+
def test_account_identifier
|
5
|
+
acc_ident = MT940::AccountIdentification.new('','12345690')
|
6
|
+
assert_equal '12345690', acc_ident.account_identifier
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_account_identifier_gets_the_first_35_characters
|
10
|
+
content = '1' * 40
|
11
|
+
acc_ident = MT940::AccountIdentification.new('', content)
|
12
|
+
assert_equal 35, acc_ident.account_identifier.length
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_DEPRECATED_bank_code
|
16
|
+
content = '123456789/987EUR'
|
17
|
+
acc_ident = MT940::AccountIdentification.new('', content)
|
18
|
+
assert_equal '123456789', acc_ident.bank_code
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_DEPRECATED_account_number
|
22
|
+
content = '123456789/987EUR'
|
23
|
+
acc_ident = MT940::AccountIdentification.new('', content)
|
24
|
+
assert_equal '987', acc_ident.account_number
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_DEPRECATED_account_currency
|
28
|
+
content = '123456789/987EUR'
|
29
|
+
acc_ident = MT940::AccountIdentification.new('', content)
|
30
|
+
assert_equal 'EUR', acc_ident.account_currency
|
31
|
+
end
|
32
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require_relative '
|
1
|
+
require_relative 'test_helper'
|
2
2
|
|
3
3
|
|
4
4
|
# $DEBUG = true
|
@@ -19,6 +19,10 @@ class TestCustomerStatementMessage < Test::Unit::TestCase
|
|
19
19
|
assert_equal "0194787400888", @message.account_number
|
20
20
|
end
|
21
21
|
|
22
|
+
def test_it_should_have_an_account_identification
|
23
|
+
assert @message.account.is_a?(MT940::AccountIdentification)
|
24
|
+
end
|
25
|
+
|
22
26
|
def test_it_should_have_statement_lines
|
23
27
|
assert @message.statement_lines.respond_to?(:each)
|
24
28
|
assert_equal 4, @message.statement_lines.size
|
data/test/test_mt940.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mt940_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thies C. Arntzen
|
8
8
|
- Phillip Oertel
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-06-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: gem_hadar
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 1.
|
20
|
+
version: 1.11.0
|
21
21
|
type: :development
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 1.
|
27
|
+
version: 1.11.0
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: test-unit
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,26 +39,12 @@ dependencies:
|
|
39
39
|
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '0'
|
42
|
-
- !ruby/object:Gem::Dependency
|
43
|
-
name: simplecov
|
44
|
-
requirement: !ruby/object:Gem::Requirement
|
45
|
-
requirements:
|
46
|
-
- - ">="
|
47
|
-
- !ruby/object:Gem::Version
|
48
|
-
version: '0'
|
49
|
-
type: :development
|
50
|
-
prerelease: false
|
51
|
-
version_requirements: !ruby/object:Gem::Requirement
|
52
|
-
requirements:
|
53
|
-
- - ">="
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version: '0'
|
56
42
|
description: Ruby library that parses account statements in the SWIFT MT940 format.
|
57
43
|
email: developers@betterplace.org
|
58
44
|
executables: []
|
59
45
|
extensions: []
|
60
46
|
extra_rdoc_files:
|
61
|
-
- README.
|
47
|
+
- README.md
|
62
48
|
- lib/mt940.rb
|
63
49
|
- lib/mt940/customer_statement_message.rb
|
64
50
|
- lib/mt940/errors.rb
|
@@ -70,10 +56,9 @@ files:
|
|
70
56
|
- ".travis.yml"
|
71
57
|
- Gemfile
|
72
58
|
- LICENSE
|
73
|
-
- README.
|
59
|
+
- README.md
|
74
60
|
- Rakefile
|
75
61
|
- VERSION
|
76
|
-
- VERSION.yml
|
77
62
|
- docs/0E0Y00DNY.pdf
|
78
63
|
- docs/FinTS_4.0_Formals.pdf
|
79
64
|
- docs/FinTS_4.0_Messages_Finanzdatenformate.pdf
|
@@ -89,6 +74,8 @@ files:
|
|
89
74
|
- mt940_parser.gemspec
|
90
75
|
- test/fixtures/amount_formats.txt
|
91
76
|
- test/fixtures/amount_formats.yml
|
77
|
+
- test/fixtures/colon_in_descriptor.txt
|
78
|
+
- test/fixtures/colon_in_descriptor.yml
|
92
79
|
- test/fixtures/currency_in_25.txt
|
93
80
|
- test/fixtures/currency_in_25.yml
|
94
81
|
- test/fixtures/empty_86.txt
|
@@ -105,19 +92,20 @@ files:
|
|
105
92
|
- test/fixtures/sepa_snippet_broken.txt
|
106
93
|
- test/fixtures/with_binary_character.txt
|
107
94
|
- test/fixtures/with_binary_character.yml
|
108
|
-
- test/
|
95
|
+
- test/test_account_identifier.rb
|
109
96
|
- test/test_customer_statement_message.rb
|
97
|
+
- test/test_helper.rb
|
110
98
|
- test/test_mt940.rb
|
111
99
|
homepage: http://github.com/betterplace/mt940_parser
|
112
100
|
licenses:
|
113
101
|
- MIT
|
114
102
|
metadata: {}
|
115
|
-
post_install_message:
|
103
|
+
post_install_message:
|
116
104
|
rdoc_options:
|
117
105
|
- "--title"
|
118
106
|
- Mt940Parser - MT940 parses account statements in the SWIFT MT940 format.
|
119
107
|
- "--main"
|
120
|
-
- README.
|
108
|
+
- README.md
|
121
109
|
require_paths:
|
122
110
|
- lib
|
123
111
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -131,11 +119,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
131
119
|
- !ruby/object:Gem::Version
|
132
120
|
version: '0'
|
133
121
|
requirements: []
|
134
|
-
|
135
|
-
|
136
|
-
signing_key:
|
122
|
+
rubygems_version: 3.2.3
|
123
|
+
signing_key:
|
137
124
|
specification_version: 4
|
138
125
|
summary: MT940 parses account statements in the SWIFT MT940 format.
|
139
126
|
test_files:
|
127
|
+
- test/test_account_identifier.rb
|
140
128
|
- test/test_customer_statement_message.rb
|
129
|
+
- test/test_helper.rb
|
141
130
|
- test/test_mt940.rb
|