catarse_pagarme 2.9.7 → 2.9.8

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: 32d86f548a6da4361bd96f91af536713d103f664
4
- data.tar.gz: 708071f6cdd2a534e66457e8b18f8258e6e859f3
3
+ metadata.gz: 539f0a1d892950356a3905c81128a24bd4adbc24
4
+ data.tar.gz: ecc70fd87f7c736542efac872129ca7642311801
5
5
  SHA512:
6
- metadata.gz: 64fd9604b09364c0410857af9c0782a574963c5e029a90659a992945946523d77a30355b53cd7e1306bbb63217e469c660b5fb36fc901ac8afdb4bac8848863c
7
- data.tar.gz: 89aff104baf53a6edff9335c4626569a6f48cdcda1fbf486d88542f2556cbb13d324d6a0082a1d04e7df413375acc62635850cdb99a2b2b86f535f11f24a7fb6
6
+ metadata.gz: e83a89104df7abfbadf1eb9ae1b88f3c1d5cbf15eb502dc24d3633371e7b7b7e39fbfcf2a5948e5b5e0c38b1143a111110ba08f2b487380d3a17034a70ff6cb0
7
+ data.tar.gz: 65903c85d65efbaccb06b1aaebd929b805f44967392b39bd87fd730b5c1be625825f385b6d7ed13de1362591d07353bbe94d2585f8b59c0656ad220e3c6359b6
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.3.0
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- catarse_pagarme (2.9.7)
4
+ catarse_pagarme (2.9.8)
5
5
  pagarme (= 2.1.3)
6
6
  rails (~> 4.0)
7
7
  sidekiq
@@ -179,4 +179,4 @@ DEPENDENCIES
179
179
  rspec-rails (~> 3.3)
180
180
 
181
181
  BUNDLED WITH
182
- 1.12.5
182
+ 1.13.0
@@ -30,6 +30,10 @@ module CatarsePagarme
30
30
  unless defined?(current_user) && current_user
31
31
  raise Exception.new('invalid user')
32
32
  end
33
+
34
+ if current_user != contribution.user
35
+ raise Exception.new('invalid user') unless current_user.admin?
36
+ end
33
37
  end
34
38
 
35
39
  def permited_attrs(attributes)
@@ -21,6 +21,10 @@ module CatarsePagarme
21
21
  end
22
22
  end
23
23
 
24
+ def slip_data
25
+ render json: {slip_expiration_date: payment.slip_expiration_date.to_date}
26
+ end
27
+
24
28
  protected
25
29
 
26
30
  def slip_attributes
data/config/routes.rb CHANGED
@@ -3,6 +3,7 @@ CatarsePagarme::Engine.routes.draw do
3
3
 
4
4
  member do
5
5
  get :review
6
+ get :slip_data, to: 'slip#slip_data'
6
7
  get :second_slip, to: 'slip#update'
7
8
  post :pay_credit_card, to: 'credit_cards#create'
8
9
  post :pay_slip, to: 'slip#create'
@@ -1,3 +1,3 @@
1
1
  module CatarsePagarme
2
- VERSION = "2.9.7"
2
+ VERSION = "2.9.8"
3
3
  end
@@ -16,6 +16,16 @@ describe CatarsePagarme::CreditCardsController, type: :controller do
16
16
  end
17
17
 
18
18
  describe 'pay with credit card' do
19
+ context 'with diff user' do
20
+ let(:user) { create(:user) }
21
+
22
+ it 'should raise a error' do
23
+ expect {
24
+ post :create, { locale: :pt, id: contribution.id }
25
+ }.to raise_error('invalid user')
26
+ end
27
+ end
28
+
19
29
  context 'without an user' do
20
30
  let(:user) { nil }
21
31
 
@@ -13,6 +13,16 @@ describe CatarsePagarme::SlipController, type: :controller do
13
13
  let(:credit_card) { create(:credit_card, subscription_id: '1542')}
14
14
 
15
15
  describe 'GET update' do
16
+ context 'with diff user' do
17
+ let(:user) { create(:user) }
18
+
19
+ it 'should raise a error' do
20
+ expect {
21
+ get :update, locale: :pt, id: contribution.id
22
+ }.to raise_error('invalid user')
23
+ end
24
+ end
25
+
16
26
  context 'without an user' do
17
27
  let(:user) { nil }
18
28
 
@@ -37,6 +47,16 @@ describe CatarsePagarme::SlipController, type: :controller do
37
47
  end
38
48
 
39
49
  describe 'POST create' do
50
+ context 'with diff user' do
51
+ let(:user) { create(:user) }
52
+
53
+ it 'should raise a error' do
54
+ expect {
55
+ post :create, { locale: :pt, id: contribution.id }
56
+ }.to raise_error('invalid user')
57
+ end
58
+ end
59
+
40
60
  context 'without an user' do
41
61
  let(:user) { nil }
42
62
 
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.7
4
+ version: 2.9.8
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-09-06 00:00:00.000000000 Z
12
+ date: 2016-09-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -132,6 +132,7 @@ extensions: []
132
132
  extra_rdoc_files: []
133
133
  files:
134
134
  - ".gitignore"
135
+ - ".ruby-version"
135
136
  - Gemfile
136
137
  - Gemfile.lock
137
138
  - MIT-LICENSE
@@ -270,7 +271,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
270
271
  version: '0'
271
272
  requirements: []
272
273
  rubyforge_project:
273
- rubygems_version: 2.4.5.1
274
+ rubygems_version: 2.5.1
274
275
  signing_key:
275
276
  specification_version: 4
276
277
  summary: Integration with Pagar.me