Class: ActiveMerchant::Billing::Response

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(success, message, params = {}, options = {}) ⇒ Response



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/active_merchant/billing/response.rb', line 28

def initialize(success, message, params = {}, options = {})
  @success, @message, @params = success, message, params.stringify_keys
  @test = options[:test] || false
  @authorization = options[:authorization]
  @fraud_review = options[:fraud_review]
  @error_code = options[:error_code]
  @emv_authorization = options[:emv_authorization]
  @network_transaction_id = options[:network_transaction_id]

  @avs_result = if options[:avs_result].kind_of?(AVSResult)
                  options[:avs_result].to_hash
                else
                  AVSResult.new(options[:avs_result]).to_hash
                end

  @cvv_result = if options[:cvv_result].kind_of?(CVVResult)
                  options[:cvv_result].to_hash
                else
                  CVVResult.new(options[:cvv_result]).to_hash
                end
  @response_type = options[:response_type]
  @response_http_code = options[:response_http_code]
  @request_endpoint = options[:request_endpoint]
  @request_method = options[:request_method]
  @request_body = options[:request_body]
  @request_id = options[:request_id]
end

Instance Attribute Details

#authorizationObject (readonly)

Returns the value of attribute authorization.



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

def authorization
  @authorization
end

#avs_resultObject (readonly)

Returns the value of attribute avs_result.



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

def avs_result
  @avs_result
end

#cvv_resultObject (readonly)

Returns the value of attribute cvv_result.



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

def cvv_result
  @cvv_result
end

#emv_authorizationObject (readonly)

Returns the value of attribute emv_authorization.



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

def emv_authorization
  @emv_authorization
end

#error_codeObject (readonly)

Returns the value of attribute error_code.



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

def error_code
  @error_code
end

#messageObject (readonly)

Returns the value of attribute message.



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

def message
  @message
end

#network_transaction_idObject (readonly)

Returns the value of attribute network_transaction_id.



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

def network_transaction_id
  @network_transaction_id
end

#paramsObject (readonly)

Returns the value of attribute params.



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

def params
  @params
end

#request_bodyObject (readonly)

Returns the value of attribute request_body.



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

def request_body
  @request_body
end

#request_endpointObject (readonly)

Returns the value of attribute request_endpoint.



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

def request_endpoint
  @request_endpoint
end

#request_idObject (readonly)

Returns the value of attribute request_id.



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

def request_id
  @request_id
end

#request_methodObject (readonly)

Returns the value of attribute request_method.



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

def request_method
  @request_method
end

#response_http_codeObject (readonly)

Returns the value of attribute response_http_code.



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

def response_http_code
  @response_http_code
end

#response_typeObject (readonly)

Returns the value of attribute response_type.



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

def response_type
  @response_type
end

#testObject (readonly)

Returns the value of attribute test.



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

def test
  @test
end

Instance Method Details

#failure?Boolean



16
17
18
# File 'lib/active_merchant/billing/response.rb', line 16

def failure?
  !success?
end

#fraud_review?Boolean



24
25
26
# File 'lib/active_merchant/billing/response.rb', line 24

def fraud_review?
  @fraud_review
end

#success?Boolean



12
13
14
# File 'lib/active_merchant/billing/response.rb', line 12

def success?
  @success
end

#test?Boolean



20
21
22
# File 'lib/active_merchant/billing/response.rb', line 20

def test?
  @test
end