I am working on an online store i developp from scratch using Ruby On rails.
I have a design question about stock and orders.
When do you update stock when a user select a product
If you lower the stock when the product is put in the cart, you must be able to restock if the user close his browser. Problem, rails does not handle session expiration for this use case
If i lower stock before sending the customer to my payment solution (like paypal, google checkout or amazon), i still am not notified if the user close his browser.
-If i lower stock once the payment is valid, i may have two different customers buying the same product when only one is left, and the shop now must deliver two product when he has only one left.
Do you know how online store handle this problem ?
Where can i find design documents of open source online store ?