How to notify the order confirmation with a request to another server
Posted: Fri Feb 23, 2018 1:26 am
I am working on a shipping cost calculator that manages the inventory on different locations and splits the items of the same order on several shipments. I think the logic is too complex for OpenCart, so I decided to create a new server to do the job. I may be wrong because I don't know OpenCart, but I don't want to risk to embark on a long project only to find out that I am asking too much from OpenCart.
So I created a new shipping cost extension for OpenCart that sends the info about the cart and the shipping address to another server. The second server crunches the numbers, and returns the shipping options to OpenCart. The user picks one of the options and continues with the checkout to the order confirmation page.
Everything works well until now.
Now I need to tell the second server that the order has been confirmed, so the inventory can be updated.
Is it possible, when the user clicks on Confirm Order, to:
1) send a request to the second server saying that the order has been confirmed
2) wait for the second server to respond, to make sure that everything went well
3) cancel the order if something went wrong
The second server will:
- when the shipping cost is calculated: put the material on hold and keep it on hold for the next 20 minutes
- when the order is confirmed: decrease the quantity on the inventory
- when the 20 minute expire without order confirmation: remove the hold on the material
So I created a new shipping cost extension for OpenCart that sends the info about the cart and the shipping address to another server. The second server crunches the numbers, and returns the shipping options to OpenCart. The user picks one of the options and continues with the checkout to the order confirmation page.
Everything works well until now.
Now I need to tell the second server that the order has been confirmed, so the inventory can be updated.
Is it possible, when the user clicks on Confirm Order, to:
1) send a request to the second server saying that the order has been confirmed
2) wait for the second server to respond, to make sure that everything went well
3) cancel the order if something went wrong
The second server will:
- when the shipping cost is calculated: put the material on hold and keep it on hold for the next 20 minutes
- when the order is confirmed: decrease the quantity on the inventory
- when the 20 minute expire without order confirmation: remove the hold on the material