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',
pick_up_card: '303',
expired_card: '305',
token_not_found: '822',
token_invalid: '823'
}.freeze
- LIVE_TRANSACTION_RESPONSE_NAMES =
{
auth: "authorization_response",
sale: "sale_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
Returns a new instance of LiveTransactionResponse.
19
20
21
22
23
|
# File 'lib/vantiv/api/live_transaction_response.rb', line 19
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
#account_updater ⇒ Object
45
46
47
48
|
# File 'lib/vantiv/api/live_transaction_response.rb', line 45
def account_updater
@account_updater ||=
litle_transaction_response.account_updater || AccountUpdaterResponse.new
end
|
#expired_card? ⇒ Boolean
41
42
43
|
# File 'lib/vantiv/api/live_transaction_response.rb', line 41
def expired_card?
response_code == RESPONSE_CODES[:expired_card]
end
|
#failure? ⇒ Boolean
29
30
31
|
# File 'lib/vantiv/api/live_transaction_response.rb', line 29
def failure?
!success?
end
|
#insufficient_funds? ⇒ Boolean
33
34
35
|
# File 'lib/vantiv/api/live_transaction_response.rb', line 33
def insufficient_funds?
response_code == RESPONSE_CODES[:insufficient_funds]
end
|
#invalid_account_number? ⇒ Boolean
37
38
39
|
# File 'lib/vantiv/api/live_transaction_response.rb', line 37
def invalid_account_number?
response_code == RESPONSE_CODES[:invalid_account_number]
end
|
#network_transaction_id ⇒ Object
50
51
52
|
# File 'lib/vantiv/api/live_transaction_response.rb', line 50
def network_transaction_id
litle_transaction_response.network_transaction_id
end
|
#success? ⇒ Boolean
25
26
27
|
# File 'lib/vantiv/api/live_transaction_response.rb', line 25
def success?
!api_level_failure? && transaction_approved?
end
|