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

- old
+ new

@@ -171,26 +171,26 @@ ActiveMerchant.deprecated RECURRING_DEPRECATION_MESSAGE requires!(options, [:periodicity, :bimonthly, :monthly, :biweekly, :weekly, :yearly, :daily], :installments, :order_id ) options.update( - :ordertype => "SALE", - :action => options[:action] || "SUBMIT", + :ordertype => 'SALE', + :action => options[:action] || 'SUBMIT', :installments => options[:installments] || 12, - :startdate => options[:startdate] || "immediate", - :periodicity => options[:periodicity].to_s || "monthly", + :startdate => options[:startdate] || 'immediate', + :periodicity => options[:periodicity].to_s || 'monthly', :comments => options[:comments] || nil, :threshold => options[:threshold] || 3 ) commit(money, creditcard, options) end # Buy the thing def purchase(money, creditcard, options={}) requires!(options, :order_id) options.update( - :ordertype => "SALE" + :ordertype => 'SALE' ) commit(money, creditcard, options) end # @@ -199,11 +199,11 @@ # Reserves the funds on the customer's credit card, but does not charge the card. # def authorize(money, creditcard, options = {}) requires!(options, :order_id) options.update( - :ordertype => "PREAUTH" + :ordertype => 'PREAUTH' ) commit(money, creditcard, options) end # @@ -213,20 +213,20 @@ # Order_id must be a valid order id from a prior authorized transaction. # def capture(money, authorization, options = {}) options.update( :order_id => authorization, - :ordertype => "POSTAUTH" + :ordertype => 'POSTAUTH' ) commit(money, nil, options) end # Void a previous transaction def void(identification, options = {}) options.update( :order_id => identification, - :ordertype => "VOID" + :ordertype => 'VOID' ) commit(nil, nil, options) end # @@ -234,11 +234,11 @@ # # identification must be a valid order id previously submitted by SALE # def refund(money, identification, options = {}) options.update( - :ordertype => "CREDIT", + :ordertype => 'CREDIT', :order_id => identification ) commit(money, nil, options) end @@ -270,23 +270,23 @@ :cvv_result => response[:avs].to_s[3,1] ) end def successful?(response) - response[:approved] == "APPROVED" + response[:approved] == 'APPROVED' end # Build the XML file def post_data(money, creditcard, options) params = parameters(money, creditcard, options) xml = REXML::Document.new - order = xml.add_element("order") + order = xml.add_element('order') # Merchant Info - merchantinfo = order.add_element("merchantinfo") - merchantinfo.add_element("configfile").text = @options[:login] + merchantinfo = order.add_element('merchantinfo') + merchantinfo.add_element('configfile').text = @options[:login] # Loop over the params hash to construct the XML string for key, value in params elem = order.add_element(key.to_s) if key == :items @@ -303,18 +303,18 @@ end # adds LinkPoint's Items entity to the XML. Called from post_data def build_items(element, items) for item in items - item_element = element.add_element("item") + item_element = element.add_element('item') for key, value in item if key == :options - options_element = item_element.add_element("options") + options_element = item_element.add_element('options') for option in value - opt_element = options_element.add_element("option") - opt_element.add_element("name").text = option[:name] unless option[:name].blank? - opt_element.add_element("value").text = option[:value] unless option[:value].blank? + opt_element = options_element.add_element('option') + opt_element.add_element('name').text = option[:name] unless option[:name].blank? + opt_element.add_element('value').text = option[:value] unless option[:value].blank? end else item_element.add_element(key.to_s).text = item[key].to_s unless item[key].blank? end end @@ -332,18 +332,18 @@ :vattax => amount(options[:vattax]), :shipping => amount(options[:shipping]), :chargetotal => amount(money) }, :transactiondetails => { - :transactionorigin => options[:transactionorigin] || "ECI", + :transactionorigin => options[:transactionorigin] || 'ECI', :oid => options[:order_id], :ponumber => options[:ponumber], :taxexempt => options[:taxexempt], :terminaltype => options[:terminaltype], :ip => options[:ip], :reference_number => options[:reference_number], - :recurring => options[:recurring] || "NO", #DO NOT USE if you are using the periodic billing option. + :recurring => options[:recurring] || 'NO', #DO NOT USE if you are using the periodic billing option. :tdate => options[:tdate] }, :orderoptions => { :ordertype => options[:ordertype], :result => @options[:result] @@ -431,21 +431,21 @@ # <r_score></r_score> # <r_authresponse></r_authresponse> # <r_approved>APPROVED</r_approved> # <r_avs></r_avs> - response = {:message => "Global Error Receipt", :complete => false} + response = {:message => 'Global Error Receipt', :complete => false} xml = REXML::Document.new("<response>#{xml}</response>") xml.root.elements.each do |node| response[node.name.downcase.sub(/^r_/, '').to_sym] = normalize(node.text) end unless xml.root.nil? response end def format_creditcard_expiry_year(year) - sprintf("%.4i", year)[-2..-1] + sprintf('%.4i', year)[-2..-1] end end end end