catarse_pagarme 2.6.4 → 2.6.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/app/controllers/catarse_pagarme/application_controller.rb +7 -0
- data/app/controllers/catarse_pagarme/credit_cards_controller.rb +1 -3
- data/app/controllers/catarse_pagarme/slip_controller.rb +1 -3
- data/app/models/catarse_pagarme/transaction_base.rb +14 -2
- data/lib/catarse_pagarme/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e8d37af9d49cc8c8fb5b97b68e5e57ba5c2df42
|
4
|
+
data.tar.gz: 75d95b6329ae2f4977b08a729ca51d65b44f322b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1637595ea9eefabe4ff14c0fbe22aed07cb29946593efe041381e7bfc0ed9af29e42b8229621653c712ee4de0eccd4253bb1382da749ea0f79df105788d4b32e
|
7
|
+
data.tar.gz: 920c7ae1937ae7a74e763cfebae198b7dcaeb5536a98ddc4d8cc570cd5f7ede090c452612663f69e7f38bbbb9e91a16f1c36c6caa6925b9a01740e80614967a6
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
catarse_pagarme (2.6.
|
4
|
+
catarse_pagarme (2.6.5)
|
5
5
|
pagarme (~> 1.9.8)
|
6
6
|
rails (~> 4.0)
|
7
7
|
|
@@ -116,7 +116,7 @@ GEM
|
|
116
116
|
thread_safe (~> 0.1)
|
117
117
|
unf (0.1.4)
|
118
118
|
unf_ext
|
119
|
-
unf_ext (0.0.
|
119
|
+
unf_ext (0.0.7.1)
|
120
120
|
|
121
121
|
PLATFORMS
|
122
122
|
ruby
|
@@ -9,6 +9,13 @@ module CatarsePagarme
|
|
9
9
|
layout :false
|
10
10
|
|
11
11
|
protected
|
12
|
+
def metadata_attributes
|
13
|
+
{
|
14
|
+
key: payment.generate_key,
|
15
|
+
project_id: payment.contribution.project_id
|
16
|
+
}
|
17
|
+
end
|
18
|
+
|
12
19
|
def configure_pagarme
|
13
20
|
PagarMe.api_key = CatarsePagarme.configuration.api_key
|
14
21
|
end
|
@@ -10,8 +10,8 @@ module CatarsePagarme
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def change_payment_state
|
13
|
-
self.payment.save!
|
14
13
|
self.payment.update_attributes(attributes_to_payment)
|
14
|
+
self.payment.save!
|
15
15
|
delegator.update_fee
|
16
16
|
self.payment.payment_notifications.create(contribution_id: self.payment.contribution_id, extra_data: self.transaction.to_json)
|
17
17
|
delegator.change_status_by_transaction(self.transaction.status)
|
@@ -27,11 +27,23 @@ module CatarsePagarme
|
|
27
27
|
gateway_id: self.transaction.id,
|
28
28
|
gateway: 'Pagarme',
|
29
29
|
gateway_data: self.transaction.to_json,
|
30
|
-
installments:
|
30
|
+
installments: default_installments,
|
31
31
|
installment_value: (delegator.value_for_installment(self.transaction.installments || 0) / 100.0).to_f
|
32
32
|
}
|
33
33
|
end
|
34
34
|
|
35
|
+
def default_installments
|
36
|
+
(self.transaction.installments || 1)
|
37
|
+
end
|
38
|
+
|
39
|
+
def default_installment_value
|
40
|
+
if default_installments == 1
|
41
|
+
self.payment.value
|
42
|
+
else
|
43
|
+
(delegator.value_for_installment(self.transaction.installments || 0) / 100.0).to_f
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
35
47
|
def delegator
|
36
48
|
self.payment.pagarme_delegator
|
37
49
|
end
|