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#

  1. Fetch all orders that have placed order state and that have a lifespan of over 5 minutes. Dubbed as "ignored orders".
  2. Fetch all orders that have Accepted, Awaiting pickup, order state and that have a lifespan of over 45 minutes. Dubbed as "delayed orders".
  3. Fetch all orders that have In delivery order state and that have a lifespan of over 60 minutes. Dubbed as "Lost couriers".
  4. Fetch all orders that have Accepted, Awaiting pickup order state and that have a delivery method of home delivery which do not have a courier assigned to them for at least 3 minutes since being Accepted. Dubbed as "No couriers".
  5. Fetch all Delivered orders that do not have an order sale state of Captured or Resolved for 5 minutes since the order being Delivered. Dubbed as "Payment failures".
  6. Sum the amount of orders in each of the previous queries.
  7. 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.