Browse files

Renamed ProtxGateway to SagePayGateway due to rebranding; Updated end…

…point URL's.
  • Loading branch information...
1 parent 3877160 commit 65a878b9d734095ef998eab93e039d1bee30c0f1 @jstorimer jstorimer committed Jul 6, 2009
View
1 CHANGELOG
@@ -3,6 +3,7 @@
* Add support for the Antigua based FirstPay payment gateway [Phil R]
* Add support for PayPal reference transactions [kevin, John, Rahsun McAfee]
* Add support for the MerchantWARE payment gateway [cody]
+* Rename Protx to SagePay [jstorimer]
* Allow test mode for eWay gateway [Duff OMelia]
* Don't use Time.parse for the ExpiryDate [cody]
* Add support for CVV code to Authorize.net CIM [Guy Naor]
View
17 ...active_merchant/billing/gateways/protx.rb → ...ive_merchant/billing/gateways/sage_pay.rb
@@ -1,13 +1,13 @@
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
- class ProtxGateway < Gateway
+ class SagePayGateway < Gateway
cattr_accessor :simulate
self.simulate = false
- TEST_URL = 'https://ukvpstest.protx.com/vspgateway/service'
- LIVE_URL = 'https://ukvps.protx.com/vspgateway/service'
- SIMULATOR_URL = 'https://ukvpstest.protx.com/VSPSimulator'
-
+ TEST_URL = 'https://test.sagepay.com/gateway/service'
+ LIVE_URL = 'https://live.sagepay.com/gateway/service'
+ SIMULATOR_URL = 'https://test.sagepay.com/Simulator'
+
APPROVED = 'OK'
TRANSACTIONS = {
@@ -45,8 +45,8 @@ class ProtxGateway < Gateway
self.supported_countries = ['GB']
self.default_currency = 'GBP'
- self.homepage_url = 'http://www.protx.com'
- self.display_name = 'Protx'
+ self.homepage_url = 'http://www.sagepay.com'
+ self.display_name = 'SagePay'
def initialize(options = {})
requires!(options, :login)
@@ -281,7 +281,7 @@ def post_data(action, parameters = {})
parameters.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join("&")
end
- # Protx returns data in the following format
+ # SagePay returns data in the following format
# Key1=value1
# Key2=value2
def parse(body)
@@ -302,6 +302,7 @@ def parse_first_and_last_name(value)
[ first_name[0,20], last_name[0,20] ]
end
end
+ ProtxGateway = SagePayGateway
end
end
View
2 test/fixtures.yml
@@ -135,7 +135,7 @@ plugnpay:
login: LOGIN
password: PASSWORD
-protx:
+sage_pay:
login: LOGIN
# Working credentials, no need to replace
View
12 test/remote/gateways/remote_protx_test.rb → test/remote/gateways/remote_sage_pay_test.rb
@@ -1,15 +1,15 @@
require 'test_helper'
-# Some of the standard tests have been removed at Protx test
+# Some of the standard tests have been removed at SagePay test
# server is pants and accepts anything and says Status=OK. (shift)
# The tests for American Express will only pass if your account is
# American express enabled.
-class RemoteProtxTest < Test::Unit::TestCase
+class RemoteSagePayTest < Test::Unit::TestCase
# set to true to run the tests in the simulated environment
- ProtxGateway.simulate = false
+ SagePayGateway.simulate = false
def setup
- @gateway = ProtxGateway.new(fixtures(:protx))
+ @gateway = SagePayGateway.new(fixtures(:sage_pay))
@amex = CreditCard.new(
:number => '374200000000004',
@@ -201,9 +201,9 @@ def test_successful_electron_purchase
end
def test_invalid_login
- message = ProtxGateway.simulate ? 'VSP Simulator cannot find your vendor name. Ensure you have have supplied a Vendor field with your VSP Vendor name assigned to it.' : '3034 : The Vendor or VendorName value is required.'
+ message = SagePayGateway.simulate ? 'VSP Simulator cannot find your vendor name. Ensure you have have supplied a Vendor field with your VSP Vendor name assigned to it.' : '3034 : The Vendor or VendorName value is required.'
- gateway = ProtxGateway.new(
+ gateway = SagePayGateway.new(
:login => ''
)
assert response = gateway.purchase(@amount, @mastercard, @options)
View
38 test/unit/gateways/protx_test.rb → test/unit/gateways/sage_pay_test.rb
@@ -1,8 +1,8 @@
require 'test_helper'
-class ProtxTest < Test::Unit::TestCase
+class SagePayTest < Test::Unit::TestCase
def setup
- @gateway = ProtxGateway.new(
+ @gateway = SagePayGateway.new(
:login => 'X'
)
@@ -44,50 +44,50 @@ def test_unsuccessful_purchase
end
def test_purchase_url
- assert_equal 'https://ukvpstest.protx.com/vspgateway/service/vspdirect-register.vsp', @gateway.send(:url_for, :purchase)
+ assert_equal 'https://test.sagepay.com/gateway/service/vspdirect-register.vsp', @gateway.send(:url_for, :purchase)
end
def test_capture_url
- assert_equal 'https://ukvpstest.protx.com/vspgateway/service/release.vsp', @gateway.send(:url_for, :capture)
+ assert_equal 'https://test.sagepay.com/gateway/service/release.vsp', @gateway.send(:url_for, :capture)
end
def test_electron_cards
# Visa range
- assert_no_match ProtxGateway::ELECTRON, '4245180000000000'
+ assert_no_match SagePayGateway::ELECTRON, '4245180000000000'
# First electron range
- assert_match ProtxGateway::ELECTRON, '4245190000000000'
+ assert_match SagePayGateway::ELECTRON, '4245190000000000'
# Second range
- assert_match ProtxGateway::ELECTRON, '4249620000000000'
- assert_match ProtxGateway::ELECTRON, '4249630000000000'
+ assert_match SagePayGateway::ELECTRON, '4249620000000000'
+ assert_match SagePayGateway::ELECTRON, '4249630000000000'
# Third
- assert_match ProtxGateway::ELECTRON, '4508750000000000'
+ assert_match SagePayGateway::ELECTRON, '4508750000000000'
# Fourth
- assert_match ProtxGateway::ELECTRON, '4844060000000000'
- assert_match ProtxGateway::ELECTRON, '4844080000000000'
+ assert_match SagePayGateway::ELECTRON, '4844060000000000'
+ assert_match SagePayGateway::ELECTRON, '4844080000000000'
# Fifth
- assert_match ProtxGateway::ELECTRON, '4844110000000000'
- assert_match ProtxGateway::ELECTRON, '4844550000000000'
+ assert_match SagePayGateway::ELECTRON, '4844110000000000'
+ assert_match SagePayGateway::ELECTRON, '4844550000000000'
# Sixth
- assert_match ProtxGateway::ELECTRON, '4917300000000000'
- assert_match ProtxGateway::ELECTRON, '4917590000000000'
+ assert_match SagePayGateway::ELECTRON, '4917300000000000'
+ assert_match SagePayGateway::ELECTRON, '4917590000000000'
# Seventh
- assert_match ProtxGateway::ELECTRON, '4918800000000000'
+ assert_match SagePayGateway::ELECTRON, '4918800000000000'
# Visa
- assert_no_match ProtxGateway::ELECTRON, '4918810000000000'
+ assert_no_match SagePayGateway::ELECTRON, '4918810000000000'
# 19 PAN length
- assert_match ProtxGateway::ELECTRON, '4249620000000000000'
+ assert_match SagePayGateway::ELECTRON, '4249620000000000000'
# 20 PAN length
- assert_no_match ProtxGateway::ELECTRON, '42496200000000000'
+ assert_no_match SagePayGateway::ELECTRON, '42496200000000000'
end
def test_avs_result

0 comments on commit 65a878b

Please sign in to comment.