Get problematic orders
Description#
Allows the admins to fetch an immediate list of problematic orders that they need to be aware of and potentially resolve themselves.
Mechanism#
- Fetch all orders that have
placedorder state and that have a lifespan of over 5 minutes. Dubbed as "ignored orders". - Fetch all orders that have
Accepted,Awaiting pickup, order state and that have a lifespan of over 45 minutes. Dubbed as "delayed orders". - Fetch all orders that have
In deliveryorder state and that have a lifespan of over 60 minutes. Dubbed as "Lost couriers". - Fetch all orders that have
Accepted,Awaiting pickuporder state and that have a delivery method ofhome deliverywhich do not have a courier assigned to them for at least 3 minutes since beingAccepted. Dubbed as "No couriers". - Fetch all
Deliveredorders that do not have an order sale state ofCapturedorResolvedfor 5 minutes since the order beingDelivered. Dubbed as "Payment failures". - Sum the amount of orders in each of the previous queries.
- Sort the orders by creation date, oldest to newest.
Output#
- Object with a property for each of the orders defined in the mechanism in the form of an array of order entityorders along with a count of the total "Problematic" orders.