bankserv 0.7.5 → 0.7.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -230,7 +230,7 @@ describe Bankserv::OutputDocument do
230
230
 
231
231
  it "should mark the payment as failed" do
232
232
  Bankserv::Credit.all.each do |c|
233
- c.error?.should be_true
233
+ c.rejected?.should be_true
234
234
  c.response.first[:message].should == "TARGET ACCOUNT BRANCH INVALID"
235
235
  end
236
236
  end
@@ -349,6 +349,7 @@ describe Bankserv::ReplyDocument do
349
349
 
350
350
  context "Fix bug where transmission number not being updated after accepted reply file received" do
351
351
  before(:all) do
352
+ Timecop.travel(2014,8,4)
352
353
  @cs = Bankserv::CreditService.register(client_code: '04136', client_name: "RENTAL CONNECT PTY LTD", client_abbreviated_name: 'RAWSONPROP', user_code: "A855", generation_number: 6365, transmission_status: "L", transmission_number: "376", sequence_number: 57, active: true)
353
354
 
354
355
  Bankserv::Document.create!(type: "input", set_id: 18242, processed: true, transmission_status: "L", rec_status: "L", transmission_number: "367", reply_status: "ACCEPTED", error: nil, created_at: "2014-07-25 15:10:24", updated_at: "2014-07-25 16:30:22", client_code: "04136", user_ref: "2426")
@@ -364,8 +365,8 @@ describe Bankserv::ReplyDocument do
364
365
  data: {
365
366
  :type_of_service=>"BATCH",
366
367
  :batches=>[{
367
- :debit=>{:account_number=>c[2][:homing_account_number], :id_number=>"", :initials=>"", :account_name=>c[2][:homing_account_name], :branch_code=>c[2][:homing_branch], :account_type=>"cheque", :amount=>c[2][:amount], :user_ref=>c[2][:user_ref].gsub("RAWSONPROPCONTRA", ""), :action_date=>"2014-07-15".to_date},
368
- :credit=>{:account_number=>c[1][:homing_account_number], :id_number=>"", :initials=>"", :account_name=>c[1][:homing_account_name], :branch_code=>c[1][:homing_branch], :account_type=>"cheque", :amount=>c[1][:amount], :user_ref=>c[1][:user_ref].gsub("RAWSONPROP", ""), :action_date=>"2014-07-15".to_date}
368
+ :debit=>{:account_number=>c[2][:homing_account_number], :id_number=>"", :initials=>"", :account_name=>c[2][:homing_account_name], :branch_code=>c[2][:homing_branch], :account_type=>"cheque", :amount=>c[2][:amount], :user_ref=>c[2][:user_ref].gsub("RAWSONPROPCONTRA", ""), :action_date=>"2014-08-04".to_date},
369
+ :credit=>{:account_number=>c[1][:homing_account_number], :id_number=>"", :initials=>"", :account_name=>c[1][:homing_account_name], :branch_code=>c[1][:homing_branch], :account_type=>"cheque", :amount=>c[1][:amount], :user_ref=>c[1][:user_ref].gsub("RAWSONPROP", ""), :action_date=>"2014-08-04".to_date}
369
370
  }]
370
371
  }
371
372
  })
@@ -393,5 +394,18 @@ describe Bankserv::ReplyDocument do
393
394
  it "should not have any rejected credits" do
394
395
  Bankserv::Credit.where(status: 'rejected').count.should == 0
395
396
  end
397
+
398
+ context "Receive output file" do
399
+ before(:each) do
400
+ @file_contents = File.open("./spec/examples/output_long.txt", "rb").read
401
+
402
+ @document = Bankserv::OutputDocument.store(@file_contents)
403
+ @document.process!
404
+ end
405
+
406
+ it "should mark some payments as rejected" do
407
+ Bankserv::Credit.where(status: 'rejected').count.should == 4
408
+ end
409
+ end
396
410
  end
397
411
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 7
8
- - 5
9
- version: 0.7.5
8
+ - 6
9
+ version: 0.7.6
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jeffrey van Aswegen
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2014-08-04 00:00:00 +02:00
18
+ date: 2014-08-05 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -186,15 +186,18 @@ files:
186
186
  - spec/examples/empty_output.txt
187
187
  - spec/examples/failed_output_file.txt
188
188
  - spec/examples/host2host/tmp.log
189
+ - spec/examples/input_long.txt
189
190
  - spec/examples/input_with_warning_generated.txt
190
191
  - spec/examples/input_with_wrong_trans_num.txt
191
192
  - spec/examples/notify_me.xml
192
193
  - spec/examples/notify_me_with_one_record.xml
194
+ - spec/examples/output_long.txt
193
195
  - spec/examples/reply/accepted_and_rejected_transactions.txt
194
196
  - spec/examples/reply/accepted_reply.txt
195
197
  - spec/examples/reply/rejected_transmission.txt
196
198
  - spec/examples/reply/reply2.txt
197
199
  - spec/examples/reply/reply_file.txt
200
+ - spec/examples/reply/reply_long.txt
198
201
  - spec/examples/reply/reply_with_warning.txt
199
202
  - spec/examples/reply/transnumber_wrong.txt
200
203
  - spec/examples/simple_input_file.txt
@@ -274,15 +277,18 @@ test_files:
274
277
  - spec/examples/empty_output.txt
275
278
  - spec/examples/failed_output_file.txt
276
279
  - spec/examples/host2host/tmp.log
280
+ - spec/examples/input_long.txt
277
281
  - spec/examples/input_with_warning_generated.txt
278
282
  - spec/examples/input_with_wrong_trans_num.txt
279
283
  - spec/examples/notify_me.xml
280
284
  - spec/examples/notify_me_with_one_record.xml
285
+ - spec/examples/output_long.txt
281
286
  - spec/examples/reply/accepted_and_rejected_transactions.txt
282
287
  - spec/examples/reply/accepted_reply.txt
283
288
  - spec/examples/reply/rejected_transmission.txt
284
289
  - spec/examples/reply/reply2.txt
285
290
  - spec/examples/reply/reply_file.txt
291
+ - spec/examples/reply/reply_long.txt
286
292
  - spec/examples/reply/reply_with_warning.txt
287
293
  - spec/examples/reply/transnumber_wrong.txt
288
294
  - spec/examples/simple_input_file.txt