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'
}
TIED_TRANSACTION_RESPONSE_NAMES =
{
  auth_reversal: 'authReversalResponse',
  capture: "captureResponse",
  credit: "creditResponse",
  return: "creditResponse",
  void: "voidResponse"
}

Instance Attribute Summary

Attributes inherited from Response

#body, #http_response_code, #httpok

Instance Method Summary collapse

Methods inherited from Response

#api_level_failure?, #load, #message, #request_id, #response_code, #transaction_id

Constructor Details

#initialize(transaction_name) ⇒ TiedTransactionResponse

Returns a new instance of TiedTransactionResponse.



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

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)


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

def failure?
  !success?
end

#success?Boolean

Returns:

  • (Boolean)


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

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