Skip to Content Skip to Search
Methods
D
E
N
P
Included Modules

Attributes

[R] errors
[R] member
[R] owner_view
[R] plan

Class Public methods

new(plan:, member: nil, owner_view: false)

# File app/services/service/plan_details.rb, line 8
def initialize(plan:, member: nil, owner_view: false)
  @plan = plan
  @member = member
  @owner_view = !!owner_view
  @errors = []
end

Instance Public methods

details()

# File app/services/service/plan_details.rb, line 15
def details
  details = ""

  details += if plan.subscription_plan_type? && member.active_subscription
    details_for_replacing_active_subscription
  else
    pricing_description
  end

  expiration = expiration_description
  details += ", #{expiration}" if expiration

  details += " #{upcoming.coupon_message}" if plan.subscription_plan_type?

  add_owner_view(details).html_safe
end

expiration_description()

# File app/services/service/plan_details.rb, line 64
def expiration_description
  if plan.specific_time_expiration_type?
    specific_time_expiration_description
  elsif plan.interval_expiration_type?
    interval_expiration_description
  end
end

pricing_description()

# File app/services/service/plan_details.rb, line 32
def pricing_description
  text = ""

  if trial_duration > 0
    text += "#{end_of_trial} "
  end

  if plan.subscription_plan_type?
    text += subscription_plan_description
  elsif plan.multi_payment_plan_type?
    text += payment_plan_description
  elsif plan.one_time_payment_plan_type?
    text += one_time_payment_plan_description
  elsif plan.free_plan_type?
    text += free_plan_description
  end

  if plan.signup_fee && !plan.trial?
    text += ", #{signup_fee_description}"
  end

  if plan.tax_percentage
    text += plan_tax_percentage_description
  end

  if billing_cycle_info?
    text += billing_cycle_info
  end

  text.html_safe
end