tangentlabs/django-oscar-paypal — pull request #39 by marcofucci (2013-09-18 09:18:46+00:00)
Title: avoid basket getting frozen during express redirect in case of errors

This fixes a bug which freezes the basket if ``RedirectView.as_payment_method = True`` but the shipping address or the shipping method have not been set properly.

In these cases, the ``_get_redirect_url`` method sets the error in messages and returns a url (redirecting to `checkout:shipping-address` or `checkout:shipping-method`) but the ``else`` statement in the ``get_redirect_url`` method freezes the basket so after the redirect the customer can't access to it anymore.

This pull request fixes the bug and improves the ``_get_redirect_url`` method which I believe should raise an exception in case of errors instead of a url redirecting to a previous page.

Unit tests attached.