From 5ab0b9d6bea87b741627a914b4d7b5920ae539f0 Mon Sep 17 00:00:00 2001 From: Ryan Bigg Date: Wed, 2 May 2012 10:26:01 -0500 Subject: [PATCH] Explicitly set order state to complete + call finalize, rather than jumping through all the states Previously, the checkout controller decorator here would go through each of the order states and call @order.update! for each state, as well as the order callback. This is unecessary for PayPal transactions. All that needs to happen here is that the state is put into the complete state and the order is finalized. Fixes #48. Finally. --- app/controllers/spree/checkout_controller_decorator.rb | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/app/controllers/spree/checkout_controller_decorator.rb b/app/controllers/spree/checkout_controller_decorator.rb index 8e78ef4..7227ad7 100644 --- a/app/controllers/spree/checkout_controller_decorator.rb +++ b/app/controllers/spree/checkout_controller_decorator.rb @@ -145,14 +145,8 @@ module Spree Rails.logger.error ppx_auth_response.to_yaml end - #need to force checkout to complete state - until @order.state == "complete" - if @order.next! - @order.update! - state_callback(:after) - end - end - + @order.update_attribute(:state, "complete") + @order.finalize! flash[:notice] = I18n.t(:order_processed_successfully) redirect_to completion_route