From 3bcfc673f7b7b14972ee7a3ef48f8f8a7f0640ed Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Mon, 6 Sep 2021 20:27:10 +0100 Subject: [PATCH] Ensure selected shipping method is actually selected Hashes with symbol keys != hashes with string keys :see_no_evil: --- app/controllers/checkout_controller.rb | 2 +- app/services/order_workflow.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/checkout_controller.rb b/app/controllers/checkout_controller.rb index cffa0877b7..6b0f08ba99 100644 --- a/app/controllers/checkout_controller.rb +++ b/app/controllers/checkout_controller.rb @@ -175,7 +175,7 @@ class CheckoutController < ::BaseController return action_failed unless @order.process_payments! end - next if OrderWorkflow.new(@order).next({ shipping_method_id: shipping_method_id }) + next if OrderWorkflow.new(@order).next({ "shipping_method_id" => shipping_method_id }) return action_failed end diff --git a/app/services/order_workflow.rb b/app/services/order_workflow.rb index b27a828370..46596b67ce 100644 --- a/app/services/order_workflow.rb +++ b/app/services/order_workflow.rb @@ -37,7 +37,7 @@ class OrderWorkflow def advance_order_options shipping_method_id = order.shipping_method.id if order.shipping_method.present? - { shipping_method_id: shipping_method_id } + { "shipping_method_id" => shipping_method_id } end def advance_to_state(target_state, options = {}) @@ -67,7 +67,7 @@ class OrderWorkflow def after_transition_hook(options) if order.state == "delivery" - order.select_shipping_method(options[:shipping_method_id]) + order.select_shipping_method(options["shipping_method_id"]) end persist_all_payments if order.state == "payment"