Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't destroy line items #11

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open

Conversation

hoverlover
Copy link

I made a change in base_controller_decorator.rb to not destroy the line items. This was causing a problem if the user returns to the Spree site via some means other than the PayPal link, but after the IPN call is made.

As a result of the IPN call, the order#payment_state is set to paid. When the line items are destroyed in the base_controller_decorator.rb, it triggers the order#update! method. This in turn calls order#update_totals, and since there are no longer any line items, sets order#total to 0. It also triggers the order#update_payment_state. This method sees that order#total is now 0, and sets the order#payment_state to credit_owed since there is a payment with an amount greater than 0.

You can see how removing the line items is causing problems. I opted to simply set the @current_order to nil, and since you were already setting the order_id in the session to nil, the user no longer has a cart.

@tomash
Copy link
Owner

tomash commented Jan 26, 2012

This looks interesting, I'll look into it during the weekend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants