chore: Update self-hosted billing redirect (#8580)

This commit is contained in:
Sojan Jose
2023-12-18 16:34:47 -08:00
committed by GitHub
parent 1ab3966b75
commit 0b2f539ad0
5 changed files with 37 additions and 4 deletions

View File

@@ -4,6 +4,7 @@ class ChatwootHub
REGISTRATION_URL = "#{BASE_URL}/instances".freeze
PUSH_NOTIFICATION_URL = "#{BASE_URL}/send_push".freeze
EVENTS_URL = "#{BASE_URL}/events".freeze
BILLING_URL = "#{BASE_URL}/billing".freeze
def self.installation_identifier
identifier = InstallationConfig.find_by(name: 'INSTALLATION_IDENTIFIER')&.value
@@ -11,10 +12,18 @@ class ChatwootHub
identifier
end
def self.billing_url
"#{BILLING_URL}?installation_identifier=#{installation_identifier}"
end
def self.pricing_plan
InstallationConfig.find_by(name: 'INSTALLATION_PRICING_PLAN')&.value || 'community'
end
def self.pricing_plan_quantity
InstallationConfig.find_by(name: 'INSTALLATION_PRICING_PLAN_QUANTITY')&.value || 0
end
def self.support_config
{
support_website_token: InstallationConfig.find_by(name: 'CHATWOOT_SUPPORT_WEBSITE_TOKEN')&.value,