I - as OrderItem type@Entity public class Order<I extends OrderItem> extends BaseOrderItem implements FlowState, Identifiable<Long>
Order.| Modifier and Type | Field and Description |
|---|---|
protected Date |
created
Date of creation.
Useful if purchaseDate is not same as created date
TODO: Made nullable for now to support projects where col did not exist. |
protected Long |
id |
protected PaymentMethod |
paymentMethod |
protected Date |
purchaseDate
Date when the order was purchased.
|
protected Boolean |
realized
If the order was realized or not.
|
protected Date |
statusDate
Date when
BaseOrderItem.status was changed |
protected String |
type
A type to specify the type of order.
|
protected GenericEcomUser |
user
Orders may contain
userContactDetails and hence for GuestUsers in particular, user maybe optional |
amount, finalWeight, lastStatusReason, packagingAmount, paymentContext, promotionNames, quantity, shippingAmount, status, updated| Constructor and Description |
|---|
Order() |
Order(GenericEcomUser user,
PaymentContext paymentContext,
PaymentMethod paymentMethod,
Amount amount,
Date purchaseDate) |
Order(GenericEcomUser user,
PaymentMethod paymentMethod) |
Order(GenericEcomUser user,
PaymentMethod paymentMethod,
Amount amount) |
Order(GenericEcomUser user,
PaymentMethod paymentMethod,
Amount amount,
Date purchaseDate) |
Order(Order order) |
Order(String json) |
| Modifier and Type | Method and Description |
|---|---|
void |
addItem(I item)
Add
OrderItem and do some basic checks and assignment |
void |
addTransaction(Transaction transaction)
Add
Transaction and do some basic checks and assignment
TODO: Add Unit test case to avoid duplicates |
boolean |
equals(Object obj) |
String |
getActors()
Who all were involved in the Order workflow if it involved multiple people.
|
Integer |
getBitmask()
Optional param that allows an Application to define project specific switches (boolean flags) for an Order.
|
Date |
getCreated()
|
DeliveryDetails |
getDeliveryDetails() |
FlowStatus |
getFlowStatus()
Existing
FlowStatus |
Long |
getId() |
String |
getInvoiceId()
The Invoice ID/Number generated
Clients maybe picky about Invoice Number formats etc, hence a special field provided so it does not HAVE TO be same as Order or Transaction Number. |
List<I> |
getItems() |
Date |
getLastInvoiceDate()
Date the last invoice was sent for this Order
An order amount can be changed and hence Invoices can be re-sent or for other reason Invoices can be sent multiple times. |
String |
getParams()
A comma or JSON defined parameter String that allows an Application to define project specific params for an Order.
|
PaymentMethod |
getPaymentMethod() |
Date |
getPurchaseDate()
Date when the order was purchased.
|
Boolean |
getRealized()
If the order was realized or not.
|
Date |
getStatusDate()
Date when the
FlowStatus was changed |
String |
getSteps()
In a multi-step Work Flow, the steps are captured that were performed.
|
String |
getStrategiesVersion()
Track the
Strategy.getVersion() of all strategies involved that provide their version id. |
Transaction |
getTransaction()
Last associated successful online
Transaction that occoured to fulfill this order |
String |
getTransactionIds()
An order may have multiple
Transactions ; incase there are issues and failures to purchasing the same order a few times. |
String |
getType()
A type to specify the type of order.
|
IGenericEcomUser |
getUser()
Orders may contain
userContactDetails and hence for GuestUsers in particular, user maybe optional |
String |
getUserContactDetails()
In addition to the default User Address and contact details;
an order may define/override default
Address with its own. |
int |
hashCode() |
void |
setActors(String actors)
Who all were involved in the Order workflow if it involved multiple people.
|
void |
setBitmask(Integer bitmask)
Optional param that allows an Application to define project specific switches (boolean flags) for an Order.
|
void |
setCreated(Date created)
|
void |
setDeliveryDetails(DeliveryDetails deliveryDetails) |
void |
setId(Long id) |
void |
setInvoiceId(String invoiceId)
The Invoice ID/Number generated
Clients maybe picky about Invoice Number formats etc, hence a special field provided so it does not HAVE TO be same as Order or Transaction Number. |
void |
setItems(List<I> items) |
void |
setLastInvoiceDate(Date lastInvoiceDate)
Date the last invoice was sent for this Order
An order amount can be changed and hence Invoices can be re-sent or for other reason Invoices can be sent multiple times. |
void |
setParams(String params)
A comma or JSON defined parameter String that allows an Application to define project specific params for an Order.
|
void |
setPaymentMethod(PaymentMethod paymentMethod) |
void |
setPurchaseDate(Date purchaseDate)
Date when the order was purchased.
|
void |
setRealized(Boolean realized)
If the order was realized or not.
|
void |
setStatus(OrderStatus status) |
void |
setStatusDate(Date statusDate) |
void |
setSteps(String steps)
In a multi-step Work Flow, the steps are captured that were performed.
|
void |
setStrategiesVersion(String strategiesVersion)
Track the
Strategy.getVersion() of all strategies involved that provide their version id. |
void |
setTransaction(Transaction transaction)
Last associated successful online
Transaction that occoured to fulfill this order |
void |
setTransactionIds(String transactionIds)
An order may have multiple
Transactions ; incase there are issues and failures to purchasing the same order a few times. |
void |
setType(String type)
A type to specify the type of order.
|
void |
setUser(IGenericEcomUser user)
Orders may contain
userContactDetails and hence for GuestUsers in particular, user maybe optional |
void |
setUserContactDetails(String userContactDetails)
In addition to the default User Address and contact details;
an order may define/override default
Address with its own. |
void |
synchStatusWithItems()
Convenience method to update the status of all items to the
BaseOrderItem.status |
String |
toString() |
getAmount, getComments, getFinalWeight, getLastStatusReason, getPackagingAmount, getPaymentContext, getPromotionNames, getQuantity, getShippingAmount, getStatus, getUpdated, setAmount, setComments, setFinalWeight, setLastStatusReason, setPackagingAmount, setPaymentContext, setPromotionNames, setQuantity, setShippingAmount, setUpdatedclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetUpdatedprotected Long id
protected PaymentMethod paymentMethod
protected Date created
purchaseDate is not same as created date
protected Date purchaseDate
protected GenericEcomUser user
userContactDetails and hence for GuestUsers in particular, user maybe optionaluserContactDetailsprotected Boolean realized
BaseOrderItem.getStatus() but typically like OrderStatus.CLOSED can override the state, hence we need a permanent indicator
if at the time the Order was realized or not.
Transaction.getSuccess() for ONLINE orders and for non-transactional orders check the BaseOrderItem.getLastStatusReason()protected String type
protected Date statusDate
BaseOrderItem.status was changedpublic Order()
public Order(String json)
public Order(Order order)
public Order(GenericEcomUser user, PaymentMethod paymentMethod)
public Order(GenericEcomUser user, PaymentMethod paymentMethod, Amount amount)
public Order(GenericEcomUser user, PaymentMethod paymentMethod, Amount amount, Date purchaseDate)
public Order(GenericEcomUser user, PaymentContext paymentContext, PaymentMethod paymentMethod, Amount amount, Date purchaseDate)
public Long getId()
getId in interface Identifiable<Long>public void setId(Long id)
setId in interface Identifiable<Long>public PaymentMethod getPaymentMethod()
public void setPaymentMethod(PaymentMethod paymentMethod)
public Date getCreated()
getCreated in interface FlowStatepublic void setCreated(Date created)
public Date getPurchaseDate()
public void setPurchaseDate(Date purchaseDate)
public Date getLastInvoiceDate()
public void setLastInvoiceDate(Date lastInvoiceDate)
public IGenericEcomUser getUser()
userContactDetails and hence for GuestUsers in particular, user maybe optionaluserContactDetailspublic void setUser(IGenericEcomUser user)
userContactDetails and hence for GuestUsers in particular, user maybe optionaluser - as IGenericEcomUser; fo this class it is assumed to be GenericEcomUseruserContactDetailspublic String getUserContactDetails()
Address with its own. This also ensures if the user modifies their address or details; for audit purposes
we know what the address was @ the point of placing the order.
Address's as JSON(preferable) String for the order
getUser() also has IGenericEcomUser.getAddresses(); this overrides that, for standard applications.
While this can be an application preference; all the Utilities (like Utils.getAddresses(Order) and Utils.getAddress(Order, String) prefer to fetch from userContactDetails.public void setUserContactDetails(String userContactDetails)
Address with its own. This also ensures if the user modifies their address or details; for audit purposes
we know what the address was @ the point of placing the order.
Address's as JSON(preferable) String for the order
getUser() also has IGenericEcomUser.getAddresses(); this overrides that, for standard applications.
While this can be an application preference; all the Utilities (like Utils.getAddresses(Order) and Utils.getAddress(Order, String) prefer to fetch from userContactDetails.public String getInvoiceId()
public void setInvoiceId(String invoiceId)
public String getType()
public void setType(String type)
public Transaction getTransaction()
Transaction that occoured to fulfill this orderpublic void setTransaction(Transaction transaction)
Transaction that occoured to fulfill this orderpublic String getTransactionIds()
Transactions ; incase there are issues and failures to purchasing the same order a few times.
All transaction Ids are captured as a comma separated String for reference purposespublic void setTransactionIds(String transactionIds)
Transactions ; incase there are issues and failures to purchasing the same order a few times.
All transaction Ids are captured as a comma separated String for reference purposespublic DeliveryDetails getDeliveryDetails()
public void setDeliveryDetails(DeliveryDetails deliveryDetails)
public void addTransaction(Transaction transaction)
Transaction and do some basic checks and assignment
public void synchStatusWithItems()
BaseOrderItem.statuspublic String getSteps()
PaymentMethod.WORK_FLOW, OrderStatus.CAPTURED_AUTO + OrderStatus.PLACED_MANUAL etcpublic void setSteps(String steps)
PaymentMethod.WORK_FLOW, OrderStatus.CAPTURED_AUTO + OrderStatus.PLACED_MANUAL etcpublic String getStrategiesVersion()
Strategy.getVersion() of all strategies involved that provide their version id.public void setStrategiesVersion(String strategiesVersion)
Strategy.getVersion() of all strategies involved that provide their version id.public Integer getBitmask()
public void setBitmask(Integer bitmask)
public String getActors()
public void setActors(String actors)
public String getParams()
public void setParams(String params)
public Boolean getRealized()
BaseOrderItem.getStatus() but typically like OrderStatus.CLOSED can override the state, hence we need a permanent indicator
if at the time the Order was realized or not.
Transaction.getSuccess() for ONLINE orders and for non-transactional orders check the BaseOrderItem.getLastStatusReason()public void setRealized(Boolean realized)
BaseOrderItem.getStatus() but typically like OrderStatus.CLOSED can override the state, hence we need a permanent indicator
if at the time the Order was realized or not.
Transaction.getSuccess() for ONLINE orders and for non-transactional orders check the BaseOrderItem.getLastStatusReason()public FlowStatus getFlowStatus()
FlowStateFlowStatusgetFlowStatus in interface FlowStatepublic Date getStatusDate()
FlowStateFlowStatus was changedgetStatusDate in interface FlowStatepublic void setStatusDate(Date statusDate)
public void setStatus(OrderStatus status)
setStatus in class BaseOrderItempublic boolean equals(Object obj)
equals in class BaseOrderItempublic int hashCode()
hashCode in class BaseOrderItempublic String toString()
toString in class BaseOrderItemCopyright © 2018. All rights reserved.