Class: AdvancedBilling::TrialType

Inherits:
Object
  • Object
show all
Defined in:
lib/advanced_billing/models/trial_type.rb

Overview

Indicates how a trial is handled when the trail period ends and there is no credit card on file. For ‘no_obligation`, the subscription transitions to a Trial Ended state. Maxio will not send any emails or statements. For `payment_expected`, the subscription transitions to a Past Due state. Maxio will send normal dunning emails and statements according to your other settings.

Constant Summary collapse

TRIAL_TYPE =
[
  # TODO: Write general description for NO_OBLIGATION
  NO_OBLIGATION = 'no_obligation'.freeze,

  # TODO: Write general description for PAYMENT_EXPECTED
  PAYMENT_EXPECTED = 'payment_expected'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = NO_OBLIGATION) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/advanced_billing/models/trial_type.rb', line 28

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

  str = value.to_s.strip

  case str.downcase
  when 'no_obligation' then NO_OBLIGATION
  when 'payment_expected' then PAYMENT_EXPECTED
  else
    default_value
  end
end

.validate(value) ⇒ Object



22
23
24
25
26
# File 'lib/advanced_billing/models/trial_type.rb', line 22

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

  TRIAL_TYPE.include?(value)
end