lib/active_merchant/billing/integrations/pxpay/helper.rb in activemerchant-1.42.9 vs lib/active_merchant/billing/integrations/pxpay/helper.rb in activemerchant-1.43.0

- old
+ new

@@ -88,20 +88,21 @@ xml.to_s end def request_secure_redirect request = generate_request - response = ssl_post(Pxpay.token_url, request) xml = REXML::Document.new(response) root = REXML::XPath.first(xml, "//Request") valid = root.attributes["valid"] - redirect = root.elements["URI"].text + redirect = root.elements["URI"].try(:text) + valid, redirect = "0", root.elements["ResponseText"].try(:text) unless redirect - # example positive response: + # example valid response: # <Request valid="1"><URI>https://sec.paymentexpress.com/pxpay/pxpay.aspx?userid=PxpayUser&amp;request=REQUEST_TOKEN</URI></Request> + # <Request valid='1'><Reco>IP</Reco><ResponseText>Invalid Access Info</ResponseText></Request> - # example negative response: + # example invalid response: # <Request valid="0"><URI>Invalid TxnType</URI></Request> {:valid => valid, :redirect => redirect} end end