Suppose, you have a scenario like this:
Each new order in Virto Commerce should be sent to a logistics company using its REST API. Instead of scheduled execution every X minutes, the customer would prefer to have more control over this process. One option could be initiating the synchronization right after the checkout process is completed.
Or, could a grace period be added? So that a customer could change/cancel the order.
The solution
Straightforward to implement in a custom module and Azure Logic Apps:
- Create a Logic App for getting the order from Virto Commerce, transforming and sending it to external API;
- Create custom Virto Commerce module:
- Create Order event handler, subscribe to Order events, and filter the orders with status “New”;
- Make an HTTP request to trigger the Logic App;
- The (optional) grace period step: create a background job to make the HTTP request after X min. delay, if order wasn’t canceled;
- Logic App gets the order by Id and processes it.
- the Logic App could add the processing info, if any. Or just change status to “Processed”.
Also, check our samples.