cfonb 0.0.7 → 1.1.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/lib/cfonb/line_parser/base.rb +1 -1
- data/lib/cfonb/line_parser/operation.rb +1 -1
- data/lib/cfonb/line_parser/{operation_detail.rb → operation_details.rb} +1 -1
- data/lib/cfonb/operation.rb +6 -1
- data/lib/cfonb/operation_details/base.rb +32 -0
- data/lib/cfonb/operation_details/fee.rb +18 -0
- data/lib/cfonb/operation_details/ibe.rb +16 -0
- data/lib/cfonb/operation_details/ipy.rb +16 -0
- data/lib/cfonb/operation_details/lc2.rb +15 -0
- data/lib/cfonb/operation_details/lcc.rb +15 -0
- data/lib/cfonb/operation_details/lcs.rb +15 -0
- data/lib/cfonb/operation_details/lib.rb +15 -0
- data/lib/cfonb/operation_details/mmo.rb +26 -0
- data/lib/cfonb/operation_details/nbe.rb +15 -0
- data/lib/cfonb/operation_details/nbu.rb +15 -0
- data/lib/cfonb/operation_details/npo.rb +15 -0
- data/lib/cfonb/operation_details/npy.rb +15 -0
- data/lib/cfonb/operation_details/rcn.rb +18 -0
- data/lib/cfonb/operation_details/ref.rb +17 -0
- data/lib/cfonb/operation_details/unknown.rb +23 -0
- data/lib/cfonb/{operation_detail.rb → operation_details.rb} +5 -3
- data/lib/cfonb.rb +18 -12
- data/spec/cfonb/line_parser/{operation_detail_spec.rb → operation_details_spec.rb} +1 -1
- data/spec/cfonb/operation_spec.rb +120 -16
- data/spec/cfonb/parser_spec.rb +125 -41
- metadata +23 -17
- data/lib/cfonb/operation_detail/fee.rb +0 -18
- data/lib/cfonb/operation_detail/lc2.rb +0 -13
- data/lib/cfonb/operation_detail/lcc.rb +0 -13
- data/lib/cfonb/operation_detail/lcs.rb +0 -13
- data/lib/cfonb/operation_detail/lib.rb +0 -13
- data/lib/cfonb/operation_detail/mmo.rb +0 -28
- data/lib/cfonb/operation_detail/nbe.rb +0 -15
- data/lib/cfonb/operation_detail/npy.rb +0 -15
- data/lib/cfonb/operation_detail/rcn.rb +0 -22
- data/lib/cfonb/operation_detail/ref.rb +0 -20
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:
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Johan Le Bray
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2024-12-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: license_finder
|
@@ -93,25 +93,31 @@ files:
|
|
93
93
|
- lib/cfonb/line_parser/base.rb
|
94
94
|
- lib/cfonb/line_parser/new_balance.rb
|
95
95
|
- lib/cfonb/line_parser/operation.rb
|
96
|
-
- lib/cfonb/line_parser/
|
96
|
+
- lib/cfonb/line_parser/operation_details.rb
|
97
97
|
- lib/cfonb/line_parser/previous_balance.rb
|
98
98
|
- lib/cfonb/operation.rb
|
99
|
-
- lib/cfonb/
|
100
|
-
- lib/cfonb/
|
101
|
-
- lib/cfonb/
|
102
|
-
- lib/cfonb/
|
103
|
-
- lib/cfonb/
|
104
|
-
- lib/cfonb/
|
105
|
-
- lib/cfonb/
|
106
|
-
- lib/cfonb/
|
107
|
-
- lib/cfonb/
|
108
|
-
- lib/cfonb/
|
109
|
-
- lib/cfonb/
|
99
|
+
- lib/cfonb/operation_details.rb
|
100
|
+
- lib/cfonb/operation_details/base.rb
|
101
|
+
- lib/cfonb/operation_details/fee.rb
|
102
|
+
- lib/cfonb/operation_details/ibe.rb
|
103
|
+
- lib/cfonb/operation_details/ipy.rb
|
104
|
+
- lib/cfonb/operation_details/lc2.rb
|
105
|
+
- lib/cfonb/operation_details/lcc.rb
|
106
|
+
- lib/cfonb/operation_details/lcs.rb
|
107
|
+
- lib/cfonb/operation_details/lib.rb
|
108
|
+
- lib/cfonb/operation_details/mmo.rb
|
109
|
+
- lib/cfonb/operation_details/nbe.rb
|
110
|
+
- lib/cfonb/operation_details/nbu.rb
|
111
|
+
- lib/cfonb/operation_details/npo.rb
|
112
|
+
- lib/cfonb/operation_details/npy.rb
|
113
|
+
- lib/cfonb/operation_details/rcn.rb
|
114
|
+
- lib/cfonb/operation_details/ref.rb
|
115
|
+
- lib/cfonb/operation_details/unknown.rb
|
110
116
|
- lib/cfonb/parser.rb
|
111
117
|
- lib/cfonb/refinements/strings.rb
|
112
118
|
- lib/cfonb/statement.rb
|
113
119
|
- spec/cfonb/line_parser/new_balance_spec.rb
|
114
|
-
- spec/cfonb/line_parser/
|
120
|
+
- spec/cfonb/line_parser/operation_details_spec.rb
|
115
121
|
- spec/cfonb/line_parser/operation_spec.rb
|
116
122
|
- spec/cfonb/line_parser/previous_balance_spec.rb
|
117
123
|
- spec/cfonb/operation_spec.rb
|
@@ -129,14 +135,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
129
135
|
requirements:
|
130
136
|
- - ">="
|
131
137
|
- !ruby/object:Gem::Version
|
132
|
-
version: 3.2
|
138
|
+
version: '3.2'
|
133
139
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
140
|
requirements:
|
135
141
|
- - ">="
|
136
142
|
- !ruby/object:Gem::Version
|
137
143
|
version: '0'
|
138
144
|
requirements: []
|
139
|
-
rubygems_version: 3.
|
145
|
+
rubygems_version: 3.5.16
|
140
146
|
signing_key:
|
141
147
|
specification_version: 4
|
142
148
|
summary: CFONB parser
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module CFONB
|
4
|
-
module OperationDetail
|
5
|
-
class FEE
|
6
|
-
ATTRIBUTES = %i[fee fee_currency].freeze
|
7
|
-
|
8
|
-
def self.apply(operation, line)
|
9
|
-
operation.fee_currency = line.detail[0..2]
|
10
|
-
scale = line.detail[3].to_i
|
11
|
-
|
12
|
-
operation.fee = BigDecimal(line.detail[4..17]) / (10**scale)
|
13
|
-
end
|
14
|
-
|
15
|
-
CFONB::OperationDetail.register('FEE', self)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'bigdecimal'
|
4
|
-
|
5
|
-
module CFONB
|
6
|
-
module OperationDetail
|
7
|
-
class MMO
|
8
|
-
ATTRIBUTES = %i[original_currency original_amount exchange_rate].freeze
|
9
|
-
|
10
|
-
def self.apply(operation, line)
|
11
|
-
operation.original_currency = line.detail[0..2]
|
12
|
-
|
13
|
-
scale = line.detail[3].to_i
|
14
|
-
sign = operation.amount <=> 0 # the detail amount is unsigned
|
15
|
-
|
16
|
-
operation.original_amount = sign * BigDecimal(line.detail[4..17]) / (10**scale)
|
17
|
-
exchange_rate_value = line.detail[26..29]
|
18
|
-
|
19
|
-
return if exchange_rate_value.nil? || exchange_rate_value.strip.empty?
|
20
|
-
|
21
|
-
exchange_rate_scale = line.detail[18]
|
22
|
-
operation.exchange_rate = BigDecimal(exchange_rate_value) / (10**BigDecimal(exchange_rate_scale))
|
23
|
-
end
|
24
|
-
|
25
|
-
CFONB::OperationDetail.register('MMO', self)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module CFONB
|
4
|
-
module OperationDetail
|
5
|
-
class NBE
|
6
|
-
ATTRIBUTES = %i[creditor].freeze
|
7
|
-
|
8
|
-
def self.apply(operation, line)
|
9
|
-
operation.creditor = line.detail.strip
|
10
|
-
end
|
11
|
-
|
12
|
-
CFONB::OperationDetail.register('NBE', self)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module CFONB
|
4
|
-
module OperationDetail
|
5
|
-
class NPY
|
6
|
-
ATTRIBUTES = %i[debtor].freeze
|
7
|
-
|
8
|
-
def self.apply(operation, line)
|
9
|
-
operation.debtor = line.detail.strip
|
10
|
-
end
|
11
|
-
|
12
|
-
CFONB::OperationDetail.register('NPY', self)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module CFONB
|
4
|
-
module OperationDetail
|
5
|
-
class RCN
|
6
|
-
using CFONB::Refinements::Strings
|
7
|
-
|
8
|
-
ATTRIBUTES = %i[reference purpose].freeze
|
9
|
-
|
10
|
-
def self.apply(operation, line)
|
11
|
-
operation.reference = [
|
12
|
-
operation.reference,
|
13
|
-
line.detail[0..34].strip,
|
14
|
-
].filter_map(&:presence).join(' - ')
|
15
|
-
|
16
|
-
operation.purpose = line.detail[35..-1]&.strip
|
17
|
-
end
|
18
|
-
|
19
|
-
CFONB::OperationDetail.register('RCN', self)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module CFONB
|
4
|
-
module OperationDetail
|
5
|
-
class REF
|
6
|
-
using CFONB::Refinements::Strings
|
7
|
-
|
8
|
-
ATTRIBUTES = %i[reference].freeze
|
9
|
-
|
10
|
-
def self.apply(operation, line)
|
11
|
-
operation.reference = [
|
12
|
-
operation.reference,
|
13
|
-
line.detail.strip,
|
14
|
-
].filter_map(&:presence).join(' - ')
|
15
|
-
end
|
16
|
-
|
17
|
-
CFONB::OperationDetail.register('REF', self)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|