catarse_pagarme 1.4.8 → 1.4.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa3287da5d630e31c6f6c614ae47c8aae791eedf
|
4
|
+
data.tar.gz: 4b93a6d4a039f944aee8ba39c6c228a9ad8ad1c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7662c10c5875730e39c2aaf9ee3f60c8f9d06d75185df3942ee50d44570ddf4049cbe6cd306ac8b1b9cdfb12c3e2353c3deed0602ad3f4e14627f49f9208e4c7
|
7
|
+
data.tar.gz: 5a02052bc6e79b71e7568da29916eff35e943298f3b1314c7f1c7b51aef05453333f030d3aaaa3f0e89698fc14981a7c5ce5fffff35bb167bf9ba4894b5f9549
|
@@ -75,11 +75,29 @@ module CatarsePagarme
|
|
75
75
|
end
|
76
76
|
|
77
77
|
def get_fee(payment_method, acquirer_name = nil)
|
78
|
+
value = self.contribution.value
|
79
|
+
installment_value = self.contribution.installment_value
|
80
|
+
installments = self.contribution.installments
|
81
|
+
cents_fee = CatarsePagarme.configuration.credit_card_cents_fee.to_f
|
82
|
+
pagarme_tax = CatarsePagarme.configuration.pagarme_tax.to_f
|
83
|
+
cielo_tax = CatarsePagarme.configuration.cielo_tax.to_f
|
84
|
+
stone_tax = CatarsePagarme.configuration.stone_tax.to_f
|
85
|
+
|
78
86
|
if payment_method == PaymentType::SLIP
|
79
87
|
CatarsePagarme.configuration.slip_tax.to_f
|
80
88
|
else
|
81
|
-
if acquirer_name
|
82
|
-
|
89
|
+
if acquirer_name == 'stone'
|
90
|
+
if installments > 1
|
91
|
+
(((installment_value * installments) * pagarme_tax) + cents_fee).round(2) + ((installment_value * stone_tax).round(2) * installments)
|
92
|
+
else
|
93
|
+
((value * pagarme_tax) + cents_fee).round(2) + (value * stone_tax).round(2)
|
94
|
+
end
|
95
|
+
else
|
96
|
+
if installments > 1
|
97
|
+
(((installment_value * installments) * pagarme_tax) + cents_fee).round(2) + ((installment_value * cielo_tax).round(2) * installments)
|
98
|
+
else
|
99
|
+
((value * pagarme_tax) + cents_fee).round(2) + (value * cielo_tax).round(2)
|
100
|
+
end
|
83
101
|
end
|
84
102
|
end
|
85
103
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module CatarsePagarme
|
2
2
|
class Configuration
|
3
3
|
attr_accessor :api_key, :slip_tax, :credit_card_tax, :interest_rate, :host, :subdomain, :protocol,
|
4
|
-
:max_installments, :minimum_value_for_installment, :credit_card_cents_fee
|
4
|
+
:max_installments, :minimum_value_for_installment, :credit_card_cents_fee, :pagarme_tax, :stone_tax, :cielo_tax
|
5
5
|
|
6
6
|
def initialize
|
7
7
|
self.api_key = ''
|
@@ -14,6 +14,9 @@ module CatarsePagarme
|
|
14
14
|
self.host = 'catarse.me'
|
15
15
|
self.subdomain = 'www'
|
16
16
|
self.protocol = 'http'
|
17
|
+
self.pagarme_tax = 0.0063
|
18
|
+
self.stone_tax = 0.0307
|
19
|
+
self.cielo_tax = 0.038
|
17
20
|
end
|
18
21
|
end
|
19
22
|
end
|
@@ -33,6 +33,9 @@ describe CatarsePagarme::ContributionDelegator do
|
|
33
33
|
before do
|
34
34
|
CatarsePagarme.configuration.stub(:slip_tax).and_return(2.00)
|
35
35
|
CatarsePagarme.configuration.stub(:credit_card_tax).and_return(0.01)
|
36
|
+
CatarsePagarme.configuration.stub(:pagarme_tax).and_return(0.0063)
|
37
|
+
CatarsePagarme.configuration.stub(:cielo_tax).and_return(0.038)
|
38
|
+
CatarsePagarme.configuration.stub(:stone_tax).and_return(0.0307)
|
36
39
|
end
|
37
40
|
|
38
41
|
context 'when choice is slip' do
|
@@ -42,7 +45,7 @@ describe CatarsePagarme::ContributionDelegator do
|
|
42
45
|
|
43
46
|
context 'when choice is credit card' do
|
44
47
|
subject { delegator.get_fee(CatarsePagarme::PaymentType::CREDIT_CARD).to_f }
|
45
|
-
it { expect(subject).to eq(0.
|
48
|
+
it { expect(subject).to eq(0.83) }
|
46
49
|
end
|
47
50
|
end
|
48
51
|
|
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: 1.4.
|
4
|
+
version: 1.4.9
|
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: 2014-12-
|
12
|
+
date: 2014-12-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|