Add billing (#329)

This commit is contained in:
Riccardo Graziosi
2024-05-03 18:11:07 +02:00
committed by GitHub
parent fc36c967af
commit bea146e612
63 changed files with 1354 additions and 27 deletions

View File

@@ -35,6 +35,7 @@ class ApplicationController < ActionController::Base
# Load tenant data
@tenant = Current.tenant_or_raise!
@tenant_setting = TenantSetting.first_or_create
@tenant_billing = TenantBilling.first_or_create
@boards = Board.select(:id, :name, :slug).order(order: :asc)
# Setup locale
@@ -48,6 +49,14 @@ class ApplicationController < ActionController::Base
.order(created_at: :asc)
end
def check_tenant_subscription
return if Current.tenant.tenant_billing.has_active_subscription?
render json: {
error: 'Your subscription has expired. Please renew it to continue using the service.'
}, status: :forbidden
end
private
def user_not_authorized