spree_gateway 3.1.0 → 3.2.0.beta
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 +4 -4
- data/.travis.yml +1 -1
- data/app/models/spree/gateway/quickpay.rb +9 -0
- data/lib/controllers/frontend/spree/checkout_controller_decorator.rb +1 -1
- data/lib/spree_gateway.rb +1 -2
- data/lib/spree_gateway/engine.rb +1 -0
- data/spec/features/stripe_checkout_spec.rb +29 -15
- data/spec/models/gateway/braintree_gateway_spec.rb +30 -71
- data/spec/models/gateway/pin_gateway_spec.rb +1 -1
- data/spec/models/gateway/quickpay_spec.rb +11 -0
- data/spec/models/gateway/usa_epay_transaction_spec.rb +1 -1
- data/spec/spec_helper.rb +13 -2
- data/spec/support/wait_for_stripe.rb +27 -0
- data/spree_gateway.gemspec +10 -7
- metadata +68 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de80caa4522285cd27f1a301ef97b5c8a55b97ac
|
4
|
+
data.tar.gz: b845e06202782fa21dc24ee638037dfc8dab433d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48adbc9c754c4ee9bf87577fc7f7ececb41c0bf04e4a938b24b4ff2876fba318f9b6fbf07974e1cdafc01316cc15d3668dd4aa909899dac2646520bc12cee1ba
|
7
|
+
data.tar.gz: 899026855249b287e02426298925d293d03f375d60155543c076560d88b506160107857a7f5e5df79e0cb2cc245d4b15e1f6f8ab5a5ab8db784ef6abe0f84751
|
data/.travis.yml
CHANGED
data/lib/spree_gateway.rb
CHANGED
data/lib/spree_gateway/engine.rb
CHANGED
@@ -25,6 +25,7 @@ module SpreeGateway
|
|
25
25
|
app.config.spree.payment_methods << Spree::Gateway::PayflowPro
|
26
26
|
app.config.spree.payment_methods << Spree::Gateway::Paymill
|
27
27
|
app.config.spree.payment_methods << Spree::Gateway::PinGateway
|
28
|
+
app.config.spree.payment_methods << Spree::Gateway::Quickpay
|
28
29
|
app.config.spree.payment_methods << Spree::Gateway::SagePay
|
29
30
|
app.config.spree.payment_methods << Spree::Gateway::SecurePayAU
|
30
31
|
app.config.spree.payment_methods << Spree::Gateway::SpreedlyCoreGateway
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe "Stripe checkout" do
|
3
|
+
describe "Stripe checkout", type: :feature do
|
4
4
|
let!(:country) { create(:country, :states_required => true) }
|
5
5
|
let!(:state) { create(:state, :country => country) }
|
6
6
|
let!(:shipping_method) { create(:shipping_method) }
|
@@ -24,13 +24,20 @@ describe "Stripe checkout" do
|
|
24
24
|
|
25
25
|
order.reload
|
26
26
|
order.user = user
|
27
|
-
order.
|
27
|
+
order.update_with_updater!
|
28
28
|
|
29
29
|
Spree::CheckoutController.any_instance.stub(:current_order => order)
|
30
30
|
Spree::CheckoutController.any_instance.stub(:try_spree_current_user => user)
|
31
31
|
Spree::CheckoutController.any_instance.stub(:skip_state_validation? => true)
|
32
32
|
|
33
|
+
# Capybara should wait up to 10 seconds for async. changes to be applied
|
34
|
+
Capybara.default_max_wait_time = 10
|
35
|
+
|
33
36
|
visit spree.checkout_state_path(:payment)
|
37
|
+
begin
|
38
|
+
setup_stripe_watcher
|
39
|
+
rescue Capybara::NotSupportedByDriverError
|
40
|
+
end
|
34
41
|
end
|
35
42
|
|
36
43
|
# This will pass the CC data to the server and the StripeGateway class handles it
|
@@ -39,9 +46,9 @@ describe "Stripe checkout" do
|
|
39
46
|
fill_in "Card Code", :with => "123"
|
40
47
|
fill_in "Expiration", :with => "01 / #{Time.now.year + 1}"
|
41
48
|
click_button "Save and Continue"
|
42
|
-
page.current_url.
|
49
|
+
expect(page.current_url).to include("/checkout/confirm")
|
43
50
|
click_button "Place Order"
|
44
|
-
page.
|
51
|
+
expect(page).to have_content("Your order has been processed successfully")
|
45
52
|
end
|
46
53
|
|
47
54
|
# This will fetch a token from Stripe.com and then pass that to the webserver.
|
@@ -53,24 +60,29 @@ describe "Stripe checkout" do
|
|
53
60
|
fill_in "Card Code", :with => "123"
|
54
61
|
fill_in "Expiration", :with => "01 / #{Time.now.year + 1}"
|
55
62
|
click_button "Save and Continue"
|
56
|
-
|
57
|
-
page.
|
63
|
+
wait_for_stripe # Wait for Stripe API to return + form to submit
|
64
|
+
expect(page).to have_css('#checkout_form_confirm')
|
65
|
+
expect(page.current_url).to include("/checkout/confirm")
|
58
66
|
click_button "Place Order"
|
59
|
-
page.
|
67
|
+
expect(page).to have_content("Your order has been processed successfully")
|
60
68
|
end
|
61
69
|
|
62
70
|
it "shows an error with an invalid credit card number", :js => true do
|
71
|
+
# Card number is NOT valid. Fails Luhn checksum
|
72
|
+
fill_in "Card Number", :with => "4242 4242 4242 4249"
|
63
73
|
click_button "Save and Continue"
|
64
|
-
|
65
|
-
page.
|
74
|
+
wait_for_stripe
|
75
|
+
expect(page).to have_content("Your card number is incorrect")
|
76
|
+
expect(page).to have_css('.has-error #card_number.error')
|
66
77
|
end
|
67
78
|
|
68
79
|
it "shows an error with invalid security fields", :js => true do
|
69
80
|
fill_in "Card Number", :with => "4242 4242 4242 4242"
|
70
81
|
fill_in "Expiration", :with => "01 / #{Time.now.year + 1}"
|
71
82
|
click_button "Save and Continue"
|
72
|
-
|
73
|
-
page.
|
83
|
+
wait_for_stripe
|
84
|
+
expect(page).to have_content("Your card's security code is invalid.")
|
85
|
+
expect(page).to have_css('.has-error #card_code.error')
|
74
86
|
end
|
75
87
|
|
76
88
|
it "shows an error with invalid expiry month field", :js => true do
|
@@ -78,8 +90,9 @@ describe "Stripe checkout" do
|
|
78
90
|
fill_in "Expiration", :with => "00 / #{Time.now.year + 1}"
|
79
91
|
fill_in "Card Code", :with => "123"
|
80
92
|
click_button "Save and Continue"
|
81
|
-
|
82
|
-
page.
|
93
|
+
wait_for_stripe
|
94
|
+
expect(page).to have_content("Your card's expiration month is invalid.")
|
95
|
+
expect(page).to have_css('.has-error #card_expiry.error')
|
83
96
|
end
|
84
97
|
|
85
98
|
it "shows an error with invalid expiry year field", :js => true do
|
@@ -87,7 +100,8 @@ describe "Stripe checkout" do
|
|
87
100
|
fill_in "Expiration", :with => "12 / "
|
88
101
|
fill_in "Card Code", :with => "123"
|
89
102
|
click_button "Save and Continue"
|
90
|
-
|
91
|
-
page.
|
103
|
+
wait_for_stripe
|
104
|
+
expect(page).to have_content("Your card's expiration year is invalid.")
|
105
|
+
expect(page).to have_css('.has-error #card_expiry.error')
|
92
106
|
end
|
93
107
|
end
|
@@ -2,6 +2,9 @@ require 'spec_helper'
|
|
2
2
|
require 'pry'
|
3
3
|
|
4
4
|
describe Spree::Gateway::BraintreeGateway do
|
5
|
+
let!(:country) { create(:country, name: 'United States', iso_name: 'UNITED STATES', iso3: 'USA', iso: 'US', numcode: 840) }
|
6
|
+
let!(:state) { create(:state, name: 'Maryland', abbr: 'MD', country: country) }
|
7
|
+
let!(:address) { create(:address, firstname: 'John', lastname: 'Doe', address1: '1234 My Street', address2: 'Apt 1', city: 'Washington DC', zipcode: '20123', phone: '(555)555-5555', state: state, country: country) }
|
5
8
|
|
6
9
|
before do
|
7
10
|
Spree::Gateway.update_all(active: false)
|
@@ -15,22 +18,8 @@ describe Spree::Gateway::BraintreeGateway do
|
|
15
18
|
@gateway.save!
|
16
19
|
|
17
20
|
with_payment_profiles_off do
|
18
|
-
country = create(:country, name: 'United States', iso_name: 'UNITED STATES', iso3: 'USA', iso: 'US', numcode: 840)
|
19
|
-
state = create(:state, name: 'Maryland', abbr: 'MD', country: country)
|
20
|
-
address = create(:address,
|
21
|
-
firstname: 'John',
|
22
|
-
lastname: 'Doe',
|
23
|
-
address1: '1234 My Street',
|
24
|
-
address2: 'Apt 1',
|
25
|
-
city: 'Washington DC',
|
26
|
-
zipcode: '20123',
|
27
|
-
phone: '(555)555-5555',
|
28
|
-
state: state,
|
29
|
-
country: country
|
30
|
-
)
|
31
|
-
|
32
21
|
order = create(:order_with_totals, bill_address: address, ship_address: address)
|
33
|
-
order.
|
22
|
+
order.update_with_updater!
|
34
23
|
|
35
24
|
# Use a valid CC from braintree sandbox: https://www.braintreepayments.com/docs/ruby/reference/sandbox
|
36
25
|
|
@@ -48,23 +37,8 @@ describe Spree::Gateway::BraintreeGateway do
|
|
48
37
|
|
49
38
|
describe 'payment profile creation' do
|
50
39
|
before do
|
51
|
-
country = create(:country, name: 'United States', iso_name: 'UNITED STATES', iso3: 'USA', iso: 'US', numcode: 840)
|
52
|
-
state = create(:state, name: 'Maryland', abbr: 'MD', country: country)
|
53
|
-
address = create(:address,
|
54
|
-
firstname: 'John',
|
55
|
-
lastname: 'Doe',
|
56
|
-
address1: '1234 My Street',
|
57
|
-
address2: 'Apt 1',
|
58
|
-
city: 'Washington DC',
|
59
|
-
zipcode: '20123',
|
60
|
-
phone: '(555)555-5555',
|
61
|
-
state: state,
|
62
|
-
country: country
|
63
|
-
)
|
64
|
-
@address = address
|
65
|
-
|
66
40
|
order = create(:order_with_totals, bill_address: address, ship_address: address)
|
67
|
-
order.
|
41
|
+
order.update_with_updater!
|
68
42
|
|
69
43
|
@credit_card = create(:credit_card,
|
70
44
|
verification_value: '123',
|
@@ -82,12 +56,12 @@ describe Spree::Gateway::BraintreeGateway do
|
|
82
56
|
remote_customer = @gateway.provider.instance_variable_get(:@braintree_gateway).customer.find(@credit_card.gateway_customer_profile_id)
|
83
57
|
remote_address = remote_customer.addresses.first rescue nil
|
84
58
|
expect(remote_address).not_to be_nil
|
85
|
-
expect(remote_address.street_address).to eq(
|
86
|
-
expect(remote_address.extended_address).to eq(
|
87
|
-
expect(remote_address.locality).to eq(
|
88
|
-
expect(remote_address.region).to eq(
|
89
|
-
expect(remote_address.country_code_alpha2).to eq(
|
90
|
-
expect(remote_address.postal_code).to eq(
|
59
|
+
expect(remote_address.street_address).to eq(address.address1)
|
60
|
+
expect(remote_address.extended_address).to eq(address.address2)
|
61
|
+
expect(remote_address.locality).to eq(address.city)
|
62
|
+
expect(remote_address.region).to eq(address.state.name)
|
63
|
+
expect(remote_address.country_code_alpha2).to eq(address.country.iso)
|
64
|
+
expect(remote_address.postal_code).to eq(address.zipcode)
|
91
65
|
end
|
92
66
|
end
|
93
67
|
|
@@ -95,23 +69,8 @@ describe Spree::Gateway::BraintreeGateway do
|
|
95
69
|
|
96
70
|
describe 'payment profile failure' do
|
97
71
|
before do
|
98
|
-
country = create(:country, name: 'United States', iso_name: 'UNITED STATES', iso3: 'USA', iso: 'US', numcode: 840)
|
99
|
-
state = create(:state, name: 'Maryland', abbr: 'MD', country: country)
|
100
|
-
address = create(:address,
|
101
|
-
firstname: 'John',
|
102
|
-
lastname: 'Doe',
|
103
|
-
address1: '1234 My Street',
|
104
|
-
address2: 'Apt 1',
|
105
|
-
city: 'Washington DC',
|
106
|
-
zipcode: '20123',
|
107
|
-
phone: '(555)555-5555',
|
108
|
-
state: state,
|
109
|
-
country: country
|
110
|
-
)
|
111
|
-
@address = address
|
112
|
-
|
113
72
|
order = create(:order_with_totals, bill_address: address, ship_address: address)
|
114
|
-
order.
|
73
|
+
order.update_with_updater!
|
115
74
|
|
116
75
|
@credit_card = create(:credit_card,
|
117
76
|
verification_value: '123',
|
@@ -212,7 +171,7 @@ describe Spree::Gateway::BraintreeGateway do
|
|
212
171
|
result = @gateway.authorize(500, @credit_card)
|
213
172
|
|
214
173
|
expect(result.success?).to be true
|
215
|
-
expect(result.authorization).to match /\A\w{6}\z/
|
174
|
+
expect(result.authorization).to match /\A\w{6,}\z/
|
216
175
|
expect(Braintree::Transaction::Status::Authorized).to eq Braintree::Transaction.find(result.authorization).status
|
217
176
|
end
|
218
177
|
|
@@ -223,10 +182,10 @@ describe Spree::Gateway::BraintreeGateway do
|
|
223
182
|
|
224
183
|
@payment.process!
|
225
184
|
expect(@payment.log_entries.size).to eq(1)
|
226
|
-
expect(@payment.
|
185
|
+
expect(@payment.transaction_id).to match /\A\w{6,}\z/
|
227
186
|
expect(@payment.state).to eq 'pending'
|
228
187
|
|
229
|
-
transaction = ::Braintree::Transaction.find(@payment.
|
188
|
+
transaction = ::Braintree::Transaction.find(@payment.transaction_id)
|
230
189
|
expect(transaction.status).to eq Braintree::Transaction::Status::Authorized
|
231
190
|
|
232
191
|
card_number = @credit_card.number[0..5] + '******' + @credit_card.number[-4..-1]
|
@@ -293,15 +252,15 @@ describe Spree::Gateway::BraintreeGateway do
|
|
293
252
|
it 'do capture a previous authorization' do
|
294
253
|
@payment.process!
|
295
254
|
expect(@payment.log_entries.size).to eq(1)
|
296
|
-
expect(@payment.
|
255
|
+
expect(@payment.transaction_id).to match /\A\w{6,}\z/
|
297
256
|
|
298
|
-
transaction = ::Braintree::Transaction.find(@payment.
|
257
|
+
transaction = ::Braintree::Transaction.find(@payment.transaction_id)
|
299
258
|
expect(transaction.status).to eq Braintree::Transaction::Status::Authorized
|
300
259
|
|
301
|
-
capture_result = @gateway.capture(@payment.amount, @payment.
|
260
|
+
capture_result = @gateway.capture(@payment.amount, @payment.transaction_id)
|
302
261
|
expect(capture_result.success?).to be true
|
303
262
|
|
304
|
-
transaction = ::Braintree::Transaction.find(@payment.
|
263
|
+
transaction = ::Braintree::Transaction.find(@payment.transaction_id)
|
305
264
|
expect(transaction.status).to eq Braintree::Transaction::Status::SubmittedForSettlement
|
306
265
|
end
|
307
266
|
|
@@ -312,11 +271,11 @@ describe Spree::Gateway::BraintreeGateway do
|
|
312
271
|
@payment.process!
|
313
272
|
expect(@payment.log_entries.size).to eq(1)
|
314
273
|
|
315
|
-
transaction = ::Braintree::Transaction.find(@payment.
|
274
|
+
transaction = ::Braintree::Transaction.find(@payment.transaction_id)
|
316
275
|
expect(transaction.status).to eq Braintree::Transaction::Status::Authorized
|
317
276
|
|
318
277
|
@payment.capture! # as done in PaymentsController#fire
|
319
|
-
transaction = ::Braintree::Transaction.find(@payment.
|
278
|
+
transaction = ::Braintree::Transaction.find(@payment.transaction_id)
|
320
279
|
expect(transaction.status).to eq Braintree::Transaction::Status::SubmittedForSettlement
|
321
280
|
expect(@payment.completed?).to be true
|
322
281
|
end
|
@@ -326,20 +285,20 @@ describe Spree::Gateway::BraintreeGateway do
|
|
326
285
|
it 'return a success response with an authorization code' do
|
327
286
|
result = @gateway.purchase(500, @credit_card)
|
328
287
|
expect(result.success?).to be true
|
329
|
-
expect(result.authorization).to match /\A\w{6}\z/
|
288
|
+
expect(result.authorization).to match /\A\w{6,}\z/
|
330
289
|
expect(Braintree::Transaction::Status::SubmittedForSettlement).to eq Braintree::Transaction.find(result.authorization).status
|
331
290
|
end
|
332
291
|
|
333
292
|
it 'work through the spree payment interface with payment profiles' do
|
334
293
|
purchase_using_spree_interface
|
335
|
-
transaction = ::Braintree::Transaction.find(@payment.
|
294
|
+
transaction = ::Braintree::Transaction.find(@payment.transaction_id)
|
336
295
|
expect(transaction.credit_card_details.token).not_to be_nil
|
337
296
|
end
|
338
297
|
|
339
298
|
it 'work through the spree payment interface without payment profiles' do
|
340
299
|
with_payment_profiles_off do
|
341
300
|
purchase_using_spree_interface(false)
|
342
|
-
transaction = ::Braintree::Transaction.find(@payment.
|
301
|
+
transaction = ::Braintree::Transaction.find(@payment.transaction_id)
|
343
302
|
expect(transaction.credit_card_details.token).to be_nil
|
344
303
|
end
|
345
304
|
end
|
@@ -364,9 +323,9 @@ describe Spree::Gateway::BraintreeGateway do
|
|
364
323
|
@payment.process!
|
365
324
|
|
366
325
|
expect(@payment.log_entries.size).to eq(1)
|
367
|
-
expect(@payment.
|
326
|
+
expect(@payment.transaction_id).to match /\A\w{6,}\z/
|
368
327
|
|
369
|
-
transaction = Braintree::Transaction.find(@payment.
|
328
|
+
transaction = Braintree::Transaction.find(@payment.transaction_id)
|
370
329
|
expect(transaction.status).to eq Braintree::Transaction::Status::SubmittedForSettlement
|
371
330
|
|
372
331
|
@payment.void_transaction!
|
@@ -390,9 +349,9 @@ describe Spree::Gateway::BraintreeGateway do
|
|
390
349
|
|
391
350
|
# Let's get the payment record associated with the credit
|
392
351
|
@payment = @order.payments.last
|
393
|
-
expect(@payment.
|
352
|
+
expect(@payment.transaction_id).to match /\A\w{6,}\z/
|
394
353
|
|
395
|
-
transaction = ::Braintree::Transaction.find(@payment.
|
354
|
+
transaction = ::Braintree::Transaction.find(@payment.transaction_id)
|
396
355
|
expect(transaction.type).to eq Braintree::Transaction::Type::Credit
|
397
356
|
expect(transaction.status).to eq Braintree::Transaction::Status::SubmittedForSettlement
|
398
357
|
expect(transaction.credit_card_details.masked_number).to eq '555555******4444'
|
@@ -407,10 +366,10 @@ describe Spree::Gateway::BraintreeGateway do
|
|
407
366
|
@payment.log_entries.size == 0
|
408
367
|
@payment.process! # as done in PaymentsController#create
|
409
368
|
@payment.log_entries.size == 1
|
410
|
-
expect(@payment.
|
369
|
+
expect(@payment.transaction_id).to match /\A\w{6,}\z/
|
411
370
|
expect(@payment.state).to eq 'completed'
|
412
371
|
|
413
|
-
transaction = ::Braintree::Transaction.find(@payment.
|
372
|
+
transaction = ::Braintree::Transaction.find(@payment.transaction_id)
|
414
373
|
expect(Braintree::Transaction::Status::SubmittedForSettlement).to eq transaction.status
|
415
374
|
expect(transaction.credit_card_details.masked_number).to eq '555555******4444'
|
416
375
|
expect(transaction.credit_card_details.expiration_date).to eq "09/#{Time.now.year + 1}"
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Spree::Gateway::Quickpay do
|
4
|
+
let(:gateway) { described_class.create!(name: 'QuickpayGateway') }
|
5
|
+
|
6
|
+
context '.provider_class' do
|
7
|
+
it 'is a Quickpay gateway' do
|
8
|
+
expect(gateway.provider_class).to eq ::ActiveMerchant::Billing::QuickpayV10Gateway
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -21,7 +21,7 @@ describe Spree::Gateway::UsaEpayTransaction do
|
|
21
21
|
country: country)
|
22
22
|
|
23
23
|
order = create(:order_with_totals, bill_address: address, ship_address: address)
|
24
|
-
order.
|
24
|
+
order.update_with_updater!
|
25
25
|
|
26
26
|
credit_card = create(:credit_card,
|
27
27
|
verification_value: '123',
|
data/spec/spec_helper.rb
CHANGED
@@ -10,21 +10,26 @@ require 'rspec/active_model/mocks'
|
|
10
10
|
require 'capybara/rspec'
|
11
11
|
require 'capybara/rails'
|
12
12
|
require 'capybara/poltergeist'
|
13
|
+
require 'capybara-screenshot/rspec'
|
13
14
|
require 'database_cleaner'
|
14
15
|
require 'ffaker'
|
15
16
|
require 'rspec/active_model/mocks'
|
17
|
+
require 'rails-controller-testing'
|
16
18
|
|
17
|
-
Dir[
|
19
|
+
Dir[File.join(File.dirname(__FILE__), "support", "**", "*.rb")].each { |f| require f }
|
18
20
|
|
19
21
|
require 'spree/testing_support/factories'
|
20
22
|
require 'spree/testing_support/order_walkthrough'
|
21
23
|
require 'spree/testing_support/preferences'
|
24
|
+
require 'spree/testing_support/capybara_ext'
|
22
25
|
|
23
26
|
FactoryGirl.find_definitions
|
24
27
|
|
25
28
|
RSpec.configure do |config|
|
26
29
|
config.infer_spec_type_from_file_location!
|
27
|
-
config.mock_with :rspec
|
30
|
+
config.mock_with :rspec do |mock|
|
31
|
+
mock.syntax = [:should, :expect]
|
32
|
+
end
|
28
33
|
config.raise_errors_for_deprecations!
|
29
34
|
config.use_transactional_fixtures = false
|
30
35
|
#config.filter_run focus: true
|
@@ -49,4 +54,10 @@ RSpec.configure do |config|
|
|
49
54
|
end
|
50
55
|
|
51
56
|
Capybara.javascript_driver = :poltergeist
|
57
|
+
|
58
|
+
[:controller, :view, :request].each do |type|
|
59
|
+
config.include ::Rails::Controller::Testing::TestProcess, type: type
|
60
|
+
config.include ::Rails::Controller::Testing::TemplateAssertions, type: type
|
61
|
+
config.include ::Rails::Controller::Testing::Integration, type: type
|
62
|
+
end
|
52
63
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module WaitForStripe
|
2
|
+
def wait_for_stripe
|
3
|
+
Timeout.timeout(Capybara.default_max_wait_time) do
|
4
|
+
loop until page.evaluate_script('window.activeStripeRequests').zero?
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
def setup_stripe_watcher
|
9
|
+
page.evaluate_script <<-JS
|
10
|
+
window.activeStripeRequests = 0;
|
11
|
+
$('#checkout_form_payment [data-hook=buttons]').on('click', function() {
|
12
|
+
window.activeStripeRequests = window.activeStripeRequests + 1;
|
13
|
+
});
|
14
|
+
stripeResponseHandler = (function() {
|
15
|
+
var _f = stripeResponseHandler;
|
16
|
+
return function() {
|
17
|
+
window.activeStripeRequests = window.activeStripeRequests - 1;
|
18
|
+
_f.apply(this, arguments);
|
19
|
+
}
|
20
|
+
})();
|
21
|
+
JS
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
RSpec.configure do |config|
|
26
|
+
config.include WaitForStripe, type: :feature
|
27
|
+
end
|
data/spree_gateway.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
Gem::Specification.new do |s|
|
3
3
|
s.platform = Gem::Platform::RUBY
|
4
4
|
s.name = 'spree_gateway'
|
5
|
-
s.version = '3.
|
5
|
+
s.version = '3.2.0.beta'
|
6
6
|
s.summary = 'Additional Payment Gateways for Spree Commerce'
|
7
7
|
s.description = s.summary
|
8
8
|
|
@@ -16,25 +16,28 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.require_path = 'lib'
|
17
17
|
s.requirements << 'none'
|
18
18
|
|
19
|
-
|
19
|
+
spree_version = '>= 3.1.0', '< 4.0'
|
20
|
+
s.add_dependency 'spree_core', spree_version
|
20
21
|
|
21
22
|
s.add_development_dependency 'braintree'
|
22
23
|
s.add_development_dependency 'capybara'
|
23
|
-
s.add_development_dependency '
|
24
|
-
s.add_development_dependency '
|
25
|
-
s.add_development_dependency '
|
24
|
+
s.add_development_dependency 'capybara-screenshot'
|
25
|
+
s.add_development_dependency 'coffee-rails'
|
26
|
+
s.add_development_dependency 'database_cleaner'
|
27
|
+
s.add_development_dependency 'factory_girl'
|
26
28
|
s.add_development_dependency 'ffaker'
|
27
29
|
s.add_development_dependency 'guard-rspec'
|
28
30
|
s.add_development_dependency 'launchy'
|
29
31
|
s.add_development_dependency 'mysql2'
|
30
32
|
s.add_development_dependency 'pg'
|
31
|
-
s.add_development_dependency 'poltergeist'
|
33
|
+
s.add_development_dependency 'poltergeist'
|
32
34
|
s.add_development_dependency 'pry'
|
33
35
|
s.add_development_dependency 'rspec-activemodel-mocks'
|
34
|
-
s.add_development_dependency 'rspec-rails'
|
36
|
+
s.add_development_dependency 'rspec-rails'
|
35
37
|
s.add_development_dependency 'bootstrap-sass', '>= 3.3.5.1'
|
36
38
|
s.add_development_dependency 'sass-rails', '>= 3.2'
|
37
39
|
s.add_development_dependency 'selenium-webdriver'
|
38
40
|
s.add_development_dependency 'simplecov'
|
39
41
|
s.add_development_dependency 'sqlite3'
|
42
|
+
s.add_development_dependency 'rails-controller-testing'
|
40
43
|
end
|
metadata
CHANGED
@@ -1,29 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_gateway
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.2.0.beta
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Spree Commerce
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: spree_core
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 3.1.0
|
20
|
+
- - "<"
|
18
21
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
22
|
+
version: '4.0'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 3.1.0
|
30
|
+
- - "<"
|
25
31
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
32
|
+
version: '4.0'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: braintree
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,48 +58,62 @@ dependencies:
|
|
52
58
|
- - ">="
|
53
59
|
- !ruby/object:Gem::Version
|
54
60
|
version: '0'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: capybara-screenshot
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
55
75
|
- !ruby/object:Gem::Dependency
|
56
76
|
name: coffee-rails
|
57
77
|
requirement: !ruby/object:Gem::Requirement
|
58
78
|
requirements:
|
59
|
-
- - "
|
79
|
+
- - ">="
|
60
80
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
81
|
+
version: '0'
|
62
82
|
type: :development
|
63
83
|
prerelease: false
|
64
84
|
version_requirements: !ruby/object:Gem::Requirement
|
65
85
|
requirements:
|
66
|
-
- - "
|
86
|
+
- - ">="
|
67
87
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
88
|
+
version: '0'
|
69
89
|
- !ruby/object:Gem::Dependency
|
70
90
|
name: database_cleaner
|
71
91
|
requirement: !ruby/object:Gem::Requirement
|
72
92
|
requirements:
|
73
|
-
- -
|
93
|
+
- - ">="
|
74
94
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
95
|
+
version: '0'
|
76
96
|
type: :development
|
77
97
|
prerelease: false
|
78
98
|
version_requirements: !ruby/object:Gem::Requirement
|
79
99
|
requirements:
|
80
|
-
- -
|
100
|
+
- - ">="
|
81
101
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
102
|
+
version: '0'
|
83
103
|
- !ruby/object:Gem::Dependency
|
84
104
|
name: factory_girl
|
85
105
|
requirement: !ruby/object:Gem::Requirement
|
86
106
|
requirements:
|
87
|
-
- - "
|
107
|
+
- - ">="
|
88
108
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
109
|
+
version: '0'
|
90
110
|
type: :development
|
91
111
|
prerelease: false
|
92
112
|
version_requirements: !ruby/object:Gem::Requirement
|
93
113
|
requirements:
|
94
|
-
- - "
|
114
|
+
- - ">="
|
95
115
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
116
|
+
version: '0'
|
97
117
|
- !ruby/object:Gem::Dependency
|
98
118
|
name: ffaker
|
99
119
|
requirement: !ruby/object:Gem::Requirement
|
@@ -168,16 +188,16 @@ dependencies:
|
|
168
188
|
name: poltergeist
|
169
189
|
requirement: !ruby/object:Gem::Requirement
|
170
190
|
requirements:
|
171
|
-
- - "
|
191
|
+
- - ">="
|
172
192
|
- !ruby/object:Gem::Version
|
173
|
-
version:
|
193
|
+
version: '0'
|
174
194
|
type: :development
|
175
195
|
prerelease: false
|
176
196
|
version_requirements: !ruby/object:Gem::Requirement
|
177
197
|
requirements:
|
178
|
-
- - "
|
198
|
+
- - ">="
|
179
199
|
- !ruby/object:Gem::Version
|
180
|
-
version:
|
200
|
+
version: '0'
|
181
201
|
- !ruby/object:Gem::Dependency
|
182
202
|
name: pry
|
183
203
|
requirement: !ruby/object:Gem::Requirement
|
@@ -210,16 +230,16 @@ dependencies:
|
|
210
230
|
name: rspec-rails
|
211
231
|
requirement: !ruby/object:Gem::Requirement
|
212
232
|
requirements:
|
213
|
-
- - "
|
233
|
+
- - ">="
|
214
234
|
- !ruby/object:Gem::Version
|
215
|
-
version: '
|
235
|
+
version: '0'
|
216
236
|
type: :development
|
217
237
|
prerelease: false
|
218
238
|
version_requirements: !ruby/object:Gem::Requirement
|
219
239
|
requirements:
|
220
|
-
- - "
|
240
|
+
- - ">="
|
221
241
|
- !ruby/object:Gem::Version
|
222
|
-
version: '
|
242
|
+
version: '0'
|
223
243
|
- !ruby/object:Gem::Dependency
|
224
244
|
name: bootstrap-sass
|
225
245
|
requirement: !ruby/object:Gem::Requirement
|
@@ -290,6 +310,20 @@ dependencies:
|
|
290
310
|
- - ">="
|
291
311
|
- !ruby/object:Gem::Version
|
292
312
|
version: '0'
|
313
|
+
- !ruby/object:Gem::Dependency
|
314
|
+
name: rails-controller-testing
|
315
|
+
requirement: !ruby/object:Gem::Requirement
|
316
|
+
requirements:
|
317
|
+
- - ">="
|
318
|
+
- !ruby/object:Gem::Version
|
319
|
+
version: '0'
|
320
|
+
type: :development
|
321
|
+
prerelease: false
|
322
|
+
version_requirements: !ruby/object:Gem::Requirement
|
323
|
+
requirements:
|
324
|
+
- - ">="
|
325
|
+
- !ruby/object:Gem::Version
|
326
|
+
version: '0'
|
293
327
|
description: Additional Payment Gateways for Spree Commerce
|
294
328
|
email: gems@spreecommerce.com
|
295
329
|
executables: []
|
@@ -325,6 +359,7 @@ files:
|
|
325
359
|
- app/models/spree/gateway/payflow_pro.rb
|
326
360
|
- app/models/spree/gateway/paymill.rb
|
327
361
|
- app/models/spree/gateway/pin_gateway.rb
|
362
|
+
- app/models/spree/gateway/quickpay.rb
|
328
363
|
- app/models/spree/gateway/sage_pay.rb
|
329
364
|
- app/models/spree/gateway/secure_pay_au.rb
|
330
365
|
- app/models/spree/gateway/spreedly_core_gateway.rb
|
@@ -385,6 +420,7 @@ files:
|
|
385
420
|
- spec/models/gateway/payflow_pro_spec.rb
|
386
421
|
- spec/models/gateway/paymill_spec.rb
|
387
422
|
- spec/models/gateway/pin_gateway_spec.rb
|
423
|
+
- spec/models/gateway/quickpay_spec.rb
|
388
424
|
- spec/models/gateway/sage_pay_spec.rb
|
389
425
|
- spec/models/gateway/secure_pay_au_spec.rb
|
390
426
|
- spec/models/gateway/stripe_gateway_spec.rb
|
@@ -392,6 +428,7 @@ files:
|
|
392
428
|
- spec/models/gateway/worldpay_spec.rb
|
393
429
|
- spec/models/skrill_transaction_spec.rb
|
394
430
|
- spec/spec_helper.rb
|
431
|
+
- spec/support/wait_for_stripe.rb
|
395
432
|
- spree_gateway.gemspec
|
396
433
|
homepage: http://www.spreecommerce.com
|
397
434
|
licenses:
|
@@ -408,13 +445,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
408
445
|
version: '0'
|
409
446
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
410
447
|
requirements:
|
411
|
-
- - "
|
448
|
+
- - ">"
|
412
449
|
- !ruby/object:Gem::Version
|
413
|
-
version:
|
450
|
+
version: 1.3.1
|
414
451
|
requirements:
|
415
452
|
- none
|
416
453
|
rubyforge_project:
|
417
|
-
rubygems_version: 2.
|
454
|
+
rubygems_version: 2.5.1
|
418
455
|
signing_key:
|
419
456
|
specification_version: 4
|
420
457
|
summary: Additional Payment Gateways for Spree Commerce
|
@@ -444,6 +481,7 @@ test_files:
|
|
444
481
|
- spec/models/gateway/payflow_pro_spec.rb
|
445
482
|
- spec/models/gateway/paymill_spec.rb
|
446
483
|
- spec/models/gateway/pin_gateway_spec.rb
|
484
|
+
- spec/models/gateway/quickpay_spec.rb
|
447
485
|
- spec/models/gateway/sage_pay_spec.rb
|
448
486
|
- spec/models/gateway/secure_pay_au_spec.rb
|
449
487
|
- spec/models/gateway/stripe_gateway_spec.rb
|
@@ -451,3 +489,4 @@ test_files:
|
|
451
489
|
- spec/models/gateway/worldpay_spec.rb
|
452
490
|
- spec/models/skrill_transaction_spec.rb
|
453
491
|
- spec/spec_helper.rb
|
492
|
+
- spec/support/wait_for_stripe.rb
|