catarse_pagarme 0.1.1 → 0.1.2
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/application_controller.rb +1 -1
- data/app/helpers/catarse_pagarme/application_helper.rb +8 -2
- data/app/models/catarse_pagarme/credit_card_transaction.rb +4 -0
- data/lib/catarse_pagarme/version.rb +1 -1
- data/spec/helpers/catarse_pagarme/application_helper_spec.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: 25321c789bdd9aa0015e48087197242401b9e300
|
4
|
+
data.tar.gz: 5c02b0a25f6967ce739cd57e349c1d6e950bb166
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1cc2466205e04bbbef654d17b9a27b1aa27217dc893c53e573c93527fe6279c6a21ed4ca8fac11f1260af6314e5dd97c281280daaa11e0704478867c3bc91e4
|
7
|
+
data.tar.gz: e0dbd6e0bc58e0a3082b519daa0da2338d69100ee205fd127888abcf9884e92e32ba5cb7f812e2185b87a06c50cfd939d11ceb547ddda7b7343d2e3a1e261980
|
data/Gemfile.lock
CHANGED
@@ -8,7 +8,13 @@ module CatarsePagarme
|
|
8
8
|
installment_number = installment[0].to_i
|
9
9
|
if installment_number <= CatarsePagarme.configuration.max_installments
|
10
10
|
amount = installment[1]['installment_amount'] / 100.0
|
11
|
-
|
11
|
+
|
12
|
+
optional_text = nil
|
13
|
+
if installment_number != 1
|
14
|
+
optional_text = I18n.t('projects.contributions.edit.installment_with_tax')
|
15
|
+
end
|
16
|
+
|
17
|
+
["#{format_instalment_text(installment_number, amount)} #{optional_text}", installment_number]
|
12
18
|
end
|
13
19
|
end
|
14
20
|
|
@@ -16,7 +22,7 @@ module CatarsePagarme
|
|
16
22
|
end
|
17
23
|
|
18
24
|
def format_instalment_text(number, amount)
|
19
|
-
[number, number_to_currency(amount, precision: 2)].join(
|
25
|
+
[number, number_to_currency(amount, precision: 2)].join("x ")
|
20
26
|
end
|
21
27
|
|
22
28
|
end
|
@@ -4,6 +4,10 @@ module CatarsePagarme
|
|
4
4
|
self.transaction = PagarMe::Transaction.new(self.attributes)
|
5
5
|
self.transaction.charge
|
6
6
|
|
7
|
+
if self.transaction.status == 'refused'
|
8
|
+
raise ::PagarMe::PagarMeError.new(I18n.t('projects.contributions.edit.transaction_error'))
|
9
|
+
end
|
10
|
+
|
7
11
|
change_contribution_state
|
8
12
|
self.transaction
|
9
13
|
end
|
@@ -12,7 +12,7 @@ describe CatarsePagarme::ApplicationHelper do
|
|
12
12
|
context "#installments_for_select" do
|
13
13
|
subject { installments_for_select(contribution) }
|
14
14
|
it { expect(subject.size).to eq(6) }
|
15
|
-
it { expect(subject[0][0]).to eq('1x $100.00') }
|
15
|
+
it { expect(subject[0][0]).to eq('1x $100.00 ') }
|
16
16
|
it { expect(subject[0][1]).to eq(1) }
|
17
17
|
end
|
18
18
|
|