Class: PaypalServerSdk::TenureType

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

Overview

The tenure type of the billing cycle identifies if the billing cycle is a trial(free or discounted) or regular billing cycle., The tenure type of the billing cycle. In case of a plan having trial cycle, only 2 trial cycles are allowed per plan., The type of the billing cycle.

Constant Summary collapse

TENURE_TYPE =
[
  # A regular billing cycle to identify recurring charges for the billing
  # agreement.
  REGULAR = 'REGULAR'.freeze,

  # A trial billing cycle to identify free or discounted charge for the
  # billing agreement. Free trails will not have a price object in pricing
  # scheme where as a discounted trial would have a discounted price
  # compared to regular billing cycle.
  TRIAL = 'TRIAL'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = REGULAR) ⇒ Object



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

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

  str = value.to_s.strip

  case str.downcase
  when 'regular' then REGULAR
  when 'trial' then TRIAL
  else
    default_value
  end
end

.validate(value) ⇒ Object



24
25
26
27
28
# File 'lib/paypal_server_sdk/models/tenure_type.rb', line 24

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

  true
end