lib/active_merchant/billing/gateways/federated_canada.rb in jelaniharris-activemerchant-1.24.1 vs lib/active_merchant/billing/gateways/federated_canada.rb in jelaniharris-activemerchant-1.29.1

- old
+ new

@@ -1,10 +1,10 @@ module ActiveMerchant #:nodoc: module Billing #:nodoc: class FederatedCanadaGateway < Gateway # Same URL for both test and live, testing is done by using the test username (demo) and password (password). - URL = 'https://secure.federatedgateway.com/api/transact.php' + self.live_url = self.test_url = 'https://secure.federatedgateway.com/api/transact.php' APPROVED, DECLINED, ERROR = 1, 2, 3 # The countries the gateway supports merchants from as 2 digit ISO country codes self.supported_countries = ['CA'] @@ -20,11 +20,10 @@ # The name of the gateway self.display_name = 'Federated Canada' def initialize(options = {}) requires!(options, :login, :password) - @options = options super end def purchase(money, creditcard, options = {}) post = {} @@ -99,11 +98,11 @@ def add_invoice(post, options) post[:orderid] = options[:order_id] post[:orderdescription] = options[:description] end - + def add_creditcard(post, creditcard) post[:ccnumber] = creditcard.number post[:ccexp] = expdate(creditcard) post[:cvv] = creditcard.verification_value end @@ -119,18 +118,18 @@ k, v = x.split('=') memo[k] = v memo end end - + def commit(action, money, parameters) parameters[:amount] = amount(money) - data = ssl_post(URL, post_data(action, parameters)) + data = ssl_post(self.live_url, post_data(action, parameters)) response = parse(data) message = message_from(response) test_mode = test? - Response.new(success?(response), message, response, + Response.new(success?(response), message, response, :test => test?, :authorization => response['transactionid'], :avs_result => {:code => response['avsresponse']}, :cvv_result => response['cvvresponse'] )