lib/active_merchant/billing/gateways/moneris_us.rb in activemerchant-1.86.0 vs lib/active_merchant/billing/gateways/moneris_us.rb in activemerchant-1.87.0
- old
+ new
@@ -72,15 +72,15 @@
post[:amount] = amount(money)
post[:order_id] = options[:order_id]
add_address(post, creditcard_or_datakey, options)
post[:crypt_type] = options[:crypt_type] || @options[:crypt_type]
action = if creditcard_or_datakey.is_a?(String)
- 'us_res_purchase_cc'
- elsif card_brand(creditcard_or_datakey) == 'check'
- 'us_ach_debit'
- elsif post[:data_key].blank?
- 'us_purchase'
+ 'us_res_purchase_cc'
+ elsif card_brand(creditcard_or_datakey) == 'check'
+ 'us_ach_debit'
+ elsif post[:data_key].blank?
+ 'us_purchase'
end
commit(action, post)
end
# This method retrieves locked funds from a customer's account (from a
@@ -221,11 +221,11 @@
response = parse(raw)
Response.new(successful?(response), message_from(response[:message]), response,
:test => test?,
:avs_result => { :code => response[:avs_result_code] },
- :cvv_result => response[:cvd_result_code] && response[:cvd_result_code][-1,1],
+ :cvv_result => response[:cvd_result_code] && response[:cvd_result_code][-1, 1],
:authorization => authorization_from(response)
)
end
# Generates a Moneris authorization string of the form 'trans_id;receipt_id'.
@@ -237,11 +237,11 @@
# Tests for a successful response from Moneris' servers
def successful?(response)
response[:response_code] &&
response[:complete] &&
- (0..49).include?(response[:response_code].to_i)
+ (0..49).cover?(response[:response_code].to_i)
end
def parse(xml)
response = { :message => 'Global Error Receipt', :complete => false }
hashify_xml!(xml, response)
@@ -289,11 +289,11 @@
def avs_element(address)
full_address = "#{address[:address1]} #{address[:address2]}"
tokens = full_address.split(/\s+/)
element = REXML::Element.new('avs_info')
- element.add_element('avs_street_number').text = tokens.select{|x| x =~ /\d/}.join(' ')
- element.add_element('avs_street_name').text = tokens.reject{|x| x =~ /\d/}.join(' ')
+ element.add_element('avs_street_number').text = tokens.select { |x| x =~ /\d/ }.join(' ')
+ element.add_element('avs_street_name').text = tokens.reject { |x| x =~ /\d/ }.join(' ')
element.add_element('avs_zipcode').text = address[:zip]
element
end
def cvd_element(cvd_value)