Class: PaypalServerSdk::UsagePattern

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

Overview

Expected business/pricing model for the billing agreement., Expected business/charge model for the billing agreement.

Constant Summary collapse

USAGE_PATTERN =
[
  # On-demand instant payments – non-recurring, pre-paid, variable amount,
  # variable frequency.
  IMMEDIATE = 'IMMEDIATE'.freeze,

  # Pay after use, non-recurring post-paid, variable amount, irregular
  # frequency.
  DEFERRED = 'DEFERRED'.freeze,

  # Pay upfront fixed or variable amount on a fixed date before the
  # goods/service is delivered.
  RECURRING_PREPAID = 'RECURRING_PREPAID'.freeze,

  # Pay on a fixed date based on usage or consumption after the
  # goods/service is delivered.
  RECURRING_POSTPAID = 'RECURRING_POSTPAID'.freeze,

  # Charge payer when the set amount is reached or monthly billing cycle,
  # whichever comes first, before the goods/service is delivered.
  THRESHOLD_PREPAID = 'THRESHOLD_PREPAID'.freeze,

  # Charge payer when the set amount is reached or monthly billing cycle,
  # whichever comes first, after the goods/service is delivered.
  THRESHOLD_POSTPAID = 'THRESHOLD_POSTPAID'.freeze,

  # Subscription plan where the "amount due" and the "billing frequency" are
  # fixed, and there is no defined duration with the payment due before the
  # good/service is delivered.
  SUBSCRIPTION_PREPAID = 'SUBSCRIPTION_PREPAID'.freeze,

  # Subscription plan where the "amount due" and the "billing frequency" are
  # fixed, and there is no defined duration with the payment due after the
  # goods/services are delivered.
  SUBSCRIPTION_POSTPAID = 'SUBSCRIPTION_POSTPAID'.freeze,

  # Unscheduled card on file plan where the merchant can bill buyer upfront
  # based on an agreed logic, but "amount due" and "frequency" can vary.
  # Inclusive of automatic reload plans.
  UNSCHEDULED_PREPAID = 'UNSCHEDULED_PREPAID'.freeze,

  # Unscheduled card on file plan where the merchant can bill buyer based on
  # an agreed logic, but "amount due" and "frequency" can vary. Inclusive of
  # automatic reload plans.
  UNSCHEDULED_POSTPAID = 'UNSCHEDULED_POSTPAID'.freeze,

  # Merchant-managed installment plan when the "amount" to be paid and the
  # "billing frequency" are fixed, but there is a defined number of payments
  # with the payment due before the good/service is delivered.
  INSTALLMENT_PREPAID = 'INSTALLMENT_PREPAID'.freeze,

  # Merchant-managed installment plan when the "amount" to be paid and the
  # "billing frequency" are fixed, but there is a defined number of payments
  # with the payment due after the goods/services are delivered.
  INSTALLMENT_POSTPAID = 'INSTALLMENT_POSTPAID'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = IMMEDIATE) ⇒ Object



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/paypal_server_sdk/models/usage_pattern.rb', line 72

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

  str = value.to_s.strip

  case str.downcase
  when 'immediate' then IMMEDIATE
  when 'deferred' then DEFERRED
  when 'recurring_prepaid' then RECURRING_PREPAID
  when 'recurring_postpaid' then RECURRING_POSTPAID
  when 'threshold_prepaid' then THRESHOLD_PREPAID
  when 'threshold_postpaid' then THRESHOLD_POSTPAID
  when 'subscription_prepaid' then SUBSCRIPTION_PREPAID
  when 'subscription_postpaid' then SUBSCRIPTION_POSTPAID
  when 'unscheduled_prepaid' then UNSCHEDULED_PREPAID
  when 'unscheduled_postpaid' then UNSCHEDULED_POSTPAID
  when 'installment_prepaid' then INSTALLMENT_PREPAID
  when 'installment_postpaid' then INSTALLMENT_POSTPAID
  else
    default_value
  end
end

.validate(value) ⇒ Object



66
67
68
69
70
# File 'lib/paypal_server_sdk/models/usage_pattern.rb', line 66

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

  true
end