fix(billing): keep topup_checkout un-gated and seed topup options config in specs

This commit is contained in:
Tanmay Deep Sharma
2026-06-02 16:26:21 +05:30
parent 0768ce70ab
commit 4e33490676
2 changed files with 9 additions and 1 deletions
@@ -2,7 +2,7 @@ class Enterprise::Api::V1::AccountsController < Api::BaseController
include BillingHelper
before_action :fetch_account
before_action :check_authorization
before_action :check_cloud_env, only: [:limits, :toggle_deletion, :topup_checkout, :topup_options]
before_action :check_cloud_env, only: [:limits, :toggle_deletion, :topup_options]
def subscription
if stripe_customer_id.blank? && @account.custom_attributes['is_creating_customer'].blank?
@@ -256,6 +256,14 @@ RSpec.describe 'Enterprise Billing APIs', type: :request do
{ 'name' => 'Hacker', 'product_id' => ['prod_hacker'], 'price_ids' => ['price_hacker'] },
{ 'name' => 'Business', 'product_id' => ['prod_business'], 'price_ids' => ['price_business'] }
])
create(:installation_config, name: 'CHATWOOT_CLOUD_TOPUP_OPTIONS', value: {
'usd' => [
{ 'credits' => 1000, 'amount' => 20.0 },
{ 'credits' => 2500, 'amount' => 50.0 },
{ 'credits' => 6000, 'amount' => 100.0 },
{ 'credits' => 12_000, 'amount' => 200.0 }
]
})
end
it 'returns unauthorized for unauthenticated user' do