Class: BreadMachine::SecureTrading::XpayResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/breadmachine/secure_trading/xpay_response.rb

Instance Method Summary collapse

Constructor Details

#initialize(xml) ⇒ XpayResponse

Returns a new instance of XpayResponse.



6
7
8
# File 'lib/breadmachine/secure_trading/xpay_response.rb', line 6

def initialize(xml)
  @xml = Nokogiri::XML.parse(xml)
end

Instance Method Details

#error?Boolean

Checks whether there has been an error somewhere in the chain of servers which are processing your request (for example, if Visa’s server cacked, or XPay had an internal error, this would come back as true).

Returns:

  • (Boolean)


14
15
16
# File 'lib/breadmachine/secure_trading/xpay_response.rb', line 14

def error?
  result == '0'
end

#messageObject



22
23
24
# File 'lib/breadmachine/secure_trading/xpay_response.rb', line 22

def message
  @xml.xpath('//OperationResponse/Message').text
end

#resultObject



18
19
20
# File 'lib/breadmachine/secure_trading/xpay_response.rb', line 18

def result
  @xml.xpath('//OperationResponse/Result').text
end