Class: ActiveMerchant::Billing::PaymentechOrbital::Response

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Response.



25
26
27
28
29
# File 'lib/active_merchant/billing/paymentech_orbital/response.rb', line 25

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)



143
144
145
146
147
148
149
# File 'lib/active_merchant/billing/paymentech_orbital/response.rb', line 143

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.



6
7
8
# File 'lib/active_merchant/billing/paymentech_orbital/response.rb', line 6

def doc
  @doc
end

#request_typeObject (readonly)

Returns the value of attribute request_type.



6
7
8
# File 'lib/active_merchant/billing/paymentech_orbital/response.rb', line 6

def request_type
  @request_type
end

Instance Method Details

#approved?Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/active_merchant/billing/paymentech_orbital/response.rb', line 52

def approved?
  approval_status == "1"
end

#authorizationObject



56
57
58
# File 'lib/active_merchant/billing/paymentech_orbital/response.rb', line 56

def authorization
  approval_status
end

#avs_resp_codeObject



72
73
74
# File 'lib/active_merchant/billing/paymentech_orbital/response.rb', line 72

def avs_resp_code
  send(:AVSRespCode)
end

#avs_resultObject



64
65
66
# File 'lib/active_merchant/billing/paymentech_orbital/response.rb', line 64

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

#cvv2_resp_codeObject



76
77
78
# File 'lib/active_merchant/billing/paymentech_orbital/response.rb', line 76

def cvv2_resp_code
  send(:CVV2RespCode)
end

#cvv_resultObject



68
69
70
# File 'lib/active_merchant/billing/paymentech_orbital/response.rb', line 68

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

#mb_cancel_dateObject



80
81
82
# File 'lib/active_merchant/billing/paymentech_orbital/response.rb', line 80

def mb_cancel_date
  send(:MBCancelDate)
end

#mb_order_id_generation_methodObject



92
93
94
# File 'lib/active_merchant/billing/paymentech_orbital/response.rb', line 92

def mb_order_id_generation_method
  send(:MBOrderIdGenerationMethod)
end

#mb_recurring_end_dateObject



104
105
106
# File 'lib/active_merchant/billing/paymentech_orbital/response.rb', line 104

def mb_recurring_end_date
  send(:MBRecurringEndDate)
end

#mb_recurring_frequencyObject



100
101
102
# File 'lib/active_merchant/billing/paymentech_orbital/response.rb', line 100

def mb_recurring_frequency
  send(:MBRecurringFrequency)
end

#mb_recurring_max_billingsObject



108
109
110
# File 'lib/active_merchant/billing/paymentech_orbital/response.rb', line 108

def mb_recurring_max_billings
  send(:MBRecurringMaxBillings)
end

#mb_recurring_no_end_date_flagObject



84
85
86
# File 'lib/active_merchant/billing/paymentech_orbital/response.rb', line 84

def mb_recurring_no_end_date_flag
  send(:MBRecurringNoEndDateFlag)
end

#mb_recurring_start_dateObject



96
97
98
# File 'lib/active_merchant/billing/paymentech_orbital/response.rb', line 96

def mb_recurring_start_date
  send(:MBRecurringStartDate)
end

#mb_remove_flagObject



112
113
114
# File 'lib/active_merchant/billing/paymentech_orbital/response.rb', line 112

def mb_remove_flag
  send(:MBRemoveFlag)
end

#mb_typeObject



88
89
90
# File 'lib/active_merchant/billing/paymentech_orbital/response.rb', line 88

def mb_type
  send(:MBType)
end

#proc_success?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/active_merchant/billing/paymentech_orbital/response.rb', line 44

def proc_success?
  proc_status == "0"
end

#profile_proc_success?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/active_merchant/billing/paymentech_orbital/response.rb', line 48

def profile_proc_success?
  profile_proc_status == "0"
end

#success?Boolean

Returns:

  • (Boolean)


31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/active_merchant/billing/paymentech_orbital/response.rb', line 31

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)


60
61
62
# File 'lib/active_merchant/billing/paymentech_orbital/response.rb', line 60

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

#to_aObject



124
125
126
127
# File 'lib/active_merchant/billing/paymentech_orbital/response.rb', line 124

def to_a
  [ auth_code, avs_resp_code, cvv2_resp_code, tx_ref_num,
    customer_ref_num, profile_proc_status ]
end

#to_xmlObject



116
117
118
119
120
121
122
# File 'lib/active_merchant/billing/paymentech_orbital/response.rb', line 116

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