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.
This commit is contained in:
Ryan Bigg 2012-05-02 10:26:01 -05:00
parent e539e1d5cf
commit 5ab0b9d6be
1 changed files with 2 additions and 8 deletions

View File

@ -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