catarse_pagarme 2.9.5 → 2.9.6

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: e72f0b4cc55c672bf850cc16cf19de9c4832b63c
4
- data.tar.gz: 26b1102b44a4d4730cdc0bbdbaa176c2a766c975
3
+ metadata.gz: 185bd4250e358af76710ce94d9a3c703820f41c5
4
+ data.tar.gz: 6a67184aa54291976fea34be692724399678b300
5
5
  SHA512:
6
- metadata.gz: 90bbf83877040e6c3b0134982f60216c7d2609d90330335df6a35f7f565ca4fb16cd41bdeac19408d026455d875c843ad4d02ab7755bfb4e39c0727f99c6a277
7
- data.tar.gz: 6536b98846b8fbb1db90447c4c936cc53b743674a90bb286598549265e27f3012c30a04de2e815b12ec5ca308156f4b9a1b90e89e97f39e9fb503412e50616f3
6
+ metadata.gz: 76558ef9eaccbb5b43be7be3abeddfb10301ab89cc7517b537eda2b58f055ec8dd5a44209af1e4df990ad414e11d7597b7fc6a5bfc25bf31af4a367bdc113dfe
7
+ data.tar.gz: c2ffd38296376c43d0e1e15b648a1ac70f4129b6f19717611255fb85332ecd4ec450c8b00cabf35145a630ca5b87107c6c194ccd0db6f3f27e69ecc8b519f3b1
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- catarse_pagarme (2.9.5)
5
- pagarme (= 1.10.0)
4
+ catarse_pagarme (2.9.6)
5
+ pagarme (= 2.1.3)
6
6
  rails (~> 4.0)
7
7
  sidekiq
8
8
  weekdays (>= 1.0.2)
@@ -60,7 +60,7 @@ GEM
60
60
  factory_girl_rails (4.5.0)
61
61
  factory_girl (~> 4.5.0)
62
62
  railties (>= 3.0.0)
63
- globalid (0.3.6)
63
+ globalid (0.3.7)
64
64
  activesupport (>= 4.1.0)
65
65
  http-cookie (1.0.2)
66
66
  domain_name (~> 0.5)
@@ -71,16 +71,16 @@ GEM
71
71
  mail (2.6.4)
72
72
  mime-types (>= 1.16, < 4)
73
73
  method_source (0.8.2)
74
- mime-types (3.0)
74
+ mime-types (3.1)
75
75
  mime-types-data (~> 3.2015)
76
- mime-types-data (3.2016.0221)
76
+ mime-types-data (3.2016.0521)
77
77
  mini_portile (0.6.2)
78
78
  minitest (5.8.1)
79
79
  multi_json (1.12.1)
80
80
  netrc (0.11.0)
81
81
  nokogiri (1.6.6.2)
82
82
  mini_portile (~> 0.6.0)
83
- pagarme (1.10.0)
83
+ pagarme (2.1.3)
84
84
  multi_json
85
85
  rest-client
86
86
  pg (0.18.3)
@@ -89,6 +89,8 @@ GEM
89
89
  method_source (~> 0.8.1)
90
90
  slop (~> 3.4)
91
91
  rack (1.6.4)
92
+ rack-protection (1.5.3)
93
+ rack
92
94
  rack-test (0.6.3)
93
95
  rack (>= 1.0)
94
96
  rails (4.2.4)
@@ -116,7 +118,7 @@ GEM
116
118
  rake (>= 0.8.7)
117
119
  thor (>= 0.18.1, < 2.0)
118
120
  rake (10.4.2)
119
- redis (3.2.2)
121
+ redis (3.3.1)
120
122
  rest-client (2.0.0)
121
123
  http-cookie (>= 1.0.2, < 2.0)
122
124
  mime-types (>= 1.16, < 4.0)
@@ -138,20 +140,26 @@ GEM
138
140
  rspec-mocks (~> 3.3.0)
139
141
  rspec-support (~> 3.3.0)
140
142
  rspec-support (3.3.0)
141
- sidekiq (4.0.2)
143
+ sidekiq (4.1.4)
142
144
  concurrent-ruby (~> 1.0)
143
145
  connection_pool (~> 2.2, >= 2.2.0)
144
146
  redis (~> 3.2, >= 3.2.1)
147
+ sinatra (>= 1.4.7)
148
+ sinatra (1.4.7)
149
+ rack (~> 1.5)
150
+ rack-protection (~> 1.4)
151
+ tilt (>= 1.3, < 3)
145
152
  slop (3.6.0)
146
- sprockets (3.6.0)
153
+ sprockets (3.7.0)
147
154
  concurrent-ruby (~> 1.0)
148
155
  rack (> 1, < 3)
149
- sprockets-rails (3.0.4)
156
+ sprockets-rails (3.1.1)
150
157
  actionpack (>= 4.0)
151
158
  activesupport (>= 4.0)
152
159
  sprockets (>= 3.0.0)
153
160
  thor (0.19.1)
154
161
  thread_safe (0.3.5)
162
+ tilt (2.0.5)
155
163
  tzinfo (1.2.2)
156
164
  thread_safe (~> 0.1)
157
165
  unf (0.1.4)
@@ -6,7 +6,7 @@ module CatarsePagarme
6
6
  if payment
7
7
  payment.payment_notifications.create(contribution: payment.contribution, extra_data: params.to_json)
8
8
 
9
- if PagarMe::validate_fingerprint(payment.try(:gateway_id), params[:fingerprint])
9
+ if valid_postback?
10
10
  delegator.change_status_by_transaction(params[:current_status])
11
11
  delegator.update_transaction
12
12
 
@@ -14,7 +14,7 @@ module CatarsePagarme
14
14
  end
15
15
  end
16
16
 
17
- render nothing: true, status: 404
17
+ render_invalid_postback_response
18
18
  end
19
19
 
20
20
  protected
@@ -22,5 +22,15 @@ module CatarsePagarme
22
22
  def payment
23
23
  @payment ||= PaymentEngines.find_payment({ gateway_id: params[:id] })
24
24
  end
25
+
26
+ def valid_postback?
27
+ raw_post = request.raw_post
28
+ signature = request.headers['HTTP_X_HUB_SIGNATURE']
29
+ PagarMe::Postback.valid_request_signature?(raw_post, signature)
30
+ end
31
+
32
+ def render_invalid_postback_response
33
+ render json: {error: 'invalid postback'}, status: 400
34
+ end
25
35
  end
26
36
  end
@@ -18,7 +18,8 @@ Gem::Specification.new do |s|
18
18
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
19
19
 
20
20
  s.add_dependency "rails", "~> 4.0"
21
- s.add_dependency "pagarme", "1.10.0"
21
+ s.add_dependency "pagarme", "2.1.3"
22
+ #s.add_dependency "pagarme", "1.10.0"
22
23
  s.add_dependency "weekdays", ">= 1.0.2"
23
24
  s.add_dependency "sidekiq"
24
25
 
@@ -1,3 +1,3 @@
1
1
  module CatarsePagarme
2
- VERSION = "2.9.5"
2
+ VERSION = "2.9.6"
3
3
  end
@@ -5,7 +5,7 @@ describe CatarsePagarme::NotificationsController, type: :controller do
5
5
 
6
6
  before do
7
7
  @routes = CatarsePagarme::Engine.routes
8
- PagarMe.stub(:validate_fingerprint).and_return(true)
8
+ PagarMe::PostBack.stub(:validate_request_signature?).and_return(true)
9
9
  PagarMe::Transaction.stub(:find_by_id).and_return(fake_transaction)
10
10
  end
11
11
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: catarse_pagarme
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.5
4
+ version: 2.9.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Antônio Roberto Silva
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-08-04 00:00:00.000000000 Z
12
+ date: 2016-08-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -31,14 +31,14 @@ dependencies:
31
31
  requirements:
32
32
  - - '='
33
33
  - !ruby/object:Gem::Version
34
- version: 1.10.0
34
+ version: 2.1.3
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - '='
40
40
  - !ruby/object:Gem::Version
41
- version: 1.10.0
41
+ version: 2.1.3
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: weekdays
44
44
  requirement: !ruby/object:Gem::Requirement