camt 0.0.1 → 1.0.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/.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,207 @@
|
|
1
|
+
require_relative "../support/camt.053_integration"
|
2
|
+
|
3
|
+
RSpec.describe "camt_germany_01.xml" do
|
4
|
+
|
5
|
+
let(:expected_id) { "2736482736482" }
|
6
|
+
let(:expected_electronic_sequence_number) { "101" }
|
7
|
+
let(:expected_creation_time) { "2008-09-01T17:30:47.0+01:00" }
|
8
|
+
let(:expected_iban) { "DE87200500001234567890" }
|
9
|
+
let(:expected_currency) { "EUR" }
|
10
|
+
let(:expected_date) { "2008-09-01" }
|
11
|
+
let(:expected_start_balance) { 112.72 }
|
12
|
+
let(:expected_end_balance) { 158780.32 }
|
13
|
+
|
14
|
+
let :expected_transactions do
|
15
|
+
[
|
16
|
+
{
|
17
|
+
ex_date: "2008-09-01",
|
18
|
+
eff_date: "2008-09-01",
|
19
|
+
type: nil,
|
20
|
+
amount: 100.0,
|
21
|
+
details: [
|
22
|
+
{
|
23
|
+
messages: ["Rechnungsnr. 4711 vom 20.08.2008"],
|
24
|
+
references: ["Ende-zu-Ende-Id des Ueberweisenden"],
|
25
|
+
party: {
|
26
|
+
remote_owner: "Herr Ueberweisender",
|
27
|
+
remote_owner_country: nil,
|
28
|
+
remote_owner_address: nil,
|
29
|
+
remote_account: "DE21500500001234567897"
|
30
|
+
}
|
31
|
+
}
|
32
|
+
],
|
33
|
+
purpose: "SEPA GUTSCHRIFT"
|
34
|
+
},
|
35
|
+
{
|
36
|
+
ex_date: "2008-09-01",
|
37
|
+
eff_date: "2008-09-01",
|
38
|
+
type: nil,
|
39
|
+
amount: 200.0,
|
40
|
+
details: [
|
41
|
+
{
|
42
|
+
messages: ["Angabe des urspruenglichen Verwendungszweckes"],
|
43
|
+
references: ["Urspr. E2E-Id der Hintransaktion"],
|
44
|
+
reason: {
|
45
|
+
code: "AC01",
|
46
|
+
description: "Account identifier incorrect (i.e. invalid IBAN)"
|
47
|
+
},
|
48
|
+
party: {}
|
49
|
+
}
|
50
|
+
],
|
51
|
+
purpose: "SEPA RUECKBUCHUNG"
|
52
|
+
},
|
53
|
+
{
|
54
|
+
ex_date: "2008-09-01",
|
55
|
+
eff_date: "2008-09-01",
|
56
|
+
type: nil,
|
57
|
+
amount: -50.0,
|
58
|
+
details: [
|
59
|
+
{
|
60
|
+
messages: ["Telefonrechnung August 2009, Vertragsnummer 3536456345"],
|
61
|
+
references: ["E2E-Id vergeben vom Glaeubiger"],
|
62
|
+
mandate_identifier: "Ref. des SEPA-Lastschriftmandats",
|
63
|
+
party: {
|
64
|
+
remote_owner: "Glaeubigerfirma",
|
65
|
+
remote_owner_country: nil,
|
66
|
+
remote_owner_address: nil
|
67
|
+
}
|
68
|
+
}
|
69
|
+
],
|
70
|
+
purpose: "SEPA LASTSCHRIFT"
|
71
|
+
},
|
72
|
+
{
|
73
|
+
ex_date: "2008-09-02",
|
74
|
+
eff_date: "2008-09-02",
|
75
|
+
type: nil,
|
76
|
+
amount: 100.0,
|
77
|
+
details: [
|
78
|
+
{
|
79
|
+
messages: ["Rechnungsnr 4711 - Warenlieferung vom 20.08.2008"],
|
80
|
+
party: {
|
81
|
+
remote_owner: "Herr Überweisender",
|
82
|
+
remote_owner_country: nil,
|
83
|
+
remote_owner_address: nil,
|
84
|
+
remote_account: "1234567890"
|
85
|
+
}
|
86
|
+
}
|
87
|
+
],
|
88
|
+
purpose: "ÜBERWEISUNGSGUTSCHRIFT"
|
89
|
+
},
|
90
|
+
{
|
91
|
+
ex_date: "2008-09-02",
|
92
|
+
eff_date: "2008-09-02",
|
93
|
+
type: nil,
|
94
|
+
amount: 200.0,
|
95
|
+
details: [
|
96
|
+
{
|
97
|
+
messages: ["Angabe des ursprünglichen Verwendungszweckes"],
|
98
|
+
party: {}
|
99
|
+
}
|
100
|
+
],
|
101
|
+
purpose: "RÜCKÜBERWEISUNG"
|
102
|
+
},
|
103
|
+
{
|
104
|
+
ex_date: "2008-09-02",
|
105
|
+
eff_date: "2008-09-02",
|
106
|
+
type: nil,
|
107
|
+
amount: -50.0,
|
108
|
+
details: [
|
109
|
+
{
|
110
|
+
messages: ["Telefonrechnung August 2009, Vertragsnummer 3536456345"],
|
111
|
+
party: {
|
112
|
+
remote_owner: "Telefongesellschaft ABC",
|
113
|
+
remote_owner_country: nil,
|
114
|
+
remote_owner_address: nil
|
115
|
+
}
|
116
|
+
}
|
117
|
+
],
|
118
|
+
purpose: "LASTSCHRIFT"
|
119
|
+
},
|
120
|
+
{
|
121
|
+
ex_date: "2008-09-03",
|
122
|
+
eff_date: "2008-09-03",
|
123
|
+
type: nil,
|
124
|
+
amount: -276.0,
|
125
|
+
details: [
|
126
|
+
{
|
127
|
+
messages: ["Telefonrechnung August 2009, Vertragsnummer 3536456345"],
|
128
|
+
references: ["79892"],
|
129
|
+
mandate_identifier: "10001",
|
130
|
+
party: {
|
131
|
+
remote_owner: "Telefongesellschaft ABC",
|
132
|
+
remote_owner_country: nil,
|
133
|
+
remote_owner_address: nil
|
134
|
+
}
|
135
|
+
},
|
136
|
+
{
|
137
|
+
messages: ["Telefonrechnung August 2009, Vertragsnummer 536456888"],
|
138
|
+
references: ["768768"],
|
139
|
+
mandate_identifier: "10002",
|
140
|
+
party: {
|
141
|
+
remote_owner: "Telefongesellschaft ABC",
|
142
|
+
remote_owner_country: nil,
|
143
|
+
remote_owner_address: nil
|
144
|
+
}
|
145
|
+
},
|
146
|
+
{
|
147
|
+
messages: ["Telefonrechnung August 2009, Vertragsnummer 3536456345"],
|
148
|
+
references: ["45456465"],
|
149
|
+
mandate_identifier: "10003",
|
150
|
+
party: {
|
151
|
+
remote_owner: "Telefongesellschaft ABC",
|
152
|
+
remote_owner_country: nil,
|
153
|
+
remote_owner_address: nil
|
154
|
+
}
|
155
|
+
}
|
156
|
+
],
|
157
|
+
purpose: "SEPA Direct Debit (Einzelbuchung-Soll,Core)"
|
158
|
+
},
|
159
|
+
{
|
160
|
+
ex_date: "2008-09-03",
|
161
|
+
eff_date: "2008-09-03",
|
162
|
+
type: nil,
|
163
|
+
amount: -100876.0,
|
164
|
+
details: [
|
165
|
+
{
|
166
|
+
party: {}
|
167
|
+
}
|
168
|
+
],
|
169
|
+
purpose: "SEPA Credit Transfer (Sammler-Soll)"
|
170
|
+
},
|
171
|
+
{
|
172
|
+
ex_date: "2008-09-03",
|
173
|
+
eff_date: "2008-09-03",
|
174
|
+
type: nil,
|
175
|
+
amount: -276.0,
|
176
|
+
details: [
|
177
|
+
{
|
178
|
+
party: {}
|
179
|
+
}
|
180
|
+
],
|
181
|
+
purpose: "SEPA Direct Debit (Einzelbuchung-Soll,Core)"
|
182
|
+
},
|
183
|
+
{
|
184
|
+
ex_date: "2008-09-04",
|
185
|
+
eff_date: "2008-09-04",
|
186
|
+
type: nil,
|
187
|
+
amount: 259595.60,
|
188
|
+
details: [
|
189
|
+
{
|
190
|
+
messages: ["Invoice No. 4545"],
|
191
|
+
party: {
|
192
|
+
remote_owner: "West Coast Ltd.",
|
193
|
+
remote_owner_country: "US",
|
194
|
+
remote_owner_address: "52, Main Street",
|
195
|
+
remote_account: "546237687",
|
196
|
+
remote_bank_bic: "BANKUSNY"
|
197
|
+
}
|
198
|
+
}
|
199
|
+
],
|
200
|
+
purpose: "AZV-UEBERWEISUNGSGUTSCHRIFT"
|
201
|
+
}
|
202
|
+
]
|
203
|
+
end
|
204
|
+
|
205
|
+
it_behaves_like "any CAMT.053 file"
|
206
|
+
|
207
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require_relative "../support/camt.053_integration"
|
2
|
+
|
3
|
+
RSpec.describe "camt_switzerland_01.xml" do
|
4
|
+
|
5
|
+
let(:expected_id) { "KOBE111130009991" }
|
6
|
+
let(:expected_electronic_sequence_number) { "1" }
|
7
|
+
let(:expected_creation_time) { "2011-11-30T14:09:00.00Z" }
|
8
|
+
let(:expected_iban) { "CH8809000000505005006" }
|
9
|
+
let(:expected_currency) { "CHF" }
|
10
|
+
let(:expected_date) { "2011-11-30" }
|
11
|
+
let(:expected_start_balance) { 191.99 }
|
12
|
+
let(:expected_end_balance) { 190.99 }
|
13
|
+
|
14
|
+
let :expected_transactions do
|
15
|
+
[
|
16
|
+
{
|
17
|
+
ex_date: "2011-11-30",
|
18
|
+
eff_date: "2011-11-30",
|
19
|
+
type: nil,
|
20
|
+
amount: 3.50,
|
21
|
+
details: [
|
22
|
+
{party: {}}
|
23
|
+
],
|
24
|
+
purpose: "ORANGE EINZAHLUNGSSCHEINE VERARBEITUNG 29.11.2011 KUNDENNUMMER 01-38264-3"
|
25
|
+
},
|
26
|
+
{
|
27
|
+
ex_date: "2011-11-30",
|
28
|
+
eff_date: "2011-11-30",
|
29
|
+
type: nil,
|
30
|
+
amount: -4.50,
|
31
|
+
details: [
|
32
|
+
{references: ["123457"], party: {}}
|
33
|
+
],
|
34
|
+
purpose: "E-FINANCE 01-38264-3 TESTLABOR ONLINE/OFFLINE PRODUCT-MANAGEMENT II"
|
35
|
+
}
|
36
|
+
]
|
37
|
+
end
|
38
|
+
|
39
|
+
it_behaves_like "any CAMT.053 file"
|
40
|
+
|
41
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require_relative "../support/camt.053_integration"
|
2
|
+
|
3
|
+
RSpec.describe "camt_switzerland_02.xml" do
|
4
|
+
|
5
|
+
let(:expected_id) { "STMID-C053.01.00.10-110725163809-01" }
|
6
|
+
let(:expected_electronic_sequence_number) { "147" }
|
7
|
+
let(:expected_creation_time) { "2011-07-25T09:30:47Z" }
|
8
|
+
let(:expected_iban) { "CH9581320000001998736" }
|
9
|
+
let(:expected_currency) { "CHF" }
|
10
|
+
let(:expected_date) { "2011-07-25" }
|
11
|
+
let(:expected_start_balance) { 2501.50 }
|
12
|
+
let(:expected_end_balance) { 2397.2 }
|
13
|
+
|
14
|
+
it_behaves_like "any CAMT.053 file"
|
15
|
+
|
16
|
+
let :expected_transactions do
|
17
|
+
[
|
18
|
+
{
|
19
|
+
ex_date: "2011-07-25",
|
20
|
+
eff_date: "2011-07-25",
|
21
|
+
type: nil,
|
22
|
+
amount: 145.7,
|
23
|
+
details: [
|
24
|
+
{references: ["E2EID-P001.01.00.01-110718163809-01", "123456789012345678901234567"], party: {}},
|
25
|
+
{references: ["E2EID-P001.01.00.01-110718163809-02", "210000000003139471430009017"], party: {}}
|
26
|
+
],
|
27
|
+
purpose: "E2EID-P001.01.00.01-110718163809-01 123456789012345678901234567 " \
|
28
|
+
"E2EID-P001.01.00.01-110718163809-02 210000000003139471430009017"
|
29
|
+
},
|
30
|
+
{
|
31
|
+
ex_date: "2011-07-25",
|
32
|
+
eff_date: "2011-07-24",
|
33
|
+
type: nil,
|
34
|
+
amount: -250.0,
|
35
|
+
details: [
|
36
|
+
{references: ["E2EID-P001.01.00.02-110718163809-01"], party: {}}
|
37
|
+
],
|
38
|
+
purpose: "E2EID-P001.01.00.02-110718163809-01"
|
39
|
+
}
|
40
|
+
]
|
41
|
+
end
|
42
|
+
end
|
@@ -1808,7 +1808,7 @@ Inkomende SDD Reject
|
|
1808
1808
|
<RtrInf>
|
1809
1809
|
<Rsn>
|
1810
1810
|
<Cd>MS03</Cd>
|
1811
|
-
|
1811
|
+
</Rsn>
|
1812
1812
|
</RtrInf>
|
1813
1813
|
</TxDtls>
|
1814
1814
|
</NtryDtls>
|
@@ -1897,7 +1897,7 @@ Inkomende SDD Return
|
|
1897
1897
|
<RtrInf>
|
1898
1898
|
<Rsn>
|
1899
1899
|
<Cd>MS03</Cd>
|
1900
|
-
|
1900
|
+
</Rsn>
|
1901
1901
|
</RtrInf>
|
1902
1902
|
</TxDtls>
|
1903
1903
|
</NtryDtls>
|
@@ -0,0 +1,138 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<Document xmlns='urn:iso:std:iso:20022:tech:xsd:camt.053.001.02' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
|
3
|
+
<BkToCstmrStmt>
|
4
|
+
<GrpHdr>
|
5
|
+
<MsgId>0574908765.2013-04-02</MsgId>
|
6
|
+
<CreDtTm>2013-04-12T10:55:08.66+02:00</CreDtTm>
|
7
|
+
<MsgPgntn>
|
8
|
+
<PgNb>1</PgNb>
|
9
|
+
<LastPgInd>true</LastPgInd>
|
10
|
+
</MsgPgntn>
|
11
|
+
</GrpHdr>
|
12
|
+
<Stmt>
|
13
|
+
<Id>0574908765.2013-04-02</Id>
|
14
|
+
<ElctrncSeqNb>0070</ElctrncSeqNb>
|
15
|
+
<CreDtTm>2013-04-12T10:55:08.66+02:00</CreDtTm>
|
16
|
+
<Acct>
|
17
|
+
<Id>
|
18
|
+
<IBAN>NL77ABNA0574908765</IBAN>
|
19
|
+
</Id>
|
20
|
+
<Ccy>EUR</Ccy>
|
21
|
+
<Svcr>
|
22
|
+
<FinInstnId>
|
23
|
+
<BIC>ABNANL2A</BIC>
|
24
|
+
</FinInstnId>
|
25
|
+
</Svcr>
|
26
|
+
</Acct>
|
27
|
+
<Bal>
|
28
|
+
<Tp>
|
29
|
+
<CdOrPrtry>
|
30
|
+
<Cd>PRCD</Cd>
|
31
|
+
</CdOrPrtry>
|
32
|
+
</Tp>
|
33
|
+
<Amt Ccy='EUR'>1000.01</Amt>
|
34
|
+
<CdtDbtInd>CRDT</CdtDbtInd>
|
35
|
+
<Dt>
|
36
|
+
<Dt>2013-03-28</Dt>
|
37
|
+
</Dt>
|
38
|
+
</Bal>
|
39
|
+
<Bal>
|
40
|
+
<Tp>
|
41
|
+
<CdOrPrtry>
|
42
|
+
<Cd>CLBD</Cd>
|
43
|
+
</CdOrPrtry>
|
44
|
+
</Tp>
|
45
|
+
<Amt Ccy='EUR'>100.01</Amt>
|
46
|
+
<CdtDbtInd>CRDT</CdtDbtInd>
|
47
|
+
<Dt>
|
48
|
+
<Dt>2013-04-02</Dt>
|
49
|
+
</Dt>
|
50
|
+
</Bal>
|
51
|
+
<Ntry>
|
52
|
+
<Amt Ccy='EUR'>921.00</Amt>
|
53
|
+
<CdtDbtInd>DBIT</CdtDbtInd>
|
54
|
+
<RvslInd>true</RvslInd>
|
55
|
+
<Sts>BOOK</Sts>
|
56
|
+
<BookgDt>
|
57
|
+
<Dt>2012-04-02</Dt>
|
58
|
+
</BookgDt>
|
59
|
+
<ValDt>
|
60
|
+
<Dt>2012-04-02</Dt>
|
61
|
+
</ValDt>
|
62
|
+
<AcctSvcrRef>GB030000738195160AO</AcctSvcrRef>
|
63
|
+
<BkTxCd>
|
64
|
+
<Domn>
|
65
|
+
<Cd>PMNT</Cd>
|
66
|
+
<Fmly>
|
67
|
+
<Cd>IDDT</Cd>
|
68
|
+
<SubFmlyCd>UPDD</SubFmlyCd>
|
69
|
+
</Fmly>
|
70
|
+
</Domn>
|
71
|
+
<Prtry>
|
72
|
+
<Cd>N245</Cd>
|
73
|
+
<Issr>ABNAMRO</Issr>
|
74
|
+
</Prtry>
|
75
|
+
</BkTxCd>
|
76
|
+
<NtryDtls>
|
77
|
+
<TxDtls>
|
78
|
+
<Refs>
|
79
|
+
<AcctSvcrRef>GB030000738195160AO</AcctSvcrRef>
|
80
|
+
<PmtInfId>PMTIDPAIN008</PmtInfId>
|
81
|
+
<EndToEndId>1234567X908303804</EndToEndId>
|
82
|
+
<MndtId>123456788XXmandaat</MndtId>
|
83
|
+
</Refs>
|
84
|
+
<AmtDtls>
|
85
|
+
<TxAmt>
|
86
|
+
<Amt Ccy='EUR'>921.00</Amt>
|
87
|
+
</TxAmt>
|
88
|
+
</AmtDtls>
|
89
|
+
<BkTxCd>
|
90
|
+
<Domn>
|
91
|
+
<Cd>PMNT</Cd>
|
92
|
+
<Fmly>
|
93
|
+
<Cd>IDDT</Cd>
|
94
|
+
<SubFmlyCd>UPDD</SubFmlyCd>
|
95
|
+
</Fmly>
|
96
|
+
</Domn>
|
97
|
+
<Prtry>
|
98
|
+
<Cd>N245</Cd>
|
99
|
+
<Issr>ABNAMRO</Issr>
|
100
|
+
</Prtry>
|
101
|
+
</BkTxCd>
|
102
|
+
<RltdPties>
|
103
|
+
<Cdtr>
|
104
|
+
<Nm>Debtor</Nm>
|
105
|
+
<PstlAdr>
|
106
|
+
<Ctry>NL</Ctry>
|
107
|
+
<AdrLine>R12 SDD SIT2</AdrLine>
|
108
|
+
<AdrLine>R12 SDD SIT2</AdrLine>
|
109
|
+
</PstlAdr>
|
110
|
+
</Cdtr>
|
111
|
+
<CdtrAcct>
|
112
|
+
<Id>
|
113
|
+
<IBAN>NL27ABNA0592326340</IBAN>
|
114
|
+
</Id>
|
115
|
+
</CdtrAcct>
|
116
|
+
</RltdPties>
|
117
|
+
<RltdAgts>
|
118
|
+
<CdtrAgt>
|
119
|
+
<FinInstnId>
|
120
|
+
<BIC>ABNANL2A</BIC>
|
121
|
+
</FinInstnId>
|
122
|
+
</CdtrAgt>
|
123
|
+
</RltdAgts>
|
124
|
+
<RmtInf>
|
125
|
+
<Ustrd>Levering maand mei, zie nota 1234557. Uw klantnummer 123455666</Ustrd>
|
126
|
+
</RmtInf>
|
127
|
+
<RtrInf>
|
128
|
+
<Rsn>
|
129
|
+
<Cd>MS03</Cd>
|
130
|
+
<Rsn>
|
131
|
+
</RtrInf>
|
132
|
+
</TxDtls>
|
133
|
+
</NtryDtls>
|
134
|
+
<AddtlNtryInf>/RTYP/SEPA Incasso terugboeking bank/MARF/123456788XXmandaat/RTRN/MS03/IBAN/NL27ABNA0592326340/NAME/Debtor/REMI/Levering maand mei, zie nota 1234557. Uw klantnummer 123455666/EREF/1234567X908303804</AddtlNtryInf>
|
135
|
+
</Ntry>
|
136
|
+
</Stmt>
|
137
|
+
</BkToCstmrStmt>
|
138
|
+
</Document>
|