catarse_pagarme 2.9.8 → 2.9.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 +4 -4
- data/Gemfile.lock +1 -1
- data/app/controllers/catarse_pagarme/credit_cards_controller.rb +26 -0
- data/config/routes.rb +2 -0
- data/lib/catarse_pagarme/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 716842fae1e53a63a7b9ce00c580b3f3e313e276
|
4
|
+
data.tar.gz: d62b246e987cedff38ce634a244ea7730e39aacb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 593b4892adca5e56921e6d8cba2a1b3c46a29836c86a6e324c21efb79ea8920d16437d7b38c23a454d718d83151c39864cb3314a1b2980911c1a7a15039ad14e
|
7
|
+
data.tar.gz: a58b9621ed0a8ce3b4b2d4dbcbc4d60341b7647362b704569dd0e4dc45a1049880d15555e62807648cc9e75626992189d597368d564405992733a4fe7ee9e575
|
data/Gemfile.lock
CHANGED
@@ -12,6 +12,14 @@ module CatarsePagarme
|
|
12
12
|
render json: { payment_status: 'failed', message: e.message }
|
13
13
|
end
|
14
14
|
|
15
|
+
def get_installment_json
|
16
|
+
render json: installments_for_json.to_json
|
17
|
+
end
|
18
|
+
|
19
|
+
def get_encryption_key_json
|
20
|
+
render json: { key: CatarsePagarme.configuration.ecr_key }
|
21
|
+
end
|
22
|
+
|
15
23
|
protected
|
16
24
|
|
17
25
|
def credit_card_attributes
|
@@ -81,5 +89,23 @@ module CatarsePagarme
|
|
81
89
|
end
|
82
90
|
end
|
83
91
|
|
92
|
+
def installments_for_json
|
93
|
+
if contribution.value.to_f >= CatarsePagarme.configuration.minimum_value_for_installment.to_f
|
94
|
+
project = payment.project
|
95
|
+
installments = payment.pagarme_delegator.get_installments['installments']
|
96
|
+
collection = installments.map do |installment|
|
97
|
+
installment_number = installment[0].to_i
|
98
|
+
if installment_number <= (project.try(:total_installments) || CatarsePagarme.configuration.max_installments.to_i)
|
99
|
+
amount = installment[1]['installment_amount'] / 100.0
|
100
|
+
|
101
|
+
{amount: amount, number: installment_number}
|
102
|
+
end
|
103
|
+
end
|
104
|
+
else
|
105
|
+
collection = [{amount: payment.value, number: 1}]
|
106
|
+
end
|
107
|
+
collection.compact
|
108
|
+
end
|
109
|
+
|
84
110
|
end
|
85
111
|
end
|
data/config/routes.rb
CHANGED
@@ -5,6 +5,8 @@ CatarsePagarme::Engine.routes.draw do
|
|
5
5
|
get :review
|
6
6
|
get :slip_data, to: 'slip#slip_data'
|
7
7
|
get :second_slip, to: 'slip#update'
|
8
|
+
get :get_installment, to: 'credit_cards#get_installment_json'
|
9
|
+
get :get_encryption_key, to: 'credit_cards#get_encryption_key_json'
|
8
10
|
post :pay_credit_card, to: 'credit_cards#create'
|
9
11
|
post :pay_slip, to: 'slip#create'
|
10
12
|
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.9.
|
4
|
+
version: 2.9.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: 2016-
|
12
|
+
date: 2016-10-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|