catarse_pagarme 2.16.0 → 3.0.1

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
- SHA256:
3
- metadata.gz: 1aeb220af20a3e600ebd9a43bea5af0960a1b0a9bc417a71ce3363b3286f23d3
4
- data.tar.gz: ead3a3b224139a7496b72c1957c9e6e208dc2bb1570e2f01a55d661e84e11d1c
2
+ SHA1:
3
+ metadata.gz: 0e7be854657adedb16a5144be548f82a1d4afb2a
4
+ data.tar.gz: fcc26b9e7c29296a0f0718fb763714446a1b0ad7
5
5
  SHA512:
6
- metadata.gz: 1a5d134e4a6c4e54c785be011e25601609bac15b5a2746ba0d029f08505f71eb124ce0c6a92f9be5e52a5b934c989ebcd615421f6f09d77a8d293e5be1065fd1
7
- data.tar.gz: 17f9af0d132c6c93025c71d8100622fc427879fc1167813b73efdca3a7e799e2145ec2aed166192cb3a694b3f7647eb2924a809c6e767e601deeb66b76340c68
6
+ metadata.gz: be12e118913110b6a09a4003c7e1d7721c78e235b4453868f8b8e2ade9742939999223fb8f4df1e14b7d3714666efd361ebe96089ef3866569fe71c24104a9da
7
+ data.tar.gz: 744fc8c23ccfb2e2e65bc2f21c8ca6a1e43e1a1cdf1309161a1bea1b3b22118d131c258c4436d8c91a1eed9c2f27d769f5456c005f6cf5c1c13c1dce5922aa03
@@ -1,11 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- catarse_pagarme (2.16.0)
5
- countries (= 3.0.0)
4
+ catarse_pagarme (3.0.1)
6
5
  konduto-ruby (= 2.1.0)
7
6
  pagarme (= 2.1.4)
8
- rails (~> 4.0)
7
+ rails
9
8
  sentry-raven
10
9
  sidekiq
11
10
  weekdays (>= 1.0.2)
@@ -13,171 +12,180 @@ PATH
13
12
  GEM
14
13
  remote: https://rubygems.org/
15
14
  specs:
16
- actionmailer (4.2.10)
17
- actionpack (= 4.2.10)
18
- actionview (= 4.2.10)
19
- activejob (= 4.2.10)
15
+ actioncable (5.2.4.3)
16
+ actionpack (= 5.2.4.3)
17
+ nio4r (~> 2.0)
18
+ websocket-driver (>= 0.6.1)
19
+ actionmailer (5.2.4.3)
20
+ actionpack (= 5.2.4.3)
21
+ actionview (= 5.2.4.3)
22
+ activejob (= 5.2.4.3)
20
23
  mail (~> 2.5, >= 2.5.4)
21
- rails-dom-testing (~> 1.0, >= 1.0.5)
22
- actionpack (4.2.10)
23
- actionview (= 4.2.10)
24
- activesupport (= 4.2.10)
25
- rack (~> 1.6)
26
- rack-test (~> 0.6.2)
27
- rails-dom-testing (~> 1.0, >= 1.0.5)
24
+ rails-dom-testing (~> 2.0)
25
+ actionpack (5.2.4.3)
26
+ actionview (= 5.2.4.3)
27
+ activesupport (= 5.2.4.3)
28
+ rack (~> 2.0, >= 2.0.8)
29
+ rack-test (>= 0.6.3)
30
+ rails-dom-testing (~> 2.0)
28
31
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
29
- actionview (4.2.10)
30
- activesupport (= 4.2.10)
32
+ actionview (5.2.4.3)
33
+ activesupport (= 5.2.4.3)
31
34
  builder (~> 3.1)
32
- erubis (~> 2.7.0)
33
- rails-dom-testing (~> 1.0, >= 1.0.5)
35
+ erubi (~> 1.4)
36
+ rails-dom-testing (~> 2.0)
34
37
  rails-html-sanitizer (~> 1.0, >= 1.0.3)
35
- activejob (4.2.10)
36
- activesupport (= 4.2.10)
37
- globalid (>= 0.3.0)
38
- activemodel (4.2.10)
39
- activesupport (= 4.2.10)
40
- builder (~> 3.1)
41
- activerecord (4.2.10)
42
- activemodel (= 4.2.10)
43
- activesupport (= 4.2.10)
44
- arel (~> 6.0)
45
- activesupport (4.2.10)
46
- i18n (~> 0.7)
38
+ activejob (5.2.4.3)
39
+ activesupport (= 5.2.4.3)
40
+ globalid (>= 0.3.6)
41
+ activemodel (5.2.4.3)
42
+ activesupport (= 5.2.4.3)
43
+ activerecord (5.2.4.3)
44
+ activemodel (= 5.2.4.3)
45
+ activesupport (= 5.2.4.3)
46
+ arel (>= 9.0)
47
+ activestorage (5.2.4.3)
48
+ actionpack (= 5.2.4.3)
49
+ activerecord (= 5.2.4.3)
50
+ marcel (~> 0.3.1)
51
+ activesupport (5.2.4.3)
52
+ concurrent-ruby (~> 1.0, >= 1.0.2)
53
+ i18n (>= 0.7, < 2)
47
54
  minitest (~> 5.1)
48
- thread_safe (~> 0.3, >= 0.3.4)
49
55
  tzinfo (~> 1.1)
50
- arel (6.0.4)
51
- builder (3.2.3)
52
- coderay (1.1.2)
53
- concurrent-ruby (1.0.5)
54
- connection_pool (2.2.2)
55
- countries (3.0.0)
56
- i18n_data (~> 0.8.0)
57
- sixarm_ruby_unaccent (~> 1.1)
58
- unicode_utils (~> 1.4)
59
- crass (1.0.4)
60
- database_cleaner (1.7.0)
61
- diff-lcs (1.3)
56
+ arel (9.0.0)
57
+ builder (3.2.4)
58
+ coderay (1.1.3)
59
+ concurrent-ruby (1.1.6)
60
+ connection_pool (2.2.3)
61
+ crass (1.0.6)
62
+ database_cleaner (1.8.5)
63
+ diff-lcs (1.4.4)
62
64
  domain_name (0.5.20190701)
63
65
  unf (>= 0.0.5, < 1.0.0)
64
- erubis (2.7.0)
66
+ erubi (1.9.0)
65
67
  factory_girl (4.9.0)
66
68
  activesupport (>= 3.0.0)
67
69
  factory_girl_rails (4.9.0)
68
70
  factory_girl (~> 4.9.0)
69
71
  railties (>= 3.0.0)
70
- faraday (1.0.1)
72
+ faraday (1.1.0)
71
73
  multipart-post (>= 1.2, < 3)
74
+ ruby2_keywords
72
75
  globalid (0.4.2)
73
76
  activesupport (>= 4.2.0)
74
77
  http-accept (1.7.0)
75
78
  http-cookie (1.0.3)
76
79
  domain_name (~> 0.5)
77
- i18n (0.9.5)
80
+ i18n (1.8.3)
78
81
  concurrent-ruby (~> 1.0)
79
- i18n_data (0.8.0)
80
82
  konduto-ruby (2.1.0)
81
- loofah (2.2.2)
83
+ loofah (2.6.0)
82
84
  crass (~> 1.0.2)
83
85
  nokogiri (>= 1.5.9)
84
86
  mail (2.7.1)
85
87
  mini_mime (>= 0.1.1)
86
- method_source (0.9.0)
88
+ marcel (0.3.3)
89
+ mimemagic (~> 0.3.2)
90
+ method_source (1.0.0)
87
91
  mime-types (3.3.1)
88
92
  mime-types-data (~> 3.2015)
89
- mime-types-data (3.2019.1009)
93
+ mime-types-data (3.2020.0512)
94
+ mimemagic (0.3.5)
90
95
  mini_mime (1.0.2)
91
- mini_portile2 (2.3.0)
92
- minitest (5.11.3)
93
- multi_json (1.14.1)
96
+ mini_portile2 (2.4.0)
97
+ minitest (5.14.1)
98
+ multi_json (1.15.0)
94
99
  multipart-post (2.1.1)
95
100
  netrc (0.11.0)
96
- nokogiri (1.8.4)
97
- mini_portile2 (~> 2.3.0)
101
+ nio4r (2.5.4)
102
+ nokogiri (1.10.9)
103
+ mini_portile2 (~> 2.4.0)
98
104
  pagarme (2.1.4)
99
105
  multi_json
100
106
  rest-client
101
- pg (0.15.0)
102
- pry (0.11.3)
103
- coderay (~> 1.1.0)
104
- method_source (~> 0.9.0)
105
- rack (1.6.10)
106
- rack-protection (2.0.8.1)
107
+ pg (1.2.3)
108
+ pry (0.13.1)
109
+ coderay (~> 1.1)
110
+ method_source (~> 1.0)
111
+ rack (2.2.3)
112
+ rack-protection (2.1.0)
107
113
  rack
108
- rack-test (0.6.3)
109
- rack (>= 1.0)
110
- rails (4.2.10)
111
- actionmailer (= 4.2.10)
112
- actionpack (= 4.2.10)
113
- actionview (= 4.2.10)
114
- activejob (= 4.2.10)
115
- activemodel (= 4.2.10)
116
- activerecord (= 4.2.10)
117
- activesupport (= 4.2.10)
118
- bundler (>= 1.3.0, < 2.0)
119
- railties (= 4.2.10)
120
- sprockets-rails
121
- rails-deprecated_sanitizer (1.0.3)
122
- activesupport (>= 4.2.0.alpha)
123
- rails-dom-testing (1.0.9)
124
- activesupport (>= 4.2.0, < 5.0)
125
- nokogiri (~> 1.6)
126
- rails-deprecated_sanitizer (>= 1.0.1)
127
- rails-html-sanitizer (1.0.4)
128
- loofah (~> 2.2, >= 2.2.2)
129
- railties (4.2.10)
130
- actionpack (= 4.2.10)
131
- activesupport (= 4.2.10)
114
+ rack-test (1.1.0)
115
+ rack (>= 1.0, < 3)
116
+ rails (5.2.4.3)
117
+ actioncable (= 5.2.4.3)
118
+ actionmailer (= 5.2.4.3)
119
+ actionpack (= 5.2.4.3)
120
+ actionview (= 5.2.4.3)
121
+ activejob (= 5.2.4.3)
122
+ activemodel (= 5.2.4.3)
123
+ activerecord (= 5.2.4.3)
124
+ activestorage (= 5.2.4.3)
125
+ activesupport (= 5.2.4.3)
126
+ bundler (>= 1.3.0)
127
+ railties (= 5.2.4.3)
128
+ sprockets-rails (>= 2.0.0)
129
+ rails-dom-testing (2.0.3)
130
+ activesupport (>= 4.2.0)
131
+ nokogiri (>= 1.6)
132
+ rails-html-sanitizer (1.3.0)
133
+ loofah (~> 2.3)
134
+ railties (5.2.4.3)
135
+ actionpack (= 5.2.4.3)
136
+ activesupport (= 5.2.4.3)
137
+ method_source
132
138
  rake (>= 0.8.7)
133
- thor (>= 0.18.1, < 2.0)
134
- rake (12.3.1)
135
- redis (4.1.3)
139
+ thor (>= 0.19.0, < 2.0)
140
+ rake (13.0.1)
141
+ redis (4.1.4)
136
142
  rest-client (2.1.0)
137
143
  http-accept (>= 1.7.0, < 2.0)
138
144
  http-cookie (>= 1.0.2, < 2.0)
139
145
  mime-types (>= 1.16, < 4.0)
140
146
  netrc (~> 0.8)
141
- rspec-core (3.8.0)
142
- rspec-support (~> 3.8.0)
143
- rspec-expectations (3.8.1)
147
+ rspec-core (3.9.2)
148
+ rspec-support (~> 3.9.3)
149
+ rspec-expectations (3.9.2)
144
150
  diff-lcs (>= 1.2.0, < 2.0)
145
- rspec-support (~> 3.8.0)
146
- rspec-mocks (3.8.0)
151
+ rspec-support (~> 3.9.0)
152
+ rspec-mocks (3.9.1)
147
153
  diff-lcs (>= 1.2.0, < 2.0)
148
- rspec-support (~> 3.8.0)
149
- rspec-rails (3.8.0)
154
+ rspec-support (~> 3.9.0)
155
+ rspec-rails (3.9.1)
150
156
  actionpack (>= 3.0)
151
157
  activesupport (>= 3.0)
152
158
  railties (>= 3.0)
153
- rspec-core (~> 3.8.0)
154
- rspec-expectations (~> 3.8.0)
155
- rspec-mocks (~> 3.8.0)
156
- rspec-support (~> 3.8.0)
157
- rspec-support (3.8.0)
158
- sentry-raven (3.0.0)
159
+ rspec-core (~> 3.9.0)
160
+ rspec-expectations (~> 3.9.0)
161
+ rspec-mocks (~> 3.9.0)
162
+ rspec-support (~> 3.9.0)
163
+ rspec-support (3.9.3)
164
+ ruby2_keywords (0.0.2)
165
+ sentry-raven (3.1.1)
159
166
  faraday (>= 1.0)
160
- sidekiq (5.2.8)
167
+ sidekiq (5.2.9)
161
168
  connection_pool (~> 2.2, >= 2.2.2)
162
- rack (< 2.1.0)
169
+ rack (~> 2.0)
163
170
  rack-protection (>= 1.5.0)
164
- redis (>= 3.3.5, < 5)
165
- sixarm_ruby_unaccent (1.2.0)
171
+ redis (>= 3.3.5, < 4.2)
166
172
  sprockets (3.7.2)
167
173
  concurrent-ruby (~> 1.0)
168
174
  rack (> 1, < 3)
169
- sprockets-rails (3.2.1)
175
+ sprockets-rails (3.2.2)
170
176
  actionpack (>= 4.0)
171
177
  activesupport (>= 4.0)
172
178
  sprockets (>= 3.0.0)
173
- thor (0.20.0)
179
+ thor (1.0.1)
174
180
  thread_safe (0.3.6)
175
- tzinfo (1.2.5)
181
+ tzinfo (1.2.7)
176
182
  thread_safe (~> 0.1)
177
183
  unf (0.1.4)
178
184
  unf_ext
179
185
  unf_ext (0.0.7.7)
180
- unicode_utils (1.4.0)
186
+ websocket-driver (0.7.3)
187
+ websocket-extensions (>= 0.1.0)
188
+ websocket-extensions (0.1.5)
181
189
  weekdays (1.0.2)
182
190
 
183
191
  PLATFORMS
@@ -3,8 +3,8 @@ require "pagarme"
3
3
  module CatarsePagarme
4
4
  class ApplicationController < ActionController::Base
5
5
 
6
- before_filter :authenticate_user!
7
- before_filter :configure_pagarme
6
+ before_action :authenticate_user!
7
+ before_action :configure_pagarme
8
8
  helper_method :payment
9
9
  layout :false
10
10
 
@@ -1,6 +1,6 @@
1
1
  module CatarsePagarme
2
2
  class NotificationsController < CatarsePagarme::ApplicationController
3
- skip_before_filter :authenticate_user!
3
+ skip_before_action :authenticate_user!
4
4
 
5
5
  def create
6
6
  if payment
@@ -59,9 +59,9 @@ module CatarsePagarme
59
59
 
60
60
  def order_attributes
61
61
  {
62
- id: self.transaction.id.to_s,
62
+ id: self.transaction.id.to_s[0..99],
63
63
  total_amount: self.attributes[:amount] / 100.0,
64
- visitor: self.attributes.dig(:metadata, :contribution_id).to_s,
64
+ visitor: self.attributes.dig(:metadata, :contribution_id).to_s[0..40],
65
65
  currency: 'BRL',
66
66
  installments: self.attributes[:installments],
67
67
  purchased_at: self.transaction.date_created,
@@ -74,10 +74,10 @@ module CatarsePagarme
74
74
  tax_id = customer[:document_number].present? ? { tax_id: customer[:document_number] } : {}
75
75
 
76
76
  {
77
- id: customer[:id].to_s,
78
- name: customer[:name],
79
- email: customer[:email],
80
- phone1: customer[:phone].to_h.values.join,
77
+ id: customer[:id].to_s[0..99],
78
+ name: customer[:name].to_s[0..99],
79
+ email: customer[:email].to_s[0..99],
80
+ phone1: customer[:phone].to_h.values.join.to_s[0..99],
81
81
  created_at: self.attributes.dig(:antifraud_metadata, :register, :registered_at)
82
82
  }.merge(tax_id)
83
83
  end
@@ -95,33 +95,33 @@ module CatarsePagarme
95
95
  def billing_address_attributes
96
96
  billing_data = self.attributes.dig(:antifraud_metadata, :billing)
97
97
  {
98
- name: self.transaction.card.holder_name,
99
- address1: billing_data.dig(:address, :street),
100
- city: billing_data.dig(:address, :city),
101
- state: billing_data.dig(:address, :state),
102
- zip: billing_data.dig(:address, :zipcode),
103
- country: billing_data.dig(:address, :country_code),
98
+ name: self.transaction.card.holder_name.to_s[0..99],
99
+ address1: billing_data.dig(:address, :street).to_s[0..254],
100
+ city: billing_data.dig(:address, :city).to_s[0..99],
101
+ state: billing_data.dig(:address, :state).to_s[0..99],
102
+ zip: billing_data.dig(:address, :zipcode).to_s[0..99],
103
+ country: billing_data.dig(:address, :country_code).to_s[0..1],
104
104
  }
105
105
  end
106
106
 
107
107
  def shipping_address_attributes
108
108
  shipping_data = self.attributes.dig(:antifraud_metadata, :shipping)
109
109
  {
110
- name: shipping_data.dig(:customer, :name),
111
- address1: shipping_data.dig(:address, :street),
112
- city: shipping_data.dig(:address, :city),
113
- state: shipping_data.dig(:address, :state),
114
- zip: shipping_data.dig(:address, :zipcode)
110
+ name: shipping_data.dig(:customer, :name).to_s[0..99],
111
+ address1: shipping_data.dig(:address, :street).to_s[0..254],
112
+ city: shipping_data.dig(:address, :city).to_s[0..99],
113
+ state: shipping_data.dig(:address, :state).to_s[0..99],
114
+ zip: shipping_data.dig(:address, :zipcode).to_s[0..99]
115
115
  }
116
116
  end
117
117
 
118
118
  def item_attributes
119
119
  shopping_cart_data = self.attributes.dig(:antifraud_metadata, :shopping_cart).first
120
120
  {
121
- sku: self.attributes.dig(:metadata, :contribution_id).to_s,
122
- product_code: self.attributes.dig(:metadata, :contribution_id).to_s,
121
+ sku: self.attributes.dig(:metadata, :contribution_id).to_s[0..99],
122
+ product_code: self.attributes.dig(:metadata, :contribution_id).to_s[0..99],
123
123
  category: 9999,
124
- name: shopping_cart_data[:name],
124
+ name: shopping_cart_data[:name].to_s[0..99],
125
125
  unit_cost: self.attributes[:amount] / 100.0,
126
126
  quantity: 1,
127
127
  created_at: self.attributes.dig(:metadata, :project_online).to_s[0..9]
@@ -131,8 +131,8 @@ module CatarsePagarme
131
131
  def seller_attributes
132
132
  event_data = self.attributes.dig(:antifraud_metadata, :events).first
133
133
  {
134
- id: event_data[:id],
135
- name: event_data[:venue_name],
134
+ id: event_data[:id].to_s[0..99],
135
+ name: event_data[:venue_name].to_s[0..99],
136
136
  created_at: event_data[:date]
137
137
  }
138
138
  end
@@ -26,7 +26,7 @@ module CatarsePagarme
26
26
  transfer.create
27
27
  raise "unable to create a transfer" unless transfer.id.present?
28
28
 
29
- balance_transfer.update_attribute(:transfer_id, transfer.id)
29
+ balance_transfer.update(transfer_id: transfer.id)
30
30
  balance_transfer.transition_to(:processing, transfer_data: transfer.to_hash)
31
31
  balance_transfer
32
32
  end
@@ -40,7 +40,7 @@ module CatarsePagarme
40
40
  }.merge(credit_card_identifier)
41
41
  )
42
42
 
43
- unless payment.update_attributes(gateway: 'Pagarme', payment_method: payment_method)
43
+ unless payment.update(gateway: 'Pagarme', payment_method: payment_method)
44
44
  raise ::PagarMe::PagarMeError.new(payment.errors.messages.values.flatten.to_sentence)
45
45
  end
46
46
 
@@ -1,14 +1,13 @@
1
1
  module CatarsePagarme
2
2
  class PaymentDelegator
3
3
  attr_accessor :payment, :transaction
4
- include FeeCalculatorConcern
5
4
 
6
5
  def initialize(payment)
7
6
  configure_pagarme
8
7
  self.payment = payment
9
8
  end
10
9
 
11
- def change_status_by_transaction(transaction_status)
10
+ def change_status_by_transaction(transaction_status)
12
11
  case transaction_status
13
12
  when 'pending_review' then
14
13
  self.payment.try(:notify_about_pending_review)
@@ -32,7 +31,7 @@ module CatarsePagarme
32
31
  def update_transaction
33
32
  fill_acquirer_data
34
33
  payment.installment_value = (value_for_installment / 100.0).to_f
35
- payment.gateway_fee = get_fee
34
+ PaymentEngines.import_payables(payment)
36
35
  payment.save!
37
36
  end
38
37
 
@@ -128,7 +127,7 @@ module CatarsePagarme
128
127
  raise "unable to create a transfer" unless transfer.id.present?
129
128
 
130
129
  #avoid sending notification
131
- payment.update_attributes(state: 'pending_refund')
130
+ payment.update(state: 'pending_refund')
132
131
  payment.payment_transfers.create!({
133
132
  user: payment.user,
134
133
  transfer_id: transfer.id,
@@ -1,9 +1,10 @@
1
1
  module CatarsePagarme
2
2
  class SlipTransaction < TransactionBase
3
3
  def charge!
4
- unless payment.update_attributes({
4
+ unless payment.update(
5
5
  gateway: 'Pagarme',
6
- payment_method: payment_method})
6
+ payment_method: payment_method
7
+ )
7
8
 
8
9
  raise ::PagarMe::PagarMeError.new(
9
10
  payment.errors.messages.values.flatten.to_sentence)
@@ -10,7 +10,7 @@ module CatarsePagarme
10
10
  end
11
11
 
12
12
  def change_payment_state
13
- self.payment.update_attributes(attributes_to_payment)
13
+ self.payment.update(attributes_to_payment)
14
14
  self.payment.save!
15
15
  delegator.update_transaction
16
16
  self.payment.payment_notifications.create(contribution_id: self.payment.contribution_id, extra_data: self.transaction.to_json)
@@ -9,7 +9,7 @@ class CatarsePagarme::VerifyPagarmeWorker
9
9
  raise "payment not found" unless payment.present?
10
10
  raise "source not found" unless source.present? && source.try(:[], "metadata").try(:[], "key") == key
11
11
 
12
- payment.update_attributes({gateway_id: source["id"]})
12
+ payment.update(gateway_id: source["id"])
13
13
  payment.pagarme_delegator.update_transaction
14
14
  payment.pagarme_delegator.change_status_by_transaction source["status"]
15
15
  end
@@ -17,8 +17,7 @@ Gem::Specification.new do |s|
17
17
  s.files = `git ls-files`.split($\)
18
18
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
19
19
 
20
- s.add_dependency "countries", "3.0.0"
21
- s.add_dependency "rails", "~> 4.0"
20
+ s.add_dependency "rails"
22
21
  s.add_dependency "pagarme", "2.1.4"
23
22
  s.add_dependency "konduto-ruby", "2.1.0"
24
23
  s.add_dependency "weekdays", ">= 1.0.2"
@@ -1,6 +1,5 @@
1
1
  require "pagarme"
2
2
  require "konduto-ruby"
3
- require "countries"
4
3
  require "catarse_pagarme/engine"
5
4
  require "catarse_pagarme/configuration"
6
5
  require "catarse_pagarme/payment_engine"
@@ -1,3 +1,3 @@
1
1
  module CatarsePagarme
2
- VERSION = "2.16.0"
2
+ VERSION = "3.0.1"
3
3
  end
@@ -11,7 +11,7 @@ describe CatarsePagarme::CreditCardsController, type: :controller do
11
11
  let(:payment) do
12
12
  contribution.reload
13
13
  p = contribution.payments.first
14
- #p.update_attributes({ state: 'pending', gateway_id: nil })
14
+ #p.update(state: 'pending', gateway_id: nil)
15
15
  p
16
16
  end
17
17
 
@@ -13,7 +13,7 @@ describe CatarsePagarme::NotificationsController, type: :controller do
13
13
  let(:contribution) { create(:contribution, value: 10, project: project) }
14
14
  let(:payment) {
15
15
  p = contribution.payments.first
16
- p.update_attributes gateway_id: 'abcd'
16
+ p.update gateway_id: 'abcd'
17
17
  p
18
18
  }
19
19
  let(:credit_card) { create(:credit_card, subscription_id: '1542')}
@@ -48,4 +48,3 @@ describe CatarsePagarme::NotificationsController, type: :controller do
48
48
  end
49
49
 
50
50
  end
51
-
@@ -66,7 +66,7 @@ describe CatarsePagarme::SlipTransaction do
66
66
 
67
67
  context "with valid attributes" do
68
68
  before do
69
- payment.should_receive(:update_attributes).at_least(1).and_call_original
69
+ payment.should_receive(:update).at_least(1).and_call_original
70
70
  PagarMe::Transaction.should_receive(:find_by_id).with(pagarme_transaction.id).and_return(pagarme_transaction)
71
71
  CatarsePagarme::PaymentDelegator.any_instance.should_receive(:change_status_by_transaction).with('paid')
72
72
 
@@ -70,7 +70,7 @@ FactoryGirl.define do
70
70
  #after(:create) do |project|
71
71
  # create(:reward, project: project)
72
72
  # if project.state == 'change_to_online_after_create'
73
- # project.update_attributes(state: 'online')
73
+ # project.update(state: 'online')
74
74
  # end
75
75
  #end
76
76
  f.name "Foo bar"
@@ -190,5 +190,3 @@ FactoryGirl.define do
190
190
  f.name "foo"
191
191
  end
192
192
  end
193
-
194
-
@@ -23,7 +23,7 @@ describe CatarsePagarme::VerifyPagarmeWorker do
23
23
  allow_any_instance_of(CatarsePagarme::PaymentDelegator).to receive(:update_transaction)
24
24
  allow_any_instance_of(CatarsePagarme::PaymentDelegator).to receive(:change_status_by_transaction)
25
25
 
26
- expect_any_instance_of(Payment).to receive(:update_attributes).with({gateway_id: fake_transaction["id"]})
26
+ expect_any_instance_of(Payment).to receive(:update).with({gateway_id: fake_transaction["id"]})
27
27
  expect_any_instance_of(CatarsePagarme::PaymentDelegator).to receive(:update_transaction)
28
28
  expect_any_instance_of(CatarsePagarme::PaymentDelegator).to receive(:change_status_by_transaction).with(fake_transaction["status"])
29
29
  end
@@ -65,4 +65,3 @@ describe CatarsePagarme::VerifyPagarmeWorker do
65
65
  end
66
66
  end
67
67
  end
68
-
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.16.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Antônio Roberto Silva
@@ -9,36 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-06-04 00:00:00.000000000 Z
12
+ date: 2020-12-11 00:00:00.000000000 Z
13
13
  dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: countries
16
- requirement: !ruby/object:Gem::Requirement
17
- requirements:
18
- - - '='
19
- - !ruby/object:Gem::Version
20
- version: 3.0.0
21
- type: :runtime
22
- prerelease: false
23
- version_requirements: !ruby/object:Gem::Requirement
24
- requirements:
25
- - - '='
26
- - !ruby/object:Gem::Version
27
- version: 3.0.0
28
14
  - !ruby/object:Gem::Dependency
29
15
  name: rails
30
16
  requirement: !ruby/object:Gem::Requirement
31
17
  requirements:
32
- - - "~>"
18
+ - - ">="
33
19
  - !ruby/object:Gem::Version
34
- version: '4.0'
20
+ version: '0'
35
21
  type: :runtime
36
22
  prerelease: false
37
23
  version_requirements: !ruby/object:Gem::Requirement
38
24
  requirements:
39
- - - "~>"
25
+ - - ">="
40
26
  - !ruby/object:Gem::Version
41
- version: '4.0'
27
+ version: '0'
42
28
  - !ruby/object:Gem::Dependency
43
29
  name: pagarme
44
30
  requirement: !ruby/object:Gem::Requirement
@@ -194,7 +180,6 @@ files:
194
180
  - app/models/catarse_pagarme/balance_transfer_delegator.rb
195
181
  - app/models/catarse_pagarme/bank_account_concern.rb
196
182
  - app/models/catarse_pagarme/credit_card_transaction.rb
197
- - app/models/catarse_pagarme/fee_calculator_concern.rb
198
183
  - app/models/catarse_pagarme/payment_concern.rb
199
184
  - app/models/catarse_pagarme/payment_delegator.rb
200
185
  - app/models/catarse_pagarme/payment_type.rb
@@ -305,7 +290,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
305
290
  - !ruby/object:Gem::Version
306
291
  version: '0'
307
292
  requirements: []
308
- rubygems_version: 3.0.4
293
+ rubyforge_project:
294
+ rubygems_version: 2.6.14.1
309
295
  signing_key:
310
296
  specification_version: 4
311
297
  summary: Integration with Pagar.me
@@ -1,21 +0,0 @@
1
- module CatarsePagarme::FeeCalculatorConcern
2
- extend ActiveSupport::Concern
3
-
4
- included do
5
-
6
- def get_fee
7
- return nil if self.payment.payment_method.blank? # We always depend on the payment_choice
8
-
9
- transaction = PagarMe::Transaction.find(self.payment.gateway_id)
10
- payables = transaction.payables
11
- cost = transaction.cost.to_f / 100.00
12
- payables_fee = payables.to_a.sum(&:fee).to_f / 100.00
13
-
14
- if self.payment.payment_method == ::CatarsePagarme::PaymentType::SLIP
15
- cost + payables_fee
16
- else
17
- payables_fee == 0 ? cost : payables_fee
18
- end
19
- end
20
- end
21
- end