From 75ec77dc31de2c57514948211755a05356eab938 Mon Sep 17 00:00:00 2001 From: Rob Harrington Date: Sat, 23 Sep 2017 12:33:45 +1000 Subject: [PATCH] Remove the 'confirm' step from the order checkout flow This step is not being responded to anyway, since we are not rending a page for each checkout step It was causing an issue whereby an order in the 'confirm' state was not able to progress through the checkout controller because it was expecting to only redirect to paypal from the 'payment' state. figured it was easiest to just remove the step, seeing as it wasn't being used in any meaningful way. It should be fine to bring the 'confirm' step back in the future if we need it, we will just have to make sure paypal the paypal issue is resolved. --- app/models/spree/order_decorator.rb | 3 ++- spec/models/spree/order_spec.rb | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/models/spree/order_decorator.rb b/app/models/spree/order_decorator.rb index 9892293114..0166fc10c1 100644 --- a/app/models/spree/order_decorator.rb +++ b/app/models/spree/order_decorator.rb @@ -37,7 +37,8 @@ Spree::Order.class_eval do end order.payment_required? } - go_to_state :confirm, :if => lambda { |order| order.confirmation_required? } + # NOTE: :confirm step was removed because we were not actually using it + # go_to_state :confirm, :if => lambda { |order| order.confirmation_required? } go_to_state :complete remove_transition :from => :delivery, :to => :confirm end diff --git a/spec/models/spree/order_spec.rb b/spec/models/spree/order_spec.rb index 8ed03ff0f7..d722e234d2 100644 --- a/spec/models/spree/order_spec.rb +++ b/spec/models/spree/order_spec.rb @@ -750,4 +750,15 @@ describe Spree::Order do end end end + + describe "determining checkout steps for an order" do + let!(:enterprise) { create(:enterprise) } + let!(:order) { create(:order, distributor: enterprise) } + let!(:payment_method) { create(:stripe_payment_method, distributor_ids: [enterprise.id], preferred_enterprise_id: enterprise.id) } + let!(:payment) { create(:payment, order: order, payment_method: payment_method) } + + it "does not include the :confirm step" do + expect(order.checkout_steps).to_not include "confirm" + end + end end