lib/active_merchant/billing/gateways/realex.rb in activemerchant-1.21.0 vs lib/active_merchant/billing/gateways/realex.rb in activemerchant-1.22.0

- old
+ new

@@ -1,6 +1,6 @@ -require 'rexml/document' +require 'nokogiri' require 'digest/sha1' module ActiveMerchant module Billing # Realex is the leading CC gateway in Ireland @@ -99,24 +99,22 @@ end def parse(xml) response = {} - xml = REXML::Document.new(xml) - xml.elements.each('//response/*') do |node| - + doc = Nokogiri::XML(xml) + doc.xpath('//response/*').each do |node| if (node.elements.size == 0) response[node.name.downcase.to_sym] = normalize(node.text) else node.elements.each do |childnode| name = "#{node.name.downcase}_#{childnode.name.downcase}" response[name.to_sym] = normalize(childnode.text) end end + end unless doc.root.nil? - end unless xml.root.nil? - response end def authorization_from(parsed) [parsed[:orderid], parsed[:pasref], parsed[:authcode]].join(';') @@ -310,6 +308,6 @@ def sanitize_order_id(order_id) order_id.to_s.gsub(/[^a-zA-Z0-9\-_]/, '') end end end -end \ No newline at end of file +end