@Entity public class ProductPaymentEntry extends AccountancyEntry
ProductPaymentEntry
is used to store information of payments of orders.Constructor and Description |
---|
ProductPaymentEntry(OrderIdentifier orderIdentifier,
UserAccount userAccount,
javax.money.MonetaryAmount amount,
String description,
PaymentMethod paymentMethod)
A
ProductPaymentEntry is constructed for a specific OrderIdentifier attached to it. |
Modifier and Type | Method and Description |
---|---|
boolean |
belongsTo(Order order)
Returns whether the
ProductPaymentEntry belongs to the given Order . |
OrderIdentifier |
getOrderIdentifier()
The
OrderIdentifier which this ProductPaymentEntry refers to. |
PaymentMethod |
getPaymentMethod()
The
PaymentMethod chosen for the order belonging to this ProductPaymentEntry |
UserAccount |
getUserAccount()
The
UserAccount which this ProductPaymentEntry refers to. |
static ProductPaymentEntry |
of(Order order,
String description) |
static ProductPaymentEntry |
rollback(Order order,
String description)
Creates a new
ProductPaymentEntry that rolls back the payment for the given Order . |
String |
toString() |
getDate, getDescription, getId, getValue, hasDate, isExpense, isRevenue
equals, hashCode, isNew
public ProductPaymentEntry(OrderIdentifier orderIdentifier, UserAccount userAccount, javax.money.MonetaryAmount amount, String description, PaymentMethod paymentMethod)
ProductPaymentEntry
is constructed for a specific OrderIdentifier
attached to it. This entry
saves also the UserAccountIdentifier
and the specified amount that was paid.orderIdentifier
- the OrderIdentifier
to which this ProductPaymentEntry
will refer to, must
not be null.userAccount
- the UserAccount
to which this ProductPaymentEntry
will refer to, must not be
null.amount
- the MonetaryAmount
that was paid, must not be null.description
- textual description of the payment entry, must not be null.paymentMethod
- must not be null.public static ProductPaymentEntry of(Order order, String description)
public static ProductPaymentEntry rollback(Order order, String description)
ProductPaymentEntry
that rolls back the payment for the given Order
.order
- must not be null.description
- must not be null.public boolean belongsTo(Order order)
ProductPaymentEntry
belongs to the given Order
.order
- must not be null.public OrderIdentifier getOrderIdentifier()
OrderIdentifier
which this ProductPaymentEntry
refers to.public UserAccount getUserAccount()
UserAccount
which this ProductPaymentEntry
refers to.public PaymentMethod getPaymentMethod()
PaymentMethod
chosen for the order belonging to this ProductPaymentEntry
public String toString()
toString
in class AccountancyEntry
Copyright © 2019. All rights reserved.