fix(billing): reject currency changes after Stripe setup
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user