class Pxpay::Notification

The return notification from Payment Express

Attributes

response[RW]

Public Class Methods

new(response) click to toggle source

Create a new Notification from Payment Express' response

# File lib/pxpay/notification.rb, line 7
def initialize(response)
  @response = response
end

Public Instance Methods

to_hash() click to toggle source

Return the response as a hash

# File lib/pxpay/notification.rb, line 17
def to_hash
  doc = ::Nokogiri::XML( self.response )
  hash = {}
  doc.at_css("Response").element_children.each do |attribute|
    hash[attribute.name.underscore.to_sym] = attribute.inner_text
  end
  hash[:valid] = doc.at_css("Response")['valid']
  hash
end
to_xml() click to toggle source

Return the xml response

# File lib/pxpay/notification.rb, line 12
def to_xml
  response
end