Skip to content
This repository has been archived by the owner on Nov 5, 2023. It is now read-only.

Implement Shopping Cart Management #16

Open
9 of 24 tasks
LeHuth opened this issue May 4, 2023 · 0 comments
Open
9 of 24 tasks

Implement Shopping Cart Management #16

LeHuth opened this issue May 4, 2023 · 0 comments
Assignees
Labels

Comments

@LeHuth
Copy link
Owner

LeHuth commented May 4, 2023

Shopping Cart Management

Overview

Implement APIs and logic to manage shopping carts and their items, including creating, reading, updating, and deleting shopping carts, as well as adding, updating, and removing items from the shopping carts.

Tasks

1. Create Shopping Cart API

  • Implement an API endpoint to create a new shopping cart for a user

  • Associate the shopping cart with the user who created it

  • Ensure that a user can only have one active shopping cart at a time

2. Read Shopping Cart API

  • Implement an API endpoint to retrieve a user's active shopping cart, including its items and their details

  • Calculate and return the total price of the items in the shopping cart

  • Return an empty shopping cart if the user does not have an active shopping cart

3. Add Item to Shopping Cart API

  • Implement an API endpoint to add a new item to a user's shopping cart

  • Validate that the product exists and has sufficient stock before adding it to the cart

  • Prevent the addition of duplicate items; instead, update the existing item's quantity

  • Adjust the total price of the shopping cart accordingly

4. Update Item in Shopping Cart API

  • Implement an API endpoint to update the quantity of an item in a user's shopping cart

  • Validate the new quantity against the available stock of the product

  • Prevent updating an item's quantity to zero; instead, remove the item from the cart

  • Adjust the total price of the shopping cart accordingly

5. Remove Item from Shopping Cart API

  • Implement an API endpoint to remove an item from a user's shopping cart

  • Validate that the item exists in the shopping cart before removing it

  • Adjust the total price of the shopping cart accordingly

6. Clear Shopping Cart API

  • Implement an API endpoint to remove all items from a user's shopping cart

  • Update the total price of the shopping cart to zero

7. Validate Shopping Cart API

  • Implement a validation mechanism to ensure that the items in the shopping cart are still available and have not become out-of-stock or discontinued

  • Implement an API endpoint to validate the shopping cart before proceeding to the checkout process

  • Return a list of any items with issues, such as stock unavailability or product discontinuation

8. Error Handling

  • Implement proper error handling for shopping cart-related actions, including descriptive error messages and appropriate HTTP status codes

  • Handle cases where the user is not authenticated, the product or item is not found, or the item quantity exceeds available stock

Acceptance Criteria

  • All API endpoints for shopping cart management should be implemented and working as expected
  • Proper error handling and validation should be in place for each API endpoint
  • Unit tests should be written for each API endpoint to ensure functionality and robustness
  • The shopping cart backend should properly handle scenarios such as user authentication, product or item not found, or item quantity exceeding available stock
  • The shopping cart total price should be accurately calculated and updated as items are added, updated, or removed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants