From 62e6c2b76ee9e22855ba47f91c3b8dcdc6e4b514 Mon Sep 17 00:00:00 2001 From: Tanmay Deep Sharma Date: Fri, 19 Jun 2026 15:22:31 +0530 Subject: [PATCH] fix(billing): reject currency changes after Stripe setup --- config/locales/en.yml | 1 + .../app/controllers/enterprise/api/v1/accounts_controller.rb | 2 ++ 2 files changed, 3 insertions(+) diff --git a/config/locales/en.yml b/config/locales/en.yml index 1ff99bf4c..67d879f8f 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -165,6 +165,7 @@ en: feature_unavailable: MFA feature is not available. Please configure encryption keys. billing: invalid_currency: Invalid billing currency + currency_locked: Billing currency cannot be changed after billing has been set up topup: credits_required: Credits amount is required invalid_credits: Invalid credits amount diff --git a/enterprise/app/controllers/enterprise/api/v1/accounts_controller.rb b/enterprise/app/controllers/enterprise/api/v1/accounts_controller.rb index 53f95c2a8..19f516522 100644 --- a/enterprise/app/controllers/enterprise/api/v1/accounts_controller.rb +++ b/enterprise/app/controllers/enterprise/api/v1/accounts_controller.rb @@ -12,6 +12,8 @@ class Enterprise::Api::V1::AccountsController < Api::BaseController end def select_billing_currency + return render_could_not_create_error(I18n.t('errors.billing.currency_locked')) if stripe_customer_id.present? + currency = Enterprise::Billing::Currencies.normalize(params[:currency]) return render_could_not_create_error(I18n.t('errors.billing.invalid_currency')) unless Enterprise::Billing::Currencies.supported?(currency)