Class: PaypalServerSdk::StoredPaymentSourcePaymentType

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

Overview

Indicates the type of the stored payment_source payment.

Constant Summary collapse

STORED_PAYMENT_SOURCE_PAYMENT_TYPE =
[
  # One Time payment such as online purchase or donation. (e.g. Checkout

  # with one-click).

  ONE_TIME = 'ONE_TIME'.freeze,

  # Payment which is part of a series of payments with fixed or variable

  # amounts, following a fixed time interval. (e.g. Subscription payments).

  RECURRING = 'RECURRING'.freeze,

  # Payment which is part of a series of payments that occur on a non-fixed

  # schedule and/or have variable amounts. (e.g. Account Topup payments).

  UNSCHEDULED = 'UNSCHEDULED'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = ONE_TIME) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/paypal_server_sdk/models/stored_payment_source_payment_type.rb', line 29

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

  str = value.to_s.strip

  case str.downcase
  when 'one_time' then ONE_TIME
  when 'recurring' then RECURRING
  when 'unscheduled' then UNSCHEDULED
  else
    default_value
  end
end

.validate(value) ⇒ Object



23
24
25
26
27
# File 'lib/paypal_server_sdk/models/stored_payment_source_payment_type.rb', line 23

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

  true
end