Class: IPay::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/ipay/response.rb

Constant Summary collapse

PARSER_OPT =
XML::Parser::Options::NOBLANKS | XML::Parser::Options::NOERROR | XML::Parser::Options::RECOVER | XML::Parser::Options::NOWARNING

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml) ⇒ Response

Returns a new instance of Response.



12
13
14
15
16
17
18
19
# File 'lib/ipay/response.rb', line 12

def initialize(xml)
  if IPay::config.dry_run
    @status = {:arc => '00', :mrc => '00', :description => 'Dry Run, no response processed'}
  else
    @raw_xml = xml
    parse_response @raw_xml
  end
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



10
11
12
# File 'lib/ipay/response.rb', line 10

def data
  @data
end

#raw_xmlObject (readonly)

Returns the value of attribute raw_xml.



10
11
12
# File 'lib/ipay/response.rb', line 10

def raw_xml
  @raw_xml
end

#server_timeObject (readonly)

Returns the value of attribute server_time.



10
11
12
# File 'lib/ipay/response.rb', line 10

def server_time
  @server_time
end

#statusObject (readonly)

Returns the value of attribute status.



10
11
12
# File 'lib/ipay/response.rb', line 10

def status
  @status
end

Instance Method Details

#error?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/ipay/response.rb', line 25

def error?
  not success?
end

#success?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/ipay/response.rb', line 21

def success?
  @status[:arc] == '00' && @status[:mrc] == '00'
end