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.COMPLETED.OrderStatus.COMPLETED.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.COMPLETED.
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(@NotNull 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. |
int |
addToCart(@NotNull BasicAdVO adVO,
java.math.BigDecimal quantity)
Adds the given product to the logged user's shopping cart, returning the total count of ads in the cart.
|
ShoppingCartDTO |
adjustAndGetMyCart()
Returns the current logged user's shopping cart, adjusting all quantities
|
OrderData |
adjustShoppingCartAndGetData(@NotNull OrderVO vo)
Perform adjustments to the shopping cart quantities and returns the data for it
|
void |
checkCartStock(@NotNull UserLocatorVO seller,
@NotNull CurrencyVO currency)
Checks that all items on the given cart are still on stock
|
ShoppingCartCheckoutResult |
checkout(@NotNull 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(@NotNull UserLocatorVO seller,
@NotNull 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, without adjusting any quantity
|
OrderData |
getOrderData(@NotNull OrderVO vo)
Returns data of an order
|
UserSalesData |
getUserSalesData(@NotNull UserLocatorVO locator)
Returns data for viewing a user sales
|
int |
modifyQuantityOnCart(@NotNull BasicAdVO adVO,
java.math.BigDecimal quantity)
Updates the quantity for the given product on the logged user's shopping cart returning the total count of ads in
the cart.
|
void |
reject(@NotNull RejectOrderParams params)
Rejects the given order
|
int |
removeCart(@NotNull UserLocatorVO seller,
CurrencyVO currency)
Removes the logged user's shopping cart for the given seller and currency returning the remaining count of ads in
the cart
|
int |
removeCartById(@NotNull java.lang.Long id)
Same as
CRUDService.remove(Long) but returning the total count of items present the whole shopping cart |
int |
removeCartItem(@NotNull BasicAdVO adVO)
Removes the given product from the logged user's shopping cart returning the remaining count of ads in the cart.
|
Page<OrderVO> |
search(@NotNull OrderQuery query)
Searches for orders based on
OrderQuery |
void |
setDeliveryMethod(@NotNull 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(@NotNull OrderDTO order)
Submits the given order for buyer approval
|
getData, getDataForNew, load, remove, removeAll, saveOrderStatus accept(@NotNull @NotNull 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 statusFrameworkExceptionint addToCart(@NotNull
@NotNull BasicAdVO adVO,
java.math.BigDecimal quantity)
throws FrameworkException,
OutOfStockException,
CannotBuyException
OutOfStockException - When the given quantity is greater than the available stockFrameworkExceptionCannotBuyExceptionShoppingCartDTO adjustAndGetMyCart() throws FrameworkException
FrameworkExceptionOrderData adjustShoppingCartAndGetData(@NotNull @NotNull OrderVO vo) throws FrameworkException
FrameworkExceptionvoid checkCartStock(@NotNull
@NotNull UserLocatorVO seller,
@NotNull
@NotNull CurrencyVO currency)
throws FrameworkException,
OutOfStockException
ShoppingCartCheckoutResult checkout(@NotNull @NotNull ShoppingCartCheckoutParams dto) throws FrameworkException, OutOfStockException, InsufficientBalanceException, 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 stockInsufficientBalanceException - When there was a problem while reserving the amountPasswordException - The given confirmation password is invalidCannotBuyException - When the seller has no visibility over buyer groupFrameworkExceptionint countCartItems()
throws FrameworkException
FrameworkExceptionOrderData getCheckoutData(@NotNull @NotNull UserLocatorVO seller, @NotNull @NotNull CurrencyVO currency) throws FrameworkException, EntityNotFoundException
EntityNotFoundException - When there is no current shopping cart order with the given seller and currencyFrameworkExceptionShoppingCartDTO getMyCart() throws FrameworkException
FrameworkExceptionOrderData getOrderData(@NotNull @NotNull OrderVO vo) throws FrameworkException
FrameworkExceptionUserSalesData getUserSalesData(@NotNull @NotNull UserLocatorVO locator) throws FrameworkException
FrameworkExceptionint modifyQuantityOnCart(@NotNull
@NotNull BasicAdVO adVO,
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(@NotNull
@NotNull RejectOrderParams params)
throws FrameworkException
IllegalActionException - When the given order is not in either OrderStatus.PENDING_BUYER or
OrderStatus.PENDING_SELLER
statuses.FrameworkExceptionint removeCart(@NotNull
@NotNull UserLocatorVO seller,
CurrencyVO currency)
throws FrameworkException
FrameworkExceptionint removeCartById(@NotNull
@NotNull java.lang.Long id)
throws FrameworkException
CRUDService.remove(Long) but returning the total count of items present the whole shopping cartFrameworkExceptionCRUDService.remove(java.lang.Long)int removeCartItem(@NotNull
@NotNull BasicAdVO adVO)
throws FrameworkException
IllegalActionException - When the given ad is not in the logged user's shopping cartFrameworkExceptionPage<OrderVO> search(@NotNull @NotNull OrderQuery query) throws FrameworkException
OrderQueryFrameworkExceptionvoid setDeliveryMethod(@NotNull
@NotNull 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(@NotNull
@NotNull OrderDTO order)
throws FrameworkException,
OutOfStockException
OutOfStockException - When any of the order products have ran out of stock right before processingFrameworkException