lib/active_merchant/billing/gateways/barclays_epdq.rb in activemerchant-1.32.1 vs lib/active_merchant/billing/gateways/barclays_epdq.rb in activemerchant-1.33.0
- old
+ new
@@ -132,10 +132,17 @@
def initialize(response)
@response = response
end
def parse
- doc = REXML::Document.new(@response)
+ require 'iconv' unless String.method_defined?(:encode)
+ if String.method_defined?(:encode)
+ doc = REXML::Document.new(@response.encode("UTF-8", "ISO-8859-1"))
+ else
+ ic = Iconv.new('UTF-8', 'ISO-8859-1')
+ doc = REXML::Document.new(ic.iconv(@response))
+ end
+
auth_type = find(doc, "//Transaction/Type").to_s
message = find(doc, "//Message/Text")
if message.blank?
message = find(doc, "//Transaction/CardProcResp/CcReturnMsg")