catarse_pagarme 0.2.0 → 1.0.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: eb48d877b2a72cf8641200bc88707516c0eb0559
4
- data.tar.gz: aad8d99b7dc3f484dfcc46bcd09995d7588965e6
3
+ metadata.gz: f3607d5f370d43423f628e8a465e6a3ce7577ce3
4
+ data.tar.gz: abc10f4ade038574d8aee9974d46ea3960090be3
5
5
  SHA512:
6
- metadata.gz: 8a7c9ce6df4c64b808a6fb8e45e81b8933c48ce031318d56be3ee75fc38634f30663924d461ea138d3ededf3383270e066076d75bf2395d1358097ace22e32e4
7
- data.tar.gz: 38a3d044fe689901e2b68c241a043fd1cb18449e58a972610a4584fdd59142c1ef6a5b5e43585c440b5942442feeb8b98e57ee5db76a7bced8b1b254a88b613a
6
+ metadata.gz: 0860d30723f258e869fe2e94ca50cedd430803d273d3ca1b104ce3fbfd5b7af912928886ae9dd59b250909b7d4cca028b2eba9da4e1578836a87fbefcc2a5ff7
7
+ data.tar.gz: 55273872c9fd0461a4f66388a6ce1c10779fd9545267b5fd646813bf4f3f79b53711d001c3298a8af827d059ffcf82ab98a55ee94cda2631bb44b786e3addd7b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- catarse_pagarme (0.1.1)
4
+ catarse_pagarme (0.1.7)
5
5
  pagarme (~> 1.9.5)
6
6
  rails (~> 4.0)
7
7
 
@@ -35,7 +35,11 @@ module CatarsePagarme
35
35
  end
36
36
 
37
37
  def contribution
38
- conditions = {id: params[:id], user_id: current_user.id }
38
+ conditions = {id: params[:id] }
39
+
40
+ unless params[:controller] == 'catarse_pagarme/notifications'
41
+ conditions.merge!({user_id: current_user.id}) unless current_user.admin
42
+ end
39
43
 
40
44
  @contribution ||= PaymentEngines.find_payment(conditions)
41
45
  end
@@ -36,7 +36,9 @@ module CatarsePagarme
36
36
  card_expiration_year: splited_month_and_year[1],
37
37
  card_cvv: params[:payment_card_source],
38
38
  amount: delegator.value_with_installment_tax(get_installment),
39
- postback_url: ipn_pagarme_url(contribution),
39
+ postback_url: ipn_pagarme_url(contribution, host: CatarsePagarme.configuration.host,
40
+ subdomain: CatarsePagarme.configuration.subdomain,
41
+ protocol: CatarsePagarme.configuration.protocol),
40
42
  installments: get_installment,
41
43
  customer: {
42
44
  email: contribution.user.email,
@@ -15,13 +15,5 @@ module CatarsePagarme
15
15
 
16
16
  render nothing: true, status: 404
17
17
  end
18
-
19
- protected
20
-
21
- def contribution
22
- conditions = {payment_id: params[:id] }
23
-
24
- @contribution ||= PaymentEngines.find_payment(conditions)
25
- end
26
18
  end
27
19
  end
@@ -19,8 +19,11 @@ module CatarsePagarme
19
19
  def slip_attributes
20
20
  {
21
21
  payment_method: 'boleto',
22
+ boleto_expiration_date: 2.days.from_now,
22
23
  amount: delegator.value_for_transaction,
23
- postback_url: ipn_pagarme_url(contribution),
24
+ postback_url: ipn_pagarme_url(contribution, host: CatarsePagarme.configuration.host,
25
+ subdomain: CatarsePagarme.configuration.subdomain,
26
+ protocol: CatarsePagarme.configuration.protocol),
24
27
  customer: {
25
28
  email: contribution.user.email,
26
29
  name: contribution.user.name
@@ -30,7 +33,7 @@ module CatarsePagarme
30
33
 
31
34
  def permitted_attributes
32
35
  attrs = ActionController::Parameters.new(slip_attributes)
33
- attrs.permit(:payment_method, :amount, :postback_url, customer: [:name, :email],
36
+ attrs.permit(:boleto_expiration_date, :payment_method, :amount, :postback_url, customer: [:name, :email],
34
37
  user: [
35
38
  bank_account_attributes: [
36
39
  :bank_id, :account, :account_digit, :agency,
@@ -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 :bank_id, as: :select, collection: Bank.all, input_html: { style: 'width: 150px' }
100
+ = bank_form.input :bank_id, as: :select, collection: Bank.to_collection, 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,6 +1,6 @@
1
1
  module CatarsePagarme
2
2
  class Configuration
3
- attr_accessor :api_key, :slip_tax, :credit_card_tax, :interest_rate,
3
+ attr_accessor :api_key, :slip_tax, :credit_card_tax, :interest_rate, :host, :subdomain, :protocol,
4
4
  :max_installments, :minimum_value_for_installment, :credit_card_cents_fee
5
5
 
6
6
  def initialize
@@ -11,6 +11,9 @@ module CatarsePagarme
11
11
  self.max_installments = 12
12
12
  self.minimum_value_for_installment = 10
13
13
  self.credit_card_cents_fee = 0.39
14
+ self.host = 'catarse.me'
15
+ self.subdomain = 'www'
16
+ self.protocol = 'http'
14
17
  end
15
18
  end
16
19
  end
@@ -1,3 +1,3 @@
1
1
  module CatarsePagarme
2
- VERSION = "0.2.0"
2
+ VERSION = "1.0.0"
3
3
  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: 0.2.0
4
+ version: 1.0.0
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: 2014-09-30 00:00:00.000000000 Z
12
+ date: 2014-10-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails