Class ShoppingCart

java.lang.Object
springboot.bg.harisauto.cart.ShoppingCart

@Component @SessionScope public class ShoppingCart extends Object
Shopping cart stored in the user's session.
Author:
Kristian Popov
  • Constructor Details

    • ShoppingCart

      public ShoppingCart()
  • Method Details

    • addItem

      public void addItem(CarService service)
      Add item to the cart.
      Parameters:
      service - The service to add.
    • removeItem

      public void removeItem(UUID serviceId)
      Remove item from the cart.
      Parameters:
      serviceId - The service id.
    • clear

      public void clear()
      Clear the cart.
    • getCount

      public int getCount()
      Get the number of items in the cart.
      Returns:
      The number of items.
    • getTotal

      public BigDecimal getTotal()
      Calculate the total price of the items in the cart.
      Returns:
      The total price.