group concern
This commit is contained in:
parent
ad77fc749b
commit
3904310432
|
@ -0,0 +1,11 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module DiscoursePatrons
|
||||
module Group
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
def plan_group(plan)
|
||||
::Group.find_by_name(plan[:metadata][:group_name])
|
||||
end
|
||||
end
|
||||
end
|
|
@ -3,6 +3,7 @@
|
|||
module DiscoursePatrons
|
||||
class SubscriptionsController < ::ApplicationController
|
||||
include DiscoursePatrons::Stripe
|
||||
include DiscoursePatrons::Group
|
||||
before_action :set_api_key
|
||||
requires_login
|
||||
|
||||
|
@ -59,10 +60,6 @@ module DiscoursePatrons
|
|||
{ user_id: current_user.id, username: current_user.username_lower }
|
||||
end
|
||||
|
||||
def plan_group(plan)
|
||||
Group.find_by_name(plan[:metadata][:group_name])
|
||||
end
|
||||
|
||||
def subscription_ok
|
||||
['active', 'trialing'].include?(@subscription[:status])
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ module DiscoursePatrons
|
|||
module User
|
||||
class SubscriptionsController < ::ApplicationController
|
||||
include DiscoursePatrons::Stripe
|
||||
include DiscoursePatrons::Group
|
||||
before_action :set_api_key
|
||||
requires_login
|
||||
|
||||
|
|
Loading…
Reference in New Issue