lib/active_merchant/billing/gateways/pay_junction.rb in activemerchant-1.4.1 vs lib/active_merchant/billing/gateways/pay_junction.rb in activemerchant-1.4.2

- old
+ new

@@ -96,12 +96,16 @@ # # See example use above for address AVS fields # See #recurring for periodic transaction fields class PayJunctionGateway < Gateway API_VERSION = '1.2' - URL = 'https://payjunction.com/quick_link' # also handles test requests - + + class_inheritable_accessor :test_url, :live_url + + self.test_url = "https://demo.payjunction.com/quick_link" + self.live_url = "https://payjunction.com/quick_link" + TEST_LOGIN = 'pj-ql-01' TEST_PASSWORD = 'pj-ql-01p' SUCCESS_CODES = ["00", "85"] SUCCESS_MESSAGE = 'The transaction was approved.' @@ -316,10 +320,12 @@ params[:notes] = options[:description] unless options[:description].blank? params[:invoice] = options[:order_id].to_s.gsub(/[^-\/\w.,']/, '') unless options[:order_id].blank? end def commit(action, parameters) - response = parse( ssl_post(URL, post_data(action, parameters)) ) + url = test? ? self.test_url : self.live_url + + response = parse( ssl_post(url, post_data(action, parameters)) ) Response.new(successful?(response), message_from(response), response, :test => test?, :authorization => response[:transaction_id] || parameters[:transaction_id] ) \ No newline at end of file