Browse files

Remove the completed order from the session after returning from paypal.

  • Loading branch information...
1 parent b53f60b commit 40be35472c2138c13f10bc43d8615e7070306e1b @schof schof committed Oct 30, 2008
View
3 app/controllers/paypal_payments_controller.rb
@@ -70,6 +70,9 @@ def successful
@order.pend_payment!
end
+ # remove order from the session (its not really practical to allow the user to edit the session anymore)
+ session[:order_id] = nil
+
if logged_in?
@order.update_attribute("user", current_user)
redirect_to order_url(@order) and return
View
6 spec/controllers/paypal_payments_controllers_spec.rb
@@ -104,6 +104,12 @@ def do_successful
do_successful
response.should redirect_to(signup_path)
end
+ it "should remove the order from the session" do
+ # order should be in the session prior to reaching this controller so we'll simulate that fact
+ session[:order_id] = "FOO"
+ do_successful
+ session[:order_id].should be_nil
+ end
end
describe "when ipn has not yet been received" do
it "should create a payment" do

0 comments on commit 40be354

Please sign in to comment.