catarse_pagarme 2.12.0 → 2.13.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
  SHA1:
3
- metadata.gz: 23b7ed33b61bf278071491b4d4cb16fc26cd87a3
4
- data.tar.gz: 1a3125b4d3b945fdc1673689823bb1c4cc8d9150
3
+ metadata.gz: 157074433bd6e3fbc68743fe19bf447709501985
4
+ data.tar.gz: 68e83c91dc7923e61edabbc74f3d44572858a58d
5
5
  SHA512:
6
- metadata.gz: a40e59a710b544e295b6866653a13673b53eff3f165065290ce69ea13a42ef6a555e980d630a92d7d627abf5babd2382534a719cb790c2fc7e7538d7ded7e255
7
- data.tar.gz: fd9c19e3b631851304ad7ead7b13f2bfad24b29909c1e0fea0c0582b5f4d251def2658d36ebec655fc744e1eadd7f821ac94e231df91cb74daabf10a1367c50b
6
+ metadata.gz: c37db8be1bf72f45cce1136464856d16812c510d59874c47f19e91334f3927cde2e8f89f701c56459df589e2e852550be79861cce4f14ae920555e3cb4c22f81
7
+ data.tar.gz: a3dd9f06b8e595883199a50a4ec47cd478171780482c37a786733015f262c4eee8076e7293b8e8442edd5ade489f98ab52817c617de69d1c4f580651efa0ef39
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- catarse_pagarme (2.12.0)
4
+ catarse_pagarme (2.13.0)
5
5
  pagarme (= 2.1.4)
6
6
  rails (~> 4.0)
7
7
  sentry-raven
@@ -63,7 +63,7 @@ GEM
63
63
  railties (>= 3.0.0)
64
64
  faraday (0.15.4)
65
65
  multipart-post (>= 1.2, < 3)
66
- globalid (0.4.1)
66
+ globalid (0.4.2)
67
67
  activesupport (>= 4.2.0)
68
68
  http-cookie (1.0.3)
69
69
  domain_name (~> 0.5)
@@ -94,7 +94,7 @@ GEM
94
94
  coderay (~> 1.1.0)
95
95
  method_source (~> 0.9.0)
96
96
  rack (1.6.10)
97
- rack-protection (2.0.4)
97
+ rack-protection (2.0.5)
98
98
  rack
99
99
  rack-test (0.6.3)
100
100
  rack (>= 1.0)
@@ -123,7 +123,7 @@ GEM
123
123
  rake (>= 0.8.7)
124
124
  thor (>= 0.18.1, < 2.0)
125
125
  rake (12.3.1)
126
- redis (4.0.3)
126
+ redis (4.1.0)
127
127
  rest-client (2.0.2)
128
128
  http-cookie (>= 1.0.2, < 2.0)
129
129
  mime-types (>= 1.16, < 4.0)
@@ -145,10 +145,11 @@ GEM
145
145
  rspec-mocks (~> 3.8.0)
146
146
  rspec-support (~> 3.8.0)
147
147
  rspec-support (3.8.0)
148
- sentry-raven (2.7.4)
148
+ sentry-raven (2.9.0)
149
149
  faraday (>= 0.7.6, < 1.0)
150
- sidekiq (5.2.3)
150
+ sidekiq (5.2.5)
151
151
  connection_pool (~> 2.2, >= 2.2.2)
152
+ rack (>= 1.5.0)
152
153
  rack-protection (>= 1.5.0)
153
154
  redis (>= 3.3.5, < 5)
154
155
  sprockets (3.7.2)
@@ -117,7 +117,7 @@ module CatarsePagarme
117
117
  if installment_number <= (project.try(:total_installments) || CatarsePagarme.configuration.max_installments.to_i)
118
118
  amount = installment[1]['installment_amount'] / 100.0
119
119
 
120
- { amount: amount, number: installment_number, total_amount: installment[1]['amount'] / 100.0 }
120
+ { amount: amount, number: installment_number, total_amount: installment[1]['amount'] / 100.0, free_installment: (project.free_installments >= installment_number.to_i) }
121
121
  end
122
122
  end
123
123
  else
@@ -88,10 +88,23 @@ module CatarsePagarme
88
88
  installment[installment_number.to_s]
89
89
  end
90
90
 
91
+ def current_interest_rate
92
+ project.interest_rate.presence || CatarsePagarme.configuration.interest_rate
93
+ end
94
+
95
+ def current_free_installments
96
+ project.free_installments
97
+ end
98
+
99
+ def project
100
+ self.payment.try(:project)
101
+ end
102
+
91
103
  def get_installments
92
104
  @installments ||= PagarMe::Transaction.calculate_installments({
93
105
  amount: self.value_for_transaction,
94
- interest_rate: CatarsePagarme.configuration.interest_rate
106
+ free_installments: current_free_installments,
107
+ interest_rate: current_interest_rate
95
108
  })
96
109
  end
97
110
 
@@ -1,3 +1,3 @@
1
1
  module CatarsePagarme
2
- VERSION = "2.12.0"
2
+ VERSION = "2.13.0"
3
3
  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.12.0
4
+ version: 2.13.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: 2018-12-05 00:00:00.000000000 Z
12
+ date: 2019-02-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails