Class: PaypalServerSdk::PaymentTokenStatus

Inherits:
Object
  • Object
show all
Defined in:
lib/paypal_server_sdk/models/payment_token_status.rb

Overview

The status of the payment token.

Constant Summary collapse

PAYMENT_TOKEN_STATUS =
[
  # A setup token is initialized with minimal information, more data must be

  # added to the setup-token to be vaulted

  CREATED = 'CREATED'.freeze,

  # A contingency on payer approval is required before the payment method

  # can be saved.

  PAYER_ACTION_REQUIRED = 'PAYER_ACTION_REQUIRED'.freeze,

  # Setup token is ready to be vaulted. If a buyer approval contigency was

  # returned, it is has been approved.

  APPROVED = 'APPROVED'.freeze,

  # The payment token has been vaulted.

  VAULTED = 'VAULTED'.freeze,

  # A vaulted payment method token has been tokenized for short term (one

  # time) use.

  TOKENIZED = 'TOKENIZED'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = CREATED) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/paypal_server_sdk/models/payment_token_status.rb', line 36

def self.from_value(value, default_value = CREATED)
  return default_value if value.nil?

  str = value.to_s.strip

  case str.downcase
  when 'created' then CREATED
  when 'payer_action_required' then PAYER_ACTION_REQUIRED
  when 'approved' then APPROVED
  when 'vaulted' then VAULTED
  when 'tokenized' then TOKENIZED
  else
    default_value
  end
end

.validate(value) ⇒ Object



30
31
32
33
34
# File 'lib/paypal_server_sdk/models/payment_token_status.rb', line 30

def self.validate(value)
  return false if value.nil?

  true
end