catarse_pagarme 2.10.1 → 2.10.2

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: 3aeb5fcb993fb1f9e8d3c63de8db9cef4065e454
4
- data.tar.gz: 1bc6977f0d550f54adafe72df199b08f2500535f
3
+ metadata.gz: d92cef6d2e2207c5f2085a2608ae8fb391fc70eb
4
+ data.tar.gz: 7e8c3e743cf8a0de16c60911ced7b2737645d885
5
5
  SHA512:
6
- metadata.gz: bb04eef93c18928a190d4b04140a9f79f0f1723b32dbd1ee0530d66a105ec97306841e2318ed958fd7497ad3b50b6a537d272f293d055f3730509b4607e6a12b
7
- data.tar.gz: 65540aab44acc36a86dda6eac73a5a12ed1735789ee2f5b4502151e5e6fdd4bc8f6339cf5362cebec7f500b8d48e733bf3b9191bf8c45202c4e3f4dc387eb8d8
6
+ metadata.gz: 04070141b9c6c38b6424ca80767db10bcbe02775447c32b3de6eee58ae5077378e56581ae18df0d677857662e15d6f23c153ee9f037304cb4c72d8bf51e827f7
7
+ data.tar.gz: 0043c6adc7d3782e8dac4a05b5508dad456b79ed771bcefd168c38b5122666a3af2ff1fe32ed6edbf78fdbbf9d4fa24e34dc72d604c44ada6b1b02b10458ff21
data/Gemfile.lock CHANGED
@@ -1,9 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- catarse_pagarme (2.10.1)
4
+ catarse_pagarme (2.10.2)
5
5
  pagarme (= 2.1.4)
6
6
  rails (~> 4.0)
7
+ sentry-raven
7
8
  sidekiq
8
9
  weekdays (>= 1.0.2)
9
10
 
@@ -60,6 +61,8 @@ GEM
60
61
  factory_girl_rails (4.5.0)
61
62
  factory_girl (~> 4.5.0)
62
63
  railties (>= 3.0.0)
64
+ faraday (0.9.2)
65
+ multipart-post (>= 1.2, < 3)
63
66
  globalid (0.3.7)
64
67
  activesupport (>= 4.1.0)
65
68
  http-cookie (1.0.3)
@@ -77,6 +80,7 @@ GEM
77
80
  mini_portile (0.6.2)
78
81
  minitest (5.8.1)
79
82
  multi_json (1.12.1)
83
+ multipart-post (2.0.0)
80
84
  netrc (0.11.0)
81
85
  nokogiri (1.6.6.2)
82
86
  mini_portile (~> 0.6.0)
@@ -140,6 +144,8 @@ GEM
140
144
  rspec-mocks (~> 3.3.0)
141
145
  rspec-support (~> 3.3.0)
142
146
  rspec-support (3.3.0)
147
+ sentry-raven (1.2.0)
148
+ faraday (>= 0.7.6, < 0.10.x)
143
149
  sidekiq (4.2.7)
144
150
  concurrent-ruby (~> 1.0)
145
151
  connection_pool (~> 2.2, >= 2.2.0)
@@ -9,6 +9,20 @@ module CatarsePagarme
9
9
  layout :false
10
10
 
11
11
  protected
12
+ def raven_capture exception
13
+ ::Raven.user_context(
14
+ {
15
+ contribution_id: payment.contribution_id,
16
+ user_id: contribution.user_id,
17
+ payment_key: payment.key,
18
+ project_id: contribution.project_id,
19
+ payment_method: payment.payment_method
20
+ }
21
+ )
22
+ ::Raven.capture_exception(exception)
23
+ ::Raven.user_context({})
24
+ end
25
+
12
26
  def metadata_attributes
13
27
  {
14
28
  key: payment.generate_key,
@@ -8,6 +8,10 @@ module CatarsePagarme
8
8
 
9
9
  render json: { payment_status: transaction.status }
10
10
  rescue PagarMe::PagarMeError => e
11
+ # should ignore refused payments
12
+ if payment.state != 'refused'
13
+ raven_capture(e)
14
+ end
11
15
  payment.destroy if payment.persisted? && !payment.gateway_id.present?
12
16
 
13
17
  render json: { payment_status: 'failed', message: e.message }
@@ -8,6 +8,7 @@ module CatarsePagarme
8
8
 
9
9
  render json: { boleto_url: transaction.boleto_url, payment_status: transaction.status }
10
10
  rescue PagarMe::PagarMeError => e
11
+ raven_capture(e)
11
12
  render json: { boleto_url: nil, payment_status: 'failed', message: e.message }
12
13
  end
13
14
 
@@ -30,7 +31,7 @@ module CatarsePagarme
30
31
  def slip_attributes
31
32
  {
32
33
  payment_method: 'boleto',
33
- boleto_expiration_date: payment.slip_expiration_date,
34
+ boleto_expiration_date: payment.slip_expiration_date.to_date,
34
35
  amount: delegator.value_for_transaction,
35
36
  postback_url: ipn_pagarme_index_url(host: CatarsePagarme.configuration.host,
36
37
  subdomain: CatarsePagarme.configuration.subdomain,
@@ -22,6 +22,7 @@ Gem::Specification.new do |s|
22
22
  #s.add_dependency "pagarme", "1.10.0"
23
23
  s.add_dependency "weekdays", ">= 1.0.2"
24
24
  s.add_dependency "sidekiq"
25
+ s.add_dependency "sentry-raven"
25
26
 
26
27
  s.add_development_dependency "rspec-rails", "~> 3.3"
27
28
  s.add_development_dependency "factory_girl_rails"
@@ -1,3 +1,3 @@
1
1
  module CatarsePagarme
2
- VERSION = "2.10.1"
2
+ VERSION = "2.10.2"
3
3
  end
@@ -4,9 +4,17 @@ require 'rails/all'
4
4
 
5
5
  Bundler.require(*Rails.groups)
6
6
  require "catarse_pagarme"
7
+ require "sentry-raven"
7
8
 
8
9
  module Dummy
9
10
  class Application < Rails::Application
11
+ config.to_prepare do
12
+ Raven.configure do |config|
13
+ config.dsn = ''
14
+ config.environments = ['staging', 'production']
15
+ end
16
+ end
17
+
10
18
  # Settings in config/environments/* take precedence over those specified here.
11
19
  # Application configuration should go into files in config/initializers
12
20
  # -- all .rb files in that directory are automatically loaded.
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.10.1
4
+ version: 2.10.2
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: 2017-01-13 00:00:00.000000000 Z
12
+ date: 2017-02-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -67,6 +67,20 @@ dependencies:
67
67
  - - ">="
68
68
  - !ruby/object:Gem::Version
69
69
  version: '0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: sentry-raven
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :runtime
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
70
84
  - !ruby/object:Gem::Dependency
71
85
  name: rspec-rails
72
86
  requirement: !ruby/object:Gem::Requirement