class Payline::ResponseHandler
Public Instance Methods
handle_errors(hash)
click to toggle source
# File lib/payline/response_handler.rb, line 19 def handle_errors(hash) if hash['PROCESSING.REASON.CODE'].to_s != '00' # Error message should be friendly raise Payline::Error.new(hash['PROCESSING.RETURN'], hash) end end
parse(text)
click to toggle source
# File lib/payline/response_handler.rb, line 4 def parse(text) # CGI by default returns an hash of arrays even if there is one element (is is the norm) hash = CGI::parse(text) hash.each {|k, v| hash[k] = v.length == 1 ? v.first : v } hash end
parse_and_handle_errors(text)
click to toggle source
# File lib/payline/response_handler.rb, line 13 def parse_and_handle_errors(text) hash = parse(text) handle_errors(hash) hash end