lib/active_merchant/billing/gateways/moneris.rb in tlconnor-activemerchant-1.20.4 vs lib/active_merchant/billing/gateways/moneris.rb in tlconnor-activemerchant-1.23.0

- old
+ new

@@ -99,13 +99,11 @@ :order_id => options[:order_id], :cust_id => options[:customer], :amount => amount(money), :pan => creditcard.number, :expdate => expdate(creditcard), - :crypt_type => options[:crypt_type] || @options[:crypt_type], - :cvv => creditcard.verification_value, - :billing_address => options[:address] || options[:billing_address] + :crypt_type => options[:crypt_type] || @options[:crypt_type] } end # Common params used amongst the +credit+, +void+ and +capture+ methods def crediting_params(authorization, options = {}) @@ -129,13 +127,11 @@ def commit(action, parameters = {}) response = parse(ssl_post(test? ? TEST_URL : LIVE_URL, post_data(action, parameters))) Response.new(successful?(response), message_from(response[:message]), response, :test => test?, - :authorization => authorization_from(response), - :avs_result => {:code => response[:avs_result_code]}, - :cvv_result => response[:cvd_result_code] && response[:cvd_result_code].last + :authorization => authorization_from(response) ) end # Generates a Moneris authorization string of the form 'trans_id;receipt_id'. def authorization_from(response = {}) @@ -174,35 +170,13 @@ # Must add the elements in the correct order actions[action].each do |key| transaction.add_element(key.to_s).text = parameters[key] unless parameters[key].blank? end - - add_avs_info(transaction, parameters) - add_cvd_info(transaction, parameters) - + xml.to_s end - - def add_avs_info(transaction, parameters) - if address = parameters[:billing_address] - street_number, street_name = address[:address1].split(' ', 2) - - avs_info = transaction.add_element('avs_info') - avs_info.add_element('avs_street_number').text = street_number - avs_info.add_element('avs_street_name').text = street_name - avs_info.add_element('avs_zipcode').text = address[:zip] - end - end - - def add_cvd_info(transaction, parameters) - if cvd_value = parameters[:cvv] - cvd_info = transaction.add_element('cvd_info') - cvd_info.add_element('cvd_indicator').text = '1' - cvd_info.add_element('cvd_value').text = cvd_value - end - end - + def message_from(message) return 'Unspecified error' if message.blank? message.gsub(/[^\w]/, ' ').split.join(" ").capitalize end