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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a5356050880ba2640c7d64ea497b07aca1b6d042
4
- data.tar.gz: f98985c8e6b3a799c51a38494d2d7810ac485d30
3
+ metadata.gz: 30809e9c36413ab244dffb52b0e37a4455b16236
4
+ data.tar.gz: af0b66b4a3e788a616aa2c9098aa7d99effd7bf4
5
5
  SHA512:
6
- metadata.gz: 46d2f2a9cc3039c2baedb28c7a5d8bf454f7169caf8c014362fbc16969414103ad542bffe97de6441bbf5deb1202be8719e1c19ddbdde15587c6803ee308fbd4
7
- data.tar.gz: 78573868ae9af5576ab6de5824fade2b3bf71378efdb5e66d29a13e987dbfd4432f45d0f2e354c2d0a583203ac834e61595000cb802e9a3acdcedd2b78c96d4c
6
+ metadata.gz: 2a14521286514fdf2377f74913332ffdf3ada7050122cd418cb4eaa1523d82c9045522a97421b0104419fbe0f216ae778b922e1226141b1862a5840ea124fad0
7
+ data.tar.gz: be3d00024a69a975f505c0ea91831973ae6639e0bf9230484103f19b5a3f8e40f893b015ffba4930d7a546cdbda0ec2f3629ff93b8d3e0fb33c07bd4f55664a4
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- catarse_pagarme (2.6.1)
4
+ catarse_pagarme (2.6.2)
5
5
  pagarme (~> 1.9.8)
6
6
  rails (~> 4.0)
7
7
 
@@ -24,7 +24,9 @@ module CatarsePagarme
24
24
  protected
25
25
 
26
26
  def update_user_bank_account
27
- self.user.update_attributes(self.attributes.delete(:user))
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(contribution)
28
- url_helpers.second_slip_pagarme_path(contribution)
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
@@ -1,3 +1,3 @@
1
1
  module CatarsePagarme
2
- VERSION = "2.6.1"
2
+ VERSION = "2.6.2"
3
3
  end
@@ -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 'pay with slip' do
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
- self.key ||= SecureRandom.uuid
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.1
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-06 00:00:00.000000000 Z
12
+ date: 2015-04-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails