catarse_moip 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d16a1550e626fb9eae05ff313dd0295f62a16e0d
4
- data.tar.gz: 70ad09f8044ad602ccac430460e75be1fbe3dbf6
3
+ metadata.gz: c66d57d3bfcaab6661b6135c0889b8f70ce0a07d
4
+ data.tar.gz: 5525def340c92871f2c30b92e389a0b9947b6c95
5
5
  SHA512:
6
- metadata.gz: 8c6ce4f3311fe998821ac03f3b16e1cda8a3f65aa6c465ca86a3f41744c682cb6a3f4e1999285f0e405a586d2cf1aac3f072a72a1349916856e60766c283b9a4
7
- data.tar.gz: 67a3ce105e6d099fbd3f01d4bbf521c39ba94808edd5a19361c9dfb0a9e1b4c918cf068b5bc8bab99bed4fa043e5c6d8055ad75d857caf67aeae00eae85e129e
6
+ metadata.gz: d9497ecb61d0c0190caf4b8ba465723a9519e93a4be6c3e14e5778304d0ca66e176f58e8391e4ed925604cb7c2327a42a234e6d7a3a60429ce4add6501d8737d
7
+ data.tar.gz: faf0ad6b55baa625cd7c625a3ab79e387a92c62937272b744bc6d132cd07cd9e5980d8a91625ca861b15b7efd292c1e86a2f278e27884efa86bb765c120f6874
@@ -10,7 +10,7 @@ GIT
10
10
  PATH
11
11
  remote: .
12
12
  specs:
13
- catarse_moip (1.0.4)
13
+ catarse_moip (1.0.5)
14
14
  libxml-ruby (~> 2.6.0)
15
15
  rails (~> 3.2.12)
16
16
 
@@ -110,7 +110,7 @@ module CatarseMoip
110
110
  PaymentEngines.create_payment_notification backer_id: backer.id, extra_data: JSON.parse(params.to_json.force_encoding('iso-8859-1').encode('utf-8'))
111
111
 
112
112
  backer.with_lock do
113
- if backer.payment_id.gsub(".", "").to_i < params[:cod_moip].to_i
113
+ if backer.payment_id.gsub(".", "").to_i <= params[:cod_moip].to_i
114
114
  backer.update_attributes payment_id: params[:cod_moip]
115
115
 
116
116
  case params[:status_pagamento].to_i
@@ -1,3 +1,3 @@
1
1
  module CatarseMoip
2
- VERSION = "1.0.4"
2
+ VERSION = "1.0.5"
3
3
  end
@@ -85,6 +85,21 @@ describe CatarseMoip::MoipController do
85
85
  it("should assign backer"){ assigns(:backer).should == backer }
86
86
  end
87
87
 
88
+ context "when we receive a notification with the same payment id but with another status" do
89
+ before do
90
+ controller.stub(:params).and_return({:cod_moip => 123, :id_transacao =>backer.key, :controller => "catarse_moip/moip", :action => "create_notification", :status_pagamento => 1})
91
+ backer.stub(:payment_id).and_return('123')
92
+
93
+ controller.should_receive(:process_moip_message).and_call_original
94
+ backer.should_receive(:update_attributes).with(payment_id: 123)
95
+ post :create_notification, {:id_transacao => backer.key, :use_route => 'catarse_moip'}
96
+ end
97
+
98
+ its(:body){ should == ' ' }
99
+ its(:status){ should == 200 }
100
+ it("should assign backer"){ assigns(:backer).should == backer }
101
+ end
102
+
88
103
  context "when receive a unordered notification for backer" do
89
104
  before do
90
105
  controller.stub(:params).and_return({:cod_moip => 122, :id_transacao =>backer.key, :controller => "catarse_moip/moip", :action => "create_notification", :status_pagamento => 5})
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: catarse_moip
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Antônio Roberto Silva
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-09-10 00:00:00.000000000 Z
13
+ date: 2013-09-11 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails