catarse_pagarme 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 940198177a85e25c77f4bda44df9d977b7734ab2
4
- data.tar.gz: f3040d8a082253963d4132e0e4f315a139163ee1
3
+ metadata.gz: 37b5997612c9b0aa8f466a15d4b3363e04e4aae1
4
+ data.tar.gz: d07591832c70c9dc332bea5858e42c327032d614
5
5
  SHA512:
6
- metadata.gz: 2b9df037287f568dbb4b525c065b7c05406452c68a563b812f4b1470356ebd7d6a60047dcce41fdc0aa33162726a0cb3bd871003981ac8e8721c17ea6b1d60c9
7
- data.tar.gz: 2d6b7a8a7a4c5ca2a08a9f2f2302d1619c01e27d34353610ba641d396791aa5f1217ee25beaced124edb1ecfd4e97cccd4213c4b6d98dce37dc1ab71aeb3746a
6
+ metadata.gz: d35abb2d31477f1f729e2c1a843652e77d26a8a030bdc3b08fd7e8e987a8717f17f69ed21221ede28a4eae736d406987800f4767fd3603624e139282bd75793c
7
+ data.tar.gz: 3d8ed5835649bc23f5cf3a9b59eda9061ab035dafeb50b28569872fb5ae185a529ed82f660cf4ac15366bae13368ceb888e4e319fb04c219502e41b814095ee1
@@ -36,9 +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, host: CatarsePagarme.configuration.host,
40
- subdomain: CatarsePagarme.configuration.subdomain,
41
- protocol: CatarsePagarme.configuration.protocol),
39
+ postback_url: ipn_pagarme_index_url(host: CatarsePagarme.configuration.host,
40
+ subdomain: CatarsePagarme.configuration.subdomain,
41
+ protocol: CatarsePagarme.configuration.protocol),
42
42
  installments: get_installment,
43
43
  customer: {
44
44
  email: contribution.user.email,
@@ -15,5 +15,11 @@ module CatarsePagarme
15
15
 
16
16
  render nothing: true, status: 404
17
17
  end
18
+
19
+ protected
20
+
21
+ def contribution
22
+ @contribution ||= PaymentEngines.find_payment({ payment_id: params[:id] })
23
+ end
18
24
  end
19
25
  end
@@ -21,9 +21,9 @@ module CatarsePagarme
21
21
  payment_method: 'boleto',
22
22
  boleto_expiration_date: 2.days.from_now,
23
23
  amount: delegator.value_for_transaction,
24
- postback_url: ipn_pagarme_url(contribution, host: CatarsePagarme.configuration.host,
25
- subdomain: CatarsePagarme.configuration.subdomain,
26
- protocol: CatarsePagarme.configuration.protocol),
24
+ postback_url: ipn_pagarme_index_url(host: CatarsePagarme.configuration.host,
25
+ subdomain: CatarsePagarme.configuration.subdomain,
26
+ protocol: CatarsePagarme.configuration.protocol),
27
27
  customer: {
28
28
  email: contribution.user.email,
29
29
  name: contribution.user.name
data/config/routes.rb CHANGED
@@ -4,12 +4,15 @@ CatarsePagarme::Engine.routes.draw do
4
4
  member do
5
5
  get :review
6
6
  put :second_slip, to: 'slip#update'
7
- post :ipn, to: 'notifications#create'
8
7
  post :pay_credit_card, to: 'credit_cards#create'
9
8
  post :pay_slip, to: 'slip#create'
10
9
  post :pay_with_subscription, to: 'subscriptions#create'
11
10
  put :pay_with_subscription, to: 'subscriptions#update'
12
11
  end
13
12
 
13
+ collection do
14
+ post :ipn, to: 'notifications#create'
15
+ end
16
+
14
17
  end
15
18
  end
@@ -1,3 +1,3 @@
1
1
  module CatarsePagarme
2
- VERSION = "1.0.1"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -6,7 +6,7 @@ describe CatarsePagarme::NotificationsController do
6
6
  end
7
7
 
8
8
  let(:project) { create(:project, goal: 10_000, state: 'online') }
9
- let(:contribution) { create(:contribution, value: 10, project: project) }
9
+ let(:contribution) { create(:contribution, value: 10, project: project, payment_id: 'abcd') }
10
10
  let(:credit_card) { create(:credit_card, subscription_id: '1542')}
11
11
 
12
12
  describe 'CREATE' do
@@ -24,7 +24,7 @@ describe CatarsePagarme::NotificationsController do
24
24
  context "with valid contribution" do
25
25
  before do
26
26
  PaymentEngines.stub(:find_payment).and_return(contribution)
27
- post :create, { locale: :pt, id: contribution.id, use_route: 'catarse_pagarme' }
27
+ post :create, { locale: :pt, id: 'abcd', use_route: 'catarse_pagarme' }
28
28
  end
29
29
 
30
30
  it "should save an extra_data into payment_notifications" do
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: 1.0.1
4
+ version: 1.1.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-10-08 00:00:00.000000000 Z
12
+ date: 2014-10-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails