Skip to content

Commit

Permalink
WorldPay: Update endpoint URLs for offsite gateway.
Browse files Browse the repository at this point in the history
  • Loading branch information
Soleone committed Jun 6, 2011
1 parent 6553a15 commit 2989dbb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 26 deletions.
19 changes: 4 additions & 15 deletions lib/active_merchant/billing/integrations/world_pay.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,12 @@ module Billing #:nodoc:
module Integrations #:nodoc:
module WorldPay

# production and test have the same endpoint
mattr_accessor :production_url
self.production_url = 'https://select.worldpay.com/wcc/purchase'

mattr_accessor :test_url
self.test_url = 'https://select-test.worldpay.com/wcc/purchase'


self.production_url = 'https://secure.wp3.rbsworldpay.com/wcc/purchase'

def self.service_url
mode = ActiveMerchant::Billing::Base.integration_mode
case mode
when :production
production_url
when :test
test_url
else
raise StandardError, "Integration mode set to an invalid value: #{mode}"
end
production_url
end

def self.notification(post, options = {})
Expand Down
2 changes: 1 addition & 1 deletion test/remote/gateways/remote_worldpay_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class RemoteWorldpayTest < Test::Unit::TestCase


def setup
@gateway = WorldpayGateway.new(fixtures(:worldpay_gateway))
@gateway = WorldpayGateway.new(fixtures(:world_pay_gateway))

@amount = 100
@credit_card = credit_card('4111111111111111')
Expand Down
13 changes: 3 additions & 10 deletions test/unit/integrations/world_pay_module_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,14 @@ def setup
end

def test_service_url_in_test_mode
assert_equal 'https://select-test.worldpay.com/wcc/purchase', WorldPay.service_url
assert_equal 'https://secure.wp3.rbsworldpay.com/wcc/purchase', WorldPay.service_url
end

def test_service_url_in_production_mode
ActiveMerchant::Billing::Base.integration_mode = :production
assert_equal 'https://select.worldpay.com/wcc/purchase', WorldPay.service_url
assert_equal 'https://secure.wp3.rbsworldpay.com/wcc/purchase', WorldPay.service_url
end

def test_service_url_in_unknown_mode
ActiveMerchant::Billing::Base.integration_mode = :invalid_mode
assert_raises StandardError do
WorldPay.service_url
end
end


def test_notification_method
assert_instance_of WorldPay::Notification, WorldPay.notification('name=Andrew White', {})
end
Expand Down

0 comments on commit 2989dbb

Please sign in to comment.