-
Notifications
You must be signed in to change notification settings - Fork 438
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #259 from WebGents/add_quickpay_support
Add support for the QuickPay gateway
- Loading branch information
Showing
6 changed files
with
63 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module Spree | ||
class Gateway::Quickpay < Gateway | ||
preference :api_key, :string | ||
|
||
def provider_class | ||
ActiveMerchant::Billing::QuickpayV10Gateway | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
require 'spec_helper' | ||
|
||
describe Spree::Gateway::Quickpay do | ||
let(:gateway) { described_class.create!(name: 'QuickpayGateway') } | ||
|
||
context '.provider_class' do | ||
it 'is a Quickpay gateway' do | ||
expect(gateway.provider_class).to eq ::ActiveMerchant::Billing::QuickpayV10Gateway | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
module WaitForStripe | ||
def wait_for_stripe | ||
Timeout.timeout(Capybara.default_max_wait_time) do | ||
loop until page.evaluate_script('window.activeStripeRequests').zero? | ||
end | ||
end | ||
|
||
def setup_stripe_watcher | ||
page.evaluate_script <<-JS | ||
window.activeStripeRequests = 0; | ||
$('#checkout_form_payment [data-hook=buttons]').on('click', function() { | ||
window.activeStripeRequests = window.activeStripeRequests + 1; | ||
}); | ||
stripeResponseHandler = (function() { | ||
var _f = stripeResponseHandler; | ||
return function() { | ||
window.activeStripeRequests = window.activeStripeRequests - 1; | ||
_f.apply(this, arguments); | ||
} | ||
})(); | ||
JS | ||
end | ||
end | ||
|
||
RSpec.configure do |config| | ||
config.include WaitForStripe, type: :feature | ||
end |