add billing policy
This commit is contained in:
@@ -30,32 +30,4 @@ class AccountPolicy < ApplicationPolicy
|
||||
def toggle_deletion?
|
||||
@account_user.administrator?
|
||||
end
|
||||
|
||||
def v2_pricing_plans?
|
||||
@account_user.administrator?
|
||||
end
|
||||
|
||||
def v2_topup_options?
|
||||
@account_user.administrator?
|
||||
end
|
||||
|
||||
def v2_topup?
|
||||
@account_user.administrator?
|
||||
end
|
||||
|
||||
def v2_subscribe?
|
||||
@account_user.administrator?
|
||||
end
|
||||
|
||||
def cancel_subscription?
|
||||
@account_user.administrator?
|
||||
end
|
||||
|
||||
def credit_grants?
|
||||
@account_user.administrator?
|
||||
end
|
||||
|
||||
def change_pricing_plan?
|
||||
@account_user.administrator?
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
class BillingPolicy < ApplicationPolicy
|
||||
def credit_grants?
|
||||
@account_user.administrator?
|
||||
end
|
||||
|
||||
def pricing_plans?
|
||||
@account_user.administrator?
|
||||
end
|
||||
|
||||
def topup_options?
|
||||
@account_user.administrator?
|
||||
end
|
||||
|
||||
def topup?
|
||||
@account_user.administrator?
|
||||
end
|
||||
|
||||
def subscribe?
|
||||
@account_user.administrator?
|
||||
end
|
||||
|
||||
def cancel_subscription?
|
||||
@account_user.administrator?
|
||||
end
|
||||
|
||||
def change_pricing_plan?
|
||||
@account_user.administrator?
|
||||
end
|
||||
end
|
||||
@@ -1,6 +1,6 @@
|
||||
class Enterprise::Api::V2::BillingController < Api::BaseController
|
||||
before_action :fetch_account
|
||||
before_action :check_authorization
|
||||
before_action -> { check_authorization(:billing) }
|
||||
before_action :validate_topup_amount, only: [:topup]
|
||||
|
||||
rescue_from StandardError, with: :render_error
|
||||
|
||||
Reference in New Issue
Block a user