Class OrderServiceImpl
- All Implemented Interfaces:
OrderService
- Author:
- apazzolini
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Processorprotected booleanAdvanced setting.protected booleanAdvanced setting.protected booleanAdvanced setting.protected booleanAdvanced setting.protected Booleanprotected CustomerServiceprotected booleanprotected jakarta.persistence.EntityManagerprotected OrderServiceExtensionManagerprotected FulfillmentGroupServiceprotected MergeCartServiceprotected booleanprotected NullOrderFactoryprotected OfferDaoprotected OfferServiceprotected OfferServiceExtensionManagerprotected OrderDaoprotected OrderItemServiceprotected OrderMultishipOptionServiceprotected OrderPaymentDaoprotected intprotected longprotected PricingServiceprotected Processorprotected SecureOrderPaymentServiceprotected org.springframework.transaction.PlatformTransactionManagerprotected Processor -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanacquireLock(Order order) addAllItemsFromNamedOrder(Order namedOrder, boolean priceOrder) Adds all orderItems to the current cart from the same Customer that owns the named order.voidaddChildItems(OrderItemRequestDTO orderItemRequestDTO, int numAdditionRequests, int currentAddition, ProcessContext<CartOperationRequest> context, List<ActivityMessageDTO> orderMessages) voidaddDependentOrderItem(OrderItemRequestDTO parentOrderItemRequest, OrderItemRequestDTO dependentOrderItem) addGiftWrapItemToOrder(Order order, GiftWrapOrderItemRequest itemRequest, boolean priceOrder) Adds a GiftWrapItem to the order based on the itemRequest.addItem(Long orderId, OrderItemRequestDTO orderItemRequestDTO, boolean priceOrder) Initiates the addItem workflow that will attempt to add the given quantity of the specified item to the Order.addItemFromNamedOrder(Order namedOrder, OrderItem item, boolean priceOrder) Adds the passed in orderItem to the current cart for the same Customer that owns the named order.addItemFromNamedOrder(Order namedOrder, OrderItem item, int quantity, boolean priceOrder) This method performs the same function as addItemFromNamedOrder(Order, OrderItem, boolean) except that instead of adding all of the quantity from the named order to the cart, it will only add/move the specific quantity requested.addItemWithPriceOverrides(Long orderId, OrderItemRequestDTO orderItemRequestDTO, boolean priceOrder) Initiates the addItem workflow that will attempt to add the given quantity of the specified item to the Order.addOfferCode(Order order, OfferCode offerCode, boolean priceOrder) Adds the given OfferCode to the order.addOfferCodes(Order order, List<OfferCode> offerCodes, boolean priceOrder) Adds the given OfferCodes to the order.addPaymentToOrder(Order order, OrderPayment payment, Referenced securePaymentInfo) Associates a given OrderPayment with an Order and then saves the order.voidcancelOrder(Order order) Deletes the given order.protected booleancompareAttributes(Map<String, OrderItemAttribute> item1Attributes, OrderItemRequestDTO item2) Returns true if the two items attributes exactly match.confirmOrder(Order order) Changes the OrderStatus to SUBMITTEDcreateNamedOrderForCustomer(String name, Customer customer) Creates a new Order for the given customer with the given name.createNewCartForCustomer(Customer customer) Creates a new Order for the given customer.voiddeleteOrder(Order order) protected voidfindAllChildrenToRemove(List<Long> childrenToRemove, OrderItem orderItem) findCartForCustomer(Customer customer) Looks up the current shopping cart for the customer.findCartForCustomerWithEnhancements(Customer customer) Retrieve an enhanced version of the cart for the customer.findCartForCustomerWithEnhancements(Customer customer, Order candidateOrder) For the customer, use the candidateOrder as the source of enhancement for generating an enhanced cart.findLastMatchingItem(Order order, Long skuId, Long productId) Looks through the given order and returns the latest added OrderItem that matches on the skuId and productId.protected OrderItemfindMatchingItem(Order order, OrderItemRequestDTO itemToFind) findNamedOrderForCustomer(String name, Customer customer) Looks up an Order by the given customer and a specified order name.findOrderById(Long orderId) Looks up an Order by its database idfindOrderById(Long orderId, boolean refresh) Looks up an Order by its database id and optionally calls refresh to ensure that the entity manager pulls the instance from the DB and not from cacheprotected OrderfindOrderByIdOrByOrderItemId(Long orderId, Long orderItemId) findOrderByOrderNumber(String orderNumber) Looks up Orders and returns the order matching the given orderNumberfindOrdersByDateRange(Date startDate, Date endDate) findOrdersByDaysCount(Integer daysCount, Integer batchSize) findOrdersByEmail(String email) Looks up all Orders for the specified email, regardless of current OrderStatusfindOrdersByIds(List<Long> orderIds) Looks up a list of Orders by their database idsfindOrdersForCustomer(Customer customer) Looks up all Orders for the specified customer, regardless of current OrderStatusfindOrdersForCustomer(Customer customer, OrderStatus status) Looks up all Orders for the specified customer that are in the specified OrderStatus.findOrdersForCustomersInDateRange(List<Long> customerIds, Date startDate, Date endDate) findPaymentsForOrder(Order order) Returns all OrderPayment objects that are associated with the given orderbooleanprotected ThrowableThis method will return the exception that is immediately below the deepest WorkflowException in the current stack trace.The null order is the default order for all customers when they initially enter the site.intgetTotalChildOrderItems(OrderItemRequestDTO orderItemRequestDTO) booleanbooleanprotected booleanitemMatches(Sku item1Sku, Product item1Product, Map<String, OrderItemAttribute> item1Attributes, OrderItemRequestDTO item2) protected OrdervoidInvokes the extension handler of the same name to provide the ability for a module to throw an exception and interrupt a cart operation.voidInvokes the extension handler of the same name to provide the ability for a module to throw an exception and interrupt an update quantity operation.voidprintOrder(Order order, org.apache.commons.logging.Log log) This debugging method will print out a console-suitable representation of the current state of the order, including the items in the order and all pricing related information for the order.readBatchOrders(int start, int pageSize, List<OrderStatus> orderStatusList) voidbooleanreleaseLock(Order order) reloadOrder(Order order) Detaches the given order from the current entity manager and then reloads a fresh version from the database.removeAllOfferCodes(Order order, boolean priceOrder) Removes all offer codes for the given order.voidremoveAllPaymentsFromOrder(Order order) Deletes all the OrderPayment Info's on the order.voidremoveInactiveItems(Long orderId, boolean priceOrder) removeItem(Long orderId, Long orderItemId, boolean priceOrder) Initiates the removeItem workflow that will attempt to remove the specified OrderItem from the given Orderprotected OrderremoveItemInternal(Long orderId, Long orderItemId, boolean priceOrder) removeOfferCode(Order order, OfferCode offerCode, boolean priceOrder) Remove the given OfferCode for the order.voidremovePaymentFromOrder(Order order, OrderPayment payment) Deletes the OrderPayment Info from the order.voidremovePaymentsFromOrder(Order order, PaymentType paymentInfoType) Deletes the OrderPayment Info of the passed in type from the order Note that this method will also delete any associated Secure OrderPayment Infos if necessary.Saves the given order while optionally repricing the order (meaning, going through the pricing workflow) along with updating the prices of individual items in the order, as opposed to just pricing taxes/shipping/etc.Persists the given order to the database.voidsetAutomaticallyMergeLikeItems(boolean automaticallyMergeLikeItems) When set to true, the system when items are added to the cart, they will automatically be merged.voidsetDeleteEmptyNamedOrders(boolean deleteEmptyNamedOrders) Sets whether or not to delete named orders once all items have been removed.voidsetMoveNamedOrderItems(boolean moveNamedOrderItems) Determines whether or not items will be removed from the named order (wishlist) when they are moved to the Customer's current cart.updateItemQuantity(Long orderId, OrderItemRequestDTO orderItemRequestDTO, boolean priceOrder) Initiates the updateItem workflow that will attempt to update the item quantity for the specified OrderItem in the given Order.updateProductOptionsForItem(Long orderId, OrderItemRequestDTO orderItemRequestDTO, boolean priceOrder) Since required product option can be added after the item is in the cart, we use this method to apply product option on an existing item in the cart.
-
Field Details
-
paymentDao
-
orderDao
-
offerDao
-
nullOrderFactory
-
customerService
-
pricingService
-
orderItemService
-
fulfillmentGroupService
-
offerService
-
securePaymentInfoService
-
mergeCartService
-
extensionManager
-
addItemWorkflow
-
updateItemWorkflow
-
removeItemWorkflow
-
transactionManager
protected org.springframework.transaction.PlatformTransactionManager transactionManager -
pricingRetryCountForLockFailure
@Value("${pricing.retry.count.for.lock.failure}") protected int pricingRetryCountForLockFailure -
pricingRetryWaitIntervalForLockFailure
@Value("${pricing.retry.wait.interval.for.lock.failure}") protected long pricingRetryWaitIntervalForLockFailure -
autoFlushAddToCart
@Value("${auto.flush.on.query.during.add.to.cart:false}") protected boolean autoFlushAddToCartAdvanced setting. Should Hibernate auto flush before queries during an add-to-cart workflow. This should generally be able to be left false. This is a performance measure and add-to-cart operations will be more efficient when this is false. -
autoFlushUpdateCart
@Value("${auto.flush.on.query.during.update.cart:false}") protected boolean autoFlushUpdateCartAdvanced setting. Should Hibernate auto flush before queries during an update-cart workflow. This should generally be able to be left false. This is a performance measure and update-cart operations will be more efficient when this is false. -
autoFlushRemoveFromCart
@Value("${auto.flush.on.query.during.remove.from.cart:false}") protected boolean autoFlushRemoveFromCartAdvanced setting. Should Hibernate auto flush before queries during an remove-from-cart workflow. This should generally be able to be left false. This is a performance measure and remove-from-cart operations will be more efficient when this is false. -
autoFlushSaveCart
@Value("${auto.flush.on.query.during.cart.pricing.save:false}") protected boolean autoFlushSaveCartAdvanced setting. Should Hibernate auto flush before queries during an order save pricing flow. This should generally be able to be left false. This is a performance measure and save operations will be more efficient when this is false. -
em
protected jakarta.persistence.EntityManager em -
moveNamedOrderItems
protected boolean moveNamedOrderItems -
deleteEmptyNamedOrders
protected boolean deleteEmptyNamedOrders -
automaticallyMergeLikeItems
-
orderMultishipOptionService
-
offerServiceExtensionManager
-
-
Constructor Details
-
OrderServiceImpl
public OrderServiceImpl()
-
-
Method Details
-
createNewCartForCustomer
Description copied from interface:OrderServiceCreates a new Order for the given customer. Generally, you will want to use the customer that is on the current request, which can be grabbed by utilizing the CustomerState utility class.The default Broadleaf implementation of this method will provision a new Order in the database and set the current customer as the owner of the order. If the customer has an email address associated with their profile, that will be copied as well. If the customer is a new, anonymous customer, his username will be set to his database id.
- Specified by:
createNewCartForCustomerin interfaceOrderService- Returns:
- the newly created order
- See Also:
-
org.broadleafcommerce.profile.web.core.CustomerState#getCustomer()
-
createNamedOrderForCustomer
@Transactional("blTransactionManager") public Order createNamedOrderForCustomer(String name, Customer customer) Description copied from interface:OrderServiceCreates a new Order for the given customer with the given name. Typically, this represents a "wishlist" order that the customer can save but not check out with.- Specified by:
createNamedOrderForCustomerin interfaceOrderService- Parameters:
name- the wishlist name- Returns:
- the newly created named order
-
findNamedOrderForCustomer
Description copied from interface:OrderServiceLooks up an Order by the given customer and a specified order name.This is typically used to retrieve a "wishlist" order.
- Specified by:
findNamedOrderForCustomerin interfaceOrderService- Returns:
- the named order requested
- See Also:
-
findOrderById
Description copied from interface:OrderServiceLooks up an Order by its database id- Specified by:
findOrderByIdin interfaceOrderService- Returns:
- the requested Order
-
findOrdersByIds
Description copied from interface:OrderServiceLooks up a list of Orders by their database ids- Specified by:
findOrdersByIdsin interfaceOrderService- Returns:
- a list of Orders
-
findOrderById
Description copied from interface:OrderServiceLooks up an Order by its database id and optionally calls refresh to ensure that the entity manager pulls the instance from the DB and not from cache- Specified by:
findOrderByIdin interfaceOrderService- Returns:
- the requested Order
-
getNullOrder
Description copied from interface:OrderServiceThe null order is the default order for all customers when they initially enter the site. Upon the first addition of a product to a cart, a non-null order will be provisioned for the user.- Specified by:
getNullOrderin interfaceOrderService- Returns:
- a shared, static, unmodifiable NullOrder
- See Also:
-
findCartForCustomer
Description copied from interface:OrderServiceLooks up the current shopping cart for the customer. Note that a shopping cart is simply an Order with OrderStatus = IN_PROCESS. If for some reason the given customer has more than one current IN_PROCESS Order, the default Broadleaf implementation will return the first match found. Furthermore, also note that the current shopping cart for a customer must never be named -- an Order with a non-null "name" property indicates that it is a wishlist and not a shopping cart.- Specified by:
findCartForCustomerin interfaceOrderService- Returns:
- the current shopping cart for the customer
-
findOrdersForCustomer
Description copied from interface:OrderServiceLooks up all Orders for the specified customer, regardless of current OrderStatus- Specified by:
findOrdersForCustomerin interfaceOrderService- Returns:
- the requested Orders
-
findOrdersForCustomer
Description copied from interface:OrderServiceLooks up all Orders for the specified customer that are in the specified OrderStatus.- Specified by:
findOrdersForCustomerin interfaceOrderService- Returns:
- the requested Orders
-
findOrderByOrderNumber
Description copied from interface:OrderServiceLooks up Orders and returns the order matching the given orderNumber- Specified by:
findOrderByOrderNumberin interfaceOrderService- Returns:
- the requested Order
-
findOrdersByDateRange
- Specified by:
findOrdersByDateRangein interfaceOrderService
-
findOrdersByDaysCount
- Specified by:
findOrdersByDaysCountin interfaceOrderService
-
findOrdersForCustomersInDateRange
public List<Order> findOrdersForCustomersInDateRange(List<Long> customerIds, Date startDate, Date endDate) - Specified by:
findOrdersForCustomersInDateRangein interfaceOrderService
-
findPaymentsForOrder
Description copied from interface:OrderServiceReturns all OrderPayment objects that are associated with the given order- Specified by:
findPaymentsForOrderin interfaceOrderService- Returns:
- the list of all OrderPayment objects
-
addPaymentToOrder
@Transactional("blTransactionManager") public OrderPayment addPaymentToOrder(Order order, OrderPayment payment, Referenced securePaymentInfo) Description copied from interface:OrderServiceAssociates a given OrderPayment with an Order and then saves the order. Note that it is acceptable for the securePaymentInfo to be null. For example, if the secure credit card details are handled by a third party, a given application may never have associated securePaymentInfos- Specified by:
addPaymentToOrderin interfaceOrderServicesecurePaymentInfo- - null if it doesn't exist- Returns:
- the persisted version of the OrderPayment
-
save
Description copied from interface:OrderServiceSaves the given order while optionally repricing the order (meaning, going through the pricing workflow) along with updating the prices of individual items in the order, as opposed to just pricing taxes/shipping/etc.- Specified by:
savein interfaceOrderServicerepriceItems- whether or not to reprice the items inside of the order viaOrder.updatePrices()- Returns:
- the persisted Order, which will be a different instance than the Order passed in
- Throws:
PricingException
-
save
Description copied from interface:OrderServicePersists the given order to the database. If the priceOrder flag is set to true, the pricing workflow will execute before the order is written to the database. Generally, you will want to price the order in every request scope once, and preferrably on the last call to save() for performance reasons.However, if you have logic that depends on the Order being priced, there are no issues with saving as many times as necessary.
- Specified by:
savein interfaceOrderService- Returns:
- the persisted Order, which will be a different instance than the Order passed in
- Throws:
PricingException
-
persist
-
cancelOrder
Description copied from interface:OrderServiceDeletes the given order. Note that the default Broadleaf implementation in OrderServiceImpl will actually remove the Order instance from the database.- Specified by:
cancelOrderin interfaceOrderService
-
deleteOrder
- Specified by:
deleteOrderin interfaceOrderService
-
addOfferCode
@Transactional("blTransactionManager") public Order addOfferCode(Order order, OfferCode offerCode, boolean priceOrder) throws PricingException, OfferException Description copied from interface:OrderServiceAdds the given OfferCode to the order. Optionally prices the order as well.- Specified by:
addOfferCodein interfaceOrderService- Returns:
- the modified Order
- Throws:
PricingExceptionOfferMaxUseExceededExceptionOfferException
-
addOfferCodes
@Transactional("blTransactionManager") public Order addOfferCodes(Order order, List<OfferCode> offerCodes, boolean priceOrder) throws PricingException, OfferException Description copied from interface:OrderServiceAdds the given OfferCodes to the order. Optionally prices the order as well.- Specified by:
addOfferCodesin interfaceOrderService- Returns:
- Throws:
PricingExceptionOfferMaxUseExceededExceptionOfferException
-
removeOfferCode
@Transactional("blTransactionManager") public Order removeOfferCode(Order order, OfferCode offerCode, boolean priceOrder) throws PricingException Description copied from interface:OrderServiceRemove the given OfferCode for the order. Optionally prices the order as well.- Specified by:
removeOfferCodein interfaceOrderService- Returns:
- the modified Order
- Throws:
PricingException
-
removeAllOfferCodes
@Transactional("blTransactionManager") public Order removeAllOfferCodes(Order order, boolean priceOrder) throws PricingException Description copied from interface:OrderServiceRemoves all offer codes for the given order. Optionally prices the order as well.- Specified by:
removeAllOfferCodesin interfaceOrderService- Returns:
- the modified Order
- Throws:
PricingException
-
findLastMatchingItem
Description copied from interface:OrderServiceLooks through the given order and returns the latest added OrderItem that matches on the skuId and productId. Generally, this is used to retrieve the OrderItem that was just added to the cart. The default Broadleaf implementation will attempt to match on skuId first, and failing that, it will look at the productId.Note that the behavior is slightly undeterministic in the case that
OrderService.setAutomaticallyMergeLikeItems(boolean)is set to true and the last added sku matches on a previously added sku. In this case, the sku that has the merged items would be returned, so the total quantity of the OrderItem might not match exactly what was just added.- Specified by:
findLastMatchingItemin interfaceOrderService- Returns:
- the best matching OrderItem with highest index in the list of OrderItems in the order
-
confirmOrder
Description copied from interface:OrderServiceChanges the OrderStatus to SUBMITTED- Specified by:
confirmOrderin interfaceOrderService- Parameters:
order- to confirm- Returns:
- the order that was confirmed
-
addAllItemsFromNamedOrder
@Transactional("blTransactionManager") public Order addAllItemsFromNamedOrder(Order namedOrder, boolean priceOrder) throws RemoveFromCartException, AddToCartException Description copied from interface:OrderServiceAdds all orderItems to the current cart from the same Customer that owns the named order. This method will remove the item from the wishlist based on whether theOrderService.setMoveNamedOrderItems(boolean)flag is set.Note that any items that are in the wishlist but are no longer able to be added to a cart will still be removed from the wishlist.
Note that this method does not change the association of the OrderItems to the new order -- instead, those OrderItems is completely removed and a new OrderItem that mirrors it is created.
- Specified by:
addAllItemsFromNamedOrderin interfaceOrderService- Returns:
- Throws:
RemoveFromCartExceptionAddToCartException
-
addItemFromNamedOrder
@Transactional("blTransactionManager") public Order addItemFromNamedOrder(Order namedOrder, OrderItem item, boolean priceOrder) throws RemoveFromCartException, AddToCartException Description copied from interface:OrderServiceAdds the passed in orderItem to the current cart for the same Customer that owns the named order. This method will remove the item from the wishlist based on whether theOrderService.setMoveNamedOrderItems(boolean)flag is set.Note that if an item was in a wishlist and is no longer able to be added to the cart, the item will still be removed from the wishlist.
Note that this method does not change the association of the OrderItems to the new order -- instead, those OrderItems is completely removed and a new OrderItem that mirrors it is created.
- Specified by:
addItemFromNamedOrderin interfaceOrderService- Returns:
- the cart with the requested orderItem added to it
- Throws:
RemoveFromCartExceptionAddToCartException
-
addItemFromNamedOrder
@Transactional("blTransactionManager") public Order addItemFromNamedOrder(Order namedOrder, OrderItem item, int quantity, boolean priceOrder) throws RemoveFromCartException, AddToCartException, UpdateCartException Description copied from interface:OrderServiceThis method performs the same function as addItemFromNamedOrder(Order, OrderItem, boolean) except that instead of adding all of the quantity from the named order to the cart, it will only add/move the specific quantity requested.- Specified by:
addItemFromNamedOrderin interfaceOrderService- Returns:
- the cart with the requested orderItem added to it
- Throws:
RemoveFromCartExceptionAddToCartExceptionUpdateCartException- See Also:
-
addGiftWrapItemToOrder
@Transactional("blTransactionManager") public OrderItem addGiftWrapItemToOrder(Order order, GiftWrapOrderItemRequest itemRequest, boolean priceOrder) throws PricingException Description copied from interface:OrderServiceAdds a GiftWrapItem to the order based on the itemRequest. A GiftWrapItem is a product (for example, a "Gift Box with Red Ribbon") that contains a list of OrderItems that should be wrapped by this GiftWrapItem.The OrderItems must already exist and belong to an order before they are able to be wrapped by the GiftWrapItem
- Specified by:
addGiftWrapItemToOrderin interfaceOrderService- Returns:
- the GiftWrapItem instance that was created and attached to the order
- Throws:
PricingException
-
addItem
@Transactional(value="blTransactionManager", rollbackFor=AddToCartException.class) public Order addItem(Long orderId, OrderItemRequestDTO orderItemRequestDTO, boolean priceOrder) throws AddToCartException Description copied from interface:OrderServiceInitiates the addItem workflow that will attempt to add the given quantity of the specified item to the Order. The item to be added can be determined in a few different ways. For example, the SKU can be specified directly or it can be determine based on a Product and potentially some specified ProductOptions for that given product.The minimum required parameters for OrderItemRequest are: productId and quantity or alternatively, skuId and quantity
When priceOrder is false, the system will not reprice the order. This is more performant in cases such as bulk adds where the repricing could be done for the last item only.
This method differs from the
OrderService.addItemWithPriceOverrides(Long, OrderItemRequestDTO, boolean)in that it will clear any values set on theOrderItemRequestDTOfor the overrideSalePrice or overrideRetailPrice.This design is intended to ensure that override pricing is not called by mistake. Implementors should use this method when no manual price overrides are allowed.
- Specified by:
addItemin interfaceOrderService- Returns:
- the order the item was added to
- Throws:
AddToCartException- See Also:
-
addItemWithPriceOverrides
@Transactional(value="blTransactionManager", rollbackFor=AddToCartException.class) public Order addItemWithPriceOverrides(Long orderId, OrderItemRequestDTO orderItemRequestDTO, boolean priceOrder) throws AddToCartException Description copied from interface:OrderServiceInitiates the addItem workflow that will attempt to add the given quantity of the specified item to the Order. The item to be added can be determined in a few different ways. For example, the SKU can be specified directly or it can be determine based on a Product and potentially some specified ProductOptions for that given product.The minimum required parameters for OrderItemRequest are: productId and quantity or alternatively, skuId and quantity
When priceOrder is false, the system will not reprice the order. This is more performant in cases such as bulk adds where the repricing could be done for the last item only.
As opposed to the
OrderService.addItem(Long, OrderItemRequestDTO, boolean)method, this method allows the passed inOrderItemRequestDTOto contain values for the overrideSale or overrideRetail price fields.This design is intended to ensure that override pricing is not called by mistake. Implementors should use this method when manual price overrides are allowed.
- Specified by:
addItemWithPriceOverridesin interfaceOrderService- Returns:
- the order the item was added to
- Throws:
AddToCartException- See Also:
-
getTotalChildOrderItems
- Specified by:
getTotalChildOrderItemsin interfaceOrderService
-
addChildItems
public void addChildItems(OrderItemRequestDTO orderItemRequestDTO, int numAdditionRequests, int currentAddition, ProcessContext<CartOperationRequest> context, List<ActivityMessageDTO> orderMessages) throws WorkflowException - Specified by:
addChildItemsin interfaceOrderService- Throws:
WorkflowException
-
addDependentOrderItem
public void addDependentOrderItem(OrderItemRequestDTO parentOrderItemRequest, OrderItemRequestDTO dependentOrderItem) - Specified by:
addDependentOrderItemin interfaceOrderService
-
updateItemQuantity
@Transactional(value="blTransactionManager", rollbackFor={UpdateCartException.class,RemoveFromCartException.class}) public Order updateItemQuantity(Long orderId, OrderItemRequestDTO orderItemRequestDTO, boolean priceOrder) throws UpdateCartException, RemoveFromCartException Description copied from interface:OrderServiceInitiates the updateItem workflow that will attempt to update the item quantity for the specified OrderItem in the given Order. The new quantity is specified in the OrderItemRequestDTOMinimum required parameters for OrderItemRequest: orderItemId, quantity
- Specified by:
updateItemQuantityin interfaceOrderService- Returns:
- the order the item was added to
- Throws:
UpdateCartExceptionRemoveFromCartException- See Also:
-
removeItem
@Transactional(value="blTransactionManager", rollbackFor=RemoveFromCartException.class) public Order removeItem(Long orderId, Long orderItemId, boolean priceOrder) throws RemoveFromCartException Description copied from interface:OrderServiceInitiates the removeItem workflow that will attempt to remove the specified OrderItem from the given Order- Specified by:
removeItemin interfaceOrderService- Returns:
- the order the item was added to
- Throws:
RemoveFromCartException- See Also:
-
findAllChildrenToRemove
-
removeItemInternal
protected Order removeItemInternal(Long orderId, Long orderItemId, boolean priceOrder) throws WorkflowException - Throws:
WorkflowException
-
findOrderByIdOrByOrderItemId
-
removeInactiveItems
@Transactional(value="blTransactionManager", rollbackFor=RemoveFromCartException.class) public Order removeInactiveItems(Long orderId, boolean priceOrder) throws RemoveFromCartException - Specified by:
removeInactiveItemsin interfaceOrderService- Throws:
RemoveFromCartException
-
getAutomaticallyMergeLikeItems
public boolean getAutomaticallyMergeLikeItems()- Specified by:
getAutomaticallyMergeLikeItemsin interfaceOrderService- Returns:
- whether or not like-items will be automatically merged
- See Also:
-
setAutomaticallyMergeLikeItems
public void setAutomaticallyMergeLikeItems(boolean automaticallyMergeLikeItems) Description copied from interface:OrderServiceWhen set to true, the system when items are added to the cart, they will automatically be merged. For example, when a user adds an item to the cart and then adds the item again, the item will have its quantity changed to 2 instead of the cart containing two separate items.If this logic needs to be more complex, it is possible to extend the behavior by overriding OrderOfferProcessor.buildIdentifier().
- Specified by:
setAutomaticallyMergeLikeItemsin interfaceOrderService
-
isMoveNamedOrderItems
@ManagedAttribute(description="The move item from named order when adding to the cart attribute", currencyTimeLimit=15) public boolean isMoveNamedOrderItems()- Specified by:
isMoveNamedOrderItemsin interfaceOrderService- Returns:
- whether items will be removed from the wishlist when added to the cart
- See Also:
-
setMoveNamedOrderItems
@ManagedAttribute(description="The move item from named order when adding to the cart attribute", currencyTimeLimit=15) public void setMoveNamedOrderItems(boolean moveNamedOrderItems) Description copied from interface:OrderServiceDetermines whether or not items will be removed from the named order (wishlist) when they are moved to the Customer's current cart.- Specified by:
setMoveNamedOrderItemsin interfaceOrderService
-
isDeleteEmptyNamedOrders
@ManagedAttribute(description="The delete empty named order after adding items to cart attribute", currencyTimeLimit=15) public boolean isDeleteEmptyNamedOrders()- Specified by:
isDeleteEmptyNamedOrdersin interfaceOrderService- Returns:
- whether empty wishlists will be deleted automatically
- See Also:
-
setDeleteEmptyNamedOrders
@ManagedAttribute(description="The delete empty named order after adding items to cart attribute", currencyTimeLimit=15) public void setDeleteEmptyNamedOrders(boolean deleteEmptyNamedOrders) Description copied from interface:OrderServiceSets whether or not to delete named orders once all items have been removed.- Specified by:
setDeleteEmptyNamedOrdersin interfaceOrderService
-
removeAllPaymentsFromOrder
Description copied from interface:OrderServiceDeletes all the OrderPayment Info's on the order.- Specified by:
removeAllPaymentsFromOrderin interfaceOrderService
-
removePaymentsFromOrder
@Transactional("blTransactionManager") public void removePaymentsFromOrder(Order order, PaymentType paymentInfoType) Description copied from interface:OrderServiceDeletes the OrderPayment Info of the passed in type from the order Note that this method will also delete any associated Secure OrderPayment Infos if necessary.- Specified by:
removePaymentsFromOrderin interfaceOrderService
-
removeCreditCardPaymentsFromOrder
- Specified by:
removeCreditCardPaymentsFromOrderin interfaceOrderService
-
removePaymentFromOrder
@Transactional("blTransactionManager") public void removePaymentFromOrder(Order order, OrderPayment payment) Description copied from interface:OrderServiceDeletes the OrderPayment Info from the order. Note that this method will also delete any associated Secure OrderPayment Infos if necessary.- Specified by:
removePaymentFromOrderin interfaceOrderService
-
getCartOperationExceptionRootCause
This method will return the exception that is immediately below the deepest WorkflowException in the current stack trace.- Parameters:
e- the workflow exception that contains the requested root cause- Returns:
- the root cause of the workflow exception
-
compareAttributes
protected boolean compareAttributes(Map<String, OrderItemAttribute> item1Attributes, OrderItemRequestDTO item2) Returns true if the two items attributes exactly match.- Parameters:
item1Attributes-item2-- Returns:
-
itemMatches
protected boolean itemMatches(Sku item1Sku, Product item1Product, Map<String, OrderItemAttribute> item1Attributes, OrderItemRequestDTO item2) -
findMatchingItem
-
updateProductOptionsForItem
@Transactional(value="blTransactionManager", rollbackFor=UpdateCartException.class) public Order updateProductOptionsForItem(Long orderId, OrderItemRequestDTO orderItemRequestDTO, boolean priceOrder) throws UpdateCartException Description copied from interface:OrderServiceSince required product option can be added after the item is in the cart, we use this method to apply product option on an existing item in the cart. No validation will happen at this time, as the validation at checkout will take care of any missing product options.- Specified by:
updateProductOptionsForItemin interfaceOrderService- Returns:
- Order
- Throws:
UpdateCartException
-
reloadOrder
Description copied from interface:OrderServiceDetaches the given order from the current entity manager and then reloads a fresh version from the database.- Specified by:
reloadOrderin interfaceOrderService- Returns:
- the newly read order
-
acquireLock
- Specified by:
acquireLockin interfaceOrderService- Returns:
- whether or not the lock was acquired
- See Also:
-
releaseLock
- Specified by:
releaseLockin interfaceOrderService- Returns:
- whether or not the lock was released
- See Also:
-
printOrder
Description copied from interface:OrderServiceThis debugging method will print out a console-suitable representation of the current state of the order, including the items in the order and all pricing related information for the order.- Specified by:
printOrderin interfaceOrderService- Parameters:
order- the order to debuglog- the Log to use to print a debug-level message
-
preValidateCartOperation
Description copied from interface:OrderServiceInvokes the extension handler of the same name to provide the ability for a module to throw an exception and interrupt a cart operation.- Specified by:
preValidateCartOperationin interfaceOrderService
-
preValidateUpdateQuantityOperation
Description copied from interface:OrderServiceInvokes the extension handler of the same name to provide the ability for a module to throw an exception and interrupt an update quantity operation.- Specified by:
preValidateUpdateQuantityOperationin interfaceOrderService
-
refresh
- Specified by:
refreshin interfaceOrderService
-
findCartForCustomerWithEnhancements
Description copied from interface:OrderServiceRetrieve an enhanced version of the cart for the customer. Enhanced carts are generally provided by commercial Broadleaf modules.- Specified by:
findCartForCustomerWithEnhancementsin interfaceOrderService- Parameters:
customer- the user for whom the enhanced cart is retrieved- Returns:
- the enhanced cart, or the basic cart if no enhancement is available
-
findCartForCustomerWithEnhancements
Description copied from interface:OrderServiceFor the customer, use the candidateOrder as the source of enhancement for generating an enhanced cart. Enhanced carts are generally provided by commercial Broadleaf modules.- Specified by:
findCartForCustomerWithEnhancementsin interfaceOrderService- Parameters:
customer- the user for whom the enhanced cart is generatedcandidateOrder- the source of enhancement- Returns:
- the enhanced cart, or the untouched candidateOrder if no enhancement is available
-
findOrdersByEmail
Description copied from interface:OrderServiceLooks up all Orders for the specified email, regardless of current OrderStatus- Specified by:
findOrdersByEmailin interfaceOrderService- Returns:
- the requested Orders
-
readBatchOrders
- Specified by:
readBatchOrdersin interfaceOrderService
-
readNumberOfOrders
- Specified by:
readNumberOfOrdersin interfaceOrderService
-