cfonb 0.0.4 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cfonb/line_parser/base.rb +8 -8
- data/lib/cfonb/line_parser/new_balance.rb +1 -1
- data/lib/cfonb/line_parser/operation.rb +1 -1
- data/lib/cfonb/line_parser/operation_detail.rb +1 -1
- data/lib/cfonb/line_parser/previous_balance.rb +1 -1
- data/lib/cfonb/operation_detail/fee.rb +1 -2
- data/lib/cfonb/operation_detail/mmo.rb +6 -1
- data/lib/cfonb/operation_detail/ref.rb +1 -1
- data/lib/cfonb/parser.rb +3 -3
- data/lib/cfonb/statement.rb +2 -2
- data/lib/cfonb.rb +2 -0
- data/spec/cfonb/line_parser/new_balance_spec.rb +1 -1
- data/spec/cfonb/line_parser/operation_detail_spec.rb +1 -1
- data/spec/cfonb/line_parser/operation_spec.rb +1 -1
- data/spec/cfonb/line_parser/previous_balance_spec.rb +1 -1
- data/spec/cfonb/operation_spec.rb +21 -6
- data/spec/cfonb/parser_spec.rb +48 -27
- data/spec/cfonb/statement_spec.rb +6 -6
- metadata +75 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85f6bbc0d3b93bd081c3bbb00ac463b6907937b9520b628abc078785f48efa70
|
4
|
+
data.tar.gz: e1e9c68239d2fd2b912561b521d64d97429d2f52af2a664351773cafeb35f546
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 032a11a0ec0797c262e9dd19c9ddaec04ffd63223674273c9674c7de90d48fe48386700a2934b23e54423f79a7a530367802440237faa3f637457a9135151775
|
7
|
+
data.tar.gz: bedf78c43c86ecb9b9de4f9c4560158a1666d6c19e8b7e05b7f8dbb803ac59d00bc14d8b590ce82ebf21e0074bcbff4a45f47010ee17716ae2dd742a83f6f82f
|
@@ -14,7 +14,7 @@ module CFONB
|
|
14
14
|
['currency', (16..18)],
|
15
15
|
['scale', 19, proc { _1.to_i }],
|
16
16
|
['account', (21..31)],
|
17
|
-
['date', (34..39), proc { |value, instance| instance.send(:parse_date, value) }]
|
17
|
+
['date', (34..39), proc { |value, instance| instance.send(:parse_date, value) }],
|
18
18
|
].freeze
|
19
19
|
|
20
20
|
AMOUNT_SPECIFIERS = {
|
@@ -37,7 +37,7 @@ module CFONB
|
|
37
37
|
'P' => { sign: -1, value: '7' },
|
38
38
|
'Q' => { sign: -1, value: '8' },
|
39
39
|
'R' => { sign: -1, value: '9' },
|
40
|
-
'}' => { sign: -1, value: '0' }
|
40
|
+
'}' => { sign: -1, value: '0' },
|
41
41
|
}.transform_values(&:freeze).freeze
|
42
42
|
|
43
43
|
attr_reader :body, *BASE_DICTIONARY.map(&:first)
|
@@ -58,7 +58,7 @@ module CFONB
|
|
58
58
|
|
59
59
|
def parse_amount(input)
|
60
60
|
specifier = AMOUNT_SPECIFIERS[input.last]
|
61
|
-
raise ParserError
|
61
|
+
raise ParserError.new("Invalid specifier '#{input.last}' for line #{input}") unless specifier
|
62
62
|
|
63
63
|
specifier[:sign] * BigDecimal(input[0..-2] + specifier[:value]) / (10**scale)
|
64
64
|
end
|
@@ -68,14 +68,14 @@ module CFONB
|
|
68
68
|
return if input.strip.empty?
|
69
69
|
|
70
70
|
input_with_year = if input.last(2).to_i > 60
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
71
|
+
"#{input[0..3]}19#{input[4..5]}"
|
72
|
+
else
|
73
|
+
"#{input[0..3]}20#{input[4..5]}"
|
74
|
+
end
|
75
75
|
|
76
76
|
Date.strptime(input_with_year, '%d%m%Y')
|
77
77
|
rescue Date::Error
|
78
|
-
raise ParserError
|
78
|
+
raise ParserError.new("Invalid date '#{input}' for line #{input}")
|
79
79
|
end
|
80
80
|
end
|
81
81
|
end
|
@@ -4,7 +4,7 @@ module CFONB
|
|
4
4
|
module LineParser
|
5
5
|
class NewBalance < Base
|
6
6
|
DICTIONARY = [
|
7
|
-
['amount', (90..103), proc { |value, instance| instance.send(:parse_amount, value) }]
|
7
|
+
['amount', (90..103), proc { |value, instance| instance.send(:parse_amount, value) }],
|
8
8
|
].freeze
|
9
9
|
|
10
10
|
attr_reader(*DICTIONARY.map(&:first))
|
@@ -13,7 +13,7 @@ module CFONB
|
|
13
13
|
['exoneration_code', 88],
|
14
14
|
['unavailability_code', 89],
|
15
15
|
['reference', (104..119)],
|
16
|
-
['amount', (90..103), proc { |value, instance| instance.send(:parse_amount, value) }]
|
16
|
+
['amount', (90..103), proc { |value, instance| instance.send(:parse_amount, value) }],
|
17
17
|
].freeze
|
18
18
|
|
19
19
|
attr_reader(*DICTIONARY.map(&:first))
|
@@ -4,7 +4,7 @@ module CFONB
|
|
4
4
|
module LineParser
|
5
5
|
class PreviousBalance < Base
|
6
6
|
DICTIONARY = [
|
7
|
-
['amount', (90..103), proc { |value, instance| instance.send(:parse_amount, value) }]
|
7
|
+
['amount', (90..103), proc { |value, instance| instance.send(:parse_amount, value) }],
|
8
8
|
].freeze
|
9
9
|
|
10
10
|
attr_reader(*DICTIONARY.map(&:first))
|
@@ -8,9 +8,8 @@ module CFONB
|
|
8
8
|
def self.apply(operation, line)
|
9
9
|
operation.fee_currency = line.detail[0..2]
|
10
10
|
scale = line.detail[3].to_i
|
11
|
-
sign = operation.amount <=> 0 # the detail amount is unsigned
|
12
11
|
|
13
|
-
operation.fee =
|
12
|
+
operation.fee = BigDecimal(line.detail[4..17]) / (10**scale)
|
14
13
|
end
|
15
14
|
|
16
15
|
CFONB::OperationDetail.register('FEE', self)
|
@@ -5,7 +5,7 @@ require 'bigdecimal'
|
|
5
5
|
module CFONB
|
6
6
|
module OperationDetail
|
7
7
|
class MMO
|
8
|
-
ATTRIBUTES = %i[original_currency original_amount].freeze
|
8
|
+
ATTRIBUTES = %i[original_currency original_amount exchange_rate].freeze
|
9
9
|
|
10
10
|
def self.apply(operation, line)
|
11
11
|
operation.original_currency = line.detail[0..2]
|
@@ -14,6 +14,11 @@ module CFONB
|
|
14
14
|
sign = operation.amount <=> 0 # the detail amount is unsigned
|
15
15
|
|
16
16
|
operation.original_amount = sign * BigDecimal(line.detail[4..17]) / (10**scale)
|
17
|
+
exchange_rate_value = line.detail[26..29]
|
18
|
+
return unless exchange_rate_value
|
19
|
+
|
20
|
+
exchange_rate_scale = line.detail[18]
|
21
|
+
operation.exchange_rate = BigDecimal(exchange_rate_value) / (10**BigDecimal(exchange_rate_scale))
|
17
22
|
end
|
18
23
|
|
19
24
|
CFONB::OperationDetail.register('MMO', self)
|
data/lib/cfonb/parser.rb
CHANGED
@@ -8,7 +8,7 @@ module CFONB
|
|
8
8
|
PREVIOUS_BALANCE_CODE = '01',
|
9
9
|
OPERATION_CODE = '04',
|
10
10
|
OPERATION_DETAIL_CODE = '05',
|
11
|
-
NEW_BALANCE_CODE = '07'
|
11
|
+
NEW_BALANCE_CODE = '07',
|
12
12
|
].freeze
|
13
13
|
|
14
14
|
def initialize(input)
|
@@ -52,7 +52,7 @@ module CFONB
|
|
52
52
|
|
53
53
|
def parse_line(line)
|
54
54
|
return if line.strip.empty?
|
55
|
-
raise InvalidCodeError
|
55
|
+
raise InvalidCodeError.new("Invalid line code '#{line.first(2)}'") unless CODES.include?(line.first(2))
|
56
56
|
|
57
57
|
line = CFONB::LineParser.parse(line)
|
58
58
|
|
@@ -97,7 +97,7 @@ module CFONB
|
|
97
97
|
|
98
98
|
current_operation.merge_detail(line)
|
99
99
|
else
|
100
|
-
|
100
|
+
handle_error(UnhandledLineCodeError)
|
101
101
|
end
|
102
102
|
end
|
103
103
|
|
data/lib/cfonb/statement.rb
CHANGED
data/lib/cfonb.rb
CHANGED
@@ -13,7 +13,7 @@ describe CFONB::Operation do
|
|
13
13
|
date: Date.new(2021, 3, 5),
|
14
14
|
currency: 'EUR',
|
15
15
|
amount: -15,
|
16
|
-
reference: '42'
|
16
|
+
reference: '42',
|
17
17
|
)
|
18
18
|
end
|
19
19
|
|
@@ -88,9 +88,24 @@ describe CFONB::Operation do
|
|
88
88
|
|
89
89
|
expect(operation).to have_attributes(
|
90
90
|
original_currency: 'USD',
|
91
|
-
original_amount: -12.34
|
91
|
+
original_amount: -12.34,
|
92
|
+
exchange_rate: nil,
|
92
93
|
)
|
93
94
|
end
|
95
|
+
|
96
|
+
context 'with exchange rate' do
|
97
|
+
let(:detail) { OpenStruct.new(body: '', detail_code: 'MMO', detail: 'USD000000000008358300000001077') }
|
98
|
+
|
99
|
+
it 'Adds the original currency information' do
|
100
|
+
operation.merge_detail(detail)
|
101
|
+
|
102
|
+
expect(operation).to have_attributes(
|
103
|
+
original_currency: 'USD',
|
104
|
+
original_amount: -8358,
|
105
|
+
exchange_rate: 1.077,
|
106
|
+
)
|
107
|
+
end
|
108
|
+
end
|
94
109
|
end
|
95
110
|
|
96
111
|
context 'with a NPY detail' do
|
@@ -118,7 +133,7 @@ describe CFONB::Operation do
|
|
118
133
|
OpenStruct.new(
|
119
134
|
body: '',
|
120
135
|
detail_code: 'RCN',
|
121
|
-
detail: 'SWILE-CMD-TR-YPDHMA TICKET RESTO '
|
136
|
+
detail: 'SWILE-CMD-TR-YPDHMA TICKET RESTO ',
|
122
137
|
)
|
123
138
|
end
|
124
139
|
|
@@ -135,7 +150,7 @@ describe CFONB::Operation do
|
|
135
150
|
OpenStruct.new(
|
136
151
|
body: '0530002112701731EUR2E0000073337DA129082300 REFPENNYLANE B13A93908C36C82DF5C319/1 ',
|
137
152
|
detail_code: 'REF',
|
138
|
-
detail: 'PENNYLANE B13A93908C36C82DF5C319/1 '
|
153
|
+
detail: 'PENNYLANE B13A93908C36C82DF5C319/1 ',
|
139
154
|
)
|
140
155
|
end
|
141
156
|
|
@@ -151,7 +166,7 @@ describe CFONB::Operation do
|
|
151
166
|
OpenStruct.new(
|
152
167
|
body: '0530004411001871EUR2 0001016255614090823 FEEEUR200000000000740',
|
153
168
|
detail_code: 'FEE',
|
154
|
-
detail: 'EUR200000000000740'
|
169
|
+
detail: 'EUR200000000000740',
|
155
170
|
)
|
156
171
|
end
|
157
172
|
|
@@ -159,7 +174,7 @@ describe CFONB::Operation do
|
|
159
174
|
operation.merge_detail(detail)
|
160
175
|
|
161
176
|
expect(operation.fee_currency).to eq('EUR')
|
162
|
-
expect(operation.fee).to eq(
|
177
|
+
expect(operation.fee).to eq(7.4)
|
163
178
|
end
|
164
179
|
end
|
165
180
|
end
|
data/spec/cfonb/parser_spec.rb
CHANGED
@@ -12,7 +12,7 @@ describe CFONB::Parser do
|
|
12
12
|
it 'parses correctly' do
|
13
13
|
expect(statements).to contain_exactly(
|
14
14
|
an_instance_of(CFONB::Statement),
|
15
|
-
an_instance_of(CFONB::Statement)
|
15
|
+
an_instance_of(CFONB::Statement),
|
16
16
|
)
|
17
17
|
|
18
18
|
expect(statements[0]).to have_attributes(
|
@@ -23,7 +23,7 @@ describe CFONB::Parser do
|
|
23
23
|
from: Date.new(2019, 5, 15),
|
24
24
|
from_balance: -190.4,
|
25
25
|
to: Date.new(2019, 5, 16),
|
26
|
-
to_balance: -241.21
|
26
|
+
to_balance: -241.21,
|
27
27
|
)
|
28
28
|
|
29
29
|
expect(statements[0].operations.size).to eq(3)
|
@@ -44,7 +44,8 @@ describe CFONB::Parser do
|
|
44
44
|
value_date: Date.new(2019, 5, 16),
|
45
45
|
original_currency: nil,
|
46
46
|
original_amount: nil,
|
47
|
-
|
47
|
+
exchange_rate: nil,
|
48
|
+
debtor: 'INTERNET SFR',
|
48
49
|
)
|
49
50
|
|
50
51
|
expect(statements[0].operations[1]).to have_attributes(
|
@@ -62,7 +63,8 @@ describe CFONB::Parser do
|
|
62
63
|
value_date: Date.new(2019, 5, 16),
|
63
64
|
original_currency: nil,
|
64
65
|
original_amount: nil,
|
65
|
-
|
66
|
+
exchange_rate: nil,
|
67
|
+
debtor: 'ELEC ERDF',
|
66
68
|
)
|
67
69
|
|
68
70
|
expect(statements[0].operations[2]).to have_attributes(
|
@@ -79,7 +81,8 @@ describe CFONB::Parser do
|
|
79
81
|
unavailability_code: '0',
|
80
82
|
value_date: Date.new(2019, 5, 15),
|
81
83
|
original_currency: nil,
|
82
|
-
original_amount: nil
|
84
|
+
original_amount: nil,
|
85
|
+
exchange_rate: nil,
|
83
86
|
)
|
84
87
|
|
85
88
|
expect(statements[1]).to have_attributes(
|
@@ -90,7 +93,7 @@ describe CFONB::Parser do
|
|
90
93
|
from: Date.new(2019, 5, 16),
|
91
94
|
from_balance: -241.21,
|
92
95
|
to: Date.new(2019, 5, 17),
|
93
|
-
to_balance: -163.72
|
96
|
+
to_balance: -163.72,
|
94
97
|
)
|
95
98
|
|
96
99
|
expect(statements[1].operations.size).to eq(3)
|
@@ -109,7 +112,8 @@ describe CFONB::Parser do
|
|
109
112
|
unavailability_code: '0',
|
110
113
|
value_date: Date.new(2019, 5, 15),
|
111
114
|
original_currency: nil,
|
112
|
-
original_amount: nil
|
115
|
+
original_amount: nil,
|
116
|
+
exchange_rate: nil,
|
113
117
|
)
|
114
118
|
|
115
119
|
expect(statements[1].operations[1]).to have_attributes(
|
@@ -126,7 +130,8 @@ describe CFONB::Parser do
|
|
126
130
|
unavailability_code: '0',
|
127
131
|
value_date: Date.new(2019, 5, 15),
|
128
132
|
original_currency: nil,
|
129
|
-
original_amount: nil
|
133
|
+
original_amount: nil,
|
134
|
+
exchange_rate: nil,
|
130
135
|
)
|
131
136
|
|
132
137
|
expect(statements[1].operations[2]).to have_attributes(
|
@@ -143,7 +148,8 @@ describe CFONB::Parser do
|
|
143
148
|
unavailability_code: '0',
|
144
149
|
value_date: Date.new(2019, 5, 16),
|
145
150
|
original_currency: nil,
|
146
|
-
original_amount: nil
|
151
|
+
original_amount: nil,
|
152
|
+
exchange_rate: nil,
|
147
153
|
)
|
148
154
|
end
|
149
155
|
end
|
@@ -203,7 +209,7 @@ describe CFONB::Parser do
|
|
203
209
|
it 'parses correctly' do
|
204
210
|
expect(statements).to contain_exactly(
|
205
211
|
an_instance_of(CFONB::Statement),
|
206
|
-
an_instance_of(CFONB::Statement)
|
212
|
+
an_instance_of(CFONB::Statement),
|
207
213
|
)
|
208
214
|
|
209
215
|
expect(statements[0]).to have_attributes(
|
@@ -214,7 +220,7 @@ describe CFONB::Parser do
|
|
214
220
|
from: Date.new(2019, 5, 15),
|
215
221
|
from_balance: -190.4,
|
216
222
|
to: Date.new(2019, 5, 16),
|
217
|
-
to_balance: -241.21
|
223
|
+
to_balance: -241.21,
|
218
224
|
)
|
219
225
|
|
220
226
|
expect(statements[0].operations.size).to eq(3)
|
@@ -234,7 +240,8 @@ describe CFONB::Parser do
|
|
234
240
|
value_date: Date.new(2019, 5, 16),
|
235
241
|
original_currency: nil,
|
236
242
|
original_amount: nil,
|
237
|
-
|
243
|
+
exchange_rate: nil,
|
244
|
+
debtor: 'INTERNET SFR',
|
238
245
|
)
|
239
246
|
|
240
247
|
expect(statements[0].operations[1]).to have_attributes(
|
@@ -252,7 +259,8 @@ describe CFONB::Parser do
|
|
252
259
|
value_date: Date.new(2019, 5, 16),
|
253
260
|
original_currency: nil,
|
254
261
|
original_amount: nil,
|
255
|
-
|
262
|
+
exchange_rate: nil,
|
263
|
+
debtor: 'ELEC ERDF',
|
256
264
|
)
|
257
265
|
|
258
266
|
expect(statements[0].operations[2]).to have_attributes(
|
@@ -269,7 +277,8 @@ describe CFONB::Parser do
|
|
269
277
|
unavailability_code: '0',
|
270
278
|
value_date: Date.new(2019, 5, 15),
|
271
279
|
original_currency: nil,
|
272
|
-
original_amount: nil
|
280
|
+
original_amount: nil,
|
281
|
+
exchange_rate: nil,
|
273
282
|
)
|
274
283
|
|
275
284
|
expect(statements[1]).to have_attributes(
|
@@ -280,7 +289,7 @@ describe CFONB::Parser do
|
|
280
289
|
from: Date.new(2019, 5, 16),
|
281
290
|
from_balance: -241.21,
|
282
291
|
to: Date.new(2019, 5, 17),
|
283
|
-
to_balance: -163.72
|
292
|
+
to_balance: -163.72,
|
284
293
|
)
|
285
294
|
|
286
295
|
expect(statements[1].operations.size).to eq(3)
|
@@ -299,7 +308,8 @@ describe CFONB::Parser do
|
|
299
308
|
unavailability_code: '0',
|
300
309
|
value_date: Date.new(2019, 5, 15),
|
301
310
|
original_currency: nil,
|
302
|
-
original_amount: nil
|
311
|
+
original_amount: nil,
|
312
|
+
exchange_rate: nil,
|
303
313
|
)
|
304
314
|
|
305
315
|
expect(statements[1].operations[1]).to have_attributes(
|
@@ -316,7 +326,8 @@ describe CFONB::Parser do
|
|
316
326
|
unavailability_code: '0',
|
317
327
|
value_date: Date.new(2019, 5, 15),
|
318
328
|
original_currency: nil,
|
319
|
-
original_amount: nil
|
329
|
+
original_amount: nil,
|
330
|
+
exchange_rate: nil,
|
320
331
|
)
|
321
332
|
|
322
333
|
expect(statements[1].operations[2]).to have_attributes(
|
@@ -333,7 +344,8 @@ describe CFONB::Parser do
|
|
333
344
|
unavailability_code: '0',
|
334
345
|
value_date: Date.new(2019, 5, 16),
|
335
346
|
original_currency: nil,
|
336
|
-
original_amount: nil
|
347
|
+
original_amount: nil,
|
348
|
+
exchange_rate: nil,
|
337
349
|
)
|
338
350
|
end
|
339
351
|
end
|
@@ -359,7 +371,8 @@ describe CFONB::Parser do
|
|
359
371
|
value_date: Date.new(2019, 5, 16),
|
360
372
|
original_currency: nil,
|
361
373
|
original_amount: nil,
|
362
|
-
|
374
|
+
exchange_rate: nil,
|
375
|
+
debtor: 'ELEC ERDF',
|
363
376
|
)
|
364
377
|
end
|
365
378
|
end
|
@@ -385,7 +398,8 @@ describe CFONB::Parser do
|
|
385
398
|
value_date: Date.new(2019, 5, 16),
|
386
399
|
original_currency: nil,
|
387
400
|
original_amount: nil,
|
388
|
-
|
401
|
+
exchange_rate: nil,
|
402
|
+
debtor: 'ELEC ERDF',
|
389
403
|
)
|
390
404
|
end
|
391
405
|
end
|
@@ -411,7 +425,8 @@ describe CFONB::Parser do
|
|
411
425
|
value_date: Date.new(2019, 5, 16),
|
412
426
|
original_currency: nil,
|
413
427
|
original_amount: nil,
|
414
|
-
|
428
|
+
exchange_rate: nil,
|
429
|
+
debtor: 'ELEC ERDF',
|
415
430
|
)
|
416
431
|
end
|
417
432
|
end
|
@@ -437,7 +452,8 @@ describe CFONB::Parser do
|
|
437
452
|
value_date: Date.new(2019, 5, 16),
|
438
453
|
original_currency: nil,
|
439
454
|
original_amount: nil,
|
440
|
-
|
455
|
+
exchange_rate: nil,
|
456
|
+
debtor: 'ELEC ERDF',
|
441
457
|
)
|
442
458
|
expect(statements[0].operations[1]).to have_attributes(
|
443
459
|
amount: -7.9,
|
@@ -453,7 +469,8 @@ describe CFONB::Parser do
|
|
453
469
|
unavailability_code: '0',
|
454
470
|
value_date: Date.new(2019, 5, 16),
|
455
471
|
original_currency: nil,
|
456
|
-
original_amount: nil
|
472
|
+
original_amount: nil,
|
473
|
+
exchange_rate: nil,
|
457
474
|
)
|
458
475
|
end
|
459
476
|
end
|
@@ -494,7 +511,8 @@ describe CFONB::Parser do
|
|
494
511
|
value_date: Date.new(2019, 5, 16),
|
495
512
|
original_currency: nil,
|
496
513
|
original_amount: nil,
|
497
|
-
|
514
|
+
exchange_rate: nil,
|
515
|
+
debtor: 'INTERNET SFR',
|
498
516
|
)
|
499
517
|
end
|
500
518
|
end
|
@@ -553,7 +571,8 @@ describe CFONB::Parser do
|
|
553
571
|
value_date: Date.new(2019, 5, 16),
|
554
572
|
original_currency: nil,
|
555
573
|
original_amount: nil,
|
556
|
-
|
574
|
+
exchange_rate: nil,
|
575
|
+
debtor: 'INTERNET SFR',
|
557
576
|
)
|
558
577
|
end
|
559
578
|
end
|
@@ -577,7 +596,8 @@ describe CFONB::Parser do
|
|
577
596
|
value_date: Date.new(2019, 5, 16),
|
578
597
|
original_currency: nil,
|
579
598
|
original_amount: nil,
|
580
|
-
|
599
|
+
exchange_rate: nil,
|
600
|
+
debtor: 'INTERNET SFR',
|
581
601
|
)
|
582
602
|
end
|
583
603
|
end
|
@@ -609,7 +629,8 @@ describe CFONB::Parser do
|
|
609
629
|
value_date: Date.new(2019, 5, 16),
|
610
630
|
original_currency: nil,
|
611
631
|
original_amount: nil,
|
612
|
-
|
632
|
+
exchange_rate: nil,
|
633
|
+
debtor: 'ELEC ERDF',
|
613
634
|
)
|
614
635
|
end
|
615
636
|
end
|
@@ -5,8 +5,8 @@ require 'cfonb'
|
|
5
5
|
describe CFONB::Statement do
|
6
6
|
subject(:statement) do
|
7
7
|
described_class.new(begin_line)
|
8
|
-
|
9
|
-
|
8
|
+
.tap { _1.operations << operation }
|
9
|
+
.tap { _1.merge_new_balance(end_line) }
|
10
10
|
end
|
11
11
|
|
12
12
|
let(:operation) do
|
@@ -17,22 +17,22 @@ describe CFONB::Statement do
|
|
17
17
|
|
18
18
|
let(:begin_line) do
|
19
19
|
CFONB::LineParser.parse(
|
20
|
-
'0115589 00000EUR2 98765432100 150519 0000000001904}150519160519 '
|
20
|
+
'0115589 00000EUR2 98765432100 150519 0000000001904}150519160519 ',
|
21
21
|
)
|
22
22
|
end
|
23
23
|
let(:operation_line) do
|
24
24
|
CFONB::LineParser.parse(
|
25
|
-
'0415589916200000EUR2 98765432100B1160519 160519PRLV SEPA TEST CABINET 0000000000000000000322J '
|
25
|
+
'0415589916200000EUR2 98765432100B1160519 160519PRLV SEPA TEST CABINET 0000000000000000000322J ',
|
26
26
|
)
|
27
27
|
end
|
28
28
|
let(:detail_line) do
|
29
29
|
CFONB::LineParser.parse(
|
30
|
-
'0515589916200000EUR2 98765432100B1160519 LIBMENSUEAUHTR13133 '
|
30
|
+
'0515589916200000EUR2 98765432100B1160519 LIBMENSUEAUHTR13133 ',
|
31
31
|
)
|
32
32
|
end
|
33
33
|
let(:end_line) do
|
34
34
|
CFONB::LineParser.parse(
|
35
|
-
'0715489 00000EUR2 98765432100 160519 0000000002412J '
|
35
|
+
'0715489 00000EUR2 98765432100 160519 0000000002412J ',
|
36
36
|
)
|
37
37
|
end
|
38
38
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cfonb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Johan Le Bray
|
@@ -9,8 +9,78 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-
|
13
|
-
dependencies:
|
12
|
+
date: 2023-11-14 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: license_finder
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '0'
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '0'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: rspec
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: ruboclean
|
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
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: rubocop
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: rubocop-rspec
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
14
84
|
description: An easy to use CFONB format parser
|
15
85
|
email: ''
|
16
86
|
executables: []
|
@@ -59,14 +129,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
59
129
|
requirements:
|
60
130
|
- - ">="
|
61
131
|
- !ruby/object:Gem::Version
|
62
|
-
version:
|
132
|
+
version: 3.2.2
|
63
133
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
64
134
|
requirements:
|
65
135
|
- - ">="
|
66
136
|
- !ruby/object:Gem::Version
|
67
137
|
version: '0'
|
68
138
|
requirements: []
|
69
|
-
rubygems_version: 3.
|
139
|
+
rubygems_version: 3.4.10
|
70
140
|
signing_key:
|
71
141
|
specification_version: 4
|
72
142
|
summary: CFONB parser
|