@Entity public class Order extends AbstractEntity<OrderIdentifier>
Modifier and Type | Class and Description |
---|---|
static class |
Order.OrderCompleted |
static class |
Order.OrderPaid |
Modifier | Constructor and Description |
---|---|
protected |
Order() |
|
Order(UserAccount userAccount)
Creates a new Order
|
|
Order(UserAccount userAccount,
PaymentMethod paymentMethod)
|
Modifier and Type | Method and Description |
---|---|
void |
add(ChargeLine chargeLine) |
void |
add(OrderLine orderLine)
|
(package private) void |
cancel() |
(package private) Order |
complete() |
Streamable<ChargeLine> |
getChargeLines() |
javax.money.MonetaryAmount |
getChargeLinesPrice() |
LocalDateTime |
getDateCreated() |
(package private) Collection<Object> |
getEvents() |
OrderIdentifier |
getId() |
(package private) int |
getNumberOfLineItems() |
javax.money.MonetaryAmount |
getOrderedLinesPrice() |
Streamable<OrderLine> |
getOrderLines() |
OrderStatus |
getOrderStatus() |
PaymentMethod |
getPaymentMethod() |
javax.money.MonetaryAmount |
getTotalPrice() |
UserAccount |
getUserAccount() |
boolean |
isCanceled()
Convenience method for checking if an order has the status CANCELLED
|
boolean |
isCompleted()
Convenience method for checking if an order has the status COMPLETED
|
boolean |
isOpen()
Convenience method for checking if an order has the status OPEN
|
boolean |
isPaid()
Convenience method for checking if an order has the status PAID
|
(package private) boolean |
isPaymentExpected() |
(package private) Order |
markPaid() |
void |
remove(ChargeLine chargeLine) |
void |
remove(OrderLine orderLine) |
(package private) void |
setDateCreated(LocalDateTime dateCreated) |
void |
setPaymentMethod(PaymentMethod paymentMethod) |
String |
toString() |
(package private) void |
wipeEvents() |
equals, hashCode, isNew
public Order(UserAccount userAccount)
userAccount
- The UserAccount
connected to this order, must not be null.public Order(UserAccount userAccount, PaymentMethod paymentMethod)
userAccount
- The UserAccount
connected to this order, must not be null.paymentMethod
- The PaymentMethod
connected to this order, must not be null.@Generated(value="lombok") protected Order()
public OrderIdentifier getId()
public Streamable<OrderLine> getOrderLines()
public Streamable<ChargeLine> getChargeLines()
public javax.money.MonetaryAmount getTotalPrice()
public javax.money.MonetaryAmount getOrderedLinesPrice()
public javax.money.MonetaryAmount getChargeLinesPrice()
public void add(OrderLine orderLine)
orderLine
- the OrderLine
to be added.IllegalArgumentException
- if orderLine is null.public void remove(OrderLine orderLine)
public void add(ChargeLine chargeLine)
public void remove(ChargeLine chargeLine)
public boolean isPaid()
public boolean isCanceled()
public boolean isCompleted()
public boolean isOpen()
public final PaymentMethod getPaymentMethod()
public void setPaymentMethod(PaymentMethod paymentMethod)
Order complete()
void cancel()
int getNumberOfLineItems()
boolean isPaymentExpected()
Order markPaid()
Collection<Object> getEvents()
void wipeEvents()
@Generated(value="lombok") public String toString()
@Generated(value="lombok") public UserAccount getUserAccount()
@Generated(value="lombok") public LocalDateTime getDateCreated()
@Generated(value="lombok") void setDateCreated(LocalDateTime dateCreated)
@Generated(value="lombok") public OrderStatus getOrderStatus()
Copyright © 2018 Pivotal Software, Inc.. All rights reserved.