absa-esd 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in absa-esd.gemspec
4
+ gemspec
5
+
6
+ gem 'rspec'
data/Gemfile.lock ADDED
@@ -0,0 +1,40 @@
1
+ GIT
2
+ remote: git://github.com/tehtorq/strata.git
3
+ revision: 32ab2e00de10c0d4760ec28be6de4d49fd7e7e40
4
+ specs:
5
+ strata (0.0.1)
6
+ activesupport
7
+ i18n
8
+
9
+ PATH
10
+ remote: .
11
+ specs:
12
+ absa-esd (0.0.1)
13
+ activesupport
14
+ i18n
15
+
16
+ GEM
17
+ remote: http://rubygems.org/
18
+ specs:
19
+ activesupport (3.2.2)
20
+ i18n (~> 0.6)
21
+ multi_json (~> 1.0)
22
+ diff-lcs (1.1.3)
23
+ i18n (0.6.0)
24
+ multi_json (1.1.0)
25
+ rspec (2.8.0)
26
+ rspec-core (~> 2.8.0)
27
+ rspec-expectations (~> 2.8.0)
28
+ rspec-mocks (~> 2.8.0)
29
+ rspec-core (2.8.0)
30
+ rspec-expectations (2.8.0)
31
+ diff-lcs (~> 1.1.2)
32
+ rspec-mocks (2.8.0)
33
+
34
+ PLATFORMS
35
+ ruby
36
+
37
+ DEPENDENCIES
38
+ absa-esd!
39
+ rspec
40
+ strata (= 0.0.1)!
data/README ADDED
File without changes
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new('spec')
5
+
6
+ # If you want to make this the default task
7
+ task :default => :spec
data/absa-esd.gemspec ADDED
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "absa-esd/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "absa-esd"
7
+ s.version = Absa::Esd::VERSION
8
+ s.authors = ["Jeffrey van Aswegen, Douglas Anderson"]
9
+ s.email = ["jeffmess@gmail.com, i.am.douglas.anderson@gmail.com"]
10
+ s.homepage = ""
11
+ s.summary = %q{A ruby interface to commumicate with the ABSA Electronic Statement Delivery platform.}
12
+ s.description = %q{A ruby interface to commumicate with the ABSA Electronic Statement Delivery platform.}
13
+
14
+ s.rubyforge_project = "absa-esd"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_dependency "activesupport"
22
+ s.add_dependency "i18n"
23
+ s.add_dependency "strata", "~> 0.0.1"
24
+ end
data/lib/absa-esd.rb ADDED
@@ -0,0 +1,15 @@
1
+ require "absa-esd/version"
2
+ require "active_support/core_ext/string"
3
+ require "yaml"
4
+ #require 'strata'
5
+
6
+ module Absa
7
+ module Esd
8
+ CONFIG_DIR = File.expand_path(File.dirname(__FILE__)) + "/config"
9
+ end
10
+ end
11
+
12
+ require 'absa-esd/transmission/set'
13
+ require 'absa-esd/transmission/record'
14
+ require 'absa-esd/transmission/document'
15
+ require 'absa-esd/statement4_unpacked'
@@ -0,0 +1,20 @@
1
+ module Absa
2
+ module Esd
3
+
4
+ module Statement4Unpacked
5
+
6
+ class ReconTransmission < Transmission::Set
7
+ class Header < Transmission::Record; end
8
+ class Trailer < Transmission::Record; end
9
+ end
10
+
11
+ class ReconAccount < Transmission::Set
12
+ class Header < Transmission::Record; end
13
+ class Detail < Transmission::Record; end
14
+ class Trailer < Transmission::Record; end
15
+ end
16
+
17
+ end
18
+
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ module Absa
2
+ module Esd
3
+ module Transmission
4
+
5
+ class Document < Set
6
+
7
+ def self.from_s(string)
8
+ options = self.hash_from_s(string)
9
+ self.build(options[:data])
10
+ end
11
+
12
+ def from_file!(filename)
13
+ self.from_s(File.open(filename, "rb").read)
14
+ end
15
+
16
+ end
17
+
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,28 @@
1
+ module Absa
2
+ module Esd
3
+ module Transmission
4
+
5
+ class Record
6
+ include Strata::RecordWriter
7
+ extend Strata::RecordWriter::ClassMethods
8
+
9
+ set_record_length 550
10
+ set_delimiter "\r\n"
11
+
12
+ def initialize(options = {})
13
+ set_layout_variables(options)
14
+ validate! options
15
+ end
16
+
17
+ def self.class_layout_rules
18
+ file_name = "#{Absa::Esd::CONFIG_DIR}/#{self.name.split("::")[-3].underscore}/#{self.name.split("::")[-2].underscore}.yml"
19
+ record_type = self.name.split("::")[-1].underscore
20
+
21
+ YAML.load(File.open(file_name))[record_type]
22
+ end
23
+
24
+ end
25
+
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,155 @@
1
+ module Absa
2
+ module Esd
3
+ module Transmission
4
+
5
+ class Set
6
+
7
+ attr_accessor :records
8
+
9
+ def initialize
10
+ self.records = []
11
+ end
12
+
13
+ def self.build(data)
14
+ set = self.new
15
+
16
+ data.each do |hash|
17
+ if hash[:data].is_a? Array
18
+ klass = "Absa::Esd::Statement4Unpacked::#{hash[:type].capitalize.camelize}".constantize
19
+ set.records << klass.build(hash[:data])
20
+ else
21
+ klass = "Absa::Esd::Statement4Unpacked::#{self.partial_class_name}::#{hash[:type].capitalize.camelize}".constantize
22
+ set.records << klass.new(hash[:data])
23
+ end
24
+ end
25
+
26
+ set.validate!
27
+ set
28
+ end
29
+
30
+ def header
31
+ records[0]
32
+ end
33
+
34
+ def trailer
35
+ records[-1]
36
+ end
37
+
38
+ def transactions
39
+ records[1..-2]
40
+ end
41
+
42
+ def validate!
43
+
44
+ end
45
+
46
+ def to_s
47
+ string = ""
48
+ records.each {|record| string += record.to_s }
49
+ string
50
+ end
51
+
52
+ def self.for_record(record) # move this logic to yml file
53
+ record_id = record[0]
54
+
55
+ case record_id
56
+ when '0','9'
57
+ return Absa::Esd::Statement4Unpacked::ReconTransmission
58
+ when '1','2','8'
59
+ return Absa::Esd::Statement4Unpacked::ReconAccount
60
+ end
61
+ end
62
+
63
+ def self.trailer_id(klass)
64
+ case klass.name
65
+ when 'Absa::Esd::Statement4Unpacked::ReconTransmission'
66
+ return '9'
67
+ when 'Absa::Esd::Statement4Unpacked::ReconAccount'
68
+ return '8'
69
+ end
70
+ end
71
+
72
+ def self.is_trailer_record?(set, record)
73
+ record_id = record[0]
74
+ self.trailer_id(set) == record_id
75
+ end
76
+
77
+ def self.process_record(record)
78
+ record_info = {}
79
+
80
+ self.record_types.each do |record_type|
81
+ klass = "#{self.name}::#{record_type.camelize}".constantize
82
+
83
+ if klass.matches_definition?(record)
84
+ options = klass.string_to_hash(record)
85
+ record_info = {type: record_type, data: options}
86
+ break
87
+ end
88
+ end
89
+
90
+ record_info
91
+ end
92
+
93
+ def self.hash_from_s(string)
94
+ set_info = {type: self.partial_class_name.underscore, data: []}
95
+ lines = string.split(/^/)
96
+
97
+ # look for rec_ids, split into chunks, and pass each related class a piece of string
98
+
99
+ buffer = []
100
+ current_set = nil
101
+ subset = nil
102
+
103
+ lines.each do |line|
104
+ next if line.length < 10 # TODO: flaky - tighten it up
105
+ if Set.for_record(line) == self
106
+ if subset && (buffer.length > 0)
107
+ set_info[:data] << subset.hash_from_s(buffer.join)
108
+ buffer = []
109
+ subset = nil
110
+ end
111
+
112
+ record = line
113
+ set_info[:data] << self.process_record(record)
114
+ else
115
+ subset = Set.for_record(line) unless subset
116
+ buffer << line
117
+
118
+ if self.is_trailer_record?(subset, line)
119
+ set_info[:data] << subset.hash_from_s(buffer.join)
120
+ buffer = []
121
+ subset = nil
122
+ end
123
+ end
124
+ end
125
+
126
+ set_info
127
+ end
128
+
129
+ def self.record_types
130
+ self.layout_rules.map {|k,v| k}
131
+ end
132
+
133
+ def self.module_name
134
+ self.name.split("::")[0..-1].join("::")
135
+ end
136
+
137
+ def self.partial_class_name
138
+ self.name.split("::")[-1]
139
+ end
140
+
141
+ def self.layout_rules
142
+ file_name = "#{Absa::Esd::CONFIG_DIR}/#{self.name.split("::")[-2].underscore}/#{self.partial_class_name.underscore}.yml"
143
+
144
+ YAML.load(File.open(file_name))
145
+ end
146
+
147
+ def self.record_type(record_type)
148
+ "#{self.name}::#{record_type.camelize}".constantize
149
+ end
150
+
151
+ end
152
+
153
+ end
154
+ end
155
+ end
@@ -0,0 +1,5 @@
1
+ module Absa
2
+ module Esd
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,309 @@
1
+ header:
2
+ rec_type:
3
+ data_type: A
4
+ offset: 1
5
+ length: 1
6
+ fixed_val: '1'
7
+ account_number:
8
+ data_type: N
9
+ offset: 2
10
+ length: 19
11
+ statement_number:
12
+ data_type: N
13
+ offset: 21
14
+ length: 5
15
+ filler_1:
16
+ data_type: A
17
+ offset: 26
18
+ length: 5
19
+ processing_date:
20
+ data_type: N
21
+ offset: 31
22
+ length: 8
23
+ no_strip: true
24
+ account_branch_code:
25
+ data_type: N
26
+ offset: 39
27
+ length: 8
28
+ filler_2:
29
+ data_type: A
30
+ offset: 47
31
+ length: 18
32
+ filler_3:
33
+ data_type: A
34
+ offset: 65
35
+ length: 16
36
+ hd_op_bals:
37
+ data_type: A
38
+ offset: 81
39
+ length: 1
40
+ hd_op_bal:
41
+ data_type: N
42
+ offset: 82
43
+ length: 17
44
+ filler_4:
45
+ data_type: A
46
+ offset: 99
47
+ length: 84
48
+ function_code:
49
+ data_type: A
50
+ offset: 183
51
+ length: 4
52
+ fixed_val: 'AA0A'
53
+ filler_5:
54
+ data_type: A
55
+ offset: 187
56
+ length: 329
57
+ generation_number:
58
+ data_type: A
59
+ offset: 516
60
+ length: 9
61
+ filler_6:
62
+ data_type: A
63
+ offset: 525
64
+ length: 25
65
+ detail:
66
+ rec_type:
67
+ data_type: A
68
+ offset: 1
69
+ length: 1
70
+ fixed_val: '2'
71
+ account_number:
72
+ data_type: N
73
+ offset: 2
74
+ length: 19
75
+ statement_number:
76
+ data_type: N
77
+ offset: 21
78
+ length: 5
79
+ page_number:
80
+ data_type: N
81
+ offset: 26
82
+ length: 5
83
+ transaction_processing_date:
84
+ data_type: N
85
+ offset: 31
86
+ length: 8
87
+ transaction_effective_date:
88
+ data_type: N
89
+ offset: 39
90
+ length: 8
91
+ cheque_number:
92
+ data_type: N
93
+ offset: 47
94
+ length: 9
95
+ transaction_reference_number:
96
+ data_type: N
97
+ offset: 56
98
+ length: 9
99
+ transaction_amount_sign:
100
+ data_type: A
101
+ offset: 65
102
+ length: 1
103
+ transaction_amount:
104
+ data_type: N
105
+ offset: 66
106
+ length: 15
107
+ account_balance_sign:
108
+ data_type: A
109
+ offset: 81
110
+ length: 1
111
+ account_balance_after_transaction:
112
+ data_type: N
113
+ offset: 82
114
+ length: 17
115
+ transaction_description:
116
+ data_type: A
117
+ offset: 99
118
+ length: 50
119
+ dep_id:
120
+ data_type: A
121
+ offset: 149
122
+ length: 30
123
+ transaction_code:
124
+ data_type: A
125
+ offset: 179
126
+ length: 4
127
+ cheques_function_code:
128
+ data_type: A
129
+ offset: 183
130
+ length: 4
131
+ charge_levied_amount_sign:
132
+ data_type: A
133
+ offset: 187
134
+ length: 1
135
+ charge_levied_amount:
136
+ data_type: N
137
+ offset: 188
138
+ length: 9
139
+ charge_type:
140
+ data_type: A
141
+ offset: 197
142
+ length: 1
143
+ stamp_duty_amount_sign:
144
+ data_type: A
145
+ offset: 198
146
+ length: 1
147
+ stamp_duty_levied_amount:
148
+ data_type: N
149
+ offset: 199
150
+ length: 9
151
+ cash_deposit_fee_sign:
152
+ data_type: A
153
+ offset: 208
154
+ length: 1
155
+ cash_deposit_fee:
156
+ data_type: N
157
+ offset: 209
158
+ length: 9
159
+ charges_accrued:
160
+ data_type: A
161
+ offset: 218
162
+ length: 1
163
+ event_number:
164
+ data_type: N
165
+ offset: 219
166
+ length: 9
167
+ statement_line_sequence_number:
168
+ data_type: N
169
+ offset: 228
170
+ length: 9
171
+ vat_amount:
172
+ data_type: N
173
+ offset: 237
174
+ length: 9
175
+ cash_portion:
176
+ data_type: N
177
+ offset: 246
178
+ length: 15
179
+ deposit_number:
180
+ data_type: N
181
+ offset: 261
182
+ length: 9
183
+ transaction_time:
184
+ data_type: N
185
+ offset: 270
186
+ length: 6
187
+ filler_1:
188
+ data_type: A
189
+ offset: 276
190
+ length: 10
191
+ filler_2:
192
+ data_type: A
193
+ offset: 286
194
+ length: 4
195
+ sitename:
196
+ data_type: A
197
+ offset: 290
198
+ length: 15
199
+ category:
200
+ data_type: A
201
+ offset: 305
202
+ length: 4
203
+ transaction_type:
204
+ data_type: A
205
+ offset: 309
206
+ length: 2
207
+ deposit_id_description:
208
+ data_type: A
209
+ offset: 311
210
+ length: 10
211
+ pod_adjustment_amount:
212
+ data_type: A
213
+ offset: 321
214
+ length: 15
215
+ pod_adjustment_reason:
216
+ data_type: A
217
+ offset: 336
218
+ length: 35
219
+ pod_returned_cheque_reason_code:
220
+ data_type: N
221
+ offset: 371
222
+ length: 4
223
+ pod_returned_cheque_drawee:
224
+ data_type: A
225
+ offset: 375
226
+ length: 30
227
+ fedi_payor:
228
+ data_type: A
229
+ offset: 405
230
+ length: 30
231
+ fedi_number:
232
+ data_type: N
233
+ offset: 435
234
+ length: 16
235
+ redirect_description:
236
+ data_type: A
237
+ offset: 451
238
+ length: 16
239
+ account_number_redirect:
240
+ data_type: N
241
+ offset: 467
242
+ length: 19
243
+ unpaid_cheque_reason_description:
244
+ data_type: A
245
+ offset: 486
246
+ length: 20
247
+ filler_3:
248
+ data_type: A
249
+ offset: 506
250
+ length: 10
251
+ generation_number:
252
+ data_type: A
253
+ offset: 516
254
+ length: 9
255
+ old_reconfocus_category1:
256
+ data_type: N
257
+ offset: 525
258
+ length: 2
259
+ old_reconfocus_category2:
260
+ data_type: N
261
+ offset: 527
262
+ length: 2
263
+ filler_4:
264
+ data_type: A
265
+ offset: 529
266
+ length: 21
267
+ trailer:
268
+ rec_type:
269
+ data_type: A
270
+ offset: 1
271
+ length: 1
272
+ fixed_val: '8'
273
+ account_number:
274
+ data_type: N
275
+ offset: 2
276
+ length: 19
277
+ fixed_val: '9999999999999999999'
278
+ filler_1:
279
+ data_type: A
280
+ offset: 21
281
+ length: 44
282
+ hash_amount_sign:
283
+ data_type: A
284
+ offset: 65
285
+ length: 1
286
+ hash_amount:
287
+ data_type: N
288
+ offset: 66
289
+ length: 17
290
+ filler_2:
291
+ data_type: A
292
+ offset: 83
293
+ length: 107
294
+ rec_count:
295
+ data_type: N
296
+ offset: 190
297
+ length: 10
298
+ filler_3:
299
+ data_type: A
300
+ offset: 200
301
+ length: 316
302
+ generation_number:
303
+ data_type: A
304
+ offset: 516
305
+ length: 9
306
+ filler_4:
307
+ data_type: A
308
+ offset: 525
309
+ length: 25
@@ -0,0 +1,84 @@
1
+ header:
2
+ rec_type:
3
+ data_type: A
4
+ offset: 1
5
+ length: 1
6
+ fixed_val: '0'
7
+ filler_1:
8
+ data_type: A
9
+ offset: 2
10
+ length: 19
11
+ status:
12
+ data_type: A
13
+ offset: 21
14
+ length: 1
15
+ regex: ^T|P$
16
+ date:
17
+ data_type: N
18
+ offset: 22
19
+ length: 8
20
+ regex: ^[0-9]{8}$
21
+ no_strip: true
22
+ client_code:
23
+ data_type: N
24
+ offset: 30
25
+ length: 5
26
+ client_name:
27
+ data_type: A
28
+ offset: 35
29
+ length: 30
30
+ destination_code:
31
+ data_type: N
32
+ offset: 65
33
+ length: 5
34
+ filler_2:
35
+ data_type: A
36
+ offset: 70
37
+ length: 446
38
+ gen_no:
39
+ data_type: N
40
+ offset: 516
41
+ length: 9
42
+ filler_3:
43
+ data_type: A
44
+ offset: 525
45
+ length: 25
46
+ trailer:
47
+ rec_type:
48
+ data_type: A
49
+ offset: 1
50
+ length: 1
51
+ fixed_val: '9'
52
+ account_number:
53
+ data_type: N
54
+ offset: 2
55
+ length: 19
56
+ status:
57
+ data_type: A
58
+ offset: 21
59
+ length: 1
60
+ date:
61
+ data_type: N
62
+ offset: 22
63
+ length: 8
64
+ no_strip: true
65
+ filler_1:
66
+ data_type: A
67
+ offset: 30
68
+ length: 160
69
+ rec_count:
70
+ data_type: N
71
+ offset: 190
72
+ length: 10
73
+ filler_2:
74
+ data_type: A
75
+ offset: 200
76
+ length: 316
77
+ generation_number:
78
+ data_type: N
79
+ offset: 516
80
+ length: 9
81
+ filler_3:
82
+ data_type: A
83
+ offset: 525
84
+ length: 25
@@ -0,0 +1,51 @@
1
+ 00000000000000000000P2002111903174TEST 03174 000000295
2
+ 1000000000401111180900264000012002111800000000 +000000000000000+00000000000000000 AA0A 000000295
3
+ 2000000000401111180900264000012002111820021118000000000000103899+000000002630670+00000000002630670ACB CREDIT SETTLEMENT BASGHW GP HEALTH000212608 FN71ACC +000000000 +000000000+000000000 000012533000000004000000000000000000000000000000000000000 0012 000000000000000 0000000000000000 0000000000000000000 0000002955151
4
+ 2000000000401111180900264000012002111820021118000000000000056571+000000000649363+00000000003280033CREDIT TRANSFER CASHFOCUS 440151586 CF71CFAC+000000000 +000000000+000000000 000012537000000006000000000000000000000000000000000000000 0510 000000000000000 0000000000000000 0000000000000000000 0000002955158
5
+ 2000000000401111180900264000012002111820021118000000000000056572+000000000305575+00000000003585608CREDIT TRANSFER CASHFOCUS 440151579 CF71CFAC+000000000 +000000000+000000000 000012538000000008000000000000000000000000000000000000000 0510 000000000000000 0000000000000000 0000000000000000000 0000002955158
6
+ 2000000000401111180900264000012002111820021118000000000000000000+000000000057866+00000000003643474DEPOSIT STRYDOMPAR 440144444 FN71QD +000000000 +000000000+000000000 000012539000000010000000000000000000000000000000000000000 2740 000000000000000 0000000000000000 0000000000000000000 0000002955151
7
+ 2000000000401111180900264000012002111820021118000000000000000000+000000000031699+00000000003675173DEPOSIT STRYDOMPAR 440144437 FN71QD +000000000 +000000000+000000000 000012540000000012000000000000000000000000000000000000000 2740 000000000000000 0000000000000000 0000000000000000000 0000002955151
8
+ 2000000000401111180900264000012002111820021118000000000000000000+000000001141155+00000000004816328DEPOSIT KNYSNA 440102250 FN71QD +000000000 +000000000+000000000 000012542000000014000000000000000000000000000000000000000 2740 000000000000000 0000000000000000 0000000000000000000 0000002955151
9
+ 2000000000401111180900264000012002111820021118000000000000000000+000000001524408+00000000006340736DEPOSIT FOURWAYS 440066010 FN71QD +000000000 +000000000+000000000 000012544000000016000000000000000000000000000000000000000 2740 000000000000000 0000000000000000 0000000000000000000 0000002955151
10
+ 2000000000401111180900264000012002111820021118000000000000000000+000000000139741+00000000006480477DEPOSIT EASTGATE 440015738 FN71QD +000000000 +000000000+000000000 000012545000000018000000000000000000000000000000000000000 2740 000000000000000 0000000000000000 0000000000000000000 0000002955151
11
+ 2000000000401111180900264000012002111820021118000000000000000000+000000000183475+00000000006663952DEPOSIT EASTGATE 440015720 FN71QD +000000000 +000000000+000000000 000012546000000020000000000000000000000000000000000000000 2740 000000000000000 0000000000000000 0000000000000000000 0000002955151
12
+ 2000000000401111180900264000012002111820021118000000000000000000+000000003650595+00000000010314547DEPOSIT RSEBNK CEN 440072670 FN71QD +000000000 +000000000+000000000 000012548000000022000000000000000000000000000000000000000 2740 000000000000000 0000000000000000 0000000000000000000 0000002955151
13
+ 2000000000401111180900264000012002111820021118000000000000000000+000000000226313+00000000010540860DEPOSIT PROTEA PAR 440081667 FN71QD +000000000 +000000000+000000000 000012549000000024000000000000000000000000000000000000000 2740 000000000000000 0000000000000000 0000000000000000000 0000002955151
14
+ 2000000000401111180900264000012002111820021118000000000000000000+000000000172368+00000000010713228DEPOSIT PROTEA PAR 440086150 FN71QD +000000000 +000000000+000000000 000012550000000026000000000000000000000000000000000000000 2740 000000000000000 0000000000000000 0000000000000000000 0000002955151
15
+ 2000000000401111180900264000012002111820021118000000000000000000+000000000404852+00000000011118080DEPOSIT EST RAND M 440131727 FN71QD +000000000 +000000000+000000000 000012552000000028000000000000000000000000000000000000000 2740 000000000000000 0000000000000000 0000000000000000000 0000002955151
16
+ 2000000000401111180900264000012002111820021118000000000000000000+000000000246492+00000000011364572DEPOSIT EST RAND M 440131727 FN71QD +000000000 +000000000+000000000 000012553000000030000000000000000000000000000000000000000 2740 000000000000000 0000000000000000 0000000000000000000 0000002955151
17
+ 2000000000401111180900264000012002111820021118000000000000000000+000000000323331+00000000011687903DEPOSIT EASTGATE 440080127 FN71QD +000000000 +000000000+000000000 000012554000000032000000000000000000000000000000000000000 2740 000000000000000 0000000000000000 0000000000000000000 0000002955151
18
+ 2000000000401111180900264000012002111820021118000000000000000000+000000000128638+00000000011816541DEPOSIT HYDE PARK 440022703 FN71QD +000000000 +000000000+000000000 000012555000000034000000000000000000000000000000000000000 2740 000000000000000 0000000000000000 0000000000000000000 0000002955151
19
+ 2000000000401111180900264000022002111820021118000000000000000000+000000000190220+00000000012006761DEPOSIT HYDE PARK 440022728 FN71QD +000000000 +000000000+000000000 000012556000000002000000000000000000000000000000000000000 2740 000000000000000 0000000000000000 0000000000000000000 0000002955151
20
+ 2000000000401111180900264000022002111820021118000000000000000000+000000000054538+00000000012061299DEPOSIT HYDE PARK 440022710 FN71QD +000000000 +000000000+000000000 000012557000000004000000000000000000000000000000000000000 2740 000000000000000 0000000000000000 0000000000000000000 0000002955151
21
+ 2000000000401111180900264000022002111820021118000000000000000000+000000000016872+00000000012078171TRANSFER FROM PRIMROSE 440074532 FN71TXCR+000000000 +000000000+000000000 000012558000000006000000000000000000000000000000000000000 4240 000000000000000 0000000000000000 0000000000000000000 0000002955151
22
+ 2000000000401111180900264000022002111820021118000000000000000000+000000000300000+00000000012378171DEPOSIT LYTTELTON 440149650 FN71QD +000000000 +000000000+000000000 000012559000000008000000000000000000000000000000000000000 2740 000000000000000 0000000000000000 0000000000000000000 0000002955151
23
+ 2000000000401111180900264000022002111820021118000000000000000000+000000000340000+00000000012718171DEPOSIT LYTTELTON 440149643 FN71QD +000000000 +000000000+000000000 000012560000000010000000000000000000000000000000000000000 2740 000000000000000 0000000000000000 0000000000000000000 0000002955151
24
+ 2000000000401111180900264000022002111820021118000000000000056605+000000000150000+00000000012868171CREDIT TRANSFER CASHFOCUS 440012751 CF71CFAC+000000000 +000000000+000000000 000012561000000012000000000000000000000000000000000000000 0510 000000000000000 0000000000000000 0000000000000000000 0000002955158
25
+ 2000000000401111180900264000022002111820021118000000000000000000+000000000123750+00000000012991921ACB CREDIT SETTLEMENT ABSA BANK 440077283 FN71ACC +000000000 +000000000+000000000 000012562000000014000000000000000000000000000000000000000 0012 000000000000000 0000000000000000 0000000000000000000 0000002955151
26
+ 2000000000401111180900264000022002111820021118000000000000000000+000000000033744+00000000013025665ACB CREDIT SETTLEMENT ABSA BANK 440077290 FN71ACC +000000000 +000000000+000000000 000012563000000016000000000000000000000000000000000000000 0012 000000000000000 0000000000000000 0000000000000000000 0000002955151
27
+ 2000000000401111180900264000022002111820021118000000000000000000+000000000107274+00000000013132939ACB CREDIT SETTLEMENT ABSA BANK 440077300 FN71ACC +000000000 +000000000+000000000 000012564000000018000000000000000000000000000000000000000 0012 000000000000000 0000000000000000 0000000000000000000 0000002955151
28
+ 2000000000401111180900264000022002111820021118000000000000000000+000000000025308+00000000013158247ACB CREDIT SETTLEMENT ABSA BANK 440077269 FN71ACC +000000000 +000000000+000000000 000012565000000020000000000000000000000000000000000000000 0012 000000000000000 0000000000000000 0000000000000000000 0000002955151
29
+ 2000000000401111180900264000022002111820021118000000000000000000+000000000130788+00000000013289035ACB CREDIT SETTLEMENT ABSA BANK 440077276 FN71ACC +000000000 +000000000+000000000 000012566000000022000000000000000000000000000000000000000 0012 000000000000000 0000000000000000 0000000000000000000 0000002955151
30
+ 2000000000401111180900264000022002111820021118000000000000016406+000000000017898+00000000013306933ACB CREDIT SETTLEMENT 440085319 * FN71ACC +000000000 +000000000+000000000 000012568000000024000000000000000000000000000000000000000 0012 000000000000000 0000000000000000 0000000000000000000 0000002955151
31
+ 2000000000401111180900264000022002111820021118000000000000019087+000000000118814+00000000013425747ACB CREDIT SETTLEMENT 440071299 STAND 146 KYA SAND FN71ACC +000000000 +000000000+000000000 000012569000000026000000000000000000000000000000000000000 0012 000000000000000 0000000000000000 0000000000000000000 0000002955151
32
+ 2000000000401111180900264000022002111820021118000000000000019088+000000000090493+00000000013516240ACB CREDIT SETTLEMENT 440071281 STAND 146 KYA SAND FN71ACC +000000000 +000000000+000000000 000012570000000028000000000000000000000000000000000000000 0012 000000000000000 0000000000000000 0000000000000000000 0000002955151
33
+ 2000000000401111180900264000022002111820021118000000000000016407+000000000064389+00000000013580629ACB CREDIT SETTLEMENT 440085326 * FN71ACC +000000000 +000000000+000000000 000012571000000030000000000000000000000000000000000000000 0012 000000000000000 0000000000000000 0000000000000000000 0000002955151
34
+ 2000000000401111180900264000022002111820021118000000000000019752+000000000391562+00000000013972191ACB CREDIT SETTLEMENT 440136637-FEDBOND FN71ACC +000000000 +000000000+000000000 000012572000000032000000000000000000000000000000000000000 0012 000000000000000 0000000000000000 0000000000000000000 0000002955151
35
+ 2000000000401111180900264000022002111820021118000000000000010211+000000001077862+00000000015050053ACB CREDIT SETTLEMENT 440141203 * FN71ACC +000000000 +000000000+000000000 000012573000000034000000000000000000000000000000000000000 0012 000000000000000 0000000000000000 0000000000000000000 0000002955151
36
+ 2000000000401111180900264000032002111820021118000000000000019158+000000002000000+00000000017050053ACB CREDIT SETTLEMENT 440062135 * FN71ACC +000000000 +000000000+000000000 000012574000000002000000000000000000000000000000000000000 0012 000000000000000 0000000000000000 0000000000000000000 0000002955151
37
+ 2000000000401111180900264000032002111820021118000000000000001492+000000001389660+00000000018439713ACB CREDIT SETTLEMENT FNBPAYMENT 440141556 FN71ACC +000000000 +000000000+000000000 000012575000000004000000000000000000000000000000000000000 0012 000000000000000 0000000000000000 0000000000000000000 0000002955151
38
+ 2000000000401111180900264000032002111820021118000000000000011274+000000000012426+00000000018452139ACB CREDIT SETTLEMENT 2073913575**440176534 PRIMEGROFN71ACC +000000000 +000000000+000000000 000012576000000006000000000000000000000000000000000000000 0012 000000000000000 0000000000000000 0000000000000000000 0000002955151
39
+ 2000000000401111180900264000032002111820021118000000000000006888+000000000149270+00000000018601409ACB CREDIT SETTLEMENT 2073888701COLLIERS RMS 000580FN71ACC +000000000 +000000000+000000000 000012577000000008000000000000000000000000000000000000000 0012 000000000000000 0000000000000000 0000000000000000000 0000002955151
40
+ 2000000000401111180900264000032002111820021118000000000000006889+000000000788054+00000000019389463ACB CREDIT SETTLEMENT 2073888702COLLIERS RMS 000581FN71ACC +000000000 +000000000+000000000 000012578000000010000000000000000000000000000000000000000 0012 000000000000000 0000000000000000 0000000000000000000 0000002955151
41
+ 2000000000401111180900264000032002111820021118000000000000011273+000000000498351+00000000019887814ACB CREDIT SETTLEMENT 2073913574**440131283 PRIMEGROFN71ACC +000000000 +000000000+000000000 000012579000000012000000000000000000000000000000000000000 0012 000000000000000 0000000000000000 0000000000000000000 0000002955151
42
+ 2000000000401111180900264000032002111820021118000000000000001108+000000000259414+00000000020147228ACB CREDIT SETTLEMENT 440064559 FN71ACC +000000000 +000000000+000000000 000012580000000014000000000000000000000000000000000000000 0012 000000000000000 0000000000000000 0000000000000000000 0000002955151
43
+ 2000000000401111180900264000032002111820021118000000000000004714+000000000017898+00000000020165126ACB CREDIT SETTLEMENT CRONJE 440107442 GS CRFN71ACC +000000000 +000000000+000000000 000012581000000016000000000000000000000000000000000000000 0012 000000000000000 0000000000000000 0000000000000000000 0000002955151
44
+ 2000000000401111180900264000032002111820021118000000000000004713+000000000303949+00000000020469075ACB CREDIT SETTLEMENT CRONJE 440107450 GS CRFN71ACC +000000000 +000000000+000000000 000012582000000018000000000000000000000000000000000000000 0012 000000000000000 0000000000000000 0000000000000000000 0000002955151
45
+ 2000000000401111180900264000032002111820021118000000000000002512+000000000085000+00000000020554075ACB CREDIT SETTLEMENT ROBINSON A/C440110004 FN71ACC +000000000 +000000000+000000000 000012583000000020000000000000000000000000000000000000000 0012 000000000000000 0000000000000000 0000000000000000000 0000002955151
46
+ 2000000000401111180900264000032002111820021118081409096000000000-000000000001000+00000000020553075BANK DEBIT 81409096 HEADOFFICE FN71CHJ -000000175 -000000020+000000000 000012584000000022000000000000000000000000000000000000000 0790 000000000000000 0000000000000000 0000000000000000000 0000002950505
47
+ 2000000000401111180900264000032002111820021118081409306000000000-000000000001000+00000000020552075BANK DEBIT 81409306 HEADOFFICE FN71CHJ -000000175 -000000020+000000000 000012585000000023000000000000000000000000000000000000000 0790 000000000000000 0000000000000000 0000000000000000000 0000002950505
48
+ 2000000000401111180900264000032002111820021118000000000000000433-000000020552075+00000000000000000SWEEPING CASHFOCUS 4054394859 TR# 433 CF71FS4D+000000000 -000000020+000000000 000012586000000024000000000000000000000000000000000000000 1840 000000000000000 0000000000000000 0000000000000000000 0000002950521
49
+ 89999999999999999999 +00000000000000000 0000000048 000000295
50
+ 99999999999999999999P20021119 0000000050 000000295
51
+ 
@@ -0,0 +1,142 @@
1
+ require 'spec_helper'
2
+
3
+ describe Absa::Esd::Statement4Unpacked do
4
+
5
+ before(:each) do
6
+ @input_string = File.open("./spec/examples/statement4_unpacked.dat", "rb").read
7
+ end
8
+
9
+ it "should be able to read the recon transmission header record" do
10
+ hash = Absa::Esd::Statement4Unpacked::ReconTransmission::Header.string_to_hash(@input_string.split(/^/)[0])
11
+
12
+ hash.should == {
13
+ rec_type: "0",
14
+ filler_1: "0000000000000000000",
15
+ status: "P",
16
+ date: "20021119",
17
+ client_code: "3174",
18
+ client_name: "TEST",
19
+ destination_code: "3174",
20
+ filler_2: "",
21
+ gen_no: "295",
22
+ filler_3: ""
23
+ }
24
+ end
25
+
26
+ it "should be able to read the recon transmission trailer record" do
27
+ hash = Absa::Esd::Statement4Unpacked::ReconTransmission::Trailer.string_to_hash(@input_string.split(/^/)[-2])
28
+
29
+ hash.should == {
30
+ rec_type: "9",
31
+ account_number: "9999999999999999999",
32
+ status: "P",
33
+ date: "20021119",
34
+ filler_1: "",
35
+ rec_count: "50",
36
+ filler_2: "",
37
+ generation_number: "295",
38
+ filler_3: ""
39
+ }
40
+ end
41
+
42
+ it "should be able to read the recon account header record" do
43
+ hash = Absa::Esd::Statement4Unpacked::ReconAccount::Header.string_to_hash(@input_string.split(/^/)[1])
44
+
45
+ hash.should == {
46
+ rec_type: "1",
47
+ account_number: "4011111809",
48
+ statement_number: "264",
49
+ filler_1: "00001",
50
+ processing_date: "20021118",
51
+ account_branch_code: "0",
52
+ filler_2: "",
53
+ filler_3: "+000000000000000",
54
+ hd_op_bals: "+",
55
+ hd_op_bal: "0",
56
+ filler_4: "",
57
+ function_code: "AA0A",
58
+ filler_5: "",
59
+ generation_number: "000000295",
60
+ filler_6: ""
61
+ }
62
+ end
63
+
64
+ it "should be able to read the recon account detail record" do
65
+ hash = Absa::Esd::Statement4Unpacked::ReconAccount::Detail.string_to_hash(@input_string.split(/^/)[3])
66
+
67
+ hash.should == {
68
+ rec_type: "2",
69
+ account_number: "4011111809",
70
+ statement_number: "264",
71
+ page_number: "1",
72
+ transaction_processing_date: "20021118",
73
+ transaction_effective_date: "20021118",
74
+ cheque_number: "0",
75
+ transaction_reference_number: "56571",
76
+ transaction_amount_sign: "+",
77
+ transaction_amount: "649363",
78
+ account_balance_sign: "+",
79
+ account_balance_after_transaction: "3280033",
80
+ transaction_description: "CREDIT TRANSFER CASHFOCUS",
81
+ dep_id: "440151586",
82
+ transaction_code: "CF71",
83
+ cheques_function_code: "CFAC",
84
+ charge_levied_amount_sign: "+",
85
+ charge_levied_amount: "0",
86
+ charge_type: "",
87
+ stamp_duty_amount_sign: "+",
88
+ stamp_duty_levied_amount: "0",
89
+ cash_deposit_fee_sign: "+",
90
+ cash_deposit_fee: "0",
91
+ charges_accrued: "",
92
+ event_number: "12537",
93
+ statement_line_sequence_number: "6",
94
+ vat_amount: "0",
95
+ cash_portion: "0",
96
+ deposit_number: "0",
97
+ transaction_time: "0",
98
+ filler_1: "",
99
+ filler_2: "",
100
+ sitename: "",
101
+ category: "0510",
102
+ transaction_type: "",
103
+ deposit_id_description: "",
104
+ pod_adjustment_amount: "000000000000000",
105
+ pod_adjustment_reason: "",
106
+ pod_returned_cheque_reason_code: "0",
107
+ pod_returned_cheque_drawee: "",
108
+ fedi_payor: "",
109
+ fedi_number: "0",
110
+ redirect_description: "",
111
+ account_number_redirect: "0",
112
+ unpaid_cheque_reason_description: "",
113
+ filler_3: "",
114
+ generation_number: "000000295",
115
+ old_reconfocus_category1: "51",
116
+ old_reconfocus_category2: "58",
117
+ filler_4: ""
118
+ }
119
+ end
120
+
121
+ it "should be able to read the recon account trailer record" do
122
+ hash = Absa::Esd::Statement4Unpacked::ReconAccount::Trailer.string_to_hash(@input_string.split(/^/)[-3])
123
+
124
+ hash.should == {
125
+ rec_type: "8",
126
+ account_number: "9999999999999999999",
127
+ filler_1: "",
128
+ hash_amount_sign: "+",
129
+ hash_amount: "0",
130
+ filler_2: "",
131
+ rec_count: "48",
132
+ filler_3: "",
133
+ generation_number: "000000295",
134
+ filler_4: ""
135
+ }
136
+ end
137
+
138
+ it "should be able to parse an entire 'statement 4 unpacked' file format" do
139
+ pending
140
+ end
141
+
142
+ end
@@ -0,0 +1,9 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+
4
+ require 'strata'
5
+ require 'absa-esd'
6
+
7
+ RSpec.configure do |config|
8
+ # some (optional) config here
9
+ end
metadata ADDED
@@ -0,0 +1,99 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: absa-esd
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Jeffrey van Aswegen, Douglas Anderson
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-04-04 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: activesupport
16
+ requirement: &70145554214580 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70145554214580
25
+ - !ruby/object:Gem::Dependency
26
+ name: i18n
27
+ requirement: &70145554214160 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70145554214160
36
+ - !ruby/object:Gem::Dependency
37
+ name: strata
38
+ requirement: &70145554213660 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: 0.0.1
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *70145554213660
47
+ description: A ruby interface to commumicate with the ABSA Electronic Statement Delivery
48
+ platform.
49
+ email:
50
+ - jeffmess@gmail.com, i.am.douglas.anderson@gmail.com
51
+ executables: []
52
+ extensions: []
53
+ extra_rdoc_files: []
54
+ files:
55
+ - Gemfile
56
+ - Gemfile.lock
57
+ - README
58
+ - Rakefile
59
+ - absa-esd.gemspec
60
+ - lib/absa-esd.rb
61
+ - lib/absa-esd/statement4_unpacked.rb
62
+ - lib/absa-esd/transmission/document.rb
63
+ - lib/absa-esd/transmission/record.rb
64
+ - lib/absa-esd/transmission/set.rb
65
+ - lib/absa-esd/version.rb
66
+ - lib/config/statement4_unpacked/recon_account.yml
67
+ - lib/config/statement4_unpacked/recon_transmission.yml
68
+ - spec/examples/statement4_unpacked.dat
69
+ - spec/lib/statement4_unpacked_spec.rb
70
+ - spec/spec_helper.rb
71
+ homepage: ''
72
+ licenses: []
73
+ post_install_message:
74
+ rdoc_options: []
75
+ require_paths:
76
+ - lib
77
+ required_ruby_version: !ruby/object:Gem::Requirement
78
+ none: false
79
+ requirements:
80
+ - - ! '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ required_rubygems_version: !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ! '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ requirements: []
90
+ rubyforge_project: absa-esd
91
+ rubygems_version: 1.8.6
92
+ signing_key:
93
+ specification_version: 3
94
+ summary: A ruby interface to commumicate with the ABSA Electronic Statement Delivery
95
+ platform.
96
+ test_files:
97
+ - spec/examples/statement4_unpacked.dat
98
+ - spec/lib/statement4_unpacked_spec.rb
99
+ - spec/spec_helper.rb