abo_parser 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/.rubocop.yml +40 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +12 -0
- data/LICENSE.txt +21 -0
- data/README.md +0 -0
- data/Rakefile +12 -0
- data/abo_parser.gemspec +37 -0
- data/lib/abo.rb +420 -0
- data/lib/abo_parser/version.rb +5 -0
- data/lib/abo_parser.rb +8 -0
- data/sig/abo_parser.rbs +4 -0
- metadata +53 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0a6cd56f4d4829e57aa28c7e3a3713209f7fa5f64ff1ac1c8e1f7bdd337ff335
|
4
|
+
data.tar.gz: 603a28e200c51f2b5c2f53f59ef56acba7eb1ccbf4b55e839733a6990e1a62b3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8cba650ef983ea244ad0668318ea2952f2c414a06931e04a28db69412df375d969f6d86286535388665a5416f33f2a3ca5dbd1db9a691b0848c569b63668aaf0
|
7
|
+
data.tar.gz: fa2606a6be8f707ed94e1b0bd10125c2b5351661ef9c6dab1727be73a1ef1c6575f28fe7b9ab014361b38ab369528f0b4fa50619e3d9979f84ca4c4cd79894a1
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.6
|
3
|
+
|
4
|
+
Style/StringLiterals:
|
5
|
+
Enabled: true
|
6
|
+
EnforcedStyle: double_quotes
|
7
|
+
|
8
|
+
Style/StringLiteralsInInterpolation:
|
9
|
+
Enabled: true
|
10
|
+
EnforcedStyle: double_quotes
|
11
|
+
|
12
|
+
Layout/EndOfLine:
|
13
|
+
Enabled: false
|
14
|
+
|
15
|
+
Style/Documentation:
|
16
|
+
Enabled: false
|
17
|
+
|
18
|
+
Metrics/CyclomaticComplexity:
|
19
|
+
Max: 20
|
20
|
+
|
21
|
+
Metrics/PerceivedComplexity:
|
22
|
+
Max: 20
|
23
|
+
|
24
|
+
Metrics/AbcSize:
|
25
|
+
Enabled: false
|
26
|
+
|
27
|
+
Metrics/BlockLength:
|
28
|
+
Max: 50
|
29
|
+
|
30
|
+
Metrics/MethodLength:
|
31
|
+
Max: 50
|
32
|
+
|
33
|
+
Metrics/ClassLength:
|
34
|
+
Max: 400
|
35
|
+
|
36
|
+
Metrics/MethodLength:
|
37
|
+
Max: 100
|
38
|
+
|
39
|
+
Layout/LineLength:
|
40
|
+
Max: 120
|
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2023 Rhemery
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
File without changes
|
data/Rakefile
ADDED
data/abo_parser.gemspec
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/abo_parser/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "abo_parser"
|
7
|
+
spec.version = AboParser::VERSION
|
8
|
+
spec.authors = ["Rhemery"]
|
9
|
+
|
10
|
+
spec.summary = "This gem is a parser/export for the ABO bank statements and payment orders."
|
11
|
+
spec.required_ruby_version = ">= 2.6.0"
|
12
|
+
|
13
|
+
# spec.metadata["allowed_push_host"] = "Set to your gem server 'https://example.com'"
|
14
|
+
|
15
|
+
# spec.metadata["homepage_uri"] = spec.homepage
|
16
|
+
# spec.metadata["source_code_uri"] = "Put your gem's public repo URL here."
|
17
|
+
# spec.metadata["changelog_uri"] = "Put your gem's CHANGELOG.md URL here."
|
18
|
+
|
19
|
+
# Specify which files should be added to the gem when it is released.
|
20
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
21
|
+
spec.files = Dir.chdir(__dir__) do
|
22
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
23
|
+
(File.expand_path(f) == __FILE__) || f.start_with?(*%w[bin/ test/ spec/ features/ .git .circleci appveyor])
|
24
|
+
end
|
25
|
+
end
|
26
|
+
spec.bindir = "exe"
|
27
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ["lib"]
|
29
|
+
|
30
|
+
spec.files += Dir["lib/**/*.rb"]
|
31
|
+
|
32
|
+
# Uncomment to register a new dependency of your gem
|
33
|
+
# spec.add_dependency "example-gem", "~> 1.0"
|
34
|
+
|
35
|
+
# For more information and examples about making a new gem, check out our
|
36
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
37
|
+
end
|
data/lib/abo.rb
ADDED
@@ -0,0 +1,420 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
require "date"
|
5
|
+
|
6
|
+
class Abo
|
7
|
+
LINE_TYPE_STATEMENT = "statement"
|
8
|
+
LINE_TYPE_TRANSACTION = "transaction"
|
9
|
+
|
10
|
+
POSTING_CODE_DEBIT = 1
|
11
|
+
POSTING_CODE_CREDIT = 2
|
12
|
+
POSTING_CODE_DEBIT_REVERSAL = 4
|
13
|
+
POSTING_CODE_CREDIT_REVERSAL = 5
|
14
|
+
|
15
|
+
def parse_file(file_path)
|
16
|
+
file_object = File.new(file_path)
|
17
|
+
file_extention = file_path.to_s.split(".")[1].downcase
|
18
|
+
case file_extention
|
19
|
+
when "gpc"
|
20
|
+
parse_bank_statement_file(file_object)
|
21
|
+
when "p11"
|
22
|
+
parse_payment_order_file(file_object)
|
23
|
+
else
|
24
|
+
raise "File type not supported"
|
25
|
+
end
|
26
|
+
rescue StandardError => e
|
27
|
+
raise "Error parsing file: #{e.message}"
|
28
|
+
end
|
29
|
+
|
30
|
+
def export_to_p11(path, payment_orders)
|
31
|
+
raise "Payment orders must be an array of hashes" unless payment_orders.is_a?(Array)
|
32
|
+
|
33
|
+
p11s = []
|
34
|
+
payment_orders.each do |payment_order|
|
35
|
+
p11 = ""
|
36
|
+
p11 += payment_order[:order_number_of_statement].to_s.rjust(6, "0")
|
37
|
+
p11 += "11"
|
38
|
+
p11 += payment_order[:file_creation_date].strftime("%y%m%d")
|
39
|
+
p11 += payment_order[:own_bank_code].to_s.rjust(4, "0")
|
40
|
+
p11 += " " * 3
|
41
|
+
p11 += payment_order[:counter_account_bank_code].to_s.rjust(4, "0")
|
42
|
+
p11 += " " * 3
|
43
|
+
p11 += (payment_order[:amount] * 100).to_i.to_s.rjust(15, "0")
|
44
|
+
p11 += payment_order[:due_date].strftime("%y%m%d")
|
45
|
+
p11 += payment_order[:constant_symbol].to_s.rjust(10, "0")
|
46
|
+
p11 += payment_order[:variable_symbol_credit].to_s.rjust(10, "0")
|
47
|
+
p11 += payment_order[:specific_symbol_credit].to_s.rjust(10, "0")
|
48
|
+
p11 += payment_order[:own_account_prefix].to_s.rjust(6, "0")
|
49
|
+
p11 += payment_order[:own_account_number].to_s.rjust(10, "0")
|
50
|
+
p11 += payment_order[:counter_account_prefix].to_s.rjust(6, "0")
|
51
|
+
p11 += payment_order[:counter_account_number].to_s.rjust(10, "0")
|
52
|
+
p11 += payment_order[:credit_information].to_s.ljust(140, " ")
|
53
|
+
p11 += payment_order[:own_account_name].to_s.ljust(20, " ")
|
54
|
+
p11 += payment_order[:counter_account_name].to_s.ljust(20, " ")
|
55
|
+
p11 += payment_order[:variable_symbol_debit].to_s.rjust(10, "0")
|
56
|
+
p11 += payment_order[:specific_symbol_debit].to_s.rjust(10, "0")
|
57
|
+
p11 += payment_order[:debit_information].to_s.ljust(140, " ")
|
58
|
+
p11 += payment_order[:bank_information].to_s.ljust(140, " ")
|
59
|
+
|
60
|
+
p11s.push(p11)
|
61
|
+
end
|
62
|
+
|
63
|
+
File.open(path, "w") do |file|
|
64
|
+
p11s.each do |p11|
|
65
|
+
file.puts p11
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def export_to_gpc(path, statement)
|
71
|
+
raise "Statement must be a hash" unless statement.is_a?(Hash)
|
72
|
+
|
73
|
+
gpc = ""
|
74
|
+
gpc += "074"
|
75
|
+
gpc += statement[:client_account_prefix_number].to_s.rjust(6, "0")
|
76
|
+
gpc += statement[:client_account_number].to_s.rjust(10, "0")
|
77
|
+
gpc += statement[:abbreviated_client_name].to_s.ljust(20, " ")
|
78
|
+
gpc += statement[:old_balance_date].strftime("%d%m%y")
|
79
|
+
gpc += (statement[:old_balance] * 100).to_i.to_s.rjust(14, "0")
|
80
|
+
gpc += statement[:old_balance] >= 0 ? "+" : "-" # sign of old balance
|
81
|
+
gpc += (statement[:new_balance] * 100).to_i.to_s.rjust(14, "0")
|
82
|
+
gpc += statement[:new_balance] >= 0 ? "+" : "-" # sign of new balance
|
83
|
+
gpc += (statement[:transactions_debit] * 100).to_i.to_s.rjust(14, "0")
|
84
|
+
gpc += "0" # sign of new balance
|
85
|
+
gpc += (statement[:transactions_credit] * 100).to_i.to_s.rjust(14, "0")
|
86
|
+
gpc += "0" # sign of new balance
|
87
|
+
gpc += statement[:statement_sequence_number].to_s.rjust(3, "0")
|
88
|
+
gpc += statement[:posting_date].strftime("%d%m%y")
|
89
|
+
gpc += " " * 14
|
90
|
+
gpc += " " * 2
|
91
|
+
|
92
|
+
File.open(path, "w:cp1250") do |file|
|
93
|
+
file.puts gpc
|
94
|
+
end
|
95
|
+
|
96
|
+
statement[:transactions].each do |transaction|
|
97
|
+
case transaction[:posting_code]
|
98
|
+
when "Debit"
|
99
|
+
transaction[:posting_code] = 1
|
100
|
+
when "Credit"
|
101
|
+
transaction[:posting_code] = 2
|
102
|
+
when "Debit Reversal"
|
103
|
+
transaction[:posting_code] = 4
|
104
|
+
when "Credit Reversal"
|
105
|
+
transaction[:posting_code] = 5
|
106
|
+
end
|
107
|
+
|
108
|
+
gpc = "075"
|
109
|
+
gpc += transaction[:client_account_prefix_number].to_s.rjust(6, "0")
|
110
|
+
gpc += transaction[:client_account_number].to_s.rjust(10, "0")
|
111
|
+
gpc += transaction[:counter_account_prefix_number].to_s.rjust(6, "0")
|
112
|
+
gpc += transaction[:counter_account_number].to_s.rjust(10, "0")
|
113
|
+
gpc += transaction[:document_number].to_s.ljust(13, " ")
|
114
|
+
gpc += (transaction[:amount] * 100).to_i.to_s.rjust(12, "0")
|
115
|
+
gpc += transaction[:posting_code].to_s.rjust(1, "0")
|
116
|
+
gpc += transaction[:variable_symbol].to_s.rjust(10, "0")
|
117
|
+
gpc += (transaction[:counter_account_bank_code].rjust(4, "0") +
|
118
|
+
transaction[:constant_symbol].rjust(4, "0")).rjust(
|
119
|
+
10, "0"
|
120
|
+
)
|
121
|
+
gpc += transaction[:specific_symbol].to_s.rjust(10, "0")
|
122
|
+
gpc += transaction[:value].strftime("%d%m%y")
|
123
|
+
gpc += transaction[:additional_information].to_s.ljust(20, " ")
|
124
|
+
gpc += transaction[:change_of_item_code].to_s.rjust(1, "0")
|
125
|
+
gpc += transaction[:type_of_data].to_s.rjust(4, "0")
|
126
|
+
gpc += transaction[:due_date].strftime("%d%m%y")
|
127
|
+
gpc += " " * 2
|
128
|
+
|
129
|
+
File.open(path, "a:cp1250") do |file|
|
130
|
+
file.puts gpc
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
protected
|
136
|
+
|
137
|
+
def parse_payment_order_file(file_object)
|
138
|
+
payment_orders = []
|
139
|
+
file_object.each_line do |line|
|
140
|
+
payment_order = parse_payment_order_line(line)
|
141
|
+
payment_orders << payment_order
|
142
|
+
end
|
143
|
+
|
144
|
+
payment_orders
|
145
|
+
end
|
146
|
+
|
147
|
+
def parse_payment_order_line(line)
|
148
|
+
payment_order = AboPaymentOrder.new
|
149
|
+
|
150
|
+
payment_order.order_number_of_statement = line[0, 6]
|
151
|
+
# line[6, 2]
|
152
|
+
payment_order.file_creation_date = DateTime.strptime(line[8, 6], "%y%m%d")
|
153
|
+
payment_order.own_bank_code = line[14, 4]
|
154
|
+
payment_order.counter_account_bank_code = line[21, 4]
|
155
|
+
payment_order.amount = line[28, 15].to_i / 100.0
|
156
|
+
payment_order.due_date = DateTime.strptime(line[43, 6], "%y%m%d")
|
157
|
+
payment_order.constant_symbol = line[49, 10].gsub(/^0+/, "")
|
158
|
+
payment_order.variable_symbol_credit = line[59, 10].gsub(/^0+/, "")
|
159
|
+
payment_order.specific_symbol_credit = line[69, 10].gsub(/^0+/, "")
|
160
|
+
payment_order.own_account_prefix = line[79, 6].gsub(/^0+/, "")
|
161
|
+
payment_order.own_account_number = line[85, 10].gsub(/^0+/, "")
|
162
|
+
payment_order.counter_account_prefix = line[95, 6].gsub(/^0+/, "")
|
163
|
+
payment_order.counter_account_number = line[101, 10].gsub(/^0+/, "")
|
164
|
+
payment_order.credit_information = line[111, 140]
|
165
|
+
payment_order.own_account_name = line[251, 20]
|
166
|
+
payment_order.counter_account_name = line[271, 20]
|
167
|
+
payment_order.variable_symbol_debit = line[291, 10].gsub(/^0+/, "")
|
168
|
+
payment_order.specific_symbol_debit = line[301, 10].gsub(/^0+/, "")
|
169
|
+
payment_order.debit_information = line[311, 140]
|
170
|
+
payment_order.bank_information = line[451, 140]
|
171
|
+
|
172
|
+
payment_order
|
173
|
+
end
|
174
|
+
|
175
|
+
def parse_bank_statement_file(file_object)
|
176
|
+
@statement = AboStatement.new
|
177
|
+
|
178
|
+
file_object.each_line do |line|
|
179
|
+
line = line.force_encoding("cp1250").encode("utf-8")
|
180
|
+
case get_line_type(line)
|
181
|
+
when LINE_TYPE_STATEMENT
|
182
|
+
parse_statement_line(line)
|
183
|
+
when LINE_TYPE_TRANSACTION
|
184
|
+
transaction = parse_transaction_line(line)
|
185
|
+
@statement.transactions << transaction
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
@statement
|
190
|
+
end
|
191
|
+
|
192
|
+
def get_line_type(line)
|
193
|
+
case line[0, 3]
|
194
|
+
when "074"
|
195
|
+
LINE_TYPE_STATEMENT
|
196
|
+
when "075"
|
197
|
+
LINE_TYPE_TRANSACTION
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
def parse_statement_line(line)
|
202
|
+
pos = 0
|
203
|
+
length = 3
|
204
|
+
|
205
|
+
# rubocop:disable Lint/UselessAssignment
|
206
|
+
@statement.client_account_prefix_number = line[pos += length, length = 6].gsub(/^0+/, "")
|
207
|
+
@statement.client_account_number = line[pos += length, length = 10].gsub(/^0+/, "")
|
208
|
+
@statement.abbreviated_client_name = line[pos += length, length = 20]
|
209
|
+
@statement.old_balance_date = DateTime.strptime(line[pos += length, length = 6], "%d%m%y")
|
210
|
+
@statement.old_balance = (line[pos += length,
|
211
|
+
length = 14].to_i / 100.0) * (line[pos += length, length = 1] == "-" ? -1 : 1)
|
212
|
+
@statement.new_balance = (line[pos += length,
|
213
|
+
length = 14].to_i / 100.0) * (line[pos += length, length = 1] == "-" ? -1 : 1)
|
214
|
+
@statement.transactions_debit = (line[pos += length,
|
215
|
+
length = 14].to_i / 100.0) * (line[pos += length, length = 1] == "-" ? -1 : 1)
|
216
|
+
@statement.transactions_credit = (line[pos += length,
|
217
|
+
length = 14].to_i / 100.0) * (if line[pos += length,
|
218
|
+
length = 1] == "-"
|
219
|
+
-1
|
220
|
+
else
|
221
|
+
1
|
222
|
+
end)
|
223
|
+
@statement.statement_sequence_number = line[pos += length, length = 3]
|
224
|
+
@statement.posting_date = DateTime.strptime(line[pos += length, length = 6], "%d%m%y")
|
225
|
+
line[pos += length, length = 14] # Skip
|
226
|
+
line[pos += length, length = 2] # Skip
|
227
|
+
# rubocop:enable Lint/UselessAssignment
|
228
|
+
end
|
229
|
+
|
230
|
+
def parse_transaction_line(line)
|
231
|
+
pos = 0
|
232
|
+
length = 3
|
233
|
+
|
234
|
+
transaction = AboTransaction.new
|
235
|
+
|
236
|
+
# rubocop:disable Lint/UselessAssignment
|
237
|
+
transaction.client_account_prefix_number = line[pos += length, length = 6].gsub(/^0+/, "")
|
238
|
+
transaction.client_account_number = line[pos += length, length = 10].gsub(/^0+/, "")
|
239
|
+
transaction.counter_account_prefix_number = line[pos += length, length = 6].gsub(/^0+/, "")
|
240
|
+
transaction.counter_account_number = line[pos += length, length = 10].gsub(/^0+/, "")
|
241
|
+
transaction.document_number = line[pos += length, length = 13]
|
242
|
+
transaction.amount = line[pos += length, length = 12].to_f / 100.0
|
243
|
+
transaction.posting_code = line[pos += length, length = 1].to_i
|
244
|
+
transaction.variable_symbol = line[pos += length, length = 10].gsub(/^0+/, "")
|
245
|
+
constant_symbol = line[pos += length, length = 10]
|
246
|
+
constant_symbol.slice!(0, 6)
|
247
|
+
transaction.constant_symbol = constant_symbol.gsub(/^0+/, "")
|
248
|
+
transaction.specific_symbol = line[pos += length, length = 10].gsub(/^0+/, "")
|
249
|
+
transaction.value = DateTime.strptime(line[pos += length, length = 6], "%d%m%y")
|
250
|
+
transaction.additional_information = line[pos += length, length = 20]
|
251
|
+
transaction.change_of_item_code = line[pos += length, length = 1]
|
252
|
+
transaction.type_of_data = line[pos += length, length = 4]
|
253
|
+
transaction.due_date = DateTime.strptime(line[pos += length, length = 6], "%d%m%y")
|
254
|
+
line[pos += length, length = 2] # Skip
|
255
|
+
# rubocop:enable Lint/UselessAssignment
|
256
|
+
|
257
|
+
transaction.counter_account_bank_code = line[73, 4]
|
258
|
+
|
259
|
+
case transaction.posting_code
|
260
|
+
when POSTING_CODE_DEBIT
|
261
|
+
transaction.debit = transaction.amount
|
262
|
+
transaction.posting_code = "Debit"
|
263
|
+
when POSTING_CODE_CREDIT
|
264
|
+
transaction.credit = transaction.amount
|
265
|
+
transaction.posting_code = "Credit"
|
266
|
+
when POSTING_CODE_DEBIT_REVERSAL
|
267
|
+
transaction.debit = transaction.amount * -1.0
|
268
|
+
transaction.posting_code = "Debit Reversal"
|
269
|
+
when POSTING_CODE_CREDIT_REVERSAL
|
270
|
+
transaction.credit = transaction.amount * -1.0
|
271
|
+
transaction.posting_code = "Credit Reversal"
|
272
|
+
end
|
273
|
+
|
274
|
+
transaction
|
275
|
+
end
|
276
|
+
|
277
|
+
class AboStatement
|
278
|
+
attr_accessor :client_account_number, :client_account_prefix_number, :abbreviated_client_name, :old_balance_date,
|
279
|
+
:old_balance, :new_balance, :transactions_debit, :transactions_credit, :statement_sequence_number,
|
280
|
+
:posting_date, :transactions
|
281
|
+
|
282
|
+
def initialize
|
283
|
+
@client_account_number = nil
|
284
|
+
@client_account_prefix_number = nil
|
285
|
+
@abbreviated_client_name = nil
|
286
|
+
@old_balance_date = nil
|
287
|
+
@old_balance = nil
|
288
|
+
@new_balance = nil
|
289
|
+
@transactions_debit = nil
|
290
|
+
@transactions_credit = nil
|
291
|
+
@statement_sequence_number = nil
|
292
|
+
@posting_date = nil
|
293
|
+
@transactions = []
|
294
|
+
end
|
295
|
+
|
296
|
+
def to_hash
|
297
|
+
{
|
298
|
+
client_account_number: @client_account_number,
|
299
|
+
client_account_prefix_number: @client_account_prefix_number,
|
300
|
+
abbreviated_client_name: @abbreviated_client_name,
|
301
|
+
old_balance_date: @old_balance_date,
|
302
|
+
old_balance: @old_balance,
|
303
|
+
new_balance: @new_balance,
|
304
|
+
transactions_debit: @transactions_debit,
|
305
|
+
transactions_credit: @transactions_credit,
|
306
|
+
statement_sequence_number: @statement_sequence_number,
|
307
|
+
posting_date: @posting_date,
|
308
|
+
transactions: @transactions.map(&:to_hash)
|
309
|
+
}
|
310
|
+
end
|
311
|
+
end
|
312
|
+
|
313
|
+
class AboTransaction
|
314
|
+
attr_accessor :client_account_number, :client_account_prefix_number, :counter_account_number,
|
315
|
+
:counter_account_prefix_number, :document_number, :amount, :posting_code,
|
316
|
+
:variable_symbol, :constant_symbol, :specific_symbol, :value, :additional_information,
|
317
|
+
:change_of_item_code, :type_of_data, :due_date, :debit, :credit, :counter_account_bank_code
|
318
|
+
|
319
|
+
def initialize
|
320
|
+
@client_account_number = nil
|
321
|
+
@client_account_prefix_number = nil
|
322
|
+
@counter_account_number = nil
|
323
|
+
@counter_account_prefix_number = nil
|
324
|
+
@document_number = nil
|
325
|
+
@amount = nil
|
326
|
+
@posting_code = nil
|
327
|
+
@variable_symbol = nil
|
328
|
+
@constant_symbol = nil
|
329
|
+
@specific_symbol = nil
|
330
|
+
@value = nil
|
331
|
+
@additional_information = nil
|
332
|
+
@change_of_item_code = nil
|
333
|
+
@type_of_data = nil
|
334
|
+
@due_date = nil
|
335
|
+
|
336
|
+
@debit = nil
|
337
|
+
@credit = nil
|
338
|
+
@counter_account_bank_code = nil
|
339
|
+
end
|
340
|
+
|
341
|
+
def to_hash
|
342
|
+
{
|
343
|
+
client_account_number: @client_account_number,
|
344
|
+
client_account_prefix_number: @client_account_prefix_number,
|
345
|
+
counter_account_number: @counter_account_number,
|
346
|
+
counter_account_prefix_number: @counter_account_prefix_number,
|
347
|
+
document_number: @document_number,
|
348
|
+
amount: @amount,
|
349
|
+
posting_code: @posting_code,
|
350
|
+
variable_symbol: @variable_symbol,
|
351
|
+
constant_symbol: @constant_symbol,
|
352
|
+
specific_symbol: @specific_symbol,
|
353
|
+
value: @value,
|
354
|
+
additional_information: @additional_information,
|
355
|
+
change_of_item_code: @change_of_item_code,
|
356
|
+
type_of_data: @type_of_data,
|
357
|
+
due_date: @due_date,
|
358
|
+
debit: @debit,
|
359
|
+
credit: @credit,
|
360
|
+
counter_account_bank_code: @counter_account_bank_code
|
361
|
+
}
|
362
|
+
end
|
363
|
+
end
|
364
|
+
|
365
|
+
class AboPaymentOrder
|
366
|
+
attr_accessor :order_number_of_statement, :file_creation_date, :own_bank_code, :counter_account_bank_code, :amount,
|
367
|
+
:due_date, :constant_symbol, :variable_symbol_credit, :specific_symbol_credit, :own_account_prefix,
|
368
|
+
:own_account_number, :counter_account_prefix, :counter_account_number, :credit_information,
|
369
|
+
:own_account_name, :counter_account_name, :variable_symbol_debit, :specific_symbol_debit,
|
370
|
+
:debit_information, :bank_information
|
371
|
+
|
372
|
+
def initialize
|
373
|
+
@order_number_of_statement = nil
|
374
|
+
@file_creation_date = nil
|
375
|
+
@own_bank_code = nil
|
376
|
+
@counter_account_bank_code = nil
|
377
|
+
@amount = nil
|
378
|
+
@due_date = nil
|
379
|
+
@constant_symbol = nil
|
380
|
+
@variable_symbol_credit = nil
|
381
|
+
@specific_symbol_credit = nil
|
382
|
+
@own_account_prefix = nil
|
383
|
+
@own_account_number = nil
|
384
|
+
@counter_account_prefix = nil
|
385
|
+
@counter_account_number = nil
|
386
|
+
@credit_information = nil
|
387
|
+
@own_account_name = nil
|
388
|
+
@counter_account_name = nil
|
389
|
+
@variable_symbol_debit = nil
|
390
|
+
@specific_symbol_debit = nil
|
391
|
+
@debit_information = nil
|
392
|
+
@bank_information = nil
|
393
|
+
end
|
394
|
+
|
395
|
+
def to_hash
|
396
|
+
{
|
397
|
+
order_number_of_statement: @order_number_of_statement,
|
398
|
+
file_creation_date: @file_creation_date,
|
399
|
+
own_bank_code: @own_bank_code,
|
400
|
+
counter_account_bank_code: @counter_account_bank_code,
|
401
|
+
amount: @amount,
|
402
|
+
due_date: @due_date,
|
403
|
+
constant_symbol: @constant_symbol,
|
404
|
+
variable_symbol_credit: @variable_symbol_credit,
|
405
|
+
specific_symbol_credit: @specific_symbol_credit,
|
406
|
+
own_account_prefix: @own_account_prefix,
|
407
|
+
own_account_number: @own_account_number,
|
408
|
+
counter_account_prefix: @counter_account_prefix,
|
409
|
+
counter_account_number: @counter_account_number,
|
410
|
+
credit_information: @credit_information,
|
411
|
+
own_account_name: @own_account_name,
|
412
|
+
counter_account_name: @counter_account_name,
|
413
|
+
variable_symbol_debit: @variable_symbol_debit,
|
414
|
+
specific_symbol_debit: @specific_symbol_debit,
|
415
|
+
debit_information: @debit_information,
|
416
|
+
bank_information: @bank_information
|
417
|
+
}
|
418
|
+
end
|
419
|
+
end
|
420
|
+
end
|
data/lib/abo_parser.rb
ADDED
data/sig/abo_parser.rbs
ADDED
metadata
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: abo_parser
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Rhemery
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-06-03 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description:
|
14
|
+
email:
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- ".rspec"
|
20
|
+
- ".rubocop.yml"
|
21
|
+
- CHANGELOG.md
|
22
|
+
- Gemfile
|
23
|
+
- LICENSE.txt
|
24
|
+
- README.md
|
25
|
+
- Rakefile
|
26
|
+
- abo_parser.gemspec
|
27
|
+
- lib/abo.rb
|
28
|
+
- lib/abo_parser.rb
|
29
|
+
- lib/abo_parser/version.rb
|
30
|
+
- sig/abo_parser.rbs
|
31
|
+
homepage:
|
32
|
+
licenses: []
|
33
|
+
metadata: {}
|
34
|
+
post_install_message:
|
35
|
+
rdoc_options: []
|
36
|
+
require_paths:
|
37
|
+
- lib
|
38
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 2.6.0
|
43
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
requirements: []
|
49
|
+
rubygems_version: 3.4.10
|
50
|
+
signing_key:
|
51
|
+
specification_version: 4
|
52
|
+
summary: This gem is a parser/export for the ABO bank statements and payment orders.
|
53
|
+
test_files: []
|