lib/active_merchant/billing/gateways/secure_net.rb in activemerchant-1.79.2 vs lib/active_merchant/billing/gateways/secure_net.rb in activemerchant-1.80.0

- old
+ new

@@ -1,24 +1,24 @@ module ActiveMerchant #:nodoc: module Billing #:nodoc: class SecureNetGateway < Gateway - API_VERSION = "4.0" + API_VERSION = '4.0' TRANSACTIONS = { - :auth_only => "0000", - :auth_capture => "0100", - :prior_auth_capture => "0200", - :void => "0400", - :credit => "0500" + :auth_only => '0000', + :auth_capture => '0100', + :prior_auth_capture => '0200', + :void => '0400', + :credit => '0500' } XML_ATTRIBUTES = { - 'xmlns' => "http://gateway.securenet.com/API/Contracts", - 'xmlns:i' => "http://www.w3.org/2001/XMLSchema-instance" + 'xmlns' => 'http://gateway.securenet.com/API/Contracts', + 'xmlns:i' => 'http://www.w3.org/2001/XMLSchema-instance' } - NIL_ATTRIBUTE = { 'i:nil' => "true" } + NIL_ATTRIBUTE = { 'i:nil' => 'true' } self.supported_countries = ['US'] self.supported_cardtypes = [:visa, :master, :american_express, :discover] self.homepage_url = 'http://www.securenet.com/' self.display_name = 'SecureNet' @@ -75,11 +75,11 @@ private def commit(request) xml = build_request(request) url = test? ? self.test_url : self.live_url - data = ssl_post(url, xml, "Content-Type" => "text/xml") + data = ssl_post(url, xml, 'Content-Type' => 'text/xml') response = parse(data) Response.new(success?(response), message_from(response), response, :test => test?, :authorization => build_authorization(response), @@ -90,11 +90,11 @@ def build_request(request) xml = Builder::XmlMarkup.new xml.instruct! - xml.tag!("TRANSACTION", XML_ATTRIBUTES) do + xml.tag!('TRANSACTION', XML_ATTRIBUTES) do xml << request end xml.target! end @@ -114,11 +114,11 @@ xml = Builder::XmlMarkup.new transaction_id, amount_in_ref, last_four = split_authorization(authorization) xml.tag! 'AMOUNT', amount(money) || amount_in_ref - xml.tag!("CARD") do + xml.tag!('CARD') do xml.tag! 'CARDNUMBER', last_four end add_params_in_required_order(xml, action, nil, options) xml.tag! 'REF_TRANSID', transaction_id @@ -126,11 +126,11 @@ xml.target! end def add_credit_card(xml, creditcard) - xml.tag!("CARD") do + xml.tag!('CARD') do xml.tag! 'CARDCODE', creditcard.verification_value if creditcard.verification_value? xml.tag! 'CARDNUMBER', creditcard.number xml.tag! 'EXPDATE', expdate(creditcard) end end @@ -147,11 +147,11 @@ def add_address(xml, creditcard, options) return unless creditcard if address = options[:billing_address] || options[:address] - xml.tag!("CUSTOMER_BILL") do + xml.tag!('CUSTOMER_BILL') do xml.tag! 'ADDRESS', address[:address1].to_s xml.tag! 'CITY', address[:city].to_s xml.tag! 'COMPANY', address[:company].to_s xml.tag! 'COUNTRY', address[:country].to_s if options.has_key? :email @@ -165,11 +165,11 @@ xml.tag! 'ZIP', address[:zip].to_s end end if address = options[:shipping_address] - xml.tag!("CUSTOMER_SHIP") do + xml.tag!('CUSTOMER_SHIP') do xml.tag! 'ADDRESS', address[:address1].to_s xml.tag! 'CITY', address[:city].to_s xml.tag! 'COMPANY', address[:company].to_s xml.tag! 'COUNTRY', address[:country].to_s @@ -191,11 +191,11 @@ end end def add_merchant_key(xml, options) - xml.tag!("MERCHANT_KEY") do + xml.tag!('MERCHANT_KEY') do xml.tag! 'GROUPID', 0 xml.tag! 'SECUREKEY', @options[:password] xml.tag! 'SECURENETID', @options[:login] end end @@ -234,11 +234,11 @@ end def parse(xml) response = {} xml = REXML::Document.new(xml) - root = REXML::XPath.first(xml, "//GATEWAYRESPONSE") + root = REXML::XPath.first(xml, '//GATEWAYRESPONSE') if root root.elements.to_a.each do |node| recurring_parse_element(response, node) end end @@ -253,15 +253,15 @@ response[node.name.underscore.to_sym] = node.text end end def split_authorization(authorization) - transaction_id, amount, last_four = authorization.split("|") + transaction_id, amount, last_four = authorization.split('|') [transaction_id, amount, last_four] end def build_authorization(response) - [response[:transactionid], response[:transactionamount], response[:last4_digits]].join("|") + [response[:transactionid], response[:transactionamount], response[:last4_digits]].join('|') end end end end