Class: Vantiv::Api::TokenizationResponse

Inherits:
Response
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/vantiv/api/tokenization_response.rb

Constant Summary collapse

RESPONSE_CODES =
{
  account_successfully_registered: '801',
  account_already_registered: '802',
  credit_card_number_invalid: '820',
  merchant_not_authorized_for_tokens: '821',
  token_not_found: '822',
  token_invalid: '823',
  invalid_paypage_registration_id: '877',
  expired_paypage_registration_id: '878',
  generic_token_registration_error: '898',
  generic_token_use_error: '899'
}.freeze

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

Instance Method Details

#apple_payObject



39
40
41
42
# File 'lib/vantiv/api/tokenization_response.rb', line 39

def apple_pay
  @apple_pay ||=
    litle_transaction_response.apple_pay_response || ApplePayResponse.new
end

#card_typeObject



23
24
25
# File 'lib/vantiv/api/tokenization_response.rb', line 23

def card_type
  litle_transaction_response.type
end

#failure?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/vantiv/api/tokenization_response.rb', line 31

def failure?
  !success?
end

#invalid_card_number?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/vantiv/api/tokenization_response.rb', line 35

def invalid_card_number?
  response_code == RESPONSE_CODES[:credit_card_number_invalid]
end

#success?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/vantiv/api/tokenization_response.rb', line 27

def success?
  !api_level_failure? && tokenization_successful?
end