Class: Vantiv::Api::LiveTransactionResponse
- Inherits:
-
Response
- Object
- Response
- Vantiv::Api::LiveTransactionResponse
show all
- Defined in:
- lib/vantiv/api/live_transaction_response.rb
Constant Summary
collapse
- RESPONSE_CODES =
{
approved: '000',
insufficient_funds: '110',
invalid_account_number: '301',
expired_card: '305',
token_not_found: '822'
}
- LIVE_TRANSACTION_RESPONSE_NAMES =
{
auth: "authorizationResponse",
sale: "saleResponse"
}
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
Returns a new instance of LiveTransactionResponse.
17
18
19
20
21
|
# File 'lib/vantiv/api/live_transaction_response.rb', line 17
def initialize(transaction_name)
unless @transaction_response_name = LIVE_TRANSACTION_RESPONSE_NAMES[transaction_name]
raise "Implementation Error: Live transactions do not include #{transaction_name}"
end
end
|
Instance Method Details
#expired_card? ⇒ Boolean
39
40
41
|
# File 'lib/vantiv/api/live_transaction_response.rb', line 39
def expired_card?
response_code == RESPONSE_CODES[:expired_card]
end
|
#failure? ⇒ Boolean
27
28
29
|
# File 'lib/vantiv/api/live_transaction_response.rb', line 27
def failure?
!success?
end
|
#insufficient_funds? ⇒ Boolean
31
32
33
|
# File 'lib/vantiv/api/live_transaction_response.rb', line 31
def insufficient_funds?
response_code == RESPONSE_CODES[:insufficient_funds]
end
|
#invalid_account_number? ⇒ Boolean
35
36
37
|
# File 'lib/vantiv/api/live_transaction_response.rb', line 35
def invalid_account_number?
response_code == RESPONSE_CODES[:invalid_account_number]
end
|
#success? ⇒ Boolean
23
24
25
|
# File 'lib/vantiv/api/live_transaction_response.rb', line 23
def success?
!api_level_failure? && transaction_approved?
end
|