Class: PayXML::Auth::Response

Inherits:
Message
  • Object
show all
Defined in:
lib/payxml/auth.rb

Constant Summary

Constants inherited from Message

Message::PAYXML_VERSION_NUMBER

Instance Attribute Summary collapse

Attributes inherited from Message

#paygate_id, #paygate_password

Instance Method Summary collapse

Methods inherited from Message

#initialize, #xml_string

Constructor Details

This class inherits a constructor from PayXML::Message

Instance Attribute Details

#authorisation_codeObject (readonly)

Returns the value of attribute authorisation_code.



75
76
77
# File 'lib/payxml/auth.rb', line 75

def authorisation_code
  @authorisation_code
end

#bnoObject (readonly)

Returns the value of attribute bno.



70
71
72
# File 'lib/payxml/auth.rb', line 70

def bno
  @bno
end

#card_typeObject (readonly)

Returns the value of attribute card_type.



69
70
71
# File 'lib/payxml/auth.rb', line 69

def card_type
  @card_type
end

#customer_referenceObject (readonly)

Returns the value of attribute customer_reference.



67
68
69
# File 'lib/payxml/auth.rb', line 67

def customer_reference
  @customer_reference
end

#error_codeObject (readonly)

Returns the value of attribute error_code.



79
80
81
# File 'lib/payxml/auth.rb', line 79

def error_code
  @error_code
end

#error_descriptionObject (readonly)

Returns the value of attribute error_description.



80
81
82
# File 'lib/payxml/auth.rb', line 80

def error_description
  @error_description
end

#result_codeObject (readonly)

Returns the value of attribute result_code.



72
73
74
# File 'lib/payxml/auth.rb', line 72

def result_code
  @result_code
end

#result_descriptionObject (readonly)

Returns the value of attribute result_description.



71
72
73
# File 'lib/payxml/auth.rb', line 71

def result_description
  @result_description
end

#riskObject (readonly)

Returns the value of attribute risk.



76
77
78
# File 'lib/payxml/auth.rb', line 76

def risk
  @risk
end

#secure_checksumObject (readonly)

Returns the value of attribute secure_checksum.



78
79
80
# File 'lib/payxml/auth.rb', line 78

def secure_checksum
  @secure_checksum
end

#secure_redirect_urlObject (readonly)

Returns the value of attribute secure_redirect_url.



77
78
79
# File 'lib/payxml/auth.rb', line 77

def secure_redirect_url
  @secure_redirect_url
end

#transaction_idObject (readonly)

Returns the value of attribute transaction_id.



68
69
70
# File 'lib/payxml/auth.rb', line 68

def transaction_id
  @transaction_id
end

#transaction_statusObject (readonly)

Returns the value of attribute transaction_status.



74
75
76
# File 'lib/payxml/auth.rb', line 74

def transaction_status
  @transaction_status
end

#transaction_status_descriptionObject (readonly)

Returns the value of attribute transaction_status_description.



73
74
75
# File 'lib/payxml/auth.rb', line 73

def transaction_status_description
  @transaction_status_description
end

Instance Method Details

#parse(xml_string) ⇒ Object



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/payxml/auth.rb', line 86

def parse(xml_string)
  super(xml_string)

  if !(xml_string =~ /errorrx/i).nil?
    error = Error.allocate
    error.parse(xml_string)
    @error_code = error.code
    @error_description = error.description
  else
    doc = Nokogiri::XML(xml_string)
    authrx = doc.xpath("//authrx").first
    securerx = doc.xpath("//securerx").first
    if !authrx.nil?
      @customer_reference = authrx['cref'] unless authrx['cref'].nil?
      @transaction_id = authrx['tid'] unless authrx['tid'].nil?
      @card_type = authrx['ctype'] unless authrx['ctype'].nil?
      @transaction_status = authrx['stat'] unless authrx['stat'].nil?
      @transaction_status_description = authrx['sdesc'] unless authrx['sdesc'].nil?
      @bno = authrx['bno'] unless authrx['bno'].nil?
      @result_code = authrx['res'] unless authrx['res'].nil?
      @result_description = authrx['rdesc'] unless authrx['rdesc'].nil?
      @authorisation_code = authrx['auth'] unless authrx['auth'].nil?
      @risk = authrx['risk'] unless authrx['risk'].nil?
    elsif !securerx.nil?
      @customer_reference = securerx['cref'] unless securerx['cref'].nil?
      @transaction_id = securerx['tid'] unless securerx['tid'].nil?
      @secure_checksum = securerx['chk'] unless securerx['chk'].nil?
      @secure_redirect_url = "#{securerx['url']}?PAYGATE_ID=#{self.paygate_id}&TRANS_ID=#{self.transaction_id}&CHECKSUM=#{self.secure_checksum}" unless securerx['url'].nil?
    end
  end
end

#requires_secure_redirect?Boolean

Returns:

  • (Boolean)


82
83
84
# File 'lib/payxml/auth.rb', line 82

def requires_secure_redirect?
  !self.secure_redirect_url.nil?
end