Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add support for BluePay.

  • Loading branch information...
commit 99aee165ed1825c775c77549c7efb6306a1c7649 1 parent 8e6ce67
@ntalbott ntalbott authored
View
3  CHANGELOG
@@ -1,6 +1,7 @@
= ActiveMerchant CHANGELOG
-* Add QuantumGateway [Joshua Lippiner]
+* Add BluePay Gateway
+* Add Quantum Gateway [Joshua Lippiner]
* SagePayForm: Added send_email_confirmation (default false) to enable confirmation emails [wisq]
== Version 1.9.4 (Jan 5, 2011)
View
3  README.rdoc
@@ -14,6 +14,7 @@ The {ActiveMerchant Wiki}[http://github.com/Shopify/active_merchant/wikis] conta
* {Authorize.Net CIM}[http://www.authorize.net/] - US
* {Authorize.Net}[http://www.authorize.net/] - US
* {Beanstream.com}[http://www.beanstream.com/] - CA
+* {BluePay}[http://www.bluepay.com/] - US
* {Braintree}[http://www.braintreepaymentsolutions.com] - US
* {CardStream}[http://www.cardstream.com/] - GB
* {CyberSource}[http://www.cybersource.com] - US
@@ -53,7 +54,7 @@ The {ActiveMerchant Wiki}[http://github.com/Shopify/active_merchant/wikis] conta
* {Protx}[http://www.protx.com] - GB
* {Psigate}[http://www.psigate.com/] - CA
* {PSL Payment Solutions}[http://www.paymentsolutionsltd.com/] - GB
-* {Quantum Gateway}[http://www.quantumgateway.com] - US
+* {Quantum}[http://www.quantumgateway.com] - US
* {Quickpay}[http://quickpay.dk/] - DK
* {Rabobank Nederland}[http://www.rabobank.nl/] - NL
* {Realex}[http://www.realexpayments.com/] - IE, GB
View
2  lib/active_merchant/billing/gateways/authorize_net.rb
@@ -373,7 +373,7 @@ def message_from(results)
return AVSResult.messages[ results[:avs_result_code] ] if AVS_ERRORS.include?(results[:avs_result_code])
end
- return results[:response_reason_text].nil? ? '' : results[:response_reason_text][0..-2]
+ return results[:response_reason_text].nil? ? '' : results[:response_reason_text].chomp('.')
end
def expdate(creditcard)
View
11 lib/active_merchant/billing/gateways/blue_pay.rb
@@ -0,0 +1,11 @@
+module ActiveMerchant #:nodoc:
+ module Billing #:nodoc:
+ class BluePayGateway < AuthorizeNetGateway
+ self.test_url = "https://secure.bluepay.com/interfaces/a.net.test"
+ self.live_url = "https://secure.bluepay.com/interfaces/a.net"
+ self.homepage_url = 'http://www.bluepay.com/'
+ self.display_name = 'BluePay'
+ end
+ end
+end
+
View
4 test/fixtures.yml
@@ -24,6 +24,10 @@ beanstream_interac:
user: username
password: password
+blue_pay:
+ login: X
+ password: Y
+
braintree_orange:
login: demo
password: password
View
105 test/remote/gateways/remote_blue_pay_test.rb
@@ -0,0 +1,105 @@
+require 'test_helper'
+
+class RemoteBluePayTest < Test::Unit::TestCase
+ def setup
+ @gateway = BluePayGateway.new(fixtures(:blue_pay))
+ @amount = 100
+ @credit_card = credit_card('4242424242424242')
+ @options = {
+ :order_id => generate_unique_id,
+ :billing_address => address,
+ :description => 'Store purchase'
+ }
+ end
+
+ def test_successful_purchase
+ assert response = @gateway.purchase(@amount, @credit_card, @options)
+ assert_success response
+ assert response.test?
+ assert_equal 'Approved Sale', response.message
+ assert response.authorization
+ end
+
+ def test_expired_credit_card
+ @credit_card.year = 2004
+ assert response = @gateway.purchase(@amount, @credit_card, @options)
+ assert_failure response
+ assert response.test?
+ assert_equal 'Card Expired', response.message
+ end
+
+ def test_forced_test_mode_purchase
+ gateway = BluePayGateway.new(fixtures(:blue_pay).update(:test => true))
+ assert response = gateway.purchase(@amount, @credit_card, @options)
+ assert_success response
+ assert response.test?
+ assert response.authorization
+ end
+
+ def test_successful_authorization
+ assert response = @gateway.authorize(@amount, @credit_card, @options)
+ assert_success response
+ assert_equal 'Approved Auth', response.message
+ assert response.authorization
+ end
+
+ def test_authorization_and_capture
+ assert authorization = @gateway.authorize(@amount, @credit_card, @options)
+ assert_success authorization
+
+ assert capture = @gateway.capture(@amount, authorization.authorization)
+ assert_success capture
+ assert_equal 'Approved Capture', capture.message
+ end
+
+ def test_authorization_and_void
+ assert authorization = @gateway.authorize(@amount, @credit_card, @options)
+ assert_success authorization
+
+ assert void = @gateway.void(authorization.authorization)
+ assert_success void
+ assert_equal 'Approved Void', void.message
+ end
+
+ def test_bad_login
+ gateway = AuthorizeNetGateway.new(
+ :login => 'X',
+ :password => 'Y'
+ )
+
+ assert response = gateway.purchase(@amount, @credit_card)
+
+ assert_equal Response, response.class
+ assert_equal ["avs_result_code",
+ "card_code",
+ "response_code",
+ "response_reason_code",
+ "response_reason_text",
+ "transaction_id"], response.params.keys.sort
+
+ assert_match(/The merchant login ID or password is invalid/, response.message)
+
+ assert_equal false, response.success?
+ end
+
+ def test_using_test_request
+ gateway = AuthorizeNetGateway.new(
+ :login => 'X',
+ :password => 'Y'
+ )
+
+ assert response = gateway.purchase(@amount, @credit_card)
+
+ assert_equal Response, response.class
+ assert_equal ["avs_result_code",
+ "card_code",
+ "response_code",
+ "response_reason_code",
+ "response_reason_text",
+ "transaction_id"], response.params.keys.sort
+
+ assert_match(/The merchant login ID or password is invalid/, response.message)
+
+ assert_equal false, response.success?
+ end
+end
View
4 test/unit/gateways/authorize_net_test.rb
@@ -75,14 +75,14 @@ def test_add_description
def test_add_duplicate_window_without_duplicate_window
result = {}
- ActiveMerchant::Billing::AuthorizeNetGateway.duplicate_window = nil
+ @gateway.class.duplicate_window = nil
@gateway.send(:add_duplicate_window, result)
assert_nil result[:duplicate_window]
end
def test_add_duplicate_window_with_duplicate_window
result = {}
- ActiveMerchant::Billing::AuthorizeNetGateway.duplicate_window = 0
+ @gateway.class.duplicate_window = 0
@gateway.send(:add_duplicate_window, result)
assert_equal 0, result[:duplicate_window]
end
View
12 test/unit/gateways/blue_pay_test.rb
@@ -0,0 +1,12 @@
+require 'test_helper'
+require 'unit/gateways/authorize_net_test'
+
+class BluePayTest < AuthorizeNetTest
+ def setup
+ super
+ @gateway = BluePayGateway.new(
+ :login => 'X',
+ :password => 'Y'
+ )
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.