diff --git a/app/controllers/spree/checkout_controller_decorator.rb b/app/controllers/spree/checkout_controller_decorator.rb index 3db3054..890429a 100644 --- a/app/controllers/spree/checkout_controller_decorator.rb +++ b/app/controllers/spree/checkout_controller_decorator.rb @@ -147,7 +147,8 @@ module Spree Rails.logger.error ppx_auth_response.to_yaml end - @order.update_attribute(:state, "complete") + @order.update_attributes({:state => "complete", :completed_at => Time.now}, :without_protection => true) + state_callback(:after) # So that after_complete is called, setting session[:order_id] to nil # Since we dont rely on state machine callback, we just explicitly call this method for spree_store_credits diff --git a/spec/controllers/checkout_controller_spec.rb b/spec/controllers/checkout_controller_spec.rb index 90d75a3..1c4fa22 100644 --- a/spec/controllers/checkout_controller_spec.rb +++ b/spec/controllers/checkout_controller_spec.rb @@ -97,6 +97,7 @@ module Spree order.reload order.state.should == "complete" + order.completed_at.should_not be_nil order.payments.size.should == 1 order.payment_state.should == "paid" end