136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
|
# File 'lib/active_merchant/billing/gateways/barclays_epdq.rb', line 136
def parse
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")
end
case auth_type
when 'Credit', 'Void'
success = find(doc, "//CcReturnMsg") == "Approved."
else
success = find(doc, "//Transaction/AuthCode").present?
end
{
:success => success,
:message => message,
:transaction_id => find(doc, "//Transaction/Id"),
:avs_result => find(doc, "//Transaction/AvsRespCode"),
:cvv_result => find(doc, "//Transaction/Cvv2Resp"),
:authorization => find(doc, "//OrderFormDoc/Id"),
:raw_response => @response
}
end
|