catarse_pagarme 2.5.1 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -257
  3. data/app/controllers/catarse_pagarme/application_controller.rb +6 -7
  4. data/app/controllers/catarse_pagarme/credit_cards_controller.rb +5 -5
  5. data/app/controllers/catarse_pagarme/notifications_controller.rb +6 -6
  6. data/app/controllers/catarse_pagarme/slip_controller.rb +6 -6
  7. data/app/helpers/catarse_pagarme/application_helper.rb +3 -3
  8. data/app/models/catarse_pagarme/credit_card_transaction.rb +1 -1
  9. data/app/models/catarse_pagarme/fee_calculator_concern.rb +12 -12
  10. data/app/models/catarse_pagarme/payment_concern.rb +9 -0
  11. data/app/models/catarse_pagarme/{contribution_delegator.rb → payment_delegator.rb} +17 -17
  12. data/app/models/catarse_pagarme/slip_transaction.rb +3 -2
  13. data/app/models/catarse_pagarme/transaction_base.rb +14 -13
  14. data/lib/catarse_pagarme/engine.rb +1 -1
  15. data/lib/catarse_pagarme/version.rb +1 -1
  16. data/spec/controllers/catarse_pagarme/credit_cards_controller_spec.rb +5 -5
  17. data/spec/controllers/catarse_pagarme/notifications_controller_spec.rb +11 -6
  18. data/spec/controllers/catarse_pagarme/slip_controller_spec.rb +6 -6
  19. data/spec/dummy/app/models/contribution.rb +1 -24
  20. data/spec/dummy/app/models/payment.rb +55 -0
  21. data/spec/dummy/app/models/payment_engines.rb +7 -0
  22. data/spec/helpers/catarse_pagarme/application_helper_spec.rb +2 -2
  23. data/spec/models/catarse_pagarme/credit_card_transaction_spec.rb +23 -23
  24. data/spec/models/catarse_pagarme/{contribution_delegator_spec.rb → payment_delegator_spec.rb} +28 -55
  25. data/spec/models/catarse_pagarme/slip_transaction_spec.rb +35 -29
  26. data/spec/support/factories.rb +16 -6
  27. metadata +8 -6
  28. data/app/models/catarse_pagarme/contribution_concern.rb +0 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ca5f1843f383ba1b039078824668b3ae1f76355d
4
- data.tar.gz: d1490d6301640a4c5c07c874aeb435a4948475e6
3
+ metadata.gz: 7dc8ae441730dda9e80feffa57915394a1b7d00f
4
+ data.tar.gz: 889da7140baeb1bbdc7b43d712c77186eab8a5e7
5
5
  SHA512:
6
- metadata.gz: 45bafd1a218639dae2940a9e37066fec3c28b17c3ded75a58738d13c5f7863cf837e9d5c81e9b2fe00fe46a06a8127f1064fcf534e3e3131c74ac09eabcee003
7
- data.tar.gz: 64d599f47e98fe0d17c81258e788d4fa278a0a615314d95b893ce0f0eec76e34a22a8137d4ad77b51b17199ec3d5f90458c11d72e6278e56e82765df6c0e2375
6
+ metadata.gz: 2adc8c464fdcc70ad0b5d480a86130c23d78f96a73b53ac9fb641c6f6825ebbb027b0e894545b8db278c4c3a5fd31fa0753c62811168256ff2f3a8a5cd61e163
7
+ data.tar.gz: 49a57fee3431a84a4fe913327232f47213b8bd9e8f96e2e1bd88dfa19cac78831c49783404c56b5a697498a182141e0ca524ebdecb3eaa8e06f0c2732014e6e7
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- catarse_pagarme (2.5.1)
4
+ catarse_pagarme (2.6.0)
5
5
  pagarme (~> 1.9.8)
6
6
  rails (~> 4.0)
7
7
 
@@ -111,262 +111,6 @@ GEM
111
111
  tilt (1.4.1)
112
112
  treetop (1.4.15)
113
113
  polyglot
114
- polyglot
115
- polyglot
116
- polyglot
117
- polyglot
118
- polyglot
119
- polyglot
120
- polyglot
121
- polyglot
122
- polyglot
123
- polyglot
124
- polyglot
125
- polyglot
126
- polyglot
127
- polyglot
128
- polyglot
129
- polyglot
130
- polyglot (>= 0.3.1)
131
- polyglot (>= 0.3.1)
132
- polyglot (>= 0.3.1)
133
- polyglot (>= 0.3.1)
134
- polyglot (>= 0.3.1)
135
- polyglot (>= 0.3.1)
136
- polyglot (>= 0.3.1)
137
- polyglot (>= 0.3.1)
138
- polyglot (>= 0.3.1)
139
- polyglot (>= 0.3.1)
140
- polyglot (>= 0.3.1)
141
- polyglot (>= 0.3.1)
142
- polyglot (>= 0.3.1)
143
- polyglot (>= 0.3.1)
144
- polyglot (>= 0.3.1)
145
- polyglot (>= 0.3.1)
146
- polyglot (>= 0.3.1)
147
- polyglot (>= 0.3.1)
148
- polyglot (>= 0.3.1)
149
- polyglot (>= 0.3.1)
150
- polyglot (>= 0.3.1)
151
- polyglot (>= 0.3.1)
152
- polyglot (>= 0.3.1)
153
- polyglot (>= 0.3.1)
154
- polyglot (>= 0.3.1)
155
- polyglot (>= 0.3.1)
156
- polyglot (>= 0.3.1)
157
- polyglot (>= 0.3.1)
158
- polyglot (>= 0.3.1)
159
- polyglot (>= 0.3.1)
160
- polyglot (>= 0.3.1)
161
- polyglot (>= 0.3.1)
162
- polyglot (>= 0.3.1)
163
- polyglot (>= 0.3.1)
164
- polyglot (>= 0.3.1)
165
- polyglot (>= 0.3.1)
166
- polyglot (>= 0.3.1)
167
- polyglot (>= 0.3.1)
168
- polyglot (>= 0.3.1)
169
- polyglot (>= 0.3.1)
170
- polyglot (>= 0.3.1)
171
- polyglot (>= 0.3.1)
172
- polyglot (>= 0.3.1)
173
- polyglot (>= 0.3.1)
174
- polyglot (>= 0.3.1)
175
- polyglot (>= 0.3.1)
176
- polyglot (>= 0.3.1)
177
- polyglot (>= 0.3.1)
178
- polyglot (>= 0.3.1)
179
- polyglot (>= 0.3.1)
180
- polyglot (>= 0.3.1)
181
- polyglot (>= 0.3.1)
182
- polyglot (>= 0.3.1)
183
- polyglot (>= 0.3.1)
184
- polyglot (>= 0.3.1)
185
- polyglot (>= 0.3.1)
186
- polyglot (>= 0.3.1)
187
- polyglot (>= 0.3.1)
188
- polyglot (>= 0.3.1)
189
- polyglot (>= 0.3.1)
190
- polyglot (>= 0.3.1)
191
- polyglot (>= 0.3.1)
192
- polyglot (>= 0.3.1)
193
- polyglot (>= 0.3.1)
194
- polyglot (>= 0.3.1)
195
- polyglot (>= 0.3.1)
196
- polyglot (>= 0.3.1)
197
- polyglot (>= 0.3.1)
198
- polyglot (>= 0.3.1)
199
- polyglot (>= 0.3.1)
200
- polyglot (>= 0.3.1)
201
- polyglot (>= 0.3.1)
202
- polyglot (>= 0.3.1)
203
- polyglot (>= 0.3.1)
204
- polyglot (>= 0.3.1)
205
- polyglot (>= 0.3.1)
206
- polyglot (>= 0.3.1)
207
- polyglot (>= 0.3.1)
208
- polyglot (>= 0.3.1)
209
- polyglot (>= 0.3.1)
210
- polyglot (>= 0.3.1)
211
- polyglot (>= 0.3.1)
212
- polyglot (>= 0.3.1)
213
- polyglot (>= 0.3.1)
214
- polyglot (>= 0.3.1)
215
- polyglot (>= 0.3.1)
216
- polyglot (>= 0.3.1)
217
- polyglot (>= 0.3.1)
218
- polyglot (>= 0.3.1)
219
- polyglot (>= 0.3.1)
220
- polyglot (>= 0.3.1)
221
- polyglot (>= 0.3.1)
222
- polyglot (>= 0.3.1)
223
- polyglot (>= 0.3.1)
224
- polyglot (>= 0.3.1)
225
- polyglot (>= 0.3.1)
226
- polyglot (>= 0.3.1)
227
- polyglot (>= 0.3.1)
228
- polyglot (>= 0.3.1)
229
- polyglot (>= 0.3.1)
230
- polyglot (>= 0.3.1)
231
- polyglot (>= 0.3.1)
232
- polyglot (>= 0.3.1)
233
- polyglot (>= 0.3.1)
234
- polyglot (>= 0.3.1)
235
- polyglot (>= 0.3.1)
236
- polyglot (>= 0.3.1)
237
- polyglot (>= 0.3.1)
238
- polyglot (>= 0.3.1)
239
- polyglot (>= 0.3.1)
240
- polyglot (>= 0.3.1)
241
- polyglot (>= 0.3.1)
242
- polyglot (>= 0.3.1)
243
- polyglot (>= 0.3.1)
244
- polyglot (>= 0.3.1)
245
- polyglot (>= 0.3.1)
246
- polyglot (>= 0.3.1)
247
- polyglot (>= 0.3.1)
248
- polyglot (>= 0.3.1)
249
- polyglot (>= 0.3.1)
250
- polyglot (>= 0.3.1)
251
- polyglot (>= 0.3.1)
252
- polyglot (>= 0.3.1)
253
- polyglot (>= 0.3.1)
254
- polyglot (>= 0.3.1)
255
- polyglot (>= 0.3.1)
256
- polyglot (>= 0.3.1)
257
- polyglot (>= 0.3.1)
258
- polyglot (>= 0.3.1)
259
- polyglot (>= 0.3.1)
260
- polyglot (>= 0.3.1)
261
- polyglot (>= 0.3.1)
262
- polyglot (>= 0.3.1)
263
- polyglot (>= 0.3.1)
264
- polyglot (>= 0.3.1)
265
- polyglot (>= 0.3.1)
266
- polyglot (>= 0.3.1)
267
- polyglot (>= 0.3.1)
268
- polyglot (>= 0.3.1)
269
- polyglot (>= 0.3.1)
270
- polyglot (>= 0.3.1)
271
- polyglot (>= 0.3.1)
272
- polyglot (>= 0.3.1)
273
- polyglot (>= 0.3.1)
274
- polyglot (>= 0.3.1)
275
- polyglot (>= 0.3.1)
276
- polyglot (>= 0.3.1)
277
- polyglot (>= 0.3.1)
278
- polyglot (>= 0.3.1)
279
- polyglot (>= 0.3.1)
280
- polyglot (>= 0.3.1)
281
- polyglot (>= 0.3.1)
282
- polyglot (>= 0.3.1)
283
- polyglot (>= 0.3.1)
284
- polyglot (>= 0.3.1)
285
- polyglot (>= 0.3.1)
286
- polyglot (>= 0.3.1)
287
- polyglot (>= 0.3.1)
288
- polyglot (>= 0.3.1)
289
- polyglot (>= 0.3.1)
290
- polyglot (>= 0.3.1)
291
- polyglot (>= 0.3.1)
292
- polyglot (>= 0.3.1)
293
- polyglot (>= 0.3.1)
294
- polyglot (>= 0.3.1)
295
- polyglot (>= 0.3.1)
296
- polyglot (>= 0.3.1)
297
- polyglot (>= 0.3.1)
298
- polyglot (>= 0.3.1)
299
- polyglot (>= 0.3.1)
300
- polyglot (>= 0.3.1)
301
- polyglot (>= 0.3.1)
302
- polyglot (>= 0.3.1)
303
- polyglot (>= 0.3.1)
304
- polyglot (>= 0.3.1)
305
- polyglot (>= 0.3.1)
306
- polyglot (>= 0.3.1)
307
- polyglot (>= 0.3.1)
308
- polyglot (>= 0.3.1)
309
- polyglot (>= 0.3.1)
310
- polyglot (>= 0.3.1)
311
- polyglot (>= 0.3.1)
312
- polyglot (>= 0.3.1)
313
- polyglot (>= 0.3.1)
314
- polyglot (>= 0.3.1)
315
- polyglot (>= 0.3.1)
316
- polyglot (>= 0.3.1)
317
- polyglot (>= 0.3.1)
318
- polyglot (>= 0.3.1)
319
- polyglot (>= 0.3.1)
320
- polyglot (>= 0.3.1)
321
- polyglot (>= 0.3.1)
322
- polyglot (>= 0.3.1)
323
- polyglot (>= 0.3.1)
324
- polyglot (>= 0.3.1)
325
- polyglot (>= 0.3.1)
326
- polyglot (>= 0.3.1)
327
- polyglot (>= 0.3.1)
328
- polyglot (>= 0.3.1)
329
- polyglot (>= 0.3.1)
330
- polyglot (>= 0.3.1)
331
- polyglot (>= 0.3.1)
332
- polyglot (>= 0.3.1)
333
- polyglot (>= 0.3.1)
334
- polyglot (>= 0.3.1)
335
- polyglot (>= 0.3.1)
336
- polyglot (>= 0.3.1)
337
- polyglot (>= 0.3.1)
338
- polyglot (>= 0.3.1)
339
- polyglot (>= 0.3.1)
340
- polyglot (>= 0.3.1)
341
- polyglot (>= 0.3.1)
342
- polyglot (>= 0.3.1)
343
- polyglot (>= 0.3.1)
344
- polyglot (>= 0.3.1)
345
- polyglot (>= 0.3.1)
346
- polyglot (>= 0.3.1)
347
- polyglot (>= 0.3.1)
348
- polyglot (>= 0.3.1)
349
- polyglot (>= 0.3.1)
350
- polyglot (>= 0.3.1)
351
- polyglot (>= 0.3.1)
352
- polyglot (>= 0.3.1)
353
- polyglot (>= 0.3.1)
354
- polyglot (>= 0.3.1)
355
- polyglot (>= 0.3.1)
356
- polyglot (>= 0.3.1)
357
- polyglot (>= 0.3.1)
358
- polyglot (>= 0.3.1)
359
- polyglot (>= 0.3.1)
360
- polyglot (>= 0.3.1)
361
- polyglot (>= 0.3.1)
362
- polyglot (>= 0.3.1)
363
- polyglot (>= 0.3.1)
364
- polyglot (>= 0.3.1)
365
- polyglot (>= 0.3.1)
366
- polyglot (>= 0.3.1)
367
- polyglot (>= 0.3.1)
368
- polyglot (>= 0.3.1)
369
- polyglot (>= 0.3.1)
370
114
  polyglot (>= 0.3.1)
371
115
  tzinfo (1.2.1)
372
116
  thread_safe (~> 0.1)
@@ -34,17 +34,16 @@ module CatarsePagarme
34
34
  end
35
35
 
36
36
  def contribution
37
- conditions = {id: params[:id] }
38
-
39
- unless params[:controller] == 'catarse_pagarme/notifications'
40
- conditions.merge!({user_id: current_user.id}) unless current_user.admin
41
- end
37
+ @contribution ||= PaymentEngines.find_contribution(params[:id])
38
+ end
42
39
 
43
- @contribution ||= PaymentEngines.find_payment(conditions)
40
+ def payment
41
+ attributes = {contribution: contribution, value: contribution.value}
42
+ @payment ||= PaymentEngines.new_payment(attributes)
44
43
  end
45
44
 
46
45
  def delegator
47
- contribution.pagarme_delegator
46
+ payment.pagarme_delegator
48
47
  end
49
48
  end
50
49
  end
@@ -2,7 +2,7 @@ module CatarsePagarme
2
2
  class CreditCardsController < CatarsePagarme::ApplicationController
3
3
 
4
4
  def create
5
- transaction = CreditCardTransaction.new(credit_card_attributes, contribution).charge!
5
+ transaction = CreditCardTransaction.new(credit_card_attributes, payment).charge!
6
6
 
7
7
  render json: { payment_status: transaction.status }
8
8
  rescue Exception => e
@@ -20,11 +20,11 @@ module CatarsePagarme
20
20
  protocol: CatarsePagarme.configuration.protocol),
21
21
  installments: get_installment,
22
22
  customer: {
23
- email: contribution.user.email,
24
- name: contribution.user.name
23
+ email: payment.user.email,
24
+ name: payment.user.name
25
25
  },
26
26
  metadata: {
27
- key: contribution.key
27
+ key: payment.generate_key
28
28
  }
29
29
  }
30
30
 
@@ -42,7 +42,7 @@ module CatarsePagarme
42
42
  end
43
43
 
44
44
  def get_installment
45
- if contribution.value.to_f < CatarsePagarme.configuration.minimum_value_for_installment.to_f
45
+ if payment.value.to_f < CatarsePagarme.configuration.minimum_value_for_installment.to_f
46
46
  1
47
47
  elsif params[:payment_card_installments].to_i > 0
48
48
  params[:payment_card_installments].to_i
@@ -3,13 +3,13 @@ module CatarsePagarme
3
3
  skip_before_filter :authenticate_user!
4
4
 
5
5
  def create
6
- if contribution
7
- contribution.payment_notifications.create(extra_data: params.to_json)
6
+ if payment
7
+ payment.payment_notifications.create(contribution: payment.contribution, extra_data: params.to_json)
8
8
 
9
- if PagarMe::validate_fingerprint(contribution.try(:payment_id), params[:fingerprint])
9
+ if PagarMe::validate_fingerprint(payment.try(:gateway_id), params[:fingerprint])
10
10
 
11
11
  if params[:current_status] == 'paid' && params[:desired_status] == 'refunded'
12
- contribution.try(:invalid_refund)
12
+ payment.try(:invalid_refund)
13
13
  else
14
14
  delegator.change_status_by_transaction(params[:current_status])
15
15
  delegator.update_fee
@@ -24,8 +24,8 @@ module CatarsePagarme
24
24
 
25
25
  protected
26
26
 
27
- def contribution
28
- @contribution ||= PaymentEngines.find_payment({ payment_id: params[:id] })
27
+ def payment
28
+ @payment ||= PaymentEngines.find_payment({ gateway_id: params[:id] })
29
29
  end
30
30
  end
31
31
  end
@@ -2,7 +2,7 @@ module CatarsePagarme
2
2
  class SlipController < CatarsePagarme::ApplicationController
3
3
 
4
4
  def create
5
- transaction = SlipTransaction.new(permitted_attributes, contribution).charge!
5
+ transaction = SlipTransaction.new(permitted_attributes, payment).charge!
6
6
 
7
7
  render json: { boleto_url: transaction.boleto_url, payment_status: transaction.status }
8
8
  rescue PagarMe::PagarMeError => e
@@ -10,7 +10,7 @@ module CatarsePagarme
10
10
  end
11
11
 
12
12
  def update
13
- transaction = SlipTransaction.new(permitted_attributes, contribution).charge!
13
+ transaction = SlipTransaction.new(permitted_attributes, payment).charge!
14
14
  render text: transaction.boleto_url
15
15
  end
16
16
 
@@ -25,18 +25,18 @@ module CatarsePagarme
25
25
  subdomain: CatarsePagarme.configuration.subdomain,
26
26
  protocol: CatarsePagarme.configuration.protocol),
27
27
  customer: {
28
- email: contribution.user.email,
29
- name: contribution.user.name
28
+ email: payment.user.email,
29
+ name: payment.user.name
30
30
  },
31
31
  metadata: {
32
- key: contribution.key
32
+ key: payment.generate_key
33
33
  }
34
34
  }.update({ user: params[:user] })
35
35
  end
36
36
 
37
37
  def permitted_attributes
38
38
  attrs = ActionController::Parameters.new(slip_attributes)
39
- attrs.permit(:boleto_expiration_date, :payment_method, :amount, :postback_url, customer: [:name, :email],
39
+ attrs.permit(:boleto_expiration_date, :payment_method, :amount, :postback_url, metadata: [:key], customer: [:name, :email],
40
40
  user: [
41
41
  bank_account_attributes: [
42
42
  :bank_id, :account, :account_digit, :agency,
@@ -1,8 +1,8 @@
1
1
  module CatarsePagarme
2
2
  module ApplicationHelper
3
3
 
4
- def installments_for_select(contribution)
5
- installments = contribution.pagarme_delegator.get_installments['installments']
4
+ def installments_for_select(payment)
5
+ installments = payment.pagarme_delegator.get_installments['installments']
6
6
 
7
7
  collection = installments.map do |installment|
8
8
  installment_number = installment[0].to_i
@@ -11,7 +11,7 @@ module CatarsePagarme
11
11
 
12
12
  optional_text = nil
13
13
  if installment_number != 1
14
- optional_text = I18n.t('projects.contributions.edit.installment_with_tax')
14
+ optional_text = I18n.t('projects.payments.edit.installment_with_tax')
15
15
  end
16
16
 
17
17
  ["#{format_instalment_text(installment_number, amount)} #{optional_text}", installment_number]
@@ -7,7 +7,7 @@ module CatarsePagarme
7
7
  self.transaction = PagarMe::Transaction.new(self.attributes)
8
8
  self.transaction.charge
9
9
 
10
- change_contribution_state
10
+ change_payment_state
11
11
 
12
12
  if self.transaction.status == 'refused'
13
13
  raise ::PagarMe::PagarMeError.new(I18n.t('projects.contributions.edit.transaction_error'))
@@ -4,8 +4,8 @@ module CatarsePagarme::FeeCalculatorConcern
4
4
  included do
5
5
 
6
6
  def get_fee
7
- return nil if self.contribution.payment_choice.blank? # We always depend on the payment_choice
8
- if self.contribution.payment_choice == ::CatarsePagarme::PaymentType::SLIP
7
+ return nil if self.payment.payment_method.blank? # We always depend on the payment_choice
8
+ if self.payment.payment_method == ::CatarsePagarme::PaymentType::SLIP
9
9
  get_slip_fee
10
10
  else
11
11
  get_card_fee
@@ -18,8 +18,8 @@ module CatarsePagarme::FeeCalculatorConcern
18
18
  end
19
19
 
20
20
  def get_card_fee
21
- return nil if self.contribution.acquirer_name.blank? # Here we depend on the acquirer name
22
- if self.contribution.acquirer_name == 'stone'
21
+ return nil if self.payment.gateway_data["acquirer_name"].blank? # Here we depend on the acquirer name
22
+ if self.payment.gateway_data["acquirer_name"] == 'stone'
23
23
  get_stone_fee
24
24
  else
25
25
  get_cielo_fee
@@ -27,12 +27,12 @@ module CatarsePagarme::FeeCalculatorConcern
27
27
  end
28
28
 
29
29
  def get_stone_fee
30
- self.contribution.installments > 1 ? tax_calc_for_installment(stone_tax) : tax_calc(stone_tax)
30
+ self.payment.installments > 1 ? tax_calc_for_installment(stone_tax) : tax_calc(stone_tax)
31
31
  end
32
32
 
33
33
  def get_cielo_fee
34
- return nil if self.contribution.card_brand.blank? # Here we depend on the card_brand
35
- if self.contribution.card_brand == 'amex'
34
+ return nil if self.payment.gateway_data["card_brand"].blank? # Here we depend on the card_brand
35
+ if self.payment.gateway_data["card_brand"] == 'amex'
36
36
  get_cielo_fee_for_amex
37
37
  else
38
38
  get_cielo_fee_for_non_amex
@@ -40,20 +40,20 @@ module CatarsePagarme::FeeCalculatorConcern
40
40
  end
41
41
 
42
42
  def get_cielo_fee_for_amex
43
- self.contribution.installments > 1 ? tax_calc_for_installment(cielo_installment_amex_tax) : tax_calc(cielo_installment_not_amex_tax)
43
+ self.payment.installments > 1 ? tax_calc_for_installment(cielo_installment_amex_tax) : tax_calc(cielo_installment_not_amex_tax)
44
44
  end
45
45
 
46
46
  def get_cielo_fee_for_non_amex
47
- current_tax = self.contribution.card_brand == 'diners' ? installment_diners_tax : installment_not_diners_tax
48
- self.contribution.installments > 1 ? tax_calc_for_installment(current_tax) : tax_calc(cielo_tax)
47
+ current_tax = self.payment.gateway_data["card_brand"] == 'diners' ? installment_diners_tax : installment_not_diners_tax
48
+ self.payment.installments > 1 ? tax_calc_for_installment(current_tax) : tax_calc(cielo_tax)
49
49
  end
50
50
 
51
51
  def tax_calc acquirer_tax
52
- ((self.contribution.value * pagarme_tax) + cents_fee).round(2) + (self.contribution.value * acquirer_tax).round(2)
52
+ ((self.payment.value * pagarme_tax) + cents_fee).round(2) + (self.payment.value * acquirer_tax).round(2)
53
53
  end
54
54
 
55
55
  def tax_calc_for_installment acquirer_tax
56
- (((self.contribution.installment_value * self.contribution.installments) * pagarme_tax) + cents_fee).round(2) + ((self.contribution.installment_value * acquirer_tax).round(2) * self.contribution.installments)
56
+ (((self.payment.installment_value * self.payment.installments) * pagarme_tax) + cents_fee).round(2) + ((self.payment.installment_value * acquirer_tax).round(2) * self.payment.installments)
57
57
  end
58
58
 
59
59
  def cents_fee