| Constructor and Description |
|---|
Cart() |
| Modifier and Type | Method and Description |
|---|---|
Order |
addItemsTo(Order order)
Turns the current state of the cart into an
Order. |
CartItem |
addOrUpdateItem(Product product,
double amount)
|
CartItem |
addOrUpdateItem(Product product,
long amount)
|
CartItem |
addOrUpdateItem(Product product,
Quantity quantity)
|
void |
clear()
Clears the cart.
|
Order |
createOrderFor(UserAccount user)
Creates a new Order for the given
UserAccount from the current Cart. |
Optional<CartItem> |
getItem(String identifier)
Returns the CartItem for the given identifier.
|
javax.money.MonetaryAmount |
getPrice()
Returns the price of the item.
|
boolean |
isEmpty()
Returns whether the
Cart is currently empty. |
Iterator<CartItem> |
iterator() |
Optional<CartItem> |
removeItem(String identifier)
Removes the
CartItem with the given identifier. |
static javax.money.MonetaryAmount |
sumUp(Iterable<? extends org.salespointframework.order.Priced> priced)
Sums up the prices of all given
Priced instances. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitand, empty, filter, flatMap, get, map, of, of, of, streamforEach, spliteratorpublic CartItem addOrUpdateItem(Product product, Quantity quantity)
CartItem for the given Product and Quantity. If a CartItem for the given
Product already exists the Cart will be updated to reflect the combined Quantity for the
backing CartItem.product - must not be nullquantity - must not be nullCartItem.public CartItem addOrUpdateItem(Product product, long amount)
CartItem for the given Product and amount. If a CartItem for the given
Product already exists the Cart will be updated to reflect the combined Quantity for the
backing CartItem.product - must not be null.amount - must not be null.public CartItem addOrUpdateItem(Product product, double amount)
CartItem for the given Product and amount. If a CartItem for the given
Product already exists the Cart will be updated to reflect the combined Quantity for the
backing CartItem.product - must not be null.amount - must not be null.public Optional<CartItem> removeItem(String identifier)
CartItem with the given identifier.identifier - must not be null.public Optional<CartItem> getItem(String identifier)
identifier - must not be null.public void clear()
public boolean isEmpty()
Cart is currently empty.isEmpty in interface org.springframework.data.util.Streamable<CartItem>public Order addItemsTo(Order order)
Order.order - must not be null.Order which all items in the card have been added to.IllegalStateException - if the given Order is not OrderStatus.OPEN anymore.public Order createOrderFor(UserAccount user)
UserAccount from the current Cart.user - must not be null.Cart and given UserAccount.public javax.money.MonetaryAmount getPrice()
public static javax.money.MonetaryAmount sumUp(Iterable<? extends org.salespointframework.order.Priced> priced)
Priced instances.priced - must not be null.Copyright © 2018. All rights reserved.