catarse_pagarme 2.3.9 → 2.3.10

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: c64a1d97d2763653d24303dd245a20ad6ec3f4af
4
- data.tar.gz: 99b993c1ab615ffbad417d252cd7691014986f1f
3
+ metadata.gz: 18c70a97dc75f3a4393f18ffbd3556b608c38aba
4
+ data.tar.gz: ab7d9147e8269bf844398bf7d7fbb2f4002734be
5
5
  SHA512:
6
- metadata.gz: ae93ad2f2e2380c13746893820142f4112b4430c572df69e38e27c5e57ecfa4c809d0b7c149bf82e9781118efb18e9692af68e1349740350af2029d2d9224825
7
- data.tar.gz: 8d620d708ad69465e92d4429fffa2012a193c58626d789cc7711ad1202931b33baf38fc6c066be6f64197276e69a9f45a59ed323c35e52aed5cf6bd43e276b1a
6
+ metadata.gz: b26e1eff2c24abe6cc908bc18f92a67f86deffd54fcd97ca991e4530a7539edb44aebe9481d53cbdfdd1dc4e7f6f7e2f55e9d4b3bbb9837add666039d4801ee2
7
+ data.tar.gz: 648ed04c24df704b038dbf9bda2556f747b4a59ef8172e5dbb86421c1747714a027df8fb1c030919872f719780d29a1da01ce7152d235bf27beafaa58269eaea
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- catarse_pagarme (2.3.9)
4
+ catarse_pagarme (2.3.10)
5
5
  pagarme (~> 1.9.8)
6
6
  rails (~> 4.0)
7
7
 
@@ -92,12 +92,12 @@ GEM
92
92
  rspec-core (~> 2.14.0)
93
93
  rspec-expectations (~> 2.14.0)
94
94
  rspec-mocks (~> 2.14.0)
95
- sprockets (2.12.2)
95
+ sprockets (2.12.3)
96
96
  hike (~> 1.2)
97
97
  multi_json (~> 1.0)
98
98
  rack (~> 1.0)
99
99
  tilt (~> 1.1, != 1.3.0)
100
- sprockets-rails (2.2.0)
100
+ sprockets-rails (2.2.2)
101
101
  actionpack (>= 3.0)
102
102
  activesupport (>= 3.0)
103
103
  sprockets (>= 2.8, < 4.0)
@@ -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 != 'cielo'
82
- (self.contribution.value * CatarsePagarme.configuration.credit_card_tax.to_f) + CatarsePagarme.configuration.credit_card_cents_fee.to_f
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
@@ -1,3 +1,3 @@
1
1
  module CatarsePagarme
2
- VERSION = "2.3.9"
2
+ VERSION = "2.3.10"
3
3
  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.49) }
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: 2.3.9
4
+ version: 2.3.10
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-04 00:00:00.000000000 Z
12
+ date: 2014-12-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails