Interface OrderApi


public interface OrderApi
OrderApi contains all the api operations handling Order in the DzidziApp.
  • Method Details

    • findOrderById

      Order findOrderById(UUID orderId)
      Finds an order by given id
      Parameters:
      orderId - the id of the order
      Returns:
      the order found
      Throws:
      com.dzidzi.exception.EntityNotFoundException - when the order is not found
    • findPlatformOrderById

      PlatformOrder findPlatformOrderById(UUID orderId)
      Finds an order by given id. This shows the relevant information of an order necessary to the management of the application.
      Parameters:
      orderId - the id of the order
      Returns:
      the order found
      Throws:
      com.dzidzi.exception.EntityNotFoundException - when the order is not found
    • findRestaurantOrderById

      RestaurantOrder findRestaurantOrderById(UUID orderId)
      Finds an order by given id. This shows the relevant information of an order necessary to the restaurant.
      Parameters:
      orderId - the id of the order
      Returns:
      the order found
      Throws:
      com.dzidzi.exception.EntityNotFoundException - when the order is not found
    • findRestaurantOrderByIdForNotification

      RestaurantOrder findRestaurantOrderByIdForNotification(UUID orderId)
      Finds an order by given id. This shows the relevant information of an order necessary to the restaurant for new order notifications.
      Parameters:
      orderId - the id of the order
      Returns:
      the order found
      Throws:
      com.dzidzi.exception.EntityNotFoundException - when the order is not found
    • findCourierOrderById

      CourierOrder findCourierOrderById(UUID orderId)
      Finds an order by given id. This shows the relevant information of an order necessary to the courier.
      Parameters:
      orderId - the id of the order
      Returns:
      the order found
      Throws:
      com.dzidzi.exception.EntityNotFoundException - when the order is not found
    • findCourierOrderByIdForNotification

      CourierOrder findCourierOrderByIdForNotification(UUID orderId)
      Finds an order by given id. This shows the relevant information of an order necessary to the courier for new order notifications.
      Parameters:
      orderId - the id of the order
      Returns:
      the order found
      Throws:
      com.dzidzi.exception.EntityNotFoundException - when the order is not found
    • findUserOrderById

      UserOrder findUserOrderById(UUID orderId)
      Finds an order by given id. This shows the relevant information of an order necessary to the user.
      Parameters:
      orderId - the id of the order
      Returns:
      the order found
      Throws:
      com.dzidzi.exception.EntityNotFoundException - when the order is not found
    • createOrder

      @Deprecated Order createOrder(AddOrderRequest addOrderRequest)
      Deprecated.
      Adds/create a new order by the logged-in user.
      Parameters:
      addOrderRequest - the AddOrderRequest containing the properties to create/add a new order
      Returns:
      the order created
    • addUserOrder

      UserOrder addUserOrder(AddOrderRequest addOrderRequest)
      Adds/create a new order by the logged-in user.
      Parameters:
      addOrderRequest - the AddOrderRequest containing the properties to create/add a new order
      Returns:
      the UserOrder created
    • changeOrder

      Order changeOrder(ChangeOrderRequest changeOrderRequest)
      Changes an existing order. This function only works if the order is either in the OrderStatus.PENDING, OrderStatus.ACCEPTED or OrderStatus.PAYED status. If the order status is in any other state, then it's not possible to change an order. Also, only users with UserRole.SERVICE and UserRole.ADMIN can make changes to orders in those states.
      Parameters:
      changeOrderRequest - the ChangeOrderRequest containing the properties to change an order
      Returns:
      the changed order
    • getOrderPriceList

      OrderPriceList getOrderPriceList(AddOrderRequest request)
      Gets the price list of a given order.
      Parameters:
      request - the order request
      Returns:
      the order list
    • cancelOrder

      void cancelOrder(UUID orderId)
      Cancels an order by the given order id.
      Parameters:
      orderId - the order id
      Throws:
      com.dzidzi.exception.DzidziException - when status is not OrderStatus.PENDING
    • changeOrderStatusByRestaurant

      @Deprecated Order changeOrderStatusByRestaurant(OrderStatus status, UUID orderId)
      Changes the order status by the restaurant.
      Parameters:
      status - the status
      orderId - the order id
      Returns:
      the Order changed
    • changeOrderStatusByCourier

      @Deprecated Order changeOrderStatusByCourier(OrderStatus status, UUID orderId)
      Changes the order status by the courier.
      Parameters:
      status - the status
      orderId - the order id
      Returns:
      the Order changed
    • changeStatusByRestaurant

      RestaurantOrder changeStatusByRestaurant(OrderStatus status, UUID orderId)
      Changes the order status by the restaurant.
      Parameters:
      status - the status
      orderId - the order id
      Returns:
      the RestaurantOrder changed
    • changeStatusByCourier

      CourierOrder changeStatusByCourier(OrderStatus status, UUID orderId)
      Changes the order status by the courier.
      Parameters:
      status - the status
      orderId - the order id
      Returns:
      the CourierOrder changed
    • findOrders

      @Deprecated DzidziPaginationDTO<Order> findOrders(FindOrderRequest findOrderRequest)
      Find orders by the given request params.
      Parameters:
      findOrderRequest - the request containing the params to filter orders on
      Returns:
      the paginated orders found
    • findPlatformOrders

      DzidziPaginationDTO<PlatformOrder> findPlatformOrders(FindOrderRequest findOrderRequest)
      Find orders by the given request params. This shows the relevant information of an order necessary to the management of the application.
      Parameters:
      findOrderRequest - the request containing the params to filter orders on
      Returns:
      the paginated orders found
    • findRestaurantOrders

      DzidziPaginationDTO<RestaurantOrder> findRestaurantOrders(FindRestaurantOrderRequest findRestaurantOrderRequest)
      Find orders by the given request params. This shows the relevant information of an order necessary to the restaurant.
      Parameters:
      findRestaurantOrderRequest - the request containing the params to filter restaurant orders on
      Returns:
      the paginated orders found
    • findCourierOrders

      DzidziPaginationDTO<CourierOrder> findCourierOrders(FindCourierOrderRequest findCourierOrderRequest)
      Find orders by the given request params. This shows the relevant information of an order necessary to the courier.
      Parameters:
      findCourierOrderRequest - the request containing the params to filter courier orders on
      Returns:
      the paginated orders found
    • findUserOrders

      DzidziPaginationDTO<UserOrder> findUserOrders(FindUserOrderRequest findUserOrderRequest)
      Find orders by the given request params. This shows the relevant information of an order necessary to the user.
      Parameters:
      findUserOrderRequest - the request containing the params to filter user orders on
      Returns:
      the paginated orders found
    • assignOrder

      void assignOrder(UUID orderId)