bankserv 0.6.6 → 0.6.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -42,6 +42,16 @@ module Bankserv
42
42
  status == "completed"
43
43
  end
44
44
 
45
+ def rejected?
46
+ status == "rejected"
47
+ end
48
+
49
+ def reject!(message)
50
+ self.status = "rejected"
51
+ self.response = message
52
+ self.save!
53
+ end
54
+
45
55
  def accepted?
46
56
  status == "accepted"
47
57
  end
@@ -83,7 +83,7 @@ module Bankserv
83
83
  request_id = Bankserv::Credit.where(user_ref: user_ref)[0].bankserv_request_id
84
84
 
85
85
  Bankserv::Credit.where(bankserv_request_id: request_id).each do |credit|
86
- credit.renew!
86
+ credit.reject!(record.error)
87
87
  end
88
88
  end
89
89
 
@@ -110,9 +110,24 @@ module Bankserv
110
110
  service.save!
111
111
  end
112
112
 
113
- records_with_errors.uniq.each do |rwe|
114
- #puts rwe.error.inspect
115
- end
113
+ #records_with_errors.uniq.each do |rwe|
114
+
115
+ #end
116
+ # rejections.each do |rejection|
117
+
118
+ # set = input_document.set_with_generation_number(rejection.data[:user_code_generation_number])
119
+ # user_ref = set.contra_records.first.reference.match(/CONTRA([0-9]*)/)[1]
120
+ # request_id = Bankserv::Credit.where(user_ref: user_ref)[0].bankserv_request_id
121
+ # # if service.is_a? Bankserv::CreditService
122
+ # # set = input_document.set_with_generation_number(transaction.data[:user_code_generation_number])
123
+ # # user_ref = set.contra_records.first.reference.match(/CONTRA([0-9]*)/)[1]
124
+ # # request_id = Bankserv::Credit.where(user_ref: user_ref)[0].bankserv_request_id
125
+
126
+ # # Bankserv::Credit.where(bankserv_request_id: request_id).each do |credit|
127
+ # # credit.renew!
128
+ # # end
129
+ # # end
130
+ # end
116
131
  end
117
132
  end
118
133
  end
@@ -1,3 +1,3 @@
1
1
  module Bankserv
2
- VERSION = "0.6.6"
2
+ VERSION = "0.6.7"
3
3
  end
@@ -235,13 +235,11 @@ describe Bankserv::ReplyDocument do
235
235
  end
236
236
 
237
237
  it "should have rejected transactions" do
238
- Bankserv::Credit.all.each do |c|
239
-
240
- end
238
+ Bankserv::Credit.where(status: 'rejected').count.should == 18
241
239
  end
242
240
 
243
241
  it "should reset some of the credits to new" do
244
-
242
+ Bankserv::Credit.where(status: 'new').count.should == 4
245
243
  end
246
244
 
247
245
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 6
8
- - 6
9
- version: 0.6.6
8
+ - 7
9
+ version: 0.6.7
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jeffrey van Aswegen