Class: PaymentechOrbitalResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/active_merchant/billing/gateways/paymentech_orbital/paymentech_orbital_response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(doc, request_type, options = {}) ⇒ PaymentechOrbitalResponse

Returns a new instance of PaymentechOrbitalResponse.



18
19
20
21
22
# File 'lib/active_merchant/billing/gateways/paymentech_orbital/paymentech_orbital_response.rb', line 18

def initialize(doc, request_type, options={})
  @doc = REXML::Document.new(doc)
  @request_type = request_type
  @options = options
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym, *args, &blk) ⇒ Object (private)



87
88
89
90
91
92
93
# File 'lib/active_merchant/billing/gateways/paymentech_orbital/paymentech_orbital_response.rb', line 87

def method_missing(sym, *args, &blk)
  if self.class.elements.include?(sym)
    value_at(sym)
  else
    super(sym, *args, &blk)
  end
end

Instance Attribute Details

#docObject (readonly)

Returns the value of attribute doc.



3
4
5
# File 'lib/active_merchant/billing/gateways/paymentech_orbital/paymentech_orbital_response.rb', line 3

def doc
  @doc
end

#request_typeObject (readonly)

Returns the value of attribute request_type.



3
4
5
# File 'lib/active_merchant/billing/gateways/paymentech_orbital/paymentech_orbital_response.rb', line 3

def request_type
  @request_type
end

Instance Method Details

#approved?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/active_merchant/billing/gateways/paymentech_orbital/paymentech_orbital_response.rb', line 45

def approved?
  approval_status == "1"
end

#authorizationObject



49
50
51
# File 'lib/active_merchant/billing/gateways/paymentech_orbital/paymentech_orbital_response.rb', line 49

def authorization
  approval_status
end

#avs_resultObject



57
58
59
# File 'lib/active_merchant/billing/gateways/paymentech_orbital/paymentech_orbital_response.rb', line 57

def avs_result
  @avs_result ||= AVSResult.new({:code => avs_resp_code})
end

#cvv_resultObject



61
62
63
# File 'lib/active_merchant/billing/gateways/paymentech_orbital/paymentech_orbital_response.rb', line 61

def cvv_result
  @cvv_result ||= CVVResult.new({:code => cvv2_result_code})
end

#proc_success?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/active_merchant/billing/gateways/paymentech_orbital/paymentech_orbital_response.rb', line 37

def proc_success?
  proc_status == "0"
end

#profile_proc_success?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/active_merchant/billing/gateways/paymentech_orbital/paymentech_orbital_response.rb', line 41

def profile_proc_success?
  profile_proc_status == "0"
end

#success?Boolean

Returns:

  • (Boolean)


24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/active_merchant/billing/gateways/paymentech_orbital/paymentech_orbital_response.rb', line 24

def success?
  case request_type
  when "NewOrder"
    proc_success? && approved?
  when "Profile"
    profile_proc_success?
  when "Reversal", "EndOfDay"
    proc_success?
  else
    false
  end
end

#test?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/active_merchant/billing/gateways/paymentech_orbital/paymentech_orbital_response.rb', line 53

def test?
  @options[:test] || false
end

#to_xmlObject



65
66
67
68
69
70
71
# File 'lib/active_merchant/billing/gateways/paymentech_orbital/paymentech_orbital_response.rb', line 65

def to_xml
  unless @_xml
    @_xml = ""
    doc.write(@_xml, 2)
  end
  @_xml
end