Package com.dzidzi.api
Interface OrderApi
public interface OrderApi
OrderApi contains all the api operations handling
Order in the DzidziApp.-
Method Summary
Modifier and TypeMethodDescriptionaddUserOrder(AddOrderRequest addOrderRequest) Adds/create a new order by the logged-in user.voidassignOrder(UUID orderId) voidcancelOrder(UUID orderId) Cancels an order by the given order id.changeOrder(ChangeOrderRequest changeOrderRequest) Changes an existing order.changeOrderStatusByCourier(OrderStatus status, UUID orderId) Deprecated.changeOrderStatusByRestaurant(OrderStatus status, UUID orderId) Deprecated.changeStatusByCourier(OrderStatus status, UUID orderId) Changes the order status by the courier.changeStatusByRestaurant(OrderStatus status, UUID orderId) Changes the order status by the restaurant.createOrder(AddOrderRequest addOrderRequest) Deprecated.findCourierOrderById(UUID orderId) Finds an order by given id.findCourierOrderByIdForNotification(UUID orderId) Finds an order by given id.findCourierOrders(FindCourierOrderRequest findCourierOrderRequest) Find orders by the given request params.findOrderById(UUID orderId) Finds an order by given idfindOrders(FindOrderRequest findOrderRequest) Deprecated.usefindPlatformOrders(FindOrderRequest)for platform owners,findRestaurantOrders(FindRestaurantOrderRequest)for restaurant users,findCourierOrders(FindCourierOrderRequest)for courier users andfindUserOrders(FindUserOrderRequest)for customers.findPlatformOrderById(UUID orderId) Finds an order by given id.findPlatformOrders(FindOrderRequest findOrderRequest) Find orders by the given request params.findRestaurantOrderById(UUID orderId) Finds an order by given id.Finds an order by given id.findRestaurantOrders(FindRestaurantOrderRequest findRestaurantOrderRequest) Find orders by the given request params.findUserOrderById(UUID orderId) Finds an order by given id.findUserOrders(FindUserOrderRequest findUserOrderRequest) Find orders by the given request params.getOrderPriceList(AddOrderRequest request) Gets the price list of a given order.
-
Method Details
-
findOrderById
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
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
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
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
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
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
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.Adds/create a new order by the logged-in user.- Parameters:
addOrderRequest- theAddOrderRequestcontaining the properties to create/add a new order- Returns:
- the order created
-
addUserOrder
Adds/create a new order by the logged-in user.- Parameters:
addOrderRequest- theAddOrderRequestcontaining the properties to create/add a new order- Returns:
- the
UserOrdercreated
-
changeOrder
Changes an existing order. This function only works if the order is either in theOrderStatus.PENDING,OrderStatus.ACCEPTEDorOrderStatus.PAYEDstatus. If the order status is in any other state, then it's not possible to change an order. Also, only users withUserRole.SERVICEandUserRole.ADMINcan make changes to orders in those states.- Parameters:
changeOrderRequest- theChangeOrderRequestcontaining the properties to change an order- Returns:
- the changed order
-
getOrderPriceList
Gets the price list of a given order.- Parameters:
request- the order request- Returns:
- the order list
-
cancelOrder
Cancels an order by the given order id.- Parameters:
orderId- the order id- Throws:
com.dzidzi.exception.DzidziException- when status is notOrderStatus.PENDING
-
changeOrderStatusByRestaurant
Deprecated.Changes the order status by the restaurant.- Parameters:
status- the statusorderId- the order id- Returns:
- the
Orderchanged
-
changeOrderStatusByCourier
Deprecated.Changes the order status by the courier.- Parameters:
status- the statusorderId- the order id- Returns:
- the
Orderchanged
-
changeStatusByRestaurant
Changes the order status by the restaurant.- Parameters:
status- the statusorderId- the order id- Returns:
- the
RestaurantOrderchanged
-
changeStatusByCourier
Changes the order status by the courier.- Parameters:
status- the statusorderId- the order id- Returns:
- the
CourierOrderchanged
-
findOrders
Deprecated.usefindPlatformOrders(FindOrderRequest)for platform owners,findRestaurantOrders(FindRestaurantOrderRequest)for restaurant users,findCourierOrders(FindCourierOrderRequest)for courier users andfindUserOrders(FindUserOrderRequest)for customers.Find orders by the given request params.- Parameters:
findOrderRequest- the request containing the params to filter orders on- Returns:
- the paginated orders found
-
findPlatformOrders
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
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
-
changeStatusByCourier(OrderStatus, UUID)