catarse_pagarme 0.0.2 → 0.1.0

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: 48f66f6f9bfa9f45d26efacf227457c81910d7af
4
- data.tar.gz: cc2cd6fc2fb50b2c933c51b426fb56d13ca9b31b
3
+ metadata.gz: bd54372cd3851a958fdb96641330bf113010abd6
4
+ data.tar.gz: 4a53093cf2dbd9ba4de19308254f189b45083405
5
5
  SHA512:
6
- metadata.gz: b5b94a9a12c9bbba69be8ea2a9b07e5eac0818ad1c01c1e02c5aac2d003fd080c4b410f60598910a41f780f94ddb0b2eb97d4984de3a1224751558c26400ea66
7
- data.tar.gz: d5b1977e553a5778e5df430f767999b7a5e484aaa775ad72ee9ba6a79ecf53cc387cc064761c2f6164302c6c1eed38193b1a69b513fa1b3575ca17e36a45d3a3
6
+ metadata.gz: 258192985026c1a93e543fe53c1a5a39da1fc8aff3e1750a8755cedd827256189ce3944454713472c184c83e2cde4ba4bf981402611f4674e47c910a0ba22977
7
+ data.tar.gz: 1a1282bb0256fc83450f7a7b10e7af4ea6cb12145e698252b94f80da20b1ca5b2f15ace5e7a3e890740db788c23891fb69ff28a21ed4da9df0d188674d30c2ed
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- catarse_pagarme (0.0.1)
4
+ catarse_pagarme (0.0.2)
5
5
  pagarme (~> 1.9.5)
6
6
  rails (~> 4.0)
7
7
 
@@ -33,7 +33,7 @@ App.views.PagarmeForm.addChild('PaymentSlip', {
33
33
  var bankAccountAttributes = {
34
34
  user: {
35
35
  bank_account_attributes: {
36
- name: that.$('input#user_bank_account_attributes_name').val(),
36
+ bank_id: that.$('select#user_bank_account_attributes_bank_id').val(),
37
37
  agency: that.$('input#user_bank_account_attributes_agency').val(),
38
38
  agency_digit: that.$('input#user_bank_account_attributes_agency_digit').val(),
39
39
  account: that.$('input#user_bank_account_attributes_account').val(),
@@ -33,7 +33,7 @@ module CatarsePagarme
33
33
  attrs.permit(:payment_method, :amount, :postback_url, customer: [:name, :email],
34
34
  user: [
35
35
  bank_account_attributes: [
36
- :name, :account, :account_digit, :agency,
36
+ :bank_id, :account, :account_digit, :agency,
37
37
  :agency_digit, :owner_name, :owner_document
38
38
  ]
39
39
  ])
@@ -97,7 +97,7 @@
97
97
  = simple_form_for current_user, url: 'javascript:void(0)' do |f|
98
98
  .bank_accounts
99
99
  = f.simple_fields_for :bank_account do |bank_form|
100
- = bank_form.input :name, as: :string, input_html: {autocomplete: 'off'}
100
+ = bank_form.input :bank_id, as: :select, collection: Bank.all, input_html: { style: 'width: 150px' }
101
101
  = bank_form.input :agency, as: :string
102
102
  = bank_form.input :agency_digit, as: :string
103
103
  = bank_form.input :account, as: :string
@@ -1,3 +1,3 @@
1
1
  module CatarsePagarme
2
- VERSION = "0.0.2"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -4,6 +4,7 @@ describe CatarsePagarme::SlipController do
4
4
  before do
5
5
  PaymentEngines.stub(:find_payment).and_return(contribution)
6
6
  controller.stub(:current_user).and_return(user)
7
+ Bank.create(name: 'foo', code: '123')
7
8
  end
8
9
 
9
10
  let(:project) { create(:project, goal: 10_000, state: 'online') }
@@ -29,7 +30,7 @@ describe CatarsePagarme::SlipController do
29
30
  post :create, {
30
31
  locale: :pt, project_id: project.id, contribution_id: contribution.id, use_route: 'catarse_pagarme',
31
32
  user: { bank_account_attributes: {
32
- name: 'bank', agency: '1', agency_digit: '1', account: '1', account_digit: '1', owner_name: 'foo', owner_document: '1'
33
+ bank_id: Bank.first.id, agency: '1', agency_digit: '1', account: '1', account_digit: '1', owner_name: 'foo', owner_document: '1'
33
34
  } } }
34
35
  end
35
36
 
@@ -46,7 +47,7 @@ describe CatarsePagarme::SlipController do
46
47
  let(:user) { contribution.user }
47
48
 
48
49
  before do
49
- post :create, { locale: :pt, project_id: project.id, contribution_id: contribution.id, use_route: 'catarse_pagarme', user: { bank_account_attributes: { name: '' } } }
50
+ post :create, { locale: :pt, project_id: project.id, contribution_id: contribution.id, use_route: 'catarse_pagarme', user: { bank_account_attributes: { owner_name: '' } } }
50
51
  end
51
52
 
52
53
  it 'boleto_url should be nil' do
@@ -0,0 +1,2 @@
1
+ class Bank < ActiveRecord::Base
2
+ end
@@ -1,5 +1,6 @@
1
1
  class BankAccount < ActiveRecord::Base
2
2
  belongs_to :user
3
+ belongs_to :bank
3
4
 
4
- validates :name, :agency, :agency_digit, :account, :owner_name, :owner_document, :account_digit, presence: true
5
+ validates :bank_id, :agency, :agency_digit, :account, :owner_name, :owner_document, :account_digit, presence: true
5
6
  end
@@ -19,7 +19,7 @@ describe CatarsePagarme::SlipTransaction do
19
19
  postback_url: 'http://test.foo'
20
20
  }, user: {
21
21
  bank_account_attributes: {
22
- name: 'foo', agency: '1', agency_digit: '1',
22
+ bank_id: 1, agency: '1', agency_digit: '1',
23
23
  account: '1', account_digit: '1', owner_name: 'foo',
24
24
  owner_document: 'bar'
25
25
  }
@@ -35,7 +35,7 @@ describe CatarsePagarme::SlipTransaction do
35
35
  postback_url: 'http://test.foo'
36
36
  }, user: {
37
37
  bank_account_attributes: {
38
- name: ''
38
+ owner_name: ''
39
39
  }
40
40
  }
41
41
  }
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: 0.0.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Antônio Roberto Silva
@@ -147,6 +147,7 @@ files:
147
147
  - spec/dummy/app/helpers/application_helper.rb
148
148
  - spec/dummy/app/mailers/.keep
149
149
  - spec/dummy/app/models/.keep
150
+ - spec/dummy/app/models/bank.rb
150
151
  - spec/dummy/app/models/bank_account.rb
151
152
  - spec/dummy/app/models/category.rb
152
153
  - spec/dummy/app/models/concerns/.keep
@@ -232,6 +233,7 @@ test_files:
232
233
  - spec/dummy/app/helpers/application_helper.rb
233
234
  - spec/dummy/app/mailers/.keep
234
235
  - spec/dummy/app/models/.keep
236
+ - spec/dummy/app/models/bank.rb
235
237
  - spec/dummy/app/models/bank_account.rb
236
238
  - spec/dummy/app/models/category.rb
237
239
  - spec/dummy/app/models/concerns/.keep