class Pxpay::Response

The response object received from Payment Express

Attributes

post[RW]

Public Class Methods

new(params) click to toggle source

Create a new Payment Express response object by passing in the return parameters provided to the success/failure URL

# File lib/pxpay/response.rb, line 10
def initialize(params)
  @result = params[:result]
  @user_id = params[:userid]
  @post = build_xml( params[:result] )
end

Public Instance Methods

response() click to toggle source

Retrieving the transaction details from Payment Express as an instance of Pxpay::Notification

# File lib/pxpay/response.rb, line 17
def response
  response = ::RestClient.post( Pxpay::Base.pxpay_request_url,  self.post )
  return ::Pxpay::Notification.new( response )
end

Private Instance Methods

build_xml( result ) click to toggle source

Internal method to build the xml to send to Payment Express

# File lib/pxpay/response.rb, line 24
def build_xml( result )
  xml = ::Builder::XmlMarkup.new

  xml.ProcessResponse do 
    xml.PxPayUserIdPxPayUserId::Pxpay::Base.pxpay_user_id
    xml.PxPayKeyPxPayKey::Pxpay::Base.pxpay_key
    xml.Response result
  end
end