Parent

Methods

Class Index [+]

Quicksearch

ActiveMerchant::Billing::BarclaysEpdqGateway::Parser

Public Class Methods

new(response) click to toggle source
     # File lib/active_merchant/billing/gateways/barclays_epdq.rb, line 133
133:         def initialize(response)
134:           @response = response
135:         end

Public Instance Methods

find(doc, xpath) click to toggle source
     # File lib/active_merchant/billing/gateways/barclays_epdq.rb, line 164
164:         def find(doc, xpath)
165:           REXML::XPath.first(doc, xpath).try(:text)
166:         end
parse() click to toggle source
     # File lib/active_merchant/billing/gateways/barclays_epdq.rb, line 137
137:         def parse
138:           doc = REXML::Document.new(@response)
139:           auth_type = find(doc, "//Transaction/Type").to_s
140: 
141:           message = find(doc, "//Message/Text")
142:           if message.blank?
143:             message = find(doc, "//Transaction/CardProcResp/CcReturnMsg")
144:           end
145: 
146:           case auth_type
147:           when 'Credit', 'Void'
148:             success = find(doc, "//CcReturnMsg") == "Approved."
149:           else
150:             success = find(doc, "//Transaction/AuthCode").present?
151:           end
152: 
153:           {       
154:             :success => success,
155:             :message => message,
156:             :authorization => find(doc, "//Transaction/Id"),
157:             :avs_result => find(doc, "//Transaction/AvsRespCode"),
158:             :cvv_result => find(doc, "//Transaction/Cvv2Resp"),
159:             :order_id => find(doc, "//OrderFormDoc/Transaction/Id"),
160:             :raw_response => @response
161:           }
162:         end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.