catarse_moip 2.0.4 → 2.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: 241f25a32cce31dc74cd24c699ec903052225ca9
4
- data.tar.gz: 0b4296201bc4ca0182699c3a29d9db7c7cd4e176
3
+ metadata.gz: ea387b074696fe5aefd3895b55c688bc9c93e74f
4
+ data.tar.gz: f0129205c348fcea345b77af66e05f6815b3a869
5
5
  SHA512:
6
- metadata.gz: 1d13323d30cabe055055e8acba5701588f0c9a22d994da5ae0051e5eef40f534dbb505afe57a26b9b9f1657570e2eac792c4c9ac741bccf6fa0111602e7e48b0
7
- data.tar.gz: 369f69068f71a858279e11c235c966275a18ba1df403d7c79816fa7ad0203a2bab6fe157ea63c767983a9405f1e28e07610d7021fb8eccb2aa63a33f929fee46
6
+ metadata.gz: 09be7ac9649dca2a817b17224f974cb7593673d4db409ebe3cb6f3e33315f7d53e3afbabb20d64be41e999b3b5cc046d26757e1e085f87070ba5b0f74db6cd22
7
+ data.tar.gz: 5fa35808be62683fd6147ded589defdecca39c6c794b3aa852426deaae6ef1a2a90ae83e223c8f13804c13402b6ee7640279326205dd266ec5b370f28d411dc8
@@ -10,7 +10,7 @@ GIT
10
10
  PATH
11
11
  remote: .
12
12
  specs:
13
- catarse_moip (2.0.4)
13
+ catarse_moip (2.0.5)
14
14
  libxml-ruby (~> 2.6.0)
15
15
  rails (~> 4.0)
16
16
 
@@ -119,7 +119,7 @@ module CatarseMoip
119
119
  PaymentEngines.create_payment_notification backer_id: backer.id, extra_data: JSON.parse(params.to_json.force_encoding('iso-8859-1').encode('utf-8'))
120
120
 
121
121
  backer.with_lock do
122
- if backer.payment_id.gsub(".", "").to_i < params[:cod_moip].to_i
122
+ if backer.payment_id.gsub(".", "").to_i <= params[:cod_moip].to_i
123
123
  backer.update_attributes payment_id: params[:cod_moip]
124
124
 
125
125
  case params[:status_pagamento].to_i
@@ -1,3 +1,3 @@
1
1
  module CatarseMoip
2
- VERSION = "2.0.4"
2
+ VERSION = "2.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: 2.0.4
4
+ version: 2.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