catarse_paypal_express 2.1.0 → 2.1.1

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: 462880b88a69a04cb38588b2ef1cf645a3e5f2a5
4
- data.tar.gz: d8b93811dc10e125d1de20db10d92d4afc4b2fc6
3
+ metadata.gz: afa957fb517b7455b2fe330ae7f0dbae30367f56
4
+ data.tar.gz: 79d72c792565945ce21d9d7246687abe92bc1c30
5
5
  SHA512:
6
- metadata.gz: f312249be9030a40ee51e0f8e4a4e48ce488fb45609c1a169b4a1c65284dc003fc8eaa9972710cc4ed5816471bc1ec49758c05eace37cd6afce539798ed7fd2c
7
- data.tar.gz: 4a3630047639182d35448adce5da2a78cbe0d21948d60d62b98d4755b22b0a89365130856a52e227cbe56db75b891e9240c0256998ea5be3c5196dccb9cee3aa
6
+ metadata.gz: 714f8a31749ab64ca03cec3353c79c2410613fd5b7e3f3c8ed0808ad49e7a968284f2ab51b20cd1b69883bb3c12359d2bbb54d949b95629c0df5e6e13eadb9ce
7
+ data.tar.gz: a446630032570b5600edf3e58223f6ee2c3ad7bca7f553f28b16baafb2e189039861507949259b303f823334d6f4e905a5c4fc6a2378dd60f49edb5a4bd2d4d4
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- catarse_paypal_express (2.0.0)
4
+ catarse_paypal_express (2.1.1)
5
5
  activemerchant (>= 1.34.0)
6
6
  rails (~> 4.0)
7
7
  slim-rails
@@ -44,7 +44,7 @@ GEM
44
44
  multi_json (~> 1.3)
45
45
  thread_safe (~> 0.1)
46
46
  tzinfo (~> 0.3.37)
47
- arel (4.0.0)
47
+ arel (4.0.1)
48
48
  atomic (1.1.13)
49
49
  builder (3.1.4)
50
50
  database_cleaner (1.1.1)
@@ -61,7 +61,7 @@ GEM
61
61
  mail (2.5.4)
62
62
  mime-types (~> 1.16)
63
63
  treetop (~> 1.4.8)
64
- mime-types (1.24)
64
+ mime-types (1.25.1)
65
65
  minitest (4.7.5)
66
66
  money (5.1.1)
67
67
  i18n (~> 0.6.0)
@@ -105,12 +105,12 @@ GEM
105
105
  activesupport (>= 3.0, < 4.1)
106
106
  railties (>= 3.0, < 4.1)
107
107
  slim (~> 2.0)
108
- sprockets (2.10.0)
108
+ sprockets (2.10.1)
109
109
  hike (~> 1.2)
110
110
  multi_json (~> 1.0)
111
111
  rack (~> 1.0)
112
112
  tilt (~> 1.1, != 1.3.0)
113
- sprockets-rails (2.0.0)
113
+ sprockets-rails (2.0.1)
114
114
  actionpack (>= 3.0)
115
115
  activesupport (>= 3.0)
116
116
  sprockets (~> 2.8)
@@ -119,7 +119,7 @@ GEM
119
119
  thread_safe (0.1.2)
120
120
  atomic
121
121
  tilt (1.4.1)
122
- treetop (1.4.14)
122
+ treetop (1.4.15)
123
123
  polyglot
124
124
  polyglot (>= 0.3.1)
125
125
  tzinfo (0.3.37)
@@ -21,7 +21,7 @@ class CatarsePaypalExpress::PaypalExpressController < ApplicationController
21
21
  end
22
22
 
23
23
  def ipn
24
- if backer && notification.acknowledge
24
+ if backer && notification.acknowledge && (backer.payment_method == 'PayPal' || backer.payment_method.nil?)
25
25
  process_paypal_message params
26
26
  backer.update_attributes({
27
27
  :payment_service_fee => params['mc_fee'],
@@ -1,3 +1,3 @@
1
1
  module CatarsePaypalExpress
2
- VERSION = "2.1.0"
2
+ VERSION = "2.1.1"
3
3
  end
@@ -37,7 +37,8 @@ describe CatarsePaypalExpress::PaypalExpressController do
37
37
  address_city: '123',
38
38
  address_state: '123',
39
39
  address_zip_code: '123',
40
- address_phone_number: '123'
40
+ address_phone_number: '123',
41
+ payment_method: 'PayPal'
41
42
  }) }
42
43
 
43
44
  describe "POST refund" do
@@ -64,13 +65,32 @@ describe CatarsePaypalExpress::PaypalExpressController do
64
65
 
65
66
  describe "POST ipn" do
66
67
  let(:ipn_data){ {"mc_gross"=>"50.00", "protection_eligibility"=>"Eligible", "address_status"=>"unconfirmed", "payer_id"=>"S7Q8X88KMGX5S", "tax"=>"0.00", "address_street"=>"Rua Tatui, 40 ap 81\r\nJardins", "payment_date"=>"09:03:01 Nov 05, 2012 PST", "payment_status"=>"Completed", "charset"=>"windows-1252", "address_zip"=>"01409-010", "first_name"=>"Paula", "mc_fee"=>"3.30", "address_country_code"=>"BR", "address_name"=>"Paula Rizzo", "notify_version"=>"3.7", "custom"=>"", "payer_status"=>"verified", "address_country"=>"Brazil", "address_city"=>"Sao Paulo", "quantity"=>"1", "verify_sign"=>"ALBe4QrXe2sJhpq1rIN8JxSbK4RZA.Kfc5JlI9Jk4N1VQVTH5hPYOi2S", "payer_email"=>"paula.rizzo@gmail.com", "txn_id"=>"3R811766V4891372K", "payment_type"=>"instant", "last_name"=>"Rizzo", "address_state"=>"SP", "receiver_email"=>"financeiro@catarse.me", "payment_fee"=>"", "receiver_id"=>"BVUB4EVC7YCWL", "txn_type"=>"express_checkout", "item_name"=>"Back project", "mc_currency"=>"BRL", "item_number"=>"", "residence_country"=>"BR", "handling_amount"=>"0.00", "transaction_subject"=>"Back project", "payment_gross"=>"", "shipping"=>"0.00", "ipn_track_id"=>"5865649c8c27"} }
67
- let(:backer){ double(:backer, :payment_id => ipn_data['txn_id'] ) }
68
+ let(:backer){ double(:backer, :payment_id => ipn_data['txn_id'], :payment_method => 'PayPal' ) }
68
69
  let(:notification) { double }
69
70
 
70
71
  before do
71
72
  controller.stub(:notification).and_return(notification)
72
73
  end
73
74
 
75
+ context "when payment_method is MoIP" do
76
+ before do
77
+ params = ipn_data.merge({ use_route: 'catarse_paypal_express' })
78
+
79
+ notification.stub(:acknowledge).and_return(true)
80
+ backer.stub(:payment_method).and_return('MoIP')
81
+
82
+ backer.should_not_receive(:update_attributes)
83
+ controller.should_not_receive(:process_paypal_message)
84
+
85
+ notification.should_receive(:acknowledge)
86
+
87
+ post :ipn, params
88
+ end
89
+
90
+ its(:status){ should == 500 }
91
+ its(:body){ should == ' ' }
92
+ end
93
+
74
94
  context "when is a valid ipn data" do
75
95
  before do
76
96
  params = ipn_data.merge({ use_route: 'catarse_paypal_express' })
@@ -9,7 +9,6 @@
9
9
  # Choose the win32 build.
10
10
  # Install PostgreSQL and put its /bin directory on your path.
11
11
  development:
12
- host: localhost
13
12
  adapter: postgresql
14
13
  encoding: utf-8
15
14
  database: catarse_development
@@ -36,7 +35,6 @@ development:
36
35
  # re-generated from your development database when you run "rake".
37
36
  # Do not set this db to the same as development or production.
38
37
  test: &test
39
- host: localhost
40
38
  adapter: postgresql
41
39
  encoding: utf-8
42
40
  database: catarse_test
@@ -45,7 +43,6 @@ test: &test
45
43
 
46
44
 
47
45
  production:
48
- host: localhost
49
46
  adapter: postgresql
50
47
  encoding: utf-8
51
48
  database: catarse_production
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: catarse_paypal_express
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Antônio Roberto Silva
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-11-29 00:00:00.000000000 Z
13
+ date: 2013-12-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
@@ -186,7 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
186
186
  version: '0'
187
187
  requirements: []
188
188
  rubyforge_project:
189
- rubygems_version: 2.1.10
189
+ rubygems_version: 2.0.7
190
190
  signing_key:
191
191
  specification_version: 4
192
192
  summary: PaypalExpress integration with Catarse