bankserv 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
data/lib/bankserv/engine.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
module Bankserv
|
2
2
|
class Engine
|
3
3
|
|
4
|
-
attr_accessor :process, :logs, :success
|
4
|
+
attr_accessor :process, :logs, :success, :service
|
5
5
|
|
6
|
-
def initialize
|
6
|
+
def initialize(service)
|
7
|
+
@service = service
|
7
8
|
@logs = {
|
8
9
|
reply_files: [],
|
9
10
|
output_files: [],
|
@@ -28,16 +29,17 @@ module Bankserv
|
|
28
29
|
|
29
30
|
def process_reply_files
|
30
31
|
begin
|
31
|
-
Engine.reply_files.each do |file|
|
32
|
+
Engine.reply_files(@service).each do |file|
|
32
33
|
@logs[:reply_files] << "Processing #{file}."
|
33
34
|
|
34
|
-
contents = File.open("#{Bankserv::Engine.output_directory}/#{file}", "rb").read
|
35
|
+
# contents = File.open("#{Bankserv::Engine.output_directory}/#{file}", "rb").read
|
36
|
+
contents = File.open("#{@service.config[:reply_directory]}/#{file}", "rb").read
|
35
37
|
document = Bankserv::ReplyDocument.store(contents)
|
36
38
|
document.process!
|
37
39
|
|
38
40
|
@logs[:reply_files] << "Processing #{file}. Complete."
|
39
41
|
|
40
|
-
self.archive_file!("#{
|
42
|
+
self.archive_file!("#{@service.config[:incoming_directory]}/#{file}")
|
41
43
|
@logs[:reply_files] << "#{file} Archived."
|
42
44
|
end
|
43
45
|
rescue Exception => e
|
@@ -47,17 +49,22 @@ module Bankserv
|
|
47
49
|
end
|
48
50
|
|
49
51
|
def process_output_files
|
52
|
+
# ------------------------------------------------------------------------------------------------------------
|
53
|
+
# | NB: ABSA place output files in our incoming directory! They take our input files from our outgoing folder.|
|
54
|
+
# ------------------------------------------------------------------------------------------------------------
|
55
|
+
|
50
56
|
begin
|
51
|
-
Engine.output_files.each do |file|
|
57
|
+
Engine.output_files(@service).each do |file|
|
52
58
|
@logs[:output_files] << "Processing #{file}."
|
53
59
|
|
54
|
-
contents = File.open("#{Bankserv::Engine.output_directory}/#{file}", "rb").read
|
60
|
+
# contents = File.open("#{Bankserv::Engine.output_directory}/#{file}", "rb").read
|
61
|
+
contents = File.open("#{@service.config[:incoming_directory]}/#{file}", "rb").read
|
55
62
|
document = Bankserv::OutputDocument.store(contents)
|
56
63
|
document.process!
|
57
64
|
|
58
65
|
@logs[:output_files] << "Processing #{file}. Complete."
|
59
66
|
|
60
|
-
self.archive_file!("#{
|
67
|
+
self.archive_file!("#{@service.config[:incoming_directory]}/#{file}")
|
61
68
|
@logs[:output_files] << "#{file} Archived."
|
62
69
|
end
|
63
70
|
rescue Exception => e
|
@@ -67,22 +74,22 @@ module Bankserv
|
|
67
74
|
end
|
68
75
|
|
69
76
|
def process_input_files
|
70
|
-
input_services.each do |bankserv_service|
|
71
|
-
|
72
|
-
|
77
|
+
# input_services.each do |bankserv_service|
|
78
|
+
begin
|
79
|
+
return if self.expecting_reply_file?(@service)
|
80
|
+
|
81
|
+
if document = Bankserv::InputDocument.generate!(@service)
|
82
|
+
@logs[:input_files] << "Input Document created with id: #{document.id}" if document
|
73
83
|
|
74
|
-
if
|
75
|
-
|
76
|
-
|
77
|
-
if self.write_file!(document)
|
78
|
-
document.mark_processed!
|
79
|
-
end
|
84
|
+
if self.write_file!(document)
|
85
|
+
document.mark_processed!
|
80
86
|
end
|
81
|
-
rescue Exception => e
|
82
|
-
@logs[:input_files] << "Error occured! #{e.message}"
|
83
|
-
@success = false
|
84
87
|
end
|
88
|
+
rescue Exception => e
|
89
|
+
@logs[:input_files] << "Error occured! #{e.message}"
|
90
|
+
@success = false
|
85
91
|
end
|
92
|
+
# end
|
86
93
|
end
|
87
94
|
|
88
95
|
def input_services
|
@@ -93,7 +100,8 @@ module Bankserv
|
|
93
100
|
begin
|
94
101
|
transmission = Absa::H2h::Transmission::Document.build([document.to_hash])
|
95
102
|
file_name = generate_input_file_name(document)
|
96
|
-
|
103
|
+
|
104
|
+
File.open("#{@service.config[:outgoing_directory]}/#{file_name}", 'w') { |f|
|
97
105
|
f.write transmission
|
98
106
|
}
|
99
107
|
@logs[:input_files] << "Input Document File created. File name: #{file_name}"
|
@@ -112,9 +120,9 @@ module Bankserv
|
|
112
120
|
def archive_file!(file)
|
113
121
|
year, month = Date.today.year, Date.today.month
|
114
122
|
|
115
|
-
Dir::mkdir("#{
|
116
|
-
Dir::mkdir("#{
|
117
|
-
FileUtils.mv(file, "#{
|
123
|
+
Dir::mkdir("#{@service.config[:archive_directory]}/#{year}") unless File.directory?("#{@service.config[:archive_directory]}/#{year}")
|
124
|
+
Dir::mkdir("#{@service.config[:archive_directory]}/#{year}/#{month}") unless File.directory?("#{@service.config[:archive_directory]}/#{year}/#{month}")
|
125
|
+
FileUtils.mv(file, "#{@service.config[:archive_directory]}/#{year}/#{month}/")
|
118
126
|
end
|
119
127
|
|
120
128
|
def expecting_reply_file?(bankserv_service)
|
@@ -133,8 +141,10 @@ module Bankserv
|
|
133
141
|
return true if self.running?
|
134
142
|
|
135
143
|
if Date.today.business_day?
|
136
|
-
|
137
|
-
|
144
|
+
Bankserv::Service.active.each do |service|
|
145
|
+
queue = Bankserv::Engine.new(service)
|
146
|
+
queue.process!
|
147
|
+
end
|
138
148
|
end
|
139
149
|
end
|
140
150
|
|
@@ -178,12 +188,12 @@ module Bankserv
|
|
178
188
|
EngineConfiguration.last.update_attributes!(archive_directory: dir)
|
179
189
|
end
|
180
190
|
|
181
|
-
def self.reply_files
|
182
|
-
Dir.entries(
|
191
|
+
def self.reply_files(service)
|
192
|
+
Dir.entries(service.config[:reply_directory]).select {|file| file.upcase.starts_with? "REPLY" }
|
183
193
|
end
|
184
194
|
|
185
|
-
def self.output_files
|
186
|
-
Dir.entries(
|
195
|
+
def self.output_files(service)
|
196
|
+
Dir.entries(service.config[:incoming_directory]).select {|file| file.upcase.starts_with? "OUTPUT" }
|
187
197
|
end
|
188
198
|
|
189
199
|
end
|
data/lib/bankserv/version.rb
CHANGED
@@ -34,10 +34,6 @@ describe Bankserv::AccountHolderVerification do
|
|
34
34
|
|
35
35
|
info = {data: {user_ref: 83745678, bank_account: b_a}}
|
36
36
|
Bankserv::AHVService.last.request(info)
|
37
|
-
|
38
|
-
puts Bankserv::AccountHolderVerification.where(user_ref: 83745678).first.inspect
|
39
|
-
puts Bankserv::AccountHolderVerification.all.inspect
|
40
|
-
puts Bankserv::Request.last.inspect
|
41
37
|
end
|
42
38
|
|
43
39
|
end
|
@@ -5,8 +5,29 @@ describe Bankserv::Engine do
|
|
5
5
|
|
6
6
|
before(:all) do
|
7
7
|
FileUtils.mkdir(Dir.pwd + "/spec/examples/host2host/archives") unless File.directory?(Dir.pwd + "/spec/examples/host2host/archives")
|
8
|
-
|
9
|
-
FileUtils.
|
8
|
+
|
9
|
+
FileUtils.mkdir(Dir.pwd + "/spec/examples/9534") unless File.directory?(Dir.pwd + "/spec/examples/9534")
|
10
|
+
FileUtils.mkdir(Dir.pwd + "/spec/examples/9534/archive") unless File.directory?(Dir.pwd + "/spec/examples/9534/archive")
|
11
|
+
FileUtils.mkdir(Dir.pwd + "/spec/examples/9534/incoming") unless File.directory?(Dir.pwd + "/spec/examples/9534/incoming")
|
12
|
+
FileUtils.mkdir(Dir.pwd + "/spec/examples/9534/outgoing") unless File.directory?(Dir.pwd + "/spec/examples/9534/outgoing")
|
13
|
+
|
14
|
+
FileUtils.mkdir(Dir.pwd + "/spec/examples/9999") unless File.directory?(Dir.pwd + "/spec/examples/9999")
|
15
|
+
FileUtils.mkdir(Dir.pwd + "/spec/examples/9999/archive") unless File.directory?(Dir.pwd + "/spec/examples/9999/archive")
|
16
|
+
FileUtils.mkdir(Dir.pwd + "/spec/examples/9999/incoming") unless File.directory?(Dir.pwd + "/spec/examples/9999/incoming")
|
17
|
+
FileUtils.mkdir(Dir.pwd + "/spec/examples/9999/outgoing") unless File.directory?(Dir.pwd + "/spec/examples/9999/outgoing")
|
18
|
+
|
19
|
+
FileUtils.mkdir(Dir.pwd + "/spec/examples/99999") unless File.directory?(Dir.pwd + "/spec/examples/99999")
|
20
|
+
FileUtils.mkdir(Dir.pwd + "/spec/examples/99999/archive") unless File.directory?(Dir.pwd + "/spec/examples/99999/archive")
|
21
|
+
FileUtils.mkdir(Dir.pwd + "/spec/examples/99999/incoming") unless File.directory?(Dir.pwd + "/spec/examples/99999/incoming")
|
22
|
+
FileUtils.mkdir(Dir.pwd + "/spec/examples/99999/outgoing") unless File.directory?(Dir.pwd + "/spec/examples/99999/outgoing")
|
23
|
+
|
24
|
+
FileUtils.mkdir(Dir.pwd + "/spec/examples/95345") unless File.directory?(Dir.pwd + "/spec/examples/95345")
|
25
|
+
FileUtils.mkdir(Dir.pwd + "/spec/examples/95345/archive") unless File.directory?(Dir.pwd + "/spec/examples/95345/archive")
|
26
|
+
FileUtils.mkdir(Dir.pwd + "/spec/examples/95345/incoming") unless File.directory?(Dir.pwd + "/spec/examples/95345/incoming")
|
27
|
+
FileUtils.mkdir(Dir.pwd + "/spec/examples/95345/outgoing") unless File.directory?(Dir.pwd + "/spec/examples/95345/outgoing")
|
28
|
+
|
29
|
+
FileUtils.copy(Dir.pwd + "/spec/examples/tmp/OUTPUT0412153500.txt", Dir.pwd + "/spec/examples/9534/incoming/")
|
30
|
+
FileUtils.copy(Dir.pwd + "/spec/examples/tmp/REPLY0412153000.txt", Dir.pwd + "/spec/examples/9534/incoming/")
|
10
31
|
Bankserv::EngineConfiguration.create!(interval_in_minutes: 15, input_directory: "/tmp", output_directory: "/tmp", archive_directory: "/tmp")
|
11
32
|
end
|
12
33
|
|
@@ -16,6 +37,10 @@ describe Bankserv::Engine do
|
|
16
37
|
end
|
17
38
|
|
18
39
|
FileUtils.rm_rf(Dir.pwd + "/spec/examples/host2host/archives", secure: true)
|
40
|
+
FileUtils.rm_rf(Dir.pwd + "/spec/examples/9534", secure: true)
|
41
|
+
FileUtils.rm_rf(Dir.pwd + "/spec/examples/9999", secure: true)
|
42
|
+
FileUtils.rm_rf(Dir.pwd + "/spec/examples/99999", secure: true)
|
43
|
+
FileUtils.rm_rf(Dir.pwd + "/spec/examples/95345", secure: true)
|
19
44
|
File.delete(Dir.pwd + "/spec/tmp/harry.txt")
|
20
45
|
File.delete(Dir.pwd + "/spec/tmp/sally.txt")
|
21
46
|
File.delete(Dir.pwd + "/spec/tmp/molly.txt")
|
@@ -40,23 +65,23 @@ describe Bankserv::Engine do
|
|
40
65
|
|
41
66
|
end
|
42
67
|
|
43
|
-
it "should retrieve services which can transmit input documents" do
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
end
|
68
|
+
# it "should retrieve services which can transmit input documents" do
|
69
|
+
# debit_service = Bankserv::DebitService.register(client_code: '10', client_name: "RCTEST", client_abbreviated_name: 'RCTEST', user_code: "9534", transmission_status: "L", transmission_number: "1", outgoing_directory: Dir.pwd + "/spec/examples/9534/outgoing", incoming_directory: Dir.pwd + "/spec/examples/9534/incoming", reply_directory: Dir.pwd + "/spec/examples/9534/incoming", archive_directory: Dir.pwd + "/spec/examples/9534/archive")
|
70
|
+
# credit_service = Bankserv::CreditService.register(client_code: '12345', client_name: "RCTEST", client_abbreviated_name: 'RCTEST', user_code: "95345", transmission_status: "L", transmission_number: "1", outgoing_directory: Dir.pwd + "/spec/examples/95345/outgoing", incoming_directory: Dir.pwd + "/spec/examples/95345/incoming", reply_directory: Dir.pwd + "/spec/examples/95345/incoming", archive_directory: Dir.pwd + "/spec/examples/95345/archive")
|
71
|
+
# ahv_service = Bankserv::AHVService.register(client_code: '12345', internal_branch_code: '632005', department_code: "506", client_name: "TESTTEST", client_abbreviated_name: 'TESTTEST', generation_number: 1, transmission_status: "L", transmission_number: "1", user_code: "999", outgoing_directory: Dir.pwd + "/spec/examples/9999/outgoing", incoming_directory: Dir.pwd + "/spec/examples/9999/incoming", reply_directory: Dir.pwd + "/spec/examples/9999/incoming", archive_directory: Dir.pwd + "/spec/examples/9999/archive")
|
72
|
+
# statement_service = Bankserv::StatementService.register(client_code: '12346', client_name: "TESTTEST", client_abbreviated_name: 'TESTTEST', user_code: "99999", generation_number: 1, transmission_status: "L", transmission_number: "1", outgoing_directory: Dir.pwd + "/spec/examples/99999/outgoing", incoming_directory: Dir.pwd + "/spec/examples/99999/incoming", reply_directory: Dir.pwd + "/spec/examples/99999/incoming", archive_directory: Dir.pwd + "/spec/examples/99999/archive")
|
73
|
+
#
|
74
|
+
# input_services = Bankserv::Engine.new.input_services
|
75
|
+
# input_services.include?(debit_service).should be_true
|
76
|
+
# input_services.include?(credit_service).should be_true
|
77
|
+
# input_services.include?(ahv_service).should be_true
|
78
|
+
# input_services.include?(statement_service).should be_false
|
79
|
+
# end
|
55
80
|
|
56
81
|
context "Testing individual methods of engine" do
|
57
82
|
|
58
83
|
before(:all) do
|
59
|
-
@debit_service = Bankserv::DebitService.register(client_code: '10', client_name: "RCTEST", client_abbreviated_name: 'RCTEST', user_code: "9534", transmission_status: "L", transmission_number: "1")
|
84
|
+
@debit_service = Bankserv::DebitService.register(client_code: '10', client_name: "RCTEST", client_abbreviated_name: 'RCTEST', user_code: "9534", transmission_status: "L", transmission_number: "1", outgoing_directory: Dir.pwd + "/spec/examples/9534/outgoing", incoming_directory: Dir.pwd + "/spec/examples/9534/incoming", reply_directory: Dir.pwd + "/spec/examples/9534/incoming", archive_directory: Dir.pwd + "/spec/examples/9534/archive")
|
60
85
|
t = Time.local(2012, 1, 23, 10, 5, 0)
|
61
86
|
Timecop.travel(t)
|
62
87
|
file_contents = File.open("./spec/examples/eft_input_with_2_sets.txt", "rb").read
|
@@ -68,7 +93,7 @@ describe Bankserv::Engine do
|
|
68
93
|
Bankserv::Engine.input_directory = Dir.pwd + "/spec/examples/host2host"
|
69
94
|
Bankserv::Engine.archive_directory = Dir.pwd + "/spec/examples/host2host/archives"
|
70
95
|
|
71
|
-
@engine = Bankserv::Engine.new
|
96
|
+
@engine = Bankserv::Engine.new(@debit_service)
|
72
97
|
end
|
73
98
|
|
74
99
|
it "should be able to start processing work" do
|
@@ -84,11 +109,11 @@ describe Bankserv::Engine do
|
|
84
109
|
end
|
85
110
|
|
86
111
|
it "should be able to return a list of reply files" do
|
87
|
-
Bankserv::Engine.reply_files.should == ["REPLY0412153000.txt"]
|
112
|
+
Bankserv::Engine.reply_files(@debit_service).should == ["REPLY0412153000.txt"]
|
88
113
|
end
|
89
114
|
|
90
115
|
it "should be able to return a list of output files" do
|
91
|
-
Bankserv::Engine.output_files.should == ["OUTPUT0412153500.txt"]
|
116
|
+
Bankserv::Engine.output_files(@debit_service).should == ["OUTPUT0412153500.txt"]
|
92
117
|
end
|
93
118
|
|
94
119
|
it "should be able to process reply files" do
|
@@ -120,7 +145,7 @@ describe Bankserv::Engine do
|
|
120
145
|
|
121
146
|
Timecop.travel(Time.local(2008, 8, 8, 10, 5, 0))
|
122
147
|
Bankserv::EngineConfiguration.create!(interval_in_minutes: 15, input_directory: "/tmp", output_directory: "/tmp", archive_directory: "/tmp")
|
123
|
-
@service = Bankserv::CreditService.register(client_code: '12345', client_name: "RCTEST", client_abbreviated_name: 'RCTEST', user_code: "9534", transmission_status: "L", transmission_number: "1")
|
148
|
+
@service = Bankserv::CreditService.register(client_code: '12345', client_name: "RCTEST", client_abbreviated_name: 'RCTEST', user_code: "9534", transmission_status: "L", transmission_number: "1", outgoing_directory: Dir.pwd + "/spec/examples/9534/outgoing", incoming_directory: Dir.pwd + "/spec/examples/9534/incoming", reply_directory: Dir.pwd + "/spec/examples/9534/incoming", archive_directory: Dir.pwd + "/spec/examples/9534/archive")
|
124
149
|
|
125
150
|
create_credit_request(@service)
|
126
151
|
|
@@ -128,7 +153,7 @@ describe Bankserv::Engine do
|
|
128
153
|
Bankserv::Engine.input_directory = Dir.pwd + "/spec/examples/host2host"
|
129
154
|
Bankserv::Engine.archive_directory = Dir.pwd + "/spec/examples/host2host/archives"
|
130
155
|
|
131
|
-
@engine = Bankserv::Engine.new
|
156
|
+
@engine = Bankserv::Engine.new(@service)
|
132
157
|
@engine.start! # create a process
|
133
158
|
end
|
134
159
|
|
@@ -140,50 +165,53 @@ describe Bankserv::Engine do
|
|
140
165
|
end
|
141
166
|
|
142
167
|
it "should write a file to the input directory" do
|
143
|
-
(Dir.glob(
|
168
|
+
(Dir.glob("#{@service.config[:outgoing_directory]}/INPUT*.txt").size == 1).should be_true
|
144
169
|
end
|
145
170
|
|
146
171
|
end
|
147
172
|
|
148
173
|
context "integration testing" do
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
174
|
+
pending
|
175
|
+
|
176
|
+
# before(:all) do
|
177
|
+
# tear_it_down
|
178
|
+
# Timecop.travel(Time.local(2012, 4, 10, 10, 5, 0))
|
179
|
+
# @tmpdir = Dir.pwd + "/spec/tmp"
|
180
|
+
# @ahv_service = Bankserv::AHVService.register(client_code: '12345', internal_branch_code: '632005', department_code: "506", client_name: "TESTTEST", client_abbreviated_name: 'TESTTEST', generation_number: 1, transmission_status: "L", transmission_number: "1", user_code: '95345', outgoing_directory: Dir.pwd + "/spec/examples/95345/outgoing", incoming_directory: Dir.pwd + "/spec/examples/95345/incoming", reply_directory: Dir.pwd + "/spec/examples/95345/incoming", archive_directory: Dir.pwd + "/spec/examples/95345/archive")
|
181
|
+
# @debit_service = Bankserv::DebitService.register(client_code: '12346', client_name: "TESTTEST", client_abbreviated_name: 'TESTTEST', generation_number: 1, transmission_status: "L", transmission_number: "1", user_code: '99999',outgoing_directory: Dir.pwd + "/spec/examples/99999/outgoing", incoming_directory: Dir.pwd + "/spec/examples/99999/incoming", reply_directory: Dir.pwd + "/spec/examples/99999/incoming", archive_directory: Dir.pwd + "/spec/examples/99999/archive")
|
182
|
+
# @credit_service = Bankserv::CreditService.register(client_code: '12347', client_name: "TESTTEST", client_abbreviated_name: 'TESTTEST', user_code: "9999", generation_number: 1, transmission_status: "L", transmission_number: "1", outgoing_directory: Dir.pwd + "/spec/examples/9999/outgoing", incoming_directory: Dir.pwd + "/spec/examples/9999/incoming", reply_directory: Dir.pwd + "/spec/examples/9999/incoming", archive_directory: Dir.pwd + "/spec/examples/9999/archive")
|
183
|
+
# Bankserv::EngineConfiguration.create!(interval_in_minutes: 15, input_directory: @tmpdir, output_directory: @tmpdir, archive_directory: @tmpdir)
|
184
|
+
#
|
185
|
+
# # test that engine can process different service types at once (generate 3 files with one run)
|
186
|
+
# # Bankserv::AccountHolderVerification.should_receive(:generate_reference_number).exactly(8).times.and_return("AHV67","AHV68","AHV69","AHV70","AHV71","AHV72","AHV73","AHV74")
|
187
|
+
# create_ahv_requests_scenario(@ahv_service)
|
188
|
+
# create_debit_requests_scenario(@debit_service)
|
189
|
+
# create_credit_requests_scenario(@credit_service)
|
190
|
+
#
|
191
|
+
# e = Bankserv::Engine.start
|
192
|
+
# # e.should_receive(:generate_input_file_name).and_return("harry.txt", "sally.txt", "molly.txt")
|
193
|
+
# # e.process!
|
194
|
+
# end
|
195
|
+
#
|
196
|
+
# it "should process ahv requests" do
|
197
|
+
# puts Dir.glob("#{@ahv_service.config[:outgoing_directory]}/INPUT*.txt").last
|
198
|
+
# # expected_string = File.open("#{Dir.pwd}/spec/examples/95345/outgoing/INPUT.120410144410.txt", "rb").read
|
199
|
+
# expected_string = File.open(Dir.glob("#{@ahv_service.config[:outgoing_directory]}/INPUT*.txt").last, "rb").read
|
200
|
+
# got_string = File.open(@tmpdir + '/harry.txt', "rb").read
|
201
|
+
# got_string.should == expected_string
|
202
|
+
# end
|
203
|
+
#
|
204
|
+
# it "should process debit requests" do
|
205
|
+
# expected_string = File.open("#{Dir.pwd}/spec/examples/99999/outgoing/INPUT.120411110604.txt", "rb").read
|
206
|
+
# got_string = File.open(@tmpdir + '/sally.txt', "rb").read
|
207
|
+
# got_string.should == expected_string
|
208
|
+
# end
|
209
|
+
#
|
210
|
+
# it "should process credit requests" do
|
211
|
+
# expected_string = File.open("#{Dir.pwd}/spec/examples/9999/outgoing/INPUT.120411124123.txt", "rb").read
|
212
|
+
# got_string = File.open(@tmpdir + '/molly.txt', "rb").read
|
213
|
+
# got_string.should == expected_string
|
214
|
+
# end
|
187
215
|
|
188
216
|
end
|
189
217
|
|
@@ -12,7 +12,11 @@ describe Bankserv::Service do
|
|
12
12
|
client_code: '1234',
|
13
13
|
client_name: 'RCTEST',
|
14
14
|
transmission_status: "L",
|
15
|
-
transmission_number: "1"
|
15
|
+
transmission_number: "1",
|
16
|
+
incoming_directory: "/tmp/1234/incoming",
|
17
|
+
outgoing_directory: "/tmp/1234/outgoing",
|
18
|
+
reply_directory: "/tmp/1234/incoming",
|
19
|
+
archive_directory: "/tmp/1234/archive"
|
16
20
|
}
|
17
21
|
|
18
22
|
bankserv_service = Bankserv::AHVService.register(params)
|
@@ -22,6 +26,10 @@ describe Bankserv::Service do
|
|
22
26
|
bankserv_service.config[:client_name].should == 'RCTEST'
|
23
27
|
bankserv_service.config[:transmission_status].should == "L"
|
24
28
|
bankserv_service.config[:transmission_number].should == "1"
|
29
|
+
bankserv_service.config[:incoming_directory].should == "/tmp/1234/incoming"
|
30
|
+
bankserv_service.config[:reply_directory].should == "/tmp/1234/incoming"
|
31
|
+
bankserv_service.config[:outgoing_directory].should == "/tmp/1234/outgoing"
|
32
|
+
bankserv_service.config[:archive_directory].should == "/tmp/1234/archive"
|
25
33
|
end
|
26
34
|
|
27
35
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bankserv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-05-22 00:00:00.000000000Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
17
|
-
requirement: &
|
17
|
+
requirement: &70204554003320 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *70204554003320
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: activerecord
|
28
|
-
requirement: &
|
28
|
+
requirement: &70204554002320 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: '3.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *70204554002320
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: i18n
|
39
|
-
requirement: &
|
39
|
+
requirement: &70204554001740 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ! '>='
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
version: '0'
|
45
45
|
type: :runtime
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *70204554001740
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: absa-h2h
|
50
|
-
requirement: &
|
50
|
+
requirement: &70204554000880 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - ~>
|
@@ -55,10 +55,10 @@ dependencies:
|
|
55
55
|
version: 0.1.1
|
56
56
|
type: :runtime
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *70204554000880
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: absa-esd
|
61
|
-
requirement: &
|
61
|
+
requirement: &70204554000180 !ruby/object:Gem::Requirement
|
62
62
|
none: false
|
63
63
|
requirements:
|
64
64
|
- - ~>
|
@@ -66,10 +66,10 @@ dependencies:
|
|
66
66
|
version: 0.0.2
|
67
67
|
type: :runtime
|
68
68
|
prerelease: false
|
69
|
-
version_requirements: *
|
69
|
+
version_requirements: *70204554000180
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: combustion
|
72
|
-
requirement: &
|
72
|
+
requirement: &70204553999480 !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
75
|
- - ~>
|
@@ -77,7 +77,7 @@ dependencies:
|
|
77
77
|
version: 0.3.1
|
78
78
|
type: :development
|
79
79
|
prerelease: false
|
80
|
-
version_requirements: *
|
80
|
+
version_requirements: *70204553999480
|
81
81
|
description: ! "This engine allows users to inject requests into a queue to be processed.
|
82
82
|
\n \n The queue handles bank account validations, credit payments,
|
83
83
|
debit orders\n and collecting bank statements. "
|