2019-07-30 23:29:24 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-06-12 15:03:43 -05:00
|
|
|
# License: AGPL-3.0-or-later WITH WTO-AP-3.0-or-later
|
|
|
|
# Full license explanation at https://github.com/houdiniproject/houdini/blob/master/LICENSE
|
2019-02-01 13:40:24 -06:00
|
|
|
class BillingPlan < ApplicationRecord
|
2019-08-06 14:23:39 +02:00
|
|
|
# :name, #str: readable name
|
|
|
|
# :tier, #int: 0-4 (0: Free, 1: Fundraising, 2: Supporter Management)
|
|
|
|
# :amount, #int (cents)
|
|
|
|
# :stripe_plan_id, #str (matches plan ID in Stripe) Not needed if it's not a paying subscription
|
|
|
|
# :interval, #str ('monthly', 'annual')
|
|
|
|
# :percentage_fee # 0.038
|
|
|
|
|
2019-07-30 23:29:24 +02:00
|
|
|
Names = ['Starter', 'Fundraising', 'Supporter Management'].freeze
|
|
|
|
DefaultAmounts = [0, 9900, 29_900].freeze # in pennies
|
2018-03-25 13:30:42 -04:00
|
|
|
|
2019-07-30 23:29:24 +02:00
|
|
|
has_many :billing_subscriptions
|
2018-03-25 13:30:42 -04:00
|
|
|
|
2019-07-30 23:29:24 +02:00
|
|
|
validates :name, presence: true
|
|
|
|
validates :amount, presence: true
|
2018-03-25 13:30:42 -04:00
|
|
|
end
|