Permalink
Browse files

Made XPay response more resilient to null results

  • Loading branch information...
1 parent e80bc22 commit dcece3df9893ebcce529fbaa04f87f02219d0242 Daniel Tenner committed Feb 11, 2010
Showing with 6 additions and 3 deletions.
  1. +6 −3 lib/active_merchant/billing/gateways/xpay/xpay_response.rb
@@ -14,15 +14,18 @@ def declined?
end
def transaction_reference
- @xml.root.get_elements('Response/OperationResponse/TransactionReference').first.text
+ ref = @xml.root.get_elements('Response/OperationResponse/TransactionReference').first
+ ref.nil? ? "Unspecified" : ref.text
end
def auth_code
- @xml.root.get_elements('Response/OperationResponse/AuthCode').first.text
+ code = @xml.root.get_elements('Response/OperationResponse/AuthCode').first
+ code.nil? ? "Unspecified" : code.text
end
def transaction_verifier
- @xml.root.get_elements('Response/OperationResponse/TransactionVerifier').first.text
+ verifier = @xml.root.get_elements('Response/OperationResponse/TransactionVerifier').first
+ verifier.nil? ? "Unspecified" : verifier.text
end
def initialize(xml_response)

0 comments on commit dcece3d

Please sign in to comment.