Package org.bookstore.order.service
Interface OrderService
public interface OrderService
The interface OrderService defines a service to manage the orders of a bookstore.
- 
Method SummaryModifier and TypeMethodDescriptionvoidcancelOrder(long id) Tries to cancel an order.findOrder(long id) Finds an order by identifier.placeOrder(long customerId, List<OrderItem> items) Places an order with the bookstore.searchOrders(long customerId, int year) Searches for orders by customer and year.
- 
Method Details- 
placeOrderOrder placeOrder(long customerId, List<OrderItem> items) throws CustomerNotFoundException, PaymentFailedException Places an order with the bookstore.- Parameters:
- customerId- the identifier of the customer
- items- the items to be ordered
- Returns:
- the data of the placed order
- Throws:
- CustomerNotFoundException- if no customer with the specified identifier exists
- PaymentFailedException- if the payment failed (e.g. invalid or expired credit card, amount exceeds limit)
 
- 
findOrderFinds an order by identifier.- Parameters:
- id- the identifier of the order
- Returns:
- the data of the found order
- Throws:
- OrderNotFoundException- if no order with the specified identifier exists
 
- 
searchOrdersSearches for orders by customer and year.- Parameters:
- customerId- the identifier of the customer
- year- the year of the orders
- Returns:
- the matching orders
- Throws:
- CustomerNotFoundException- if no customer with the specified identifier exists
 
- 
cancelOrderTries to cancel an order.- Parameters:
- id- the identifier of the order
- Throws:
- OrderNotFoundException- if no order with the specified identifier exists
- OrderAlreadyShippedException- if the order has already been shipped
 
 
-