public interface OrderService extends CRUDService<OrderDTO,OrderData,OrderDataParams>
OrderStatus.SHOPPING_CART) or
as a new sale by the seller (with status OrderStatus.DRAFT). OrderStatus.SHOPPING_CART when the first product is added, via
addToCart(Long, BigDecimal). Product
quantity can be modified with modifyQuantityOnCart(Long, BigDecimal) or removed with
removeCartItem(Long). Alternatively, an
entire cart can be removed with #removeCart(Long, Long).checkout(ShoppingCartCheckoutParams) method. This
will change the order status to
OrderStatus.PENDING_SELLER. If the delivery price is known, the total order amount is reserved on the buyer's
account, the confirmation
password (if any) is checked and the stock is updated.OrderStatus.PENDING_BUYER). Otherwise, if the delivery price
was known, the amount
reservation will be returned and the actual payment will be performed, and the new status will be
OrderStatus.REALIZED.OrderStatus.REALIZED.CRUDService.save(org.cyclos.model.EntityDTO) method. Only orders
with the OrderStatus.DRAFT status can be created / modified. No deeper validation is performed on draft
orders.
submitToBuyer(OrderDTO) method. At that point, the
order needs the list of products and the delivery address, price and time set.OrderStatus.REALIZED.
OrderStatus.PENDING_BUYER, the buyer may reject the order, and the new status will be
OrderStatus.REJECTED_BY_BUYER. The same accounts for OrderStatus.PENDING_SELLER and
OrderStatus.REJECTED_BY_SELLER.| Modifier and Type | Method and Description |
|---|---|
OrderStatus |
accept(AcceptOrderParams params)
Accepts the given order, which should be in either
OrderStatus.PENDING_BUYER or
OrderStatus.PENDING_SELLER status, and needs
the delivery price to be already set. |
void |
addToCart(java.lang.Long adId,
java.math.BigDecimal quantity)
Adds the given product to the logged user's shopping cart, returning the updated shopping cart.
|
void |
checkCartStock(UserLocatorVO seller,
CurrencyVO currency)
Checks that all items on the given cart are still on stock
|
java.lang.Long |
checkout(ShoppingCartCheckoutParams dto)
Checks out the logged user's shopping cart with the given seller and currency, checking the confirmation password
(if any), and reserving the
amount when the delivery price is previously known (otherwise, the buyer still needs to confirm before the
payment is done)
|
int |
countCartItems()
Returns the total number of items in the logged user's shopping cart
|
OrderData |
getCheckoutData(UserLocatorVO seller,
CurrencyVO currency)
Returns data for checkout the cart items of the given seller and currency
|
ShoppingCartDTO |
getMyCart()
Returns the current logged user's shopping cart, it's read-write because updates the messages.
|
UserSalesData |
getUserSalesData(UserLocatorVO locator)
Returns data for viewing an user sales
|
void |
modifyQuantityOnCart(java.lang.Long adId,
java.math.BigDecimal quantity)
Updates the quantity for the given product on the logged user's shopping cart
|
void |
reject(RejectOrderParams params)
Rejects the given order
|
void |
removeCart(UserLocatorVO seller,
CurrencyVO currency)
Removes the logged user's shopping cart for the given seller and currency
|
void |
removeCartItem(java.lang.Long adId)
Removes the given product from the logged user's shopping cart
|
Page<OrderVO> |
search(OrderQuery query)
Searches for orders based on
OrderQuery |
void |
setDeliveryMethod(SetDeliveryMethodParams params)
Updates the delivery method information of an order when it is on the
OrderStatus.PENDING_SELLER status
and there is no delivery
information yet. |
java.lang.Long |
submitToBuyer(OrderDTO order)
Submits the given order for buyer approval
|
getData, getDataForNew, load, remove, removeAll, saveOrderStatus accept(AcceptOrderParams params) throws FrameworkException, TransferException
OrderStatus.PENDING_BUYER or
OrderStatus.PENDING_SELLER status, and needs
the delivery price to be already set. When the buyer hasn't yet chosen a payment type, it is required now. Also,
when no amount was reserved,
the confirmation password will be checked before performing the actual payment.TransferException - When there was a problem while reserving the amount, like there is no available balancePasswordException - The given confirmation password is invalidIllegalActionException - The given order is not in either OrderStatus.PENDING_BUYER or
OrderStatus.PENDING_SELLER statusFrameworkExceptionvoid addToCart(java.lang.Long adId,
java.math.BigDecimal quantity)
throws FrameworkException,
OutOfStockException,
CannotBuyException
OutOfStockException - When the given quantity is greater than the available stockFrameworkExceptionCannotBuyExceptionvoid checkCartStock(UserLocatorVO seller, CurrencyVO currency) throws FrameworkException, OutOfStockException
java.lang.Long checkout(ShoppingCartCheckoutParams dto) throws FrameworkException, OutOfStockException, TransferException, CannotBuyException
EntityNotFoundException - When there is no current shopping cart order with the given seller and currencyOutOfStockException - When at least one of the expected items exceeds the available stockTransferException - When there was a problem while reserving the amount, like there is no available balancePasswordException - The given confirmation password is invalidCannotBuyException - When the seller has no visibility over buyer groupFrameworkExceptionint countCartItems()
throws FrameworkException
FrameworkExceptionOrderData getCheckoutData(UserLocatorVO seller, CurrencyVO currency) throws FrameworkException, EntityNotFoundException
EntityNotFoundException - When there is no current shopping cart order with the given seller and currencyFrameworkExceptionShoppingCartDTO getMyCart() throws FrameworkException
FrameworkExceptionUserSalesData getUserSalesData(UserLocatorVO locator) throws FrameworkException
FrameworkExceptionvoid modifyQuantityOnCart(java.lang.Long adId,
java.math.BigDecimal quantity)
throws FrameworkException,
IllegalActionException,
OutOfStockException
IllegalActionException - When the given ad is not in the logged user's shopping cartOutOfStockException - When the new quantity is greater than the available stockFrameworkExceptionvoid reject(RejectOrderParams params) throws FrameworkException
IllegalActionException - When the given order is not in either OrderStatus.PENDING_BUYER or
OrderStatus.PENDING_SELLER
statuses.FrameworkExceptionvoid removeCart(UserLocatorVO seller, CurrencyVO currency) throws FrameworkException
FrameworkExceptionvoid removeCartItem(java.lang.Long adId)
throws FrameworkException
IllegalActionException - When the given ad is not in the logged user's shopping cartFrameworkExceptionPage<OrderVO> search(OrderQuery query) throws FrameworkException
OrderQueryFrameworkExceptionvoid setDeliveryMethod(SetDeliveryMethodParams params) throws FrameworkException
OrderStatus.PENDING_SELLER status
and there is no delivery
information yet. Afterwards, the new status will be OrderStatus.PENDING_BUYER for final approval.IllegalActionException - When the referenced order is not on the OrderStatus.PENDING_SELLER status
or already has delivery
informationFrameworkExceptionjava.lang.Long submitToBuyer(OrderDTO order) throws FrameworkException, OutOfStockException
OutOfStockException - When any of the order products have ran out of stock right before processingFrameworkException