From 3d5af5bdafcfc8c2fb6ebcc3c94f972ed1d80726 Mon Sep 17 00:00:00 2001 From: Bounmy Stephane Date: Fri, 25 May 2012 21:26:19 +0200 Subject: [PATCH] set completed_at --- app/controllers/spree/checkout_controller_decorator.rb | 3 ++- spec/controllers/checkout_controller_spec.rb | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) 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