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)