camt 0.0.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rspec +1 -0
- data/.travis.yml +2 -0
- data/Gemfile +0 -2
- data/README.md +22 -7
- data/Rakefile +5 -7
- data/camt.gemspec +2 -0
- data/lib/camt.rb +14 -21
- data/lib/camt/amount.rb +22 -0
- data/lib/camt/file.rb +10 -5
- data/lib/camt/parser.rb +3 -126
- data/lib/camt/statement.rb +86 -0
- data/lib/camt/transaction.rb +102 -0
- data/lib/camt/version.rb +1 -1
- data/spec/amount_spec.rb +43 -0
- data/spec/file_spec.rb +91 -0
- data/spec/integration/camt.xml_spec.rb +441 -0
- data/spec/integration/camt_germany_01.xml_spec.rb +207 -0
- data/spec/integration/camt_switzerland_01.xml_spec.rb +41 -0
- data/spec/integration/camt_switzerland_02.xml_spec.rb +42 -0
- data/{test/files → spec/sample_files}/camt.xml +2 -2
- data/spec/sample_files/camt_error.xml +138 -0
- data/spec/sample_files/camt_germany_01.xml +617 -0
- data/spec/sample_files/camt_switzerland_01.xml +141 -0
- data/spec/sample_files/camt_switzerland_02.xml +144 -0
- data/spec/spec_helper.rb +73 -0
- data/spec/statement_spec.rb +82 -0
- data/spec/support/camt.053_integration.rb +57 -0
- data/spec/transaction_spec.rb +71 -0
- metadata +66 -12
- data/lib/camt/object_extension.rb +0 -11
- data/test/test_helper.rb +0 -3
- data/test/unit/camt/file_test.rb +0 -23
- data/test/unit/camt/parser_test.rb +0 -7
@@ -0,0 +1,71 @@
|
|
1
|
+
RSpec.describe Camt::Transaction do
|
2
|
+
|
3
|
+
let(:filename) { "camt.xml" }
|
4
|
+
let(:file) { Camt::File.parse(::File.expand_path("../sample_files/" << filename, __FILE__)) }
|
5
|
+
let(:doc) { file.doc.tap { |doc| doc.remove_namespaces! } }
|
6
|
+
let(:node) { doc.xpath('//BkToCstmrStmt/Stmt/Ntry')[1] }
|
7
|
+
let(:country_code) { "NL" }
|
8
|
+
|
9
|
+
subject { described_class.new(node, country_code) }
|
10
|
+
|
11
|
+
describe "#execution_date" do
|
12
|
+
let(:expected) { Date.parse("2013-04-02") }
|
13
|
+
|
14
|
+
it "has the value from the parsed file" do
|
15
|
+
expect(subject.execution_date).to eq expected
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "#effective_date" do
|
20
|
+
let(:expected) { Date.parse("2013-04-02") }
|
21
|
+
|
22
|
+
it "has the value from the parsed file" do
|
23
|
+
expect(subject.effective_date).to eq expected
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "#transfer_type" do
|
28
|
+
let(:expected) { {proprietary_code: "N654", proprietary_issuer: "ABNAMRO"} }
|
29
|
+
|
30
|
+
it "has the value from the parsed file" do
|
31
|
+
expect(subject.transfer_type).to eq expected
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe "#transferred_amount" do
|
36
|
+
let(:expected) { 1.0 }
|
37
|
+
|
38
|
+
it "has the value from the parsed file" do
|
39
|
+
expect(subject.transferred_amount).to eq expected
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe "#transaction_details" do
|
44
|
+
let :expected do
|
45
|
+
[{
|
46
|
+
:messages => ["OMSCHRIJVING"],
|
47
|
+
:references => ["NOTPROVIDED"],
|
48
|
+
:party => {
|
49
|
+
:remote_owner => "NAAM",
|
50
|
+
:remote_owner_country => nil,
|
51
|
+
:remote_owner_address => nil,
|
52
|
+
:remote_account => "NL46ABNA0499998748",
|
53
|
+
:remote_bank_bic => "ABNANL2A"
|
54
|
+
}
|
55
|
+
}]
|
56
|
+
end
|
57
|
+
|
58
|
+
it "has the value from the parsed file" do
|
59
|
+
expect(subject.transaction_details).to eq expected
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe "#purpose" do
|
64
|
+
let(:expected) { "/TRTP/SEPA OVERBOEKING/IBAN/NL46ABNA0499998748/BIC/" \
|
65
|
+
"ABNANL2A/NAME/NAAM/REMI/OMSCHRIJVING/EREF/NOTPROVIDED" }
|
66
|
+
|
67
|
+
it "has the value from the parsed file" do
|
68
|
+
expect(subject.purpose).to eq expected
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: camt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Reinier de Lange
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activesupport
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: bundler
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,6 +66,20 @@ dependencies:
|
|
52
66
|
- - ">="
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
55
83
|
description: A gem for parsing CAMT.053 files
|
56
84
|
email:
|
57
85
|
- r.j.delange@nedforce.nl
|
@@ -60,20 +88,35 @@ extensions: []
|
|
60
88
|
extra_rdoc_files: []
|
61
89
|
files:
|
62
90
|
- ".gitignore"
|
91
|
+
- ".rspec"
|
92
|
+
- ".travis.yml"
|
63
93
|
- Gemfile
|
64
94
|
- LICENSE.txt
|
65
95
|
- README.md
|
66
96
|
- Rakefile
|
67
97
|
- camt.gemspec
|
68
98
|
- lib/camt.rb
|
99
|
+
- lib/camt/amount.rb
|
69
100
|
- lib/camt/file.rb
|
70
|
-
- lib/camt/object_extension.rb
|
71
101
|
- lib/camt/parser.rb
|
102
|
+
- lib/camt/statement.rb
|
103
|
+
- lib/camt/transaction.rb
|
72
104
|
- lib/camt/version.rb
|
73
|
-
-
|
74
|
-
-
|
75
|
-
-
|
76
|
-
-
|
105
|
+
- spec/amount_spec.rb
|
106
|
+
- spec/file_spec.rb
|
107
|
+
- spec/integration/camt.xml_spec.rb
|
108
|
+
- spec/integration/camt_germany_01.xml_spec.rb
|
109
|
+
- spec/integration/camt_switzerland_01.xml_spec.rb
|
110
|
+
- spec/integration/camt_switzerland_02.xml_spec.rb
|
111
|
+
- spec/sample_files/camt.xml
|
112
|
+
- spec/sample_files/camt_error.xml
|
113
|
+
- spec/sample_files/camt_germany_01.xml
|
114
|
+
- spec/sample_files/camt_switzerland_01.xml
|
115
|
+
- spec/sample_files/camt_switzerland_02.xml
|
116
|
+
- spec/spec_helper.rb
|
117
|
+
- spec/statement_spec.rb
|
118
|
+
- spec/support/camt.053_integration.rb
|
119
|
+
- spec/transaction_spec.rb
|
77
120
|
homepage: ''
|
78
121
|
licenses:
|
79
122
|
- MIT
|
@@ -94,12 +137,23 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
137
|
version: '0'
|
95
138
|
requirements: []
|
96
139
|
rubyforge_project:
|
97
|
-
rubygems_version: 2.
|
140
|
+
rubygems_version: 2.4.2
|
98
141
|
signing_key:
|
99
142
|
specification_version: 4
|
100
143
|
summary: A gem for parsing CAMT.053 file
|
101
144
|
test_files:
|
102
|
-
-
|
103
|
-
-
|
104
|
-
-
|
105
|
-
-
|
145
|
+
- spec/amount_spec.rb
|
146
|
+
- spec/file_spec.rb
|
147
|
+
- spec/integration/camt.xml_spec.rb
|
148
|
+
- spec/integration/camt_germany_01.xml_spec.rb
|
149
|
+
- spec/integration/camt_switzerland_01.xml_spec.rb
|
150
|
+
- spec/integration/camt_switzerland_02.xml_spec.rb
|
151
|
+
- spec/sample_files/camt.xml
|
152
|
+
- spec/sample_files/camt_error.xml
|
153
|
+
- spec/sample_files/camt_germany_01.xml
|
154
|
+
- spec/sample_files/camt_switzerland_01.xml
|
155
|
+
- spec/sample_files/camt_switzerland_02.xml
|
156
|
+
- spec/spec_helper.rb
|
157
|
+
- spec/statement_spec.rb
|
158
|
+
- spec/support/camt.053_integration.rb
|
159
|
+
- spec/transaction_spec.rb
|
data/test/test_helper.rb
DELETED
data/test/unit/camt/file_test.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Camt
|
4
|
-
class FileTest < Test::Unit::TestCase
|
5
|
-
|
6
|
-
def setup
|
7
|
-
@file = Camt::File.parse (::File.dirname(__FILE__) + '/../../files/camt.xml')
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_should_have_messages
|
11
|
-
assert @file.messages.any?
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_should_have_statements
|
15
|
-
assert @file.statements.any?
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_should_have_transactions
|
19
|
-
assert @file.transactions.any?
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
23
|
-
end
|