Separate OrderCompletionReset from Checkout::PostCheckoutActions and don't pass controller objects to Checkout::PostCheckoutActions

We need to separate some of these bits to make them easier to call in different contexts. Also there's some weird stuff happening here with the controller being passed in to the service, and it seems like a code smell to me...
This commit is contained in:
Matt-Yorkley
2021-12-05 10:38:15 +00:00
parent ad60f2392a
commit 67b8a55273
3 changed files with 7 additions and 20 deletions

View File

@@ -220,7 +220,8 @@ class CheckoutController < ::BaseController
end
def checkout_succeeded
Checkout::PostCheckoutActions.new(@order).success(self, params, spree_current_user)
Checkout::PostCheckoutActions.new(@order).success(params, spree_current_user)
OrderCompletionReset.new(self, @order).call
session[:access_token] = current_order.token
flash[:notice] = t(:order_processed_successfully)