test/unit/gateways/payflow_express_test.rb in activemerchant-1.3.2 vs test/unit/gateways/payflow_express_test.rb in activemerchant-1.4.0
- old
+ new
@@ -1,8 +1,14 @@
require File.dirname(__FILE__) + '/../../test_helper'
class PayflowExpressTest < Test::Unit::TestCase
+ TEST_REDIRECT_URL = 'https://test-expresscheckout.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=1234567890'
+ LIVE_REDIRECT_URL = 'https://www.paypal.com/cgibin/webscr?cmd=_express-checkout&token=1234567890'
+
+ TEST_REDIRECT_URL_WITHOUT_REVIEW = "#{TEST_REDIRECT_URL}&useraction=commit"
+ LIVE_REDIRECT_URL_WITHOUT_REVIEW = "#{LIVE_REDIRECT_URL}&useraction=commit"
+
def setup
Base.gateway_mode = :test
@gateway = PayflowExpressGateway.new(
:login => 'LOGIN',
@@ -51,14 +57,24 @@
assert !gateway.test?
end
def test_live_redirect_url
Base.gateway_mode = :production
- assert_equal 'https://www.paypal.com/cgibin/webscr?cmd=_express-checkout&token=1234567890', @gateway.redirect_url_for('1234567890')
+ assert_equal LIVE_REDIRECT_URL, @gateway.redirect_url_for('1234567890')
end
def test_test_redirect_url
- assert_equal 'https://test-expresscheckout.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=1234567890', @gateway.redirect_url_for('1234567890')
+ assert_equal TEST_REDIRECT_URL, @gateway.redirect_url_for('1234567890')
+ end
+
+ def test_live_redirect_url_without_review
+ Base.gateway_mode = :production
+ assert_equal LIVE_REDIRECT_URL_WITHOUT_REVIEW, @gateway.redirect_url_for('1234567890', :review => false)
+ end
+
+ def test_test_redirect_url_without_review
+ assert_equal :test, Base.gateway_mode
+ assert_equal TEST_REDIRECT_URL_WITHOUT_REVIEW, @gateway.redirect_url_for('1234567890', :review => false)
end
def test_invalid_get_express_details_request
@gateway.expects(:ssl_post).returns(invalid_get_express_details_response)
response = @gateway.details_for('EC-2OPN7UJGFWK9OYFV')