2019-07-30 21:29:24 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-06-12 20:03:43 +00: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 19:40:24 +00:00
|
|
|
class BillingPlan < ApplicationRecord
|
2019-08-06 12:23:39 +00: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 21:29:24 +00:00
|
|
|
Names = ['Starter', 'Fundraising', 'Supporter Management'].freeze
|
|
|
|
DefaultAmounts = [0, 9900, 29_900].freeze # in pennies
|
2018-03-25 17:30:42 +00:00
|
|
|
|
2019-07-30 21:29:24 +00:00
|
|
|
has_many :billing_subscriptions
|
2018-03-25 17:30:42 +00:00
|
|
|
|
2019-07-30 21:29:24 +00:00
|
|
|
validates :name, presence: true
|
|
|
|
validates :amount, presence: true
|
2018-03-25 17:30:42 +00:00
|
|
|
end
|