diff --git a/api/app/controllers/concerns/spree/api/v2/storefront/order_concern.rb b/api/app/controllers/concerns/spree/api/v2/storefront/order_concern.rb index 520be6bb900..37f907a7155 100644 --- a/api/app/controllers/concerns/spree/api/v2/storefront/order_concern.rb +++ b/api/app/controllers/concerns/spree/api/v2/storefront/order_concern.rb @@ -35,9 +35,7 @@ def find_spree_current_order end def supported_currencies - Spree::Config[:supported_currencies].split(',').map do |code| - ::Money::Currency.find(code.strip) - end + spree_current_store.supported_currencies_list end def serialize_order(order) diff --git a/api/spec/controllers/spree/api/v1/stores_controller_spec.rb b/api/spec/controllers/spree/api/v1/stores_controller_spec.rb index 4b5ebeb253a..86c959b7a0e 100644 --- a/api/spec/controllers/spree/api/v1/stores_controller_spec.rb +++ b/api/spec/controllers/spree/api/v1/stores_controller_spec.rb @@ -76,7 +76,8 @@ module Spree name: 'Hack0rz', url: 'spree123.example.com', mail_from_address: 'me@example.com', - default_currency: 'USD' + default_currency: 'USD', + supported_currencies: 'USD' } api_post :create, store: store_hash expect(response.status).to eq(201) diff --git a/api/spec/requests/spree/api/v2/storefront/cart_spec.rb b/api/spec/requests/spree/api/v2/storefront/cart_spec.rb index d3f8f190dda..e94fc519493 100644 --- a/api/spec/requests/spree/api/v2/storefront/cart_spec.rb +++ b/api/spec/requests/spree/api/v2/storefront/cart_spec.rb @@ -2,7 +2,7 @@ describe 'API V2 Storefront Cart Spec', type: :request do let(:default_currency) { 'USD' } - let(:store) { create(:store, default_currency: default_currency) } + let!(:store) { create(:store, default_currency: default_currency) } let(:currency) { store.default_currency } let(:user) { create(:user) } let(:order) { create(:order, user: user, store: store, currency: currency) } @@ -359,10 +359,6 @@ end context 'for specified currency' do - before do - Spree::Config[:supported_currencies] = 'USD,EUR' - end - context 'store default' do before do store.update!(default_currency: 'EUR') diff --git a/backend/app/controllers/spree/admin/general_settings_controller.rb b/backend/app/controllers/spree/admin/general_settings_controller.rb index adab53eecfe..f1b6cf2e809 100644 --- a/backend/app/controllers/spree/admin/general_settings_controller.rb +++ b/backend/app/controllers/spree/admin/general_settings_controller.rb @@ -27,7 +27,7 @@ def clear_cache end def render(*args) - @preferences_currency |= [:allow_currency_change, :show_currency_selector, :supported_currencies] + @preferences_currency |= [:allow_currency_change, :show_currency_selector] super end diff --git a/backend/app/views/spree/admin/general_settings/_form.html.erb b/backend/app/views/spree/admin/general_settings/_form.html.erb index d54defac59e..d2b4342706a 100644 --- a/backend/app/views/spree/admin/general_settings/_form.html.erb +++ b/backend/app/views/spree/admin/general_settings/_form.html.erb @@ -4,12 +4,6 @@
<%= Spree.t('supported_currencies.long') %>