spree_paypal_express_mutalis 2.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +10 -0
- data/.rspec +1 -0
- data/.travis.yml +16 -0
- data/CONTRIBUTING.md +81 -0
- data/Gemfile +8 -0
- data/LICENSE.md +26 -0
- data/README.md +86 -0
- data/Rakefile +23 -0
- data/app/assets/javascripts/admin/spree_paypal_express.js +25 -0
- data/app/assets/javascripts/store/spree_paypal_express.js +19 -0
- data/app/assets/stylesheets/admin/spree_paypal_express.css +3 -0
- data/app/assets/stylesheets/store/spree_paypal_express.css +3 -0
- data/app/controllers/spree/admin/payments_controller_decorator.rb +19 -0
- data/app/controllers/spree/admin/paypal_payments_controller.rb +15 -0
- data/app/controllers/spree/paypal_controller.rb +144 -0
- data/app/models/spree/gateway/pay_pal_express.rb +100 -0
- data/app/models/spree/paypal_express_checkout.rb +4 -0
- data/app/views/spree/admin/payments/_paypal_complete.html.erb +20 -0
- data/app/views/spree/admin/payments/paypal_refund.html.erb +31 -0
- data/app/views/spree/admin/payments/source_forms/_paypal.html.erb +6 -0
- data/app/views/spree/admin/payments/source_views/_paypal.html.erb +35 -0
- data/app/views/spree/checkout/payment/_paypal.html.erb +6 -0
- data/config/locales/en.yml +16 -0
- data/config/routes.rb +18 -0
- data/db/migrate/20130723042610_create_spree_paypal_express_checkouts.rb +8 -0
- data/db/migrate/20130808030836_add_transaction_id_to_spree_paypal_express_checkouts.rb +6 -0
- data/db/migrate/20130809013846_add_state_to_spree_paypal_express_checkouts.rb +5 -0
- data/db/migrate/20130809014319_add_refunded_fields_to_spree_paypal_express_checkouts.rb +8 -0
- data/lib/generators/spree_paypal_express/install/install_generator.rb +31 -0
- data/lib/spree_paypal_express.rb +3 -0
- data/lib/spree_paypal_express/engine.rb +26 -0
- data/lib/spree_paypal_express/factories.rb +6 -0
- data/lib/spree_paypal_express/version.rb +3 -0
- data/script/rails +7 -0
- data/spec/features/paypal_spec.rb +244 -0
- data/spec/models/pay_pal_express_spec.rb +50 -0
- data/spec/spec_helper.rb +45 -0
- data/spree_paypal_express.gemspec +39 -0
- metadata +253 -0
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Spree::Gateway::PayPalExpress do
|
4
|
+
let(:gateway) { Spree::Gateway::PayPalExpress.create!(name: "PayPalExpress", :environment => Rails.env) }
|
5
|
+
|
6
|
+
context "payment purchase" do
|
7
|
+
let(:payment) do
|
8
|
+
payment = FactoryGirl.create(:payment, :payment_method => gateway, :amount => 10)
|
9
|
+
payment.stub :source => mock_model(Spree::PaypalExpressCheckout, :token => 'fake_token', :payer_id => 'fake_payer_id')
|
10
|
+
payment
|
11
|
+
end
|
12
|
+
|
13
|
+
let(:provider) do
|
14
|
+
provider = double('Provider')
|
15
|
+
gateway.stub(:provider => provider)
|
16
|
+
provider
|
17
|
+
end
|
18
|
+
|
19
|
+
# Test for #11
|
20
|
+
it "succeeds" do
|
21
|
+
provider.should_receive(:build_do_express_checkout_payment).with({
|
22
|
+
:DoExpressCheckoutPaymentRequestDetails => {
|
23
|
+
:PaymentAction => "Sale",
|
24
|
+
:Token => "fake_token",
|
25
|
+
:PayerID => "fake_payer_id",
|
26
|
+
:PaymentDetails => [
|
27
|
+
{ :OrderTotal => {
|
28
|
+
:currencyID => "USD",
|
29
|
+
:value => "10.00"
|
30
|
+
}
|
31
|
+
}
|
32
|
+
]
|
33
|
+
}
|
34
|
+
})
|
35
|
+
response = double('pp_response', :success? => true)
|
36
|
+
provider.should_receive(:do_express_checkout_payment).and_return(response)
|
37
|
+
payment.purchase!
|
38
|
+
# lambda { payment.purchase! }.should_not raise_error
|
39
|
+
end
|
40
|
+
|
41
|
+
# Test for #4
|
42
|
+
it "fails" do
|
43
|
+
provider.should_receive(:build_do_express_checkout_payment)
|
44
|
+
response = double('pp_response', :success? => false,
|
45
|
+
:errors => [double('pp_response_error', :long_message => "An error goes here.")])
|
46
|
+
provider.should_receive(:do_express_checkout_payment).and_return(response)
|
47
|
+
lambda { payment.purchase! }.should raise_error(Spree::Core::GatewayError, "An error goes here.")
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# Configure Rails Environment
|
2
|
+
ENV['RAILS_ENV'] = 'test'
|
3
|
+
|
4
|
+
require File.expand_path('../dummy/config/environment.rb', __FILE__)
|
5
|
+
|
6
|
+
require 'rspec/rails'
|
7
|
+
require 'database_cleaner'
|
8
|
+
require 'ffaker'
|
9
|
+
require 'capybara/rspec'
|
10
|
+
require 'pry'
|
11
|
+
|
12
|
+
Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each { |f| require f }
|
13
|
+
|
14
|
+
require 'spree/testing_support/factories'
|
15
|
+
require 'spree/testing_support/controller_requests'
|
16
|
+
require 'spree/testing_support/authorization_helpers'
|
17
|
+
require 'spree/testing_support/url_helpers'
|
18
|
+
|
19
|
+
require 'spree_paypal_express/factories'
|
20
|
+
|
21
|
+
RSpec.configure do |config|
|
22
|
+
config.include FactoryGirl::Syntax::Methods
|
23
|
+
config.include Spree::TestingSupport::UrlHelpers
|
24
|
+
config.include Spree::TestingSupport::AuthorizationHelpers::Controller
|
25
|
+
|
26
|
+
config.mock_with :rspec
|
27
|
+
config.color = true
|
28
|
+
config.use_transactional_fixtures = false
|
29
|
+
|
30
|
+
config.before :suite do
|
31
|
+
DatabaseCleaner.strategy = :transaction
|
32
|
+
DatabaseCleaner.clean_with :truncation
|
33
|
+
end
|
34
|
+
|
35
|
+
config.before do
|
36
|
+
DatabaseCleaner.strategy = example.metadata[:js] ? :truncation : :transaction
|
37
|
+
DatabaseCleaner.start
|
38
|
+
end
|
39
|
+
|
40
|
+
config.after do
|
41
|
+
DatabaseCleaner.clean
|
42
|
+
end
|
43
|
+
|
44
|
+
config.fail_fast = ENV['FAIL_FAST'] || false
|
45
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib/', __FILE__)
|
3
|
+
$:.unshift lib unless $:.include?(lib)
|
4
|
+
|
5
|
+
require 'spree_paypal_express/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.name = 'spree_paypal_express_mutalis'
|
10
|
+
s.version = SpreePayPalExpress::VERSION
|
11
|
+
s.summary = 'Adds PayPal Express as a Payment Method to Spree Commerce'
|
12
|
+
s.description = s.summary
|
13
|
+
s.required_ruby_version = '>= 1.9.3'
|
14
|
+
|
15
|
+
s.author = 'Spree Commerce'
|
16
|
+
s.email = 'gems@spreecommerce.com'
|
17
|
+
s.homepage = 'http://www.spreecommerce.com'
|
18
|
+
s.license = %q{BSD-3}
|
19
|
+
|
20
|
+
s.files = `git ls-files`.split("\n")
|
21
|
+
s.test_files = `git ls-files -- spec/*`.split("\n")
|
22
|
+
s.require_path = 'lib'
|
23
|
+
s.requirements << 'none'
|
24
|
+
|
25
|
+
|
26
|
+
s.add_dependency 'spree_core', '~> 2.1.0'
|
27
|
+
s.add_dependency 'paypal-sdk-merchant', '1.103.0'
|
28
|
+
|
29
|
+
s.add_development_dependency 'capybara', '~> 2.1'
|
30
|
+
s.add_development_dependency 'coffee-rails'
|
31
|
+
s.add_development_dependency 'database_cleaner'
|
32
|
+
s.add_development_dependency 'factory_girl', '~> 4.2'
|
33
|
+
s.add_development_dependency 'ffaker'
|
34
|
+
s.add_development_dependency 'rspec-rails', '~> 2.13'
|
35
|
+
s.add_development_dependency 'sass-rails'
|
36
|
+
s.add_development_dependency 'selenium-webdriver'
|
37
|
+
s.add_development_dependency 'simplecov'
|
38
|
+
s.add_development_dependency 'pry'
|
39
|
+
end
|
metadata
ADDED
@@ -0,0 +1,253 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: spree_paypal_express_mutalis
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.0.4
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Spree Commerce
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-10-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: spree_core
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.1.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.1.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: paypal-sdk-merchant
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.103.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.103.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: capybara
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.1'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.1'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: coffee-rails
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ! '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: database_cleaner
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ! '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ! '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: factory_girl
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ~>
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '4.2'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ~>
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '4.2'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: ffaker
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ! '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ! '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rspec-rails
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ~>
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '2.13'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ~>
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '2.13'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: sass-rails
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ! '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ! '>='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: selenium-webdriver
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ! '>='
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ! '>='
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: simplecov
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ! '>='
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ! '>='
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: pry
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ! '>='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ! '>='
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
181
|
+
description: Adds PayPal Express as a Payment Method to Spree Commerce
|
182
|
+
email: gems@spreecommerce.com
|
183
|
+
executables: []
|
184
|
+
extensions: []
|
185
|
+
extra_rdoc_files: []
|
186
|
+
files:
|
187
|
+
- .gitignore
|
188
|
+
- .rspec
|
189
|
+
- .travis.yml
|
190
|
+
- CONTRIBUTING.md
|
191
|
+
- Gemfile
|
192
|
+
- LICENSE.md
|
193
|
+
- README.md
|
194
|
+
- Rakefile
|
195
|
+
- app/assets/javascripts/admin/spree_paypal_express.js
|
196
|
+
- app/assets/javascripts/store/spree_paypal_express.js
|
197
|
+
- app/assets/stylesheets/admin/spree_paypal_express.css
|
198
|
+
- app/assets/stylesheets/store/spree_paypal_express.css
|
199
|
+
- app/controllers/spree/admin/payments_controller_decorator.rb
|
200
|
+
- app/controllers/spree/admin/paypal_payments_controller.rb
|
201
|
+
- app/controllers/spree/paypal_controller.rb
|
202
|
+
- app/models/spree/gateway/pay_pal_express.rb
|
203
|
+
- app/models/spree/paypal_express_checkout.rb
|
204
|
+
- app/views/spree/admin/payments/_paypal_complete.html.erb
|
205
|
+
- app/views/spree/admin/payments/paypal_refund.html.erb
|
206
|
+
- app/views/spree/admin/payments/source_forms/_paypal.html.erb
|
207
|
+
- app/views/spree/admin/payments/source_views/_paypal.html.erb
|
208
|
+
- app/views/spree/checkout/payment/_paypal.html.erb
|
209
|
+
- config/locales/en.yml
|
210
|
+
- config/routes.rb
|
211
|
+
- db/migrate/20130723042610_create_spree_paypal_express_checkouts.rb
|
212
|
+
- db/migrate/20130808030836_add_transaction_id_to_spree_paypal_express_checkouts.rb
|
213
|
+
- db/migrate/20130809013846_add_state_to_spree_paypal_express_checkouts.rb
|
214
|
+
- db/migrate/20130809014319_add_refunded_fields_to_spree_paypal_express_checkouts.rb
|
215
|
+
- lib/generators/spree_paypal_express/install/install_generator.rb
|
216
|
+
- lib/spree_paypal_express.rb
|
217
|
+
- lib/spree_paypal_express/engine.rb
|
218
|
+
- lib/spree_paypal_express/factories.rb
|
219
|
+
- lib/spree_paypal_express/version.rb
|
220
|
+
- script/rails
|
221
|
+
- spec/features/paypal_spec.rb
|
222
|
+
- spec/models/pay_pal_express_spec.rb
|
223
|
+
- spec/spec_helper.rb
|
224
|
+
- spree_paypal_express.gemspec
|
225
|
+
homepage: http://www.spreecommerce.com
|
226
|
+
licenses:
|
227
|
+
- BSD-3
|
228
|
+
metadata: {}
|
229
|
+
post_install_message:
|
230
|
+
rdoc_options: []
|
231
|
+
require_paths:
|
232
|
+
- lib
|
233
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
234
|
+
requirements:
|
235
|
+
- - ! '>='
|
236
|
+
- !ruby/object:Gem::Version
|
237
|
+
version: 1.9.3
|
238
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
239
|
+
requirements:
|
240
|
+
- - ! '>='
|
241
|
+
- !ruby/object:Gem::Version
|
242
|
+
version: '0'
|
243
|
+
requirements:
|
244
|
+
- none
|
245
|
+
rubyforge_project:
|
246
|
+
rubygems_version: 2.0.3
|
247
|
+
signing_key:
|
248
|
+
specification_version: 4
|
249
|
+
summary: Adds PayPal Express as a Payment Method to Spree Commerce
|
250
|
+
test_files:
|
251
|
+
- spec/features/paypal_spec.rb
|
252
|
+
- spec/models/pay_pal_express_spec.rb
|
253
|
+
- spec/spec_helper.rb
|