Answered step by step
Verified Expert Solution
Question
1 Approved Answer
To have a real functioning shopping cart, a user must be able to do the following: 1. Add items to the shopping cart 2. Delete
To have a real functioning shopping cart, a user must be able to do the following:
1. Add items to the shopping cart
2. Delete items from the shopping cart
3. Update a quantity of a shopping cart entry
4. Perform a checkout operation by converting the shopping cart entriesinto an Order with its
respective Order Items and then delete all shopping cart entries for that particular user
(customer). This should happen all as part of a single transaction.
A user should never be able to perform a checkout on an empty shopping cart. Throw a custom
exception if this is tried and return that exception to the user.
In order to complete this assignment, you will need to implement the following:
CRUD operations for shopping cart entries.
Implement a checkout operation.
Be able to list all previous orders.
Be able to list all entriesin the shopping cart.
Implement all of the user needs stated above (like performing a checkout operation)
You will need a shopping cart service to implement the checkout operation.
You will also need a controller to handle all of the various CRUD and checkout operations.
Some urls might look like the following:
/users/{customerId}/shoppingcart/{shoppingcartentryid}
/users/{customerid}/shoppingcart?checkout=true
public class ShoppingCartEntry {
@Id
private Long id;
@Column(name="product_id")
private Long productId;
private int quantity;
@Column(name="customer_id")
private Long customerId;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started