catarse_pagarme 2.6.1 → 2.6.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/models/catarse_pagarme/slip_transaction.rb +3 -1
- data/lib/catarse_pagarme/payment_engine.rb +3 -2
- data/lib/catarse_pagarme/version.rb +1 -1
- data/spec/controllers/catarse_pagarme/slip_controller_spec.rb +15 -1
- data/spec/dummy/app/models/payment.rb +5 -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: 30809e9c36413ab244dffb52b0e37a4455b16236
|
4
|
+
data.tar.gz: af0b66b4a3e788a616aa2c9098aa7d99effd7bf4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a14521286514fdf2377f74913332ffdf3ada7050122cd418cb4eaa1523d82c9045522a97421b0104419fbe0f216ae778b922e1226141b1862a5840ea124fad0
|
7
|
+
data.tar.gz: be3d00024a69a975f505c0ea91831973ae6639e0bf9230484103f19b5a3f8e40f893b015ffba4930d7a546cdbda0ec2f3629ff93b8d3e0fb33c07bd4f55664a4
|
data/Gemfile.lock
CHANGED
@@ -24,7 +24,9 @@ module CatarsePagarme
|
|
24
24
|
protected
|
25
25
|
|
26
26
|
def update_user_bank_account
|
27
|
-
self.
|
27
|
+
if self.attributes.include?(:user)
|
28
|
+
self.user.update_attributes(self.attributes.delete(:user))
|
29
|
+
end
|
28
30
|
|
29
31
|
if self.user.errors.present?
|
30
32
|
raise ::PagarMe::PagarMeError.new(self.user.errors.full_messages.to_sentence)
|
@@ -24,8 +24,9 @@ module CatarsePagarme
|
|
24
24
|
true
|
25
25
|
end
|
26
26
|
|
27
|
-
def second_slip_path(
|
28
|
-
|
27
|
+
def second_slip_path(payment)
|
28
|
+
# The second slip generates a new payment base on the contribution ID
|
29
|
+
url_helpers.second_slip_pagarme_path(id: payment.contribution.id)
|
29
30
|
end
|
30
31
|
|
31
32
|
protected
|
@@ -11,7 +11,21 @@ describe CatarsePagarme::SlipController do
|
|
11
11
|
let(:payment) { contribution.payments.first }
|
12
12
|
let(:credit_card) { create(:credit_card, subscription_id: '1542')}
|
13
13
|
|
14
|
-
describe '
|
14
|
+
describe 'PATCH update' do
|
15
|
+
let(:user) { payment.user }
|
16
|
+
|
17
|
+
before do
|
18
|
+
patch :update, locale: :pt, id: contribution.id, use_route: 'catarse_pagarme'
|
19
|
+
end
|
20
|
+
|
21
|
+
context 'with valid bank account data' do
|
22
|
+
it 'boleto_url should be filled' do
|
23
|
+
expect(response.body).to be_present
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe 'POST create' do
|
15
29
|
context 'without an user' do
|
16
30
|
let(:user) { nil }
|
17
31
|
|
@@ -7,11 +7,15 @@ class Payment < ActiveRecord::Base
|
|
7
7
|
validate :value_should_be_equal_or_greater_than_pledge
|
8
8
|
|
9
9
|
before_validation do
|
10
|
-
|
10
|
+
generate_key
|
11
11
|
self.value ||= self.contribution.try(:value)
|
12
12
|
self.state = 'pending' # mock initial state for here we do not include the stat machine
|
13
13
|
end
|
14
14
|
|
15
|
+
def generate_key
|
16
|
+
self.key ||= SecureRandom.uuid
|
17
|
+
end
|
18
|
+
|
15
19
|
def value_should_be_equal_or_greater_than_pledge
|
16
20
|
errors.add(:value, I18n.t("activerecord.errors.models.payment.attributes.value.invalid")) if self.contribution && self.value < self.contribution.value
|
17
21
|
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.6.
|
4
|
+
version: 2.6.2
|
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: 2015-04-
|
12
|
+
date: 2015-04-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|