Skip to content
This repository has been archived by the owner on Feb 27, 2021. It is now read-only.

Checkout API endpoints fails when updating an order with a shipping address #42

Open
jsilland opened this issue Jul 7, 2015 · 1 comment

Comments

@jsilland
Copy link

jsilland commented Jul 7, 2015

This is happening on a reasonably vanilla install of Spree 2.4, where spree_multi_currency 2.4-stable installed — the one customization that we have made and seems to be relevant in this case is that we set the session[:currency] field for each request based on the request's IP address, including for API requests.

The problem is relatively easy to track down:

  • CurrencyHelpers is included in ApplicationController by the SpreeMultiCurrency::Engine class in order to provide the supported_currencies method.
  • Separately, Spree::Core::ControllerHelpers::Order is augmented by a decorator in this gem to intercept the current_currency method and validate that it belongs to the supported_currencies available from every controller.
  • As it turns out, Spree::Api::CheckoutsController includes Spree::Core::ControllerHelpers::Order but does not have the supported_currencies method available, because it isn't a subclass of ApplicationController — API controllers inherit from ActionController::Base.

Proposed solution (that we are likely going to go with on our end) is to include the CurrencyHelpers in the Spree::Api::BaseController

@mdavo6
Copy link

mdavo6 commented Oct 11, 2019

Thanks @jsilland , your notes were very helpful. 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants