Frozen baskets

187 views
Skip to first unread message

Mohammad Abbas

unread,
May 29, 2014, 12:14:53 PM5/29/14
to django...@googlegroups.com
I have come across this issue a few times recently and was wondering what people's thoughts were...

The way Oscar works at the moment is to freeze the basket and then call the handle_payment method which is overriden by your app. Most of the time the handle payment will involve a redirect to a payment form. However, simply going back to the home page will show the user an empty basket as a new basket is created to replace the frozen basket. This feels like a a bad user experience and I'm not quite sure what the best way to tackle this is.

I think the basket should be frozen when you hit the page with the payment form and thawed on every single other page. This allowed the user to navigate between pages during the checkout while still maintaining the integrity of the basket and preventing manipulation.

What are your thoughts?

David Winterbottom

unread,
May 30, 2014, 7:18:41 AM5/30/14
to django-oscar
On 29 May 2014 17:14, Mohammad Abbas <mohammad...@gmail.com> wrote:
I have come across this issue a few times recently and was wondering what people's thoughts were...

The way Oscar works at the moment is to freeze the basket and then call the handle_payment method which is overriden by your app. Most of the time the handle payment will involve a redirect to a payment form. However, simply going back to the home page will show the user an empty basket as a new basket is created to replace the frozen basket. This feels like a a bad user experience and I'm not quite sure what the best way to tackle this is.

​The intention of Oscar's checkout is for any payment forms to be filled in on the payment-details view (before the basket gets frozen when submitting). If you're redirecting from within handle_payment, then it would normally be to an external site. ​

Some external services like PayPal let you register a dedicated cancellation view so if the user cancels on the external site, we have the chance to thaw their basket. See

However this isn't always the case and manually visiting the homepage will cause the basket to remain frozen.
 

I think the basket should be frozen when you hit the page with the payment form and thawed on every single other page. This allowed the user to navigate between pages during the checkout while still maintaining the integrity of the basket and preventing manipulation.

​Your suggestion makes it sound like your redirecting internally on handle_payment, which my point above addresses. Is this the case?

It's hard to think of a more general solution. The basket freezing exists to prevent users manipulating their basket while they are on an external payment site. You only really know it's safe to thaw the basket when the payment provider tells you so.
 

What are your thoughts?

--
https://github.com/tangentlabs/django-oscar
http://django-oscar.readthedocs.org/en/latest/
https://twitter.com/django_oscar
---
You received this message because you are subscribed to the Google Groups "django-oscar" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-oscar...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-oscar.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-oscar/83229c7e-473d-409f-9db9-0952fc482117%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
David Winterbottom
Technical Director

Tangent Snowball
84-86 Great Portland Street
London W1W 7NR
England, UK

jon4...@gmail.com

unread,
Jun 2, 2014, 10:50:58 AM6/2/14
to django...@googlegroups.com, david.win...@tangentlabs.co.uk
What I ended up doing is cloning the frozen basket just after freezing, making the clone 'open', and then deleting the open basket after sucessful payment. I'm currently testing it, but it seems to work. The code change is in my sagepay app, so I can't make a pull request, but I can give you [David] the diff if you want to consider doing something similar in django-oscar-paypal etc.

David Winterbottom

unread,
Jun 3, 2014, 4:30:32 AM6/3/14
to django-oscar
On 2 June 2014 15:50, <jon4...@gmail.com> wrote:
What I ended up doing is cloning the frozen basket just after freezing, making the clone 'open', and then deleting the open basket after sucessful payment. I'm currently testing it, but it seems to work. The code change is in my sagepay app, so I can't make a pull request, but I can give you [David] the diff if you want to consider doing something similar in django-oscar-paypal etc.

​Yes - that's quite a nice idea. I suppose you have to ensure you close the cloned basket if the response from PP is successful.

I'd like to see the diff if possible.

Thanks.​

 

For more options, visit https://groups.google.com/d/optout.

jon4...@gmail.com

unread,
Jun 3, 2014, 7:10:15 AM6/3/14
to django...@googlegroups.com, david.win...@tangentlabs.co.uk
So it's a bit of a hack, but here it is:
https://gist.github.com/jonatron/b2085b313beba621de3f
Really I should have made a clone method in Basket, and also copied vouchers, but ... time constraints.

jon4...@gmail.com

unread,
Jun 30, 2014, 12:47:21 PM6/30/14
to django...@googlegroups.com, david.win...@tangentlabs.co.uk
For the benefit of anyone who decides to do this, I found I needed to also clone line attributes like so:
https://gist.github.com/jonatron/22dbdcc11e1fb93d3110
Points to someone who can figure out a nicer way of doing it.
Reply all
Reply to author
Forward
0 new messages