Class: Vantiv::Api::TiedTransactionResponse

Inherits:
Response
  • Object
show all
Defined in:
lib/vantiv/api/tied_transaction_response.rb

Constant Summary collapse

RESPONSE_CODES =
{
  transaction_received: '001'
}.freeze
TIED_TRANSACTION_RESPONSE_NAMES =
{
  auth_reversal: 'auth_reversal_response',
  capture: "capture_response",
  credit: "credit_response",
  return: "credit_response",
  void: "void_response"
}

Instance Attribute Summary

Attributes inherited from Response

#body, #http_response_code, #httpok, #raw_body

Instance Method Summary collapse

Methods inherited from Response

#api_level_failure?, #error_message

Constructor Details

#initialize(transaction_name) ⇒ TiedTransactionResponse

Returns a new instance of TiedTransactionResponse.



16
17
18
19
20
# File 'lib/vantiv/api/tied_transaction_response.rb', line 16

def initialize(transaction_name)
  unless @transaction_response_name = TIED_TRANSACTION_RESPONSE_NAMES[transaction_name]
    raise "Implementation Error: Tied transactions do not include #{transaction_name}"
  end
end

Instance Method Details

#failure?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/vantiv/api/tied_transaction_response.rb', line 26

def failure?
  !success?
end

#success?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/vantiv/api/tied_transaction_response.rb', line 22

def success?
  !api_level_failure? && response_code == RESPONSE_CODES[:transaction_received]
end