catarse_pagarme 2.14.14 → 2.15.0
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33de3fd1e6afdac8723405f945acc3d89d97be9420eace3c44f354e01113de6f
|
4
|
+
data.tar.gz: b25b6ad732704f9faf108861a844936ba21722b7ab41be1fb06f155510413d9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73b17f419b5ef6ab87886c5642dd83fccb1189737a3398e5698d6aaf5cb60457846816fc547185c5fbbcafd9c8092b78f55d0a3c26648e9de03643c1c9343007
|
7
|
+
data.tar.gz: 8740a9e7f9ce6296534ea70ba43d183788b850bc100dcf82a8bdf8631dcc3b53f519b27912e5ecdea0fd479e042da3534e6d1a819f4bf48042cabc8658e00d4f
|
data/Gemfile.lock
CHANGED
@@ -8,6 +8,8 @@ module CatarsePagarme
|
|
8
8
|
else
|
9
9
|
antifraud_outcome = process_antifraud
|
10
10
|
|
11
|
+
self.payment.create_antifraud_analysis!(cost: CatarsePagarme.configuration.antifraud_tax)
|
12
|
+
|
11
13
|
if antifraud_outcome.recommendation == :APPROVE
|
12
14
|
self.transaction.capture
|
13
15
|
elsif antifraud_outcome.recommendation == :DECLINE
|
@@ -5,102 +5,17 @@ module CatarsePagarme::FeeCalculatorConcern
|
|
5
5
|
|
6
6
|
def get_fee
|
7
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
|
-
get_slip_fee
|
10
|
-
else
|
11
|
-
get_card_fee
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
protected
|
16
|
-
def get_slip_fee
|
17
|
-
CatarsePagarme.configuration.slip_tax.to_f
|
18
|
-
end
|
19
|
-
|
20
|
-
def get_card_fee
|
21
|
-
return nil if self.payment.gateway_data["acquirer_name"].blank? # Here we depend on the acquirer name
|
22
|
-
fee = if %w(stone pagarme).include? self.payment.gateway_data["acquirer_name"]
|
23
|
-
get_stone_fee
|
24
|
-
else
|
25
|
-
get_cielo_fee
|
26
|
-
end
|
27
|
-
|
28
|
-
fee + payment_cost
|
29
|
-
end
|
30
8
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
def get_stone_fee
|
36
|
-
self.payment.installments > 1 ? tax_calc_for_installment(stone_installment_tax) : tax_calc(stone_tax)
|
37
|
-
end
|
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_fee.to_a.sum(&:fee).to_f / 100.00
|
38
13
|
|
39
|
-
|
40
|
-
|
41
|
-
if self.payment.gateway_data["card_brand"] == 'amex'
|
42
|
-
get_cielo_fee_for_amex
|
14
|
+
if self.payment.payment_method == ::CatarsePagarme::PaymentType::SLIP
|
15
|
+
cost + payables_fee
|
43
16
|
else
|
44
|
-
|
17
|
+
payables_fee == 0 ? cost : payables_fee
|
45
18
|
end
|
46
19
|
end
|
47
|
-
|
48
|
-
def get_cielo_fee_for_amex
|
49
|
-
self.payment.installments > 1 ? tax_calc_for_installment(cielo_installment_amex_tax) : tax_calc(cielo_installment_not_amex_tax)
|
50
|
-
end
|
51
|
-
|
52
|
-
def get_cielo_fee_for_non_amex
|
53
|
-
current_tax = self.payment.gateway_data["card_brand"] == 'diners' ? installment_diners_tax : installment_not_diners_tax
|
54
|
-
self.payment.installments > 1 ? tax_calc_for_installment(current_tax) : tax_calc(cielo_tax)
|
55
|
-
end
|
56
|
-
|
57
|
-
def tax_calc acquirer_tax
|
58
|
-
((self.payment.value * pagarme_tax) + cents_fee).round(2) + (self.payment.value * acquirer_tax).round(2)
|
59
|
-
end
|
60
|
-
|
61
|
-
def tax_calc_for_installment acquirer_tax
|
62
|
-
(((self.payment.installment_value * self.payment.installments) * pagarme_tax) + cents_fee).round(2) + ((self.payment.installment_value * acquirer_tax).round(2) * self.payment.installments)
|
63
|
-
end
|
64
|
-
|
65
|
-
def antifraud_tax
|
66
|
-
CatarsePagarme.configuration.antifraud_tax.to_f
|
67
|
-
end
|
68
|
-
|
69
|
-
def cents_fee
|
70
|
-
CatarsePagarme.configuration.credit_card_cents_fee.to_f
|
71
|
-
end
|
72
|
-
|
73
|
-
def pagarme_tax
|
74
|
-
CatarsePagarme.configuration.pagarme_tax.to_f
|
75
|
-
end
|
76
|
-
|
77
|
-
def cielo_tax
|
78
|
-
CatarsePagarme.configuration.cielo_tax.to_f
|
79
|
-
end
|
80
|
-
|
81
|
-
def stone_tax
|
82
|
-
CatarsePagarme.configuration.stone_tax.to_f
|
83
|
-
end
|
84
|
-
|
85
|
-
def stone_installment_tax
|
86
|
-
CatarsePagarme.configuration.stone_installment_tax.to_f
|
87
|
-
end
|
88
|
-
|
89
|
-
def installment_diners_tax
|
90
|
-
CatarsePagarme.configuration.cielo_installment_diners_tax.to_f
|
91
|
-
end
|
92
|
-
|
93
|
-
def installment_not_diners_tax
|
94
|
-
CatarsePagarme.configuration.cielo_installment_not_diners_tax.to_f
|
95
|
-
end
|
96
|
-
|
97
|
-
def cielo_installment_amex_tax
|
98
|
-
CatarsePagarme.configuration.cielo_installment_amex_tax.to_f
|
99
|
-
end
|
100
|
-
|
101
|
-
def cielo_installment_not_amex_tax
|
102
|
-
CatarsePagarme.configuration.cielo_installment_not_amex_tax.to_f
|
103
|
-
end
|
104
|
-
|
105
20
|
end
|
106
21
|
end
|
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.
|
4
|
+
version: 2.15.0
|
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: 2020-
|
12
|
+
date: 2020-05-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: countries
|