Closed jedie closed 5 years ago
Well this is not something that is specifically django-oscar-docdata
related and it is not as easy at it seems.
When you create an order in django-oscar the basket will be frozen so it can't be modified anymore. When you reload a page, the view will detect that the basket is frozen and creates a new one for you. This is a bit how the django-oscar system works out of the box:
Basket -> Order -> Payment
After creating an order you can pay for it. When a payment is cancelled or an error occurred you should be redirected to a page where you can try to repay for the order again. You could unfreeze the basket, but this will result in a useless order in the system.
Repaying an order is pretty tricky with Docdata as it requires that the merchant order id is unique. In a customer project we 'solved' this by appending a suffix to the order number.
Hm. Why not just generate a new order?
e.g.:
A new order will be generated if the user just click on "pay now" again. So it's a new, unique Order ID.
So it's:
Basket -> freeze Basket -> Order -> Payment -> cancel Order -> unfreeze Basket
Here you go 41e152264cc25b0a2c74965e23a8e8f560ecc98f
Worked! Great. Thanks.
I used the sandbox and the shopping cart is always empty after return from docdata payment menu page...
I think it shouldn't be like this if it return returns with CANCELLED or ERROR. I think the basket should be filled exactly as before and not change.