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

Returns a new instance of Response.



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/active_merchant/billing/response.rb', line 25

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
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

#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

Returns:

  • (Boolean)


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

def failure?
  !success?
end

#fraud_review?Boolean

Returns:

  • (Boolean)


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

def fraud_review?
  @fraud_review
end

#success?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/active_merchant/billing/response.rb', line 9

def success?
  @success
end

#test?Boolean

Returns:

  • (Boolean)


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

def test?
  @test
end