Interface CartAdapter


public interface CartAdapter
Adapter interface for shopping cart operations.

Implement this interface to connect to a commerce platform's cart functionality.

  • Method Details

    • getCart

      Cart getCart(String cartId)
      Retrieves a cart by its ID.
      Parameters:
      cartId - the unique identifier of the cart
      Returns:
      the requested cart, or null if not found
    • createCart

      Cart createCart(String customerId)
      Creates a new cart for a customer.
      Parameters:
      customerId - the unique identifier of the customer (optional)
      Returns:
      the newly created cart
    • addToCart

      Cart addToCart(String cartId, String productId, int quantity)
      Adds an item to the cart.
      Parameters:
      cartId - the unique identifier of the cart
      productId - the unique identifier of the product to add
      quantity - the quantity of the product to add
      Returns:
      the updated cart
    • removeFromCart

      Cart removeFromCart(String cartId, String itemId)
      Removes an item from the cart.
      Parameters:
      cartId - the unique identifier of the cart
      itemId - the unique identifier of the item to remove
      Returns:
      the updated cart
    • updateItemQuantity

      Cart updateItemQuantity(String cartId, String itemId, int quantity)
      Updates the quantity of an item in the cart.
      Parameters:
      cartId - the unique identifier of the cart
      itemId - the unique identifier of the item to update
      quantity - the new quantity
      Returns:
      the updated cart