Class DefaultCartOperationService

java.lang.Object
com.broadleafcommerce.cartoperation.service.DefaultCartOperationService
All Implemented Interfaces:
CartOperationService

public class DefaultCartOperationService extends Object implements CartOperationService
Author:
Chad Harchar (charchar)
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final String
     
    protected static final String
     
    protected static final SecureRandom
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    DefaultCartOperationService(CartOperationServiceProviders providers, CartPricingService cartPricingService, CartItemConfigurationService<? extends CatalogItem> cartItemConfigurationService, CartItemCatalogInformationService<? extends CatalogItem> cartItemCatalogInformationService, com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils authenticationUtils, com.broadleafcommerce.common.extension.TypeFactory typeFactory, CartOperationServiceProperties properties, CartItemMergingService<com.broadleafcommerce.cart.client.domain.CartItem> cartItemMergingService, org.springframework.context.MessageSource messageSource, TaxService taxService, StaleCartPricingResultHolder staleCartPricingResultHolder)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    com.broadleafcommerce.cart.client.domain.Cart
    addAttributeToCart(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull AddAttributeRequest addAttributeRequest, boolean price, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Adds an attribute to the provided Cart.
    protected boolean
    addCampaignCodeIfExistsOnCart(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull String code, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Deprecated.
    Deprecated as of 1.8, if using OfferService 2.0, this method is not used
    protected boolean
    addCampaignForCodeIfExists(String code, @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Deprecated.
    Deprecated as of 1.8, if using OfferService 2.0, this method is not used
    addCodeToCart(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull AddCodeRequest codeRequest, boolean allowPriceCart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Retrieve the cart Determine if the code is valid as a campaign tracking code If so, add it to the cart as a CampaignRef Determine if the code is valid as a shared code If so, add it to the cart Update the cart Price the cart, using offers and price lists (optional) Update the cart and its items (optional)
    protected void
    addCustomQuoteItemToFulfillmentGroup(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, Set<String> assignedCartItemIds)
    A hook point to assign the custom quote item to the fulfillment group if needed.
    protected void
    addFreeGiftItemsToCart(com.broadleafcommerce.cart.client.domain.Cart cart, List<com.broadleafcommerce.promotion.offer.client.web.context.info.FreeGiftItem> freeGiftItemsToAdd, List<com.broadleafcommerce.cart.client.domain.CartItem> updatedCartItems, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Adds the list of FreeGiftItems to cart, and then adds the ids of those added free gift cart items to the qualifier cart items attributes.
    protected void
    addItemsToFulfillmentGroup(@NonNull Collection<? extends com.broadleafcommerce.cart.client.domain.CartItem> cartItems, @NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup fulfillmentGroup, @NonNull javax.money.CurrencyUnit expectedCurrency, com.broadleafcommerce.cart.client.domain.CartItem parentCartItem)
     
    com.broadleafcommerce.cart.client.domain.Cart
    addItemToCart(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull AddItemRequest addItemRequest, boolean price, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Adds a single item to the provided Cart based on the provided AddItemRequest.
    protected void
    addItemToFulfillmentGroup(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, Set<String> assignedCartItemIds, com.broadleafcommerce.cart.client.domain.CartItem parentCartItem)
    Assigns the cart item and its dependent cart items to the fulfillment group.
    addManyItemsToCart(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull Collection<AddItemRequest> addItemRequests, boolean price, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Adds one or more items to the provided Cart.
    protected void
    addNonCatalogItemPriceOverride(@NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull NonCatalogItemDetails nonCatalogItemDetails, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Adds an price override for the given CartItem based on NonCatalogItemDetails.getPrice().
    protected boolean
    addOfferCodeIfUsable(String code, boolean isForCampaign, @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Adds the code to Cart.getOfferCodes() if it's usable.
    addOfferCodeToCart(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull AddCodeRequest addOfferCodeRequest, boolean price, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Adds an offer code to the provided Cart.
    protected void
    addRemovedFreeGiftOfferToIgnoreList(com.broadleafcommerce.cart.client.domain.Cart cart, List<com.broadleafcommerce.cart.client.domain.CartItem> cartItemsBeingRemoved)
    Adds the offer id to Cart's ignore list in Cart.getInternalAttributes() whenever a free gift item is removed, so that the free gift item will not be added again.
    com.broadleafcommerce.cart.client.domain.Cart
    addToCart(@NonNull AddItemRequest addItemRequest, com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.order.common.domain.CustomerRef customerRef, boolean allowPriceCart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Add an item to the customer's current cart based on the provided untrusted information.
    protected com.broadleafcommerce.cart.client.domain.Cart
    addUnassignedItemsToFulfillmentGroup(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart)
    Identify CartItems that have not been assigned to a FulfillmentGroup & add them to the relevant FulfillmentGroup.
    protected PaymentSummary
    allocateCartTotalToPayment(@NonNull PaymentSummary paymentSummary, @NonNull javax.money.MonetaryAmount cartTotal, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Hook point to automatically reallocate the cart total to the cart's single payment.
    protected PaymentSummary
    allocateCartTotalToPayment(@NonNull PaymentSummary paymentSummary, @NonNull javax.money.MonetaryAmount cartTotal, String lockToken, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Hook point to automatically reallocate the cart total to the cart's single payment.
    buildAddCodeToCartResponse(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull String code, boolean cartWasRepriced)
    Builds an AddCodeToCartResponse based on the provided cart, code, & whether or not the cart was repriced
    protected AddItemRequest
    buildAddItemRequest(com.broadleafcommerce.promotion.offer.client.web.context.info.FreeGiftItem freeGiftItem)
    Builds an AddItemRequest from the given FreeGiftItem.
    protected com.broadleafcommerce.order.common.domain.Adjustment
    buildAdjustment(com.broadleafcommerce.promotion.offer.client.web.context.info.Adjustment offerAdjustment)
    Builds an Adjustment based on the given Adjustment.
    protected com.broadleafcommerce.order.common.domain.CampaignRef
    buildCampaignRef(String code, String trackingId)
    Deprecated.
    Deprecated as of 1.8, if using OfferService 2.0, this method is not used
    protected com.broadleafcommerce.cart.client.domain.CartActionAudit
    buildCartActionAuditForAccountCartUpdate(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, String actionType, String userType)
    Builds a CartActionAudit for cart modification if the given Cart was modified by an account member.
    protected com.broadleafcommerce.cart.client.domain.CartActionAudit
    buildCartActionAuditForApproverCartUpdate(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart)
    Builds a CartActionAudit for cart modification if the given Cart was modified by an account approver.
    protected com.broadleafcommerce.cart.client.domain.CartItem
    buildCartItem(@NonNull AddItemRequest addItemRequest, @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, javax.money.CurrencyUnit currencyUnit, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Populates a new cart item from the AddItemRequest.
    buildCartItems(@NonNull Collection<AddItemRequest> addItemRequests, @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, javax.money.CurrencyUnit currencyUnit, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Populates new cart items from the AddItemRequests.
    buildCatalogItemRequest(@NonNull AddItemRequest addItemRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Hook point to create the CatalogItemRequest and populate any additional attributes that should be passed to the CatalogProvider when fetching the catalog representation for adding the cart item.
    buildCatalogItemRequest(@NonNull UpdateItemRequest updateItemRequest, @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Hook point to build the CatalogItemRequest and populate any additional attributes that should be passed to the CatalogProvider when fetching the catalog representation for updating the cart item.
    buildCatalogItemRequestsForAdd(@NonNull Collection<AddItemRequest> addItemRequests, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
     
    buildCatalogItemRequestsForUpdate(@NonNull Collection<UpdateItemRequest> updateItemRequests, @NonNull Collection<com.broadleafcommerce.cart.client.domain.CartItem> cartItems, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
     
    protected com.broadleafcommerce.cart.client.domain.CartItem
     
    protected String
    buildGroupReferenceNumber(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart)
    Builds a FulfillmentGroup.getReferenceNumber() for a new group.
    protected String
    buildGroupReferenceNumber(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, String fulfillmentGroupId)
    Builds a FulfillmentGroup.getReferenceNumber() for the given cart and group ID.
    protected Map<String,com.broadleafcommerce.order.common.domain.AttributeChoiceValue>
    buildItemAttributeChoices(@NonNull Map<String,String> requestItemAttributeChoices)
     
    protected com.broadleafcommerce.order.common.domain.OfferItemDetail
    buildOfferItemDetails(com.broadleafcommerce.promotion.offer.client.web.context.info.OfferItemDetail offerItemDetail)
    Builds an OfferItemDetail from the given OfferItemDetail.
    buildUpdateCartRequestWithCartActionAudit(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart)
    Builds an UpdateCartRequest with a CartActionAudit if the given account Cart was modified by an account approver.
    protected AddItemFailure
    buildValidationFailure(@NonNull AddItemRequest addItemRequest, @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem)
    Builds an AddItemFailure based on the provided AddItemRequest & CartItem representing an invalid add to cart request
    bulkAddToCart(@NonNull Collection<AddItemRequest> addItemRequests, com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.order.common.domain.CustomerRef customerRef, boolean allowPriceCart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Add a list of items to the customer's current cart based on the provided untrusted information.
    com.broadleafcommerce.cart.client.domain.Cart
    bulkUpdateFulfillmentGroupsInCart(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull List<UpdateFulfillmentGroupRequest> updateFulfillmentGroupsRequests, boolean price, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Updates an existing FulfillmentGroups for the provided Cart.
    protected javax.money.MonetaryAmount
    calculateMerchandiseTotalAmountForFulfillmentItemUpdate(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull com.broadleafcommerce.cart.client.domain.CartItem fulfillmentCartItem, @NonNull com.broadleafcommerce.cart.client.domain.FulfillmentItem fulfillmentItem, int totalQuantity)
    Calculates the FulfillmentItem.getMerchandiseTotalAmount() for the cart item.
    protected boolean
    canUpdatePaymentAmount(@NonNull PaymentSummary paymentSummary)
    This method checks if the payment amount can be changed.
    protected boolean
    catalogItemRequestAlreadyExist(@NonNull Set<CatalogItemRequest> catalogItemRequests, @NonNull AddItemRequest addItemRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Hook point to prevent duplicate CatalogItemRequests from being built based on the AddItemRequest.
    protected boolean
    catalogItemRequestAlreadyExist(@NonNull Set<CatalogItemRequest> catalogItemRequests, @NonNull UpdateItemRequest updateItemRequest, @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Hook point to prevent duplicate CatalogItemRequests from being built based on the CartItem and UpdateItemRequest.
    com.broadleafcommerce.cart.client.domain.Cart
    createCart(@NonNull CartCreationRequest cartCreationRequest, com.broadleafcommerce.order.common.domain.CustomerRef customer, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Creates a new, in-progress Cart for the provided CartCreationRequest and CustomerRef.
    protected com.broadleafcommerce.cart.client.domain.CartAlert
     
    protected com.broadleafcommerce.cart.client.domain.CartItem
    createCartItem(@NonNull AddItemRequest addItemRequest, javax.money.CurrencyUnit currencyUnit, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Creates a CartItem based on the provided AddItemRequest
    protected com.broadleafcommerce.cart.client.domain.Cart
    createEmptyCart(com.broadleafcommerce.order.common.domain.CustomerRef customer, javax.money.CurrencyUnit currencyUnit, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Creates and returns an empty, unsaved Cart with typical defaults.
    protected com.broadleafcommerce.cart.client.domain.Cart
    createEmptyCart(com.broadleafcommerce.order.common.domain.CustomerRef customer, javax.money.CurrencyUnit currencyUnit, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, CartCreationRequest cartCreationRequest)
    Creates and returns an empty, unsaved Cart with typical defaults.
    protected void
    createFulfillmentGroupForItems(@NonNull Collection<? extends com.broadleafcommerce.cart.client.domain.CartItem> cartItems, @NonNull String fulfillmentType, @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.cart.client.domain.CartItem parentCartItem)
     
    protected com.broadleafcommerce.cart.client.domain.Cart
    createItemAndAddToCart(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull AddItemRequest addItemRequest, javax.money.CurrencyUnit currencyUnit, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Creates a new item and adds it to the provided Cart.
    protected com.broadleafcommerce.cart.client.domain.Cart
    createItemsAndAddToCart(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull List<AddItemRequest> addItemRequests, @NonNull BulkAddToCartResponse bulkAddToCartResponse, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Create and add the items from the given AddItemRequests to the given Cart.
    createItemsAndAddToCart(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, Collection<AddItemRequest> addItemRequests, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Creates new items and adds them to the provided Cart.
    protected void
    defaultCartCurrency(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, javax.money.CurrencyUnit currencyUnit)
     
    protected void
    defaultCartLocale(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
     
    protected final boolean
    doesCartContainCampaignForCode(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, String code)
    Deprecated.
    protected boolean
    doFulfillmentExclusionsPassForCOD(@NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup fulfillmentGroup, @NonNull CheckoutPaymentMethodOption codCheckoutPaymentMethodOption)
     
    protected boolean
    doFulfillmentInclusionsPassForCOD(@NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup fulfillmentGroup, @NonNull CheckoutPaymentMethodOption codCheckoutPaymentMethodOption)
     
    protected void
    doSoftInventoryReservationIfNecessary(com.broadleafcommerce.cart.client.domain.Cart cart, List<com.broadleafcommerce.cart.client.domain.CartItem> cartItems, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    If any of the supplied cart items have a reservation strategy of ADD_TO_CART, a soft reservation is performed.
    protected com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils
     
     
     
    protected Map<String,com.broadleafcommerce.cart.client.domain.CartItem>
    getCartItemIdsWithDependentItem(List<com.broadleafcommerce.cart.client.domain.CartItem> cartItems)
     
    protected CartItemMergingService<com.broadleafcommerce.cart.client.domain.CartItem>
     
     
     
    protected String
    getCartTotalChangeMessage(javax.money.MonetaryAmount latestCartPrice)
     
    protected CartUtils
     
    protected String
    Hook point to determine what the missing entities map is keyed on from the AddItemRequest.
     
    getCODCheckoutPaymentMethodOption(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
     
    protected javax.money.CurrencyUnit
    getCurrencyUnit(javax.money.CurrencySupplier currencySupplier, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Call utility method to determine currency.
     
    protected Supplier<com.broadleafcommerce.cart.client.domain.FulfillmentGroup>
    getFulfillmentGroupById(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, String fulfillmentGroupId)
    Gets the fulfillment group by the provided ID.
     
    protected String
    getMessage(@NonNull String errorMessage, Object... args)
     
    protected org.springframework.context.MessageSource
     
    protected Instant
    getMostRecentPaymentFinalizationTimestamp(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
     
    protected com.fasterxml.jackson.databind.ObjectMapper
     
     
    protected Map<String,String>
    getPaymentFinalizationTimestamps(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart)
     
     
    protected com.broadleafcommerce.pricing.client.domain.context.PriceContext
    getPriceContext(Locale locale, javax.money.CurrencyUnit currency)
     
    protected Object
    getProductType(com.broadleafcommerce.cart.client.domain.CartItem cartItem)
     
     
     
    protected QuoteAuthUtils
     
    protected com.broadleafcommerce.cart.client.properties.QuoteProperties
     
    protected List<com.broadleafcommerce.order.common.domain.Adjustment>
    getRelatedAdjustments(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull String code)
     
    protected List<com.broadleafcommerce.order.common.domain.Voucher>
    getRelatedVouchers(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull String code)
     
    protected com.broadleafcommerce.cart.client.domain.CartItem
    getRequiredCartItem(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull String cartItemId)
    Gets a cart item from the cart by its ID.
    protected com.broadleafcommerce.rulesengine.expression.service.SpelRuleEvaluationService
     
     
     
    protected TaxService
     
    protected com.broadleafcommerce.common.extension.TypeFactory
     
    protected boolean
    handleCODStatusChange(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, Map<String,String> paymentLockTokens, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, com.broadleafcommerce.cart.client.domain.FulfillmentGroup fulfillmentGroup)
    Handles when Collect on Delivery is selected or de-selected.
    protected boolean
    handleDeSelectCODBeforeUpdate(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup fulfillmentGroup, Map<String,String> paymentLockTokens, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Handles when Collect on Delivery is selected or de-selected.
    protected boolean
    handleSelectCODBeforeUpdate(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup fulfillmentGroup, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Handles when Collect on Delivery is selected.
    protected void
    handleSetDeselectedCODAttribute(@NonNull UpdateFulfillmentGroupRequest updateFulfillmentGroupRequest, @NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup fgToUpdate)
    Sets a temporary attribute on the fullfillment group if the COD status attribute has gone from selected to not selected.
    protected boolean
    hasDeselectedCOD(com.broadleafcommerce.cart.client.domain.FulfillmentGroup fulfillmentGroup)
     
    protected boolean
    hasPaymentFinalizationLock(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart)
     
    protected List<AddItemRequest>
    identifyAddItemRequestsForCatalogItems(@NonNull Collection<AddItemRequest> addItemRequests, @NonNull CatalogItemList<? extends CatalogItem> catalogItemList)
    Attempts to identify the AddItemRequest's related CatalogItem from the provided CatalogItemList.
    protected List<AddItemRequest>
     
    protected Optional<? extends CatalogItem>
    identifyCatalogItemForCartItem(@NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull CatalogItemList<? extends CatalogItem> catalogItemList)
    Attempts to identify the CartItem's related CatalogItem from the provided CatalogItemList.
    protected CatalogItemList<? extends CatalogItem>
    identifyCatalogItemsForAddItemRequests(@NonNull Collection<AddItemRequest> addItemRequests, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Deprecated, for removal: This API element is subject to removal in a future version.
    protected CatalogItemList<? extends CatalogItem>
    identifyCatalogItemsForAddItemRequests(@NonNull Collection<AddItemRequest> addItemRequests, com.broadleafcommerce.pricing.client.domain.context.PriceContext priceContext, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
     
    protected CatalogItemList<? extends CatalogItem>
    identifyCatalogItemsForUpdateItemRequest(@NonNull UpdateItemRequest updateItemRequest, @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Deprecated, for removal: This API element is subject to removal in a future version.
    protected CatalogItemList<? extends CatalogItem>
    identifyCatalogItemsForUpdateItemRequest(@NonNull UpdateItemRequest updateItemRequest, @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, com.broadleafcommerce.pricing.client.domain.context.PriceContext priceContext, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
     
    protected void
    insertItems(com.broadleafcommerce.cart.client.domain.Cart cart, List<com.broadleafcommerce.cart.client.domain.CartItem> itemsToAdd, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
     
    protected void
    invalidateFulfillmentGroupOverride(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem)
     
    protected boolean
    Determines if all the given AddItemRequests are for DefaultCartItemTypes.CUSTOM_QUOTE_ITEM.
    protected boolean
    isCartItemCODFee(@NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem)
     
    protected boolean
    isCartMaxTotalAllowedForCOD(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull CheckoutPaymentMethodOption codCheckoutPaymentMethodOption)
     
    protected boolean
    isCartMinTotalAllowedForCOD(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull CheckoutPaymentMethodOption codCheckoutPaymentMethodOption)
     
    protected boolean
    isItemElegibleForRemoval(@NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem)
    Hook point to prevent removal of cart items that should not be removed through the cart management endpoints.
    protected boolean
    isPaymentReallocationRequired(javax.money.MonetaryAmount previousCartTotal, javax.money.MonetaryAmount newCartTotal)
     
    protected boolean
    isUsingCollectOnDelivery(com.broadleafcommerce.cart.client.domain.FulfillmentGroup fulfillmentGroup)
     
    Instantiates a new BulkAddToCartResponse using the TypeFactory.
    protected com.broadleafcommerce.cart.client.domain.Cart
    Uses the TypeFactory to create a new Cart object.
     
    protected com.broadleafcommerce.cart.client.domain.CartPricing
    Uses the TypeFactory to create a new CartPricing object.
    protected String
    newCartStatus(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    protected String
    newCartStatus(String cartType, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Determines what status should be used when creating new carts.
    protected boolean
    paymentFinalizationLockIsExpired(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
     
    protected void
    populateCartItemFromNonCatalogItemRequest(@NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull NonCatalogItemDetails nonCatalogItemDetails, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Populates the given CartItem based on the given NonCatalogItemDetails.
    protected boolean
    populateCartItemUpdates(@NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull UpdateItemRequest request)
    Takes the changes from the UpdateItemRequest and populates them onto the CartItem.
    protected boolean
    populateCartUpdatesFromUpdateItemRequest(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull UpdateItemRequest request)
    Takes the changes from the UpdateItemRequest and populates them onto the Cart.
    protected com.broadleafcommerce.cart.client.domain.CartItem
    populateFromRequest(@NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull AddItemRequest addItemRequest, javax.money.CurrencyUnit currencyUnit, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Populates the cart item fields based on the request.
    com.broadleafcommerce.cart.client.domain.Cart
    priceCart(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, PriceCartRequest priceCartRequest, boolean saveCart, Map<String,String> paymentLockTokens, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Prices cart, processes free gift offers, and saves cart with the provided PriceCartRequest if saveCart is true.
    com.broadleafcommerce.cart.client.domain.Cart
    priceCart(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, PriceCartRequest priceCartRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Prices and saves the cart with the provided PriceCartRequest.
    com.broadleafcommerce.cart.client.domain.Cart
    priceCartWithCatalogPriceUpdates(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Reprice the cart, including applying the latest catalog-based prices for each of its items
    protected List<com.broadleafcommerce.promotion.offer.client.web.context.info.FreeGiftItem>
    processExistingFreeGiftItems(com.broadleafcommerce.cart.client.domain.Cart cart, List<com.broadleafcommerce.cart.client.domain.CartItem> updatedCartItems, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Updates existing free gift items quantities and remove existing free gift items if necessary, and then return a list of FreeGiftItems to add to cart.
    protected void
    processFreeGiftItemsForRemoval(com.broadleafcommerce.cart.client.domain.Cart cart, List<com.broadleafcommerce.cart.client.domain.CartItem> cartItemsBeingRemoved)
    Processes free gift items whenever CartItems are being removed.
    protected void
    processFreeGiftOffers(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Processes all free gift offers stored in Cart.getInternalAttributes().
    protected void
    processPaymentsForReleasedPaymentFinalizationLock(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull LockPaymentsResponse lockPaymentsResponse, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
     
    protected void
    reallocateCartTotalAmongstPayments(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull javax.money.MonetaryAmount newCartTotal, @NonNull Map<String,String> paymentLockTokens, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
     
    reallocateCartTotalAmongstPayments(@NonNull javax.money.MonetaryAmount newCartTotal, @NonNull List<PaymentSummary> paymentSummaries, @NonNull Map<String,String> paymentLockTokens, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Reallocate the cart total among the cart's payments
    protected List<PaymentSummary>
    reallocateCartTotalMultiplePayments(@NonNull javax.money.MonetaryAmount cartTotal, @NonNull List<PaymentSummary> paymentSummaries, Map<String,String> paymentLockTokens, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Hook point to automatically reallocate the cart total amongst the cart's payments.
    com.broadleafcommerce.cart.client.domain.Cart
    recalculateTaxesForCart(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, boolean estimated, boolean actual, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Deprecated.
    com.broadleafcommerce.cart.client.domain.Cart
    recalculateTaxesForCart(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, boolean estimated, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Recalculates the taxes for the provided Cart.
    com.broadleafcommerce.cart.client.domain.Cart
    releasePaymentFinalizationLock(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    For carts in the DefaultCartStatuses.AWAITING_PAYMENT_FINALIZATION status, this method updates the cart status to DefaultCartStatuses.IN_PROCESS allowing the customer to once again edit the cart.
    protected Optional<com.broadleafcommerce.cart.client.domain.Cart>
    releasePaymentFinalizationLockIfExpired(Optional<com.broadleafcommerce.cart.client.domain.Cart> optionalCart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
     
    protected void
    releaseSoftInventoryReservationIfNecessary(com.broadleafcommerce.cart.client.domain.Cart cart, List<com.broadleafcommerce.cart.client.domain.CartItem> cartItemsBeingRemoved, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Releases soft inventory reservations for the removed cart items if any of them have InventoryReservationStrategy.ADD_TO_CART.
    protected void
    removeAssociatedFreeGiftItems(com.broadleafcommerce.cart.client.domain.Cart cart, List<com.broadleafcommerce.cart.client.domain.CartItem> cartItemsBeingRemoved)
    Removes the associated free gift item if the offer qualifier item is removed.
    com.broadleafcommerce.cart.client.domain.Cart
    removeAttributeFromCart(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull String key, boolean price, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Removes an attribute to the provided Cart.
    com.broadleafcommerce.cart.client.domain.Cart
    removeCartItems(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, Collection<String> cartItemIds, boolean allowPriceCart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Remove items from the cart.
    protected void
    removeExistingFreeGiftItemsFromCart(com.broadleafcommerce.cart.client.domain.Cart cart, List<com.broadleafcommerce.cart.client.domain.CartItem> existingFreeGiftItemsToRemove, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Remove existing free gift CartItems from cart.
    protected com.broadleafcommerce.cart.client.domain.Cart
    removeFulfillmentItemsWithoutCartItems(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart)
    Deprecated, for removal: This API element is subject to removal in a future version.
    com.broadleafcommerce.cart.client.domain.Cart
    removeItemFromCart(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull String cartItemId, boolean price, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Removes a single item from the provided Cart matching the provided cart item ID.
    protected void
    removeItemsFromFulfillmentGroup(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, List<com.broadleafcommerce.cart.client.domain.CartItem> cartItems)
     
    com.broadleafcommerce.cart.client.domain.Cart
    removeManyItemsFromCart(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, Collection<String> cartItemIds, boolean price, boolean updateCart, Map<String,String> paymentLockTokens, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Removes one or more items from the provided Cart matching the provided cart item IDs.
    com.broadleafcommerce.cart.client.domain.Cart
    removeOfferAndCampaignCodesFromCart(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, List<String> codes, boolean allowPriceCart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Removes the provided offer and campaign codes from the cart and then updates the cart.
    com.broadleafcommerce.cart.client.domain.Cart
    removeOfferCodeFromCart(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull String offerCode, boolean price, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Removes an offer code from the provided Cart, if it exists.
    protected com.broadleafcommerce.cart.client.domain.Cart
    removeStaleCartItem(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.cart.client.domain.CartItem cartItem, boolean price, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
     
    protected Optional<com.broadleafcommerce.cart.client.domain.Cart>
    repriceCartIfPricingIsStale(Optional<com.broadleafcommerce.cart.client.domain.Cart> optionalCart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Called during cart resolution to check if the catalog prices on the cart are stale, and if so, updates those prices and resets the time since they were last changed.
    protected void
    resetFulfillmentGroupReferenceNumbers(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart)
    Deprecated, for removal: This API element is subject to removal in a future version.
    protected String
    resolveDefaultFulfillmentType(@NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem)
    Determines the default FulfillmentType for the provided CartItem
    protected String
    Determines the tax address source that should be used for FulfillmentGroup.getTaxAddressSource() for the given fulfillment type.
    Optional<com.broadleafcommerce.cart.client.domain.Cart>
    retrieveCartByCartId(@NonNull ResolveCartRequest resolveCartRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Retrieve the cart for the provided id, using the given request data.
    Optional<com.broadleafcommerce.cart.client.domain.Cart>
    retrieveCartByCartId(@NonNull String cartId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Retrieve the cart for the provided id.
    protected Optional<com.broadleafcommerce.cart.client.domain.Cart>
    retrieveCartByCartIdWithStatus(@NonNull String cartId, com.broadleafcommerce.cart.client.domain.enums.CartStatus status, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
     
    Optional<com.broadleafcommerce.cart.client.domain.Cart>
    retrieveCartByStatus(String customerId, String accountId, String status, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Retrieves a customer or account cart with the provided customer ID, account ID, and status, if it exists.
    Optional<com.broadleafcommerce.cart.client.domain.Cart>
    retrieveCartByStatusAndName(String customerId, String status, String name, String accountId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Retrieves a customer or account cart with the provided customer ID, account ID, and status, if it exists.
    Optional<com.broadleafcommerce.cart.client.domain.Cart>
    retrieveCsrCartByCartId(@NonNull String cartId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Retrieve the cart for the provided id, as long as it is CSR-owned.
    Optional<com.broadleafcommerce.cart.client.domain.Cart>
    retrieveCsrOwnedCartByCustomerIdAndApplicationId(@NonNull String customerId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Retrieve the CSR-owned cart for the provided customer.
    Optional<com.broadleafcommerce.cart.client.domain.Cart>
    retrieveImplicitCart(String customerId, String accountId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, boolean allowRepriceDueToStaleCartPrices)
    Resolves the implicit cart for the given customer id and account id.
    Optional<com.broadleafcommerce.cart.client.domain.Cart>
    retrieveInProcessCartByCartId(@NonNull String cartId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Retrieve the cart for the provided id, as long as it is in-process.
    Optional<com.broadleafcommerce.cart.client.domain.Cart>
    retrieveInProcessCartByCustomerIdAndApplicationId(@NonNull String customerId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Retrieve the in-process cart for the provided customer.
    org.springframework.data.domain.Page<com.broadleafcommerce.cart.client.domain.Cart>
    retrieveMyCarts(@NonNull com.broadleafcommerce.order.common.domain.CustomerRef customer, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Retrieves all of a customer's carts that have not been locked, archived, or submitted.
    Optional<com.broadleafcommerce.cart.client.domain.Cart>
    retrieveTestCartByCartId(@NonNull String cartId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Retrieve the cart for the provided id, as long as it is a test cart.
    protected com.broadleafcommerce.cart.client.domain.Cart
    saveCart(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Helper method to encapsulate saving an existing Cart.
    protected com.broadleafcommerce.cart.client.domain.Cart
    saveCart(@NonNull UpdateCartRequest updateCartRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Helper method to encapsulate saving an existing Cart.
    void
     
    void
     
    void
     
    void
     
    void
     
    void
    setObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
     
    void
     
    void
     
    void
     
    void
    setQuoteProperties(com.broadleafcommerce.cart.client.properties.QuoteProperties quoteProperties)
     
    void
    setSpelRuleEvaluationService(com.broadleafcommerce.rulesengine.expression.service.SpelRuleEvaluationService spelRuleEvaluationService)
     
    void
     
    protected boolean
    shouldRepriceCartIfPricingStale(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Decides whether a cart should be repriced in case it's prices are stale.
    protected void
    unlockCartPayments(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull Map<String,String> paymentLockTokens, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Sends a request to PaymentTransactionServices to unlock the cart's payments, based on the lock tokens that were previously obtained via PaymentProvider.lockAndRetrieveCartPayments(Cart, ContextInfo).
    com.broadleafcommerce.cart.client.domain.Cart
    updateAsNamedCart(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull String name, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Updates the provided Cart with the given name.
    com.broadleafcommerce.cart.client.domain.Cart
    updateCart(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, boolean allowPriceCart, boolean wasCartModified, boolean invalidatePrices, Map<String,String> paymentLockTokens, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Updates the provided Cart based on the provided flags.
    com.broadleafcommerce.cart.client.domain.Cart
    updateCart(@NonNull UpdateCartRequest updateCartRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Updates the provided Cart based on the provided UpdateCartRequest.
    protected com.broadleafcommerce.cart.client.domain.Cart
    updateCartAttributes(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull List<AddItemRequest> successfulAddItemRequests)
    Update cart attributes based on the successful AddItemRequests
    com.broadleafcommerce.cart.client.domain.Cart
    updateCartContactInfo(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull ContactInfoRequest contactInfoRequest, boolean allowPriceCart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Update contact information to allow business users to contact the customer if needed.
    com.broadleafcommerce.cart.client.domain.Cart
    updateCartInfo(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull UpdateCartInfoRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Updates basic info on the cart like its name or, if a quote, its expiration date.
    com.broadleafcommerce.cart.client.domain.Cart
    updateCartItem(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull UpdateItemRequest updateItemRequest, boolean allowPriceCart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Update the cart item.
    com.broadleafcommerce.cart.client.domain.Cart
    updateCartStatus(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull UpdateCartStatusRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Deprecated, for removal: This API element is subject to removal in a future version.
    com.broadleafcommerce.cart.client.domain.Cart
    updateCartStatus(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull UpdateCartStatusRequest request, com.broadleafcommerce.order.common.domain.CustomerRef customer, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Updates the cart's status.
    com.broadleafcommerce.cart.client.domain.Cart
    updateContactInfoInCart(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull ContactInfoRequest contactInfoRequest, boolean price, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Updates the contact info for the provided Cart.
    protected void
    updateExistingFreeGiftItem(com.broadleafcommerce.cart.client.domain.CartItem existingFreeGiftItem, com.broadleafcommerce.promotion.offer.client.web.context.info.FreeGiftItem freeGift, List<com.broadleafcommerce.cart.client.domain.CartItem> updatedCartItems)
    Updates existing free gift CartItem with the latest details from the given FreeGiftItem and update its Adjustment.
    protected void
    updateFulfillmentGroup(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup fgToUpdate, @NonNull UpdateFulfillmentGroupRequest updateFulfillmentGroupRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
     
    com.broadleafcommerce.cart.client.domain.Cart
    updateFulfillmentGroup(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, String fulfillmentGroupId, @NonNull UpdateFulfillmentGroupRequest fulfillmentGroupRequest, boolean allowPriceCart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Update the fulfillment group.
    protected void
    updateFulfillmentItem(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem)
    Updates the FulfillmentItem corresponding to the CartItem, keeping them in sync.
    protected void
    updateInventorySerializationValueIfNecessary(com.broadleafcommerce.cart.client.domain.CartItem cartItem)
    Updates the inventory's serialization value in CartItem.getInternalAttributes() based on CartItem.getAttributeChoices().
    com.broadleafcommerce.cart.client.domain.Cart
    updateItemInCart(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull UpdateItemRequest updateItemRequest, boolean price, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Updates a single item in the provided Cart based on the provided UpdateItemRequest.
    protected void
    updatesForBundleFulfillmentItems(com.broadleafcommerce.cart.client.domain.CartItem parentCartItem, com.broadleafcommerce.cart.client.domain.FulfillmentItem fulfillmentItem)
     
    protected void
    validateCartItem(@NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull CatalogItemList<? extends CatalogItem> catalogItemList, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Validates that the CartItem includes enough information to correctly represent the product or one of the product's variants.
    protected void
    validateCartItemAfterUpdate(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull CatalogItemList<? extends CatalogItem> catalogItemList, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
     
    protected void
    validateCartItemBeforeUpdate(@NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull UpdateItemRequest updateItemRequest)
    Validates the CartItem being updated against UpdateItemRequest before the actual cart item update.
    protected void
    validateCartItemsCanBeRemoved(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull Collection<String> cartItemIdsBeingRemoved, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Validates whether the cart items can be removed from the cart.
    protected void
    validateCartStatusChangeRequest(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull UpdateCartStatusRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Takes a UpdateCartStatusRequest and validates that the targeted cart can have its status changed.
    protected void
    validateCollectOnDeliverySelection(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup fulfillmentGroup, @NonNull CheckoutPaymentMethodOption codCheckoutPaymentMethodOption, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Validates that Collect on Delivery is still applicable given the updated cart state.
    protected void
    validateCollectOnDeliverySelection(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
     
    protected void
    validateFreeGiftItemForUpdate(@NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull UpdateItemRequest updateItemRequest)
    If the given CartItem is a free gift item, validates that its quantity is not being changed.
    protected void
    validateItemsRemovalForCustomQuoteItems(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull Collection<String> cartItemIdsBeingRemoved, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Validates whether all the remaining CartItems would be DefaultCartItemTypes.CUSTOM_QUOTE_ITEM after items removal if QuoteProperties.customQuoteItemsCanExistWithoutStandardItems(ContextInfo) is set to false.
    protected void
    validateRequestToSetExpirationDate(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Validates that Cart.getExpirationDate() can be set by the requester.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

  • Method Details

    • retrieveMyCarts

      public org.springframework.data.domain.Page<com.broadleafcommerce.cart.client.domain.Cart> retrieveMyCarts(@NonNull @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customer, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Description copied from interface: CartOperationService
      Retrieves all of a customer's carts that have not been locked, archived, or submitted.
      Specified by:
      retrieveMyCarts in interface CartOperationService
      Parameters:
      customer - The customer who owns the carts
      filters - Additional RSQL filters
      page - Pagination params
      context - Additional sandbox and multitenant info
      Returns:
      All of a customer's carts that have not been locked, archived, or submitted.
    • retrieveCartByCartId

      public Optional<com.broadleafcommerce.cart.client.domain.Cart> retrieveCartByCartId(@NonNull @NonNull String cartId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartOperationService
      Retrieve the cart for the provided id.
      Specified by:
      retrieveCartByCartId in interface CartOperationService
      Parameters:
      cartId - The id of the cart on which to perform the operation.
      contextInfo - Context information around sandbox and multitenant state.
      Returns:
      The cart for the provided id.
    • retrieveCartByCartId

      public Optional<com.broadleafcommerce.cart.client.domain.Cart> retrieveCartByCartId(@NonNull @NonNull ResolveCartRequest resolveCartRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartOperationService
      Retrieve the cart for the provided id, using the given request data.
      Specified by:
      retrieveCartByCartId in interface CartOperationService
      Parameters:
      resolveCartRequest - The request specifying the id of the cart as well as additional data to perform the operation.
      contextInfo - Context information around sandbox and multitenant state.
      Returns:
      The cart for the provided id.
    • retrieveCartByStatus

      public Optional<com.broadleafcommerce.cart.client.domain.Cart> retrieveCartByStatus(String customerId, @Nullable String accountId, String status, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartOperationService
      Retrieves a customer or account cart with the provided customer ID, account ID, and status, if it exists. Customer cart will automatically be retrieved if the given accountId is null.
      Specified by:
      retrieveCartByStatus in interface CartOperationService
      Parameters:
      customerId - the customer ID
      accountId - the id of the account that the Cart belong to, null can be passed in to retrieve customer Cart
      status - the status
      contextInfo - the context info
      Returns:
      the cart, if it exists
    • retrieveCartByStatusAndName

      public Optional<com.broadleafcommerce.cart.client.domain.Cart> retrieveCartByStatusAndName(String customerId, String status, @Nullable String name, @Nullable String accountId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartOperationService
      Retrieves a customer or account cart with the provided customer ID, account ID, and status, if it exists. Customer cart will automatically be retrieved if the given accountId is null.
      Specified by:
      retrieveCartByStatusAndName in interface CartOperationService
      Parameters:
      customerId - the customer ID
      status - the status
      name - the name of the cart or null for a cart with no name
      accountId - the id of the account that the Cart belong to, null can be passed in to retrieve customer Cart
      contextInfo - the context info
      Returns:
      the cart, if it exists
    • retrieveImplicitCart

      public Optional<com.broadleafcommerce.cart.client.domain.Cart> retrieveImplicitCart(String customerId, @Nullable String accountId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, boolean allowRepriceDueToStaleCartPrices)
      Description copied from interface: CartOperationService
      Resolves the implicit cart for the given customer id and account id.

      Out of the box, a default/implicit cart means an DefaultCartStatuses.IN_PROCESS with null name, and there should only be one default/implicit cart per user. By default, allowRepriceDueToStaleCartPrices is true since we want to reprice the cart. Only for the creation of a net new cart, it is set as false

      Specified by:
      retrieveImplicitCart in interface CartOperationService
      Parameters:
      customerId - the customer ID
      accountId - the id of the account that the Cart belong to, null can be passed in to retrieve customer Cart
      contextInfo - the context info
      allowRepriceDueToStaleCartPrices - declares if repricing due to stale cart prices should be considered or skipped entirely
      Returns:
      the registered customer's implicit cart
    • createCart

      public com.broadleafcommerce.cart.client.domain.Cart createCart(@NonNull @NonNull CartCreationRequest cartCreationRequest, @Nullable com.broadleafcommerce.order.common.domain.CustomerRef customer, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartOperationService
      Creates a new, in-progress Cart for the provided CartCreationRequest and CustomerRef. The CartCreationRequest must contain

      For guest customers, this will create a new guest cart

      Specified by:
      createCart in interface CartOperationService
      Parameters:
      cartCreationRequest - the cart creation request
      customer - the customer
      contextInfo - the context info
      Returns:
      the newly created cart
    • updateCartInfo

      public com.broadleafcommerce.cart.client.domain.Cart updateCartInfo(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull UpdateCartInfoRequest request, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartOperationService
      Updates basic info on the cart like its name or, if a quote, its expiration date.
      Specified by:
      updateCartInfo in interface CartOperationService
      Parameters:
      cart - The cart to update
      request - Request data
      contextInfo - Additional sandbox and multitenant info
      Returns:
      The updated cart.
    • validateRequestToSetExpirationDate

      protected void validateRequestToSetExpirationDate(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Validates that Cart.getExpirationDate() can be set by the requester.
      Parameters:
      cart - The cart to be updated
      contextInfo - Additional context info
      Throws:
      CartValidationException - when the user cannot update the expiration date.
    • processFreeGiftOffers

      protected void processFreeGiftOffers(com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Processes all free gift offers stored in Cart.getInternalAttributes(). This will automatically add free gift cart items to cart, update existing free gift items, and remove existing free gift items, if necessary.
      Parameters:
      cart - the Cart to process the free gift offers for
      contextInfo - the contextInfo for the request
    • processExistingFreeGiftItems

      protected List<com.broadleafcommerce.promotion.offer.client.web.context.info.FreeGiftItem> processExistingFreeGiftItems(com.broadleafcommerce.cart.client.domain.Cart cart, List<com.broadleafcommerce.cart.client.domain.CartItem> updatedCartItems, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Updates existing free gift items quantities and remove existing free gift items if necessary, and then return a list of FreeGiftItems to add to cart.
      Parameters:
      cart - the Cart to process existing free gift items for
      updatedCartItems - a list of CartItems whose quantities were updated
      contextInfo - the contextInfo for the request
      Returns:
      a list of FreeGiftItems to add to cart
    • updateExistingFreeGiftItem

      protected void updateExistingFreeGiftItem(com.broadleafcommerce.cart.client.domain.CartItem existingFreeGiftItem, com.broadleafcommerce.promotion.offer.client.web.context.info.FreeGiftItem freeGift, List<com.broadleafcommerce.cart.client.domain.CartItem> updatedCartItems)
      Updates existing free gift CartItem with the latest details from the given FreeGiftItem and update its Adjustment.
      Parameters:
      existingFreeGiftItem - the existing free gift CartItem to update the FreeGiftItem details for
      freeGift - the FreeGiftItem to update the existing free gift CartItem with
      updatedCartItems - a list of CartItems whose quantities were updated, used to ensure the FulfillmentItems are updated as well
    • buildAdjustment

      protected com.broadleafcommerce.order.common.domain.Adjustment buildAdjustment(com.broadleafcommerce.promotion.offer.client.web.context.info.Adjustment offerAdjustment)
      Builds an Adjustment based on the given Adjustment.
      Parameters:
      offerAdjustment - the Adjustment to build it from
      Returns:
      an Adjustment based on the given Adjustment
    • buildOfferItemDetails

      protected com.broadleafcommerce.order.common.domain.OfferItemDetail buildOfferItemDetails(com.broadleafcommerce.promotion.offer.client.web.context.info.OfferItemDetail offerItemDetail)
      Builds an OfferItemDetail from the given OfferItemDetail.
      Parameters:
      offerItemDetail - the OfferItemDetail to build the OfferItemDetail from
      Returns:
      an OfferItemDetail from the given OfferItemDetail
    • addFreeGiftItemsToCart

      protected void addFreeGiftItemsToCart(com.broadleafcommerce.cart.client.domain.Cart cart, List<com.broadleafcommerce.promotion.offer.client.web.context.info.FreeGiftItem> freeGiftItemsToAdd, List<com.broadleafcommerce.cart.client.domain.CartItem> updatedCartItems, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Adds the list of FreeGiftItems to cart, and then adds the ids of those added free gift cart items to the qualifier cart items attributes.
      Parameters:
      cart - the Cart to add the FreeGiftItems to
      freeGiftItemsToAdd - a list of FreeGiftItems to add
      updatedCartItems - a list of CartItems whose attributes were updated
    • removeExistingFreeGiftItemsFromCart

      protected void removeExistingFreeGiftItemsFromCart(com.broadleafcommerce.cart.client.domain.Cart cart, List<com.broadleafcommerce.cart.client.domain.CartItem> existingFreeGiftItemsToRemove, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Remove existing free gift CartItems from cart.

      Before removing existing free gift CartItems, this removes the CartItemAttributeConstants.Internal.IS_FREE_GIFT_ITEM attribute to ensure that the free gift offer is not added to the offer ignore list in addRemovedFreeGiftOfferToIgnoreList(Cart, List).

      Parameters:
      cart - the Cart to remove the existing free gift items from
      existingFreeGiftItemsToRemove - the existing free gift CartItems to remove
      contextInfo - the contextInfo for the request
      See Also:
    • buildAddItemRequest

      protected AddItemRequest buildAddItemRequest(com.broadleafcommerce.promotion.offer.client.web.context.info.FreeGiftItem freeGiftItem)
      Builds an AddItemRequest from the given FreeGiftItem.
      Parameters:
      freeGiftItem - FreeGiftItem to build the AddItemRequest for
      Returns:
      the AddItemRequest for the given FreeGiftItem
    • updateCart

      public com.broadleafcommerce.cart.client.domain.Cart updateCart(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, boolean allowPriceCart, boolean wasCartModified, boolean invalidatePrices, Map<String,String> paymentLockTokens, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartOperationService
      Updates the provided Cart based on the provided flags.

      If the cart was not modified (wasCartModified), this will price and update the cart when the cart is not already priced (Cart.isPriced()), regardless of invalidatePrices. If the cart was not modified and the cart is already priced, this does nothing.

      If the cart was modified, the cart will be priced if allowed (allowPriceCart) and if not already already priced or if prices should be invalidated.

      Note: It is intentional that no overloaded methods are provided with default values for these parameters. Callers must consider carefully whether their operation modifies the cart or requires price invalidation.

      Specified by:
      updateCart in interface CartOperationService
      Parameters:
      cart - the cart to be updated
      allowPriceCart - whether the cart may be priced
      wasCartModified - whether the cart was actually modified by the caller
      invalidatePrices - whether to invalidate prices on the cart if changes were made
      paymentLockTokens - Tokens that grant this service access to act upon the payment. The presence of these tokens indicates that this execution flow owns the lock.
      Returns:
      synced version of the cart with the cart service
    • updateCart

      public com.broadleafcommerce.cart.client.domain.Cart updateCart(@NonNull @NonNull UpdateCartRequest updateCartRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartOperationService
      Updates the provided Cart based on the provided UpdateCartRequest.

      The update cart logic is the same as CartOperationService.updateCart(Cart, boolean, boolean, boolean, Map, ContextInfo) under the hood.

      Specified by:
      updateCart in interface CartOperationService
      Parameters:
      updateCartRequest - the UpdateCartRequest containing the details about the cart update
      Returns:
      synced version of the cart with the cart service
    • buildUpdateCartRequestWithCartActionAudit

      protected UpdateCartRequest buildUpdateCartRequestWithCartActionAudit(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart)
      Builds an UpdateCartRequest with a CartActionAudit if the given account Cart was modified by an account approver.
      Parameters:
      cart - the Cart to update
      Returns:
      an UpdateCartRequest with a CartActionAudit if the given account Cart was modified by an account approver.
    • buildCartActionAuditForApproverCartUpdate

      protected com.broadleafcommerce.cart.client.domain.CartActionAudit buildCartActionAuditForApproverCartUpdate(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart)
      Builds a CartActionAudit for cart modification if the given Cart was modified by an account approver.
      Parameters:
      cart - the account Cart that was modified
    • buildCartActionAuditForAccountCartUpdate

      protected com.broadleafcommerce.cart.client.domain.CartActionAudit buildCartActionAuditForAccountCartUpdate(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, String actionType, String userType)
      Builds a CartActionAudit for cart modification if the given Cart was modified by an account member.
      Parameters:
      cart - the account Cart that was modified
      actionType - An action type
      userType - A user type
    • updateCartStatus

      @Deprecated(since="2.1.0", forRemoval=true) public com.broadleafcommerce.cart.client.domain.Cart updateCartStatus(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull UpdateCartStatusRequest request, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: CartOperationService
      Updates the cart's status.
      Specified by:
      updateCartStatus in interface CartOperationService
      Parameters:
      cart - The cart to update
      request - The status request with the status to update to, see DefaultCartStatuses.
      contextInfo - Additional multitenant and sandbox info
      Returns:
      The updated cart.
    • updateCartStatus

      public com.broadleafcommerce.cart.client.domain.Cart updateCartStatus(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull UpdateCartStatusRequest request, @Nullable com.broadleafcommerce.order.common.domain.CustomerRef customer, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartOperationService
      Updates the cart's status.
      Specified by:
      updateCartStatus in interface CartOperationService
      Parameters:
      cart - The cart to update
      request - The status request with the status to update to, see DefaultCartStatuses
      customer - The CustomerRef representing the currently authenticated user
      contextInfo - Additional multitenant and sandbox info
      Returns:
      The updated cart.
    • updateAsNamedCart

      public com.broadleafcommerce.cart.client.domain.Cart updateAsNamedCart(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull String name, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartOperationService
      Updates the provided Cart with the given name. This method is often used when transferring or creating new carts for a registered customer who already has an implicit/default cart.

      Prior to 1.8.0, named carts are represented by the DefaultCartStatuses.NAMED. After 1.8.0, named carts simply mean a cart with a name. Named carts are different from the implicit/default cart, implicit/default cart are DefaultCartStatuses.IN_PROCESS with null name, and there can be only one per user.

      Specified by:
      updateAsNamedCart in interface CartOperationService
      Parameters:
      cart - the cart to update
      name - the name for the cart
      contextInfo - the context info
      Returns:
      the newly named cart
    • addItemToCart

      public com.broadleafcommerce.cart.client.domain.Cart addItemToCart(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull AddItemRequest addItemRequest, boolean price, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartOperationService
      Adds a single item to the provided Cart based on the provided AddItemRequest.
      Specified by:
      addItemToCart in interface CartOperationService
      Parameters:
      cart - the cart
      addItemRequest - the request to add an item
      price - whether or not to re-price the cart
      contextInfo - the context info
      Returns:
      the cart with item added
    • updateItemInCart

      public com.broadleafcommerce.cart.client.domain.Cart updateItemInCart(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull UpdateItemRequest updateItemRequest, boolean price, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartOperationService
      Updates a single item in the provided Cart based on the provided UpdateItemRequest.
      Specified by:
      updateItemInCart in interface CartOperationService
      Parameters:
      cart - the cart
      updateItemRequest - the request to update an item
      price - whether or not to re-price the cart
      contextInfo - the context info
      Returns:
      the cart with item updated
    • identifyCatalogItemForCartItem

      protected Optional<? extends CatalogItem> identifyCatalogItemForCartItem(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull @NonNull CatalogItemList<? extends CatalogItem> catalogItemList)
      Attempts to identify the CartItem's related CatalogItem from the provided CatalogItemList.

      By default, this identifies the catalog item by the product ID.

      Parameters:
      cartItem - The CartItem whose CatalogItem we're attempting to find.
      catalogItemList - The CatalogItemList that we expect to contain the CartItem's CatalogItem.
      Returns:
      the CartItem's related CatalogItem.
    • removeStaleCartItem

      protected com.broadleafcommerce.cart.client.domain.Cart removeStaleCartItem(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.cart.client.domain.CartItem cartItem, boolean price, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • removeItemFromCart

      public com.broadleafcommerce.cart.client.domain.Cart removeItemFromCart(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull String cartItemId, boolean price, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartOperationService
      Removes a single item from the provided Cart matching the provided cart item ID.
      Specified by:
      removeItemFromCart in interface CartOperationService
      Parameters:
      cart - the cart
      cartItemId - the cart item ID
      price - whether or not to re-price the cart
      contextInfo - the context info
      Returns:
      the cart without the provided item
    • addManyItemsToCart

      public BulkAddToCartResponse addManyItemsToCart(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull Collection<AddItemRequest> addItemRequests, boolean price, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartOperationService
      Adds one or more items to the provided Cart.
      Specified by:
      addManyItemsToCart in interface CartOperationService
      Parameters:
      cart - the cart
      addItemRequests - the add item requests
      price - whether or not to re-price the cart
      contextInfo - the context info
      Returns:
      a response with the cart and any item failures
    • removeManyItemsFromCart

      public com.broadleafcommerce.cart.client.domain.Cart removeManyItemsFromCart(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, Collection<String> cartItemIds, boolean price, boolean updateCart, Map<String,String> paymentLockTokens, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartOperationService
      Removes one or more items from the provided Cart matching the provided cart item IDs.
      Specified by:
      removeManyItemsFromCart in interface CartOperationService
      Parameters:
      cart - the cart
      cartItemIds - the cart item IDs
      price - whether or not to re-price the cart
      updateCart - whether or not to update Cart pricing and save the cart after the removal
      paymentLockTokens - Tokens that grant this service access to act upon the payment. The presence of these tokens indicates that this execution flow owns the lock.
      contextInfo - the context info
      Returns:
      the cart without the provided item
    • validateCartItemsCanBeRemoved

      protected void validateCartItemsCanBeRemoved(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull Collection<String> cartItemIdsBeingRemoved, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Validates whether the cart items can be removed from the cart.
      Parameters:
      cart - the Cart the items are being removed from
      cartItemIdsBeingRemoved - the list of CartItem.getId() being removed from cart
      contextInfo - the contextInfo for the request
    • validateItemsRemovalForCustomQuoteItems

      protected void validateItemsRemovalForCustomQuoteItems(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull Collection<String> cartItemIdsBeingRemoved, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Validates whether all the remaining CartItems would be DefaultCartItemTypes.CUSTOM_QUOTE_ITEM after items removal if QuoteProperties.customQuoteItemsCanExistWithoutStandardItems(ContextInfo) is set to false.
      Parameters:
      cart - the Cart the items are being removed from
      cartItemIdsBeingRemoved - the list of CartItem.getId() being removed from cart
      contextInfo - the contextInfo for the request
    • isItemElegibleForRemoval

      protected boolean isItemElegibleForRemoval(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem)
      Hook point to prevent removal of cart items that should not be removed through the cart management endpoints. By default, we prevent COD fees from being removed.
      Parameters:
      cartItem - the cart item to be removed
      Returns:
      true, if the cart item can be removed
    • processFreeGiftItemsForRemoval

      protected void processFreeGiftItemsForRemoval(com.broadleafcommerce.cart.client.domain.Cart cart, List<com.broadleafcommerce.cart.client.domain.CartItem> cartItemsBeingRemoved)
      Processes free gift items whenever CartItems are being removed.
      Parameters:
      cart - the Cart the items are being removed from
      cartItemsBeingRemoved - the list of CartItems being removed from cart
    • addRemovedFreeGiftOfferToIgnoreList

      protected void addRemovedFreeGiftOfferToIgnoreList(com.broadleafcommerce.cart.client.domain.Cart cart, List<com.broadleafcommerce.cart.client.domain.CartItem> cartItemsBeingRemoved)
      Adds the offer id to Cart's ignore list in Cart.getInternalAttributes() whenever a free gift item is removed, so that the free gift item will not be added again.
      Parameters:
      cart - the Cart to add the offer id ignore list to
      cartItemsBeingRemoved - the list of CartItems being removed from cart
      See Also:
    • removeAssociatedFreeGiftItems

      protected void removeAssociatedFreeGiftItems(com.broadleafcommerce.cart.client.domain.Cart cart, List<com.broadleafcommerce.cart.client.domain.CartItem> cartItemsBeingRemoved)
      Removes the associated free gift item if the offer qualifier item is removed.
      Parameters:
      cart - the Cart to remove the free gift item from
      cartItemsBeingRemoved - the list of CartItems being removed from cart
    • addOfferCodeToCart

      public AddCodeToCartResponse addOfferCodeToCart(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull AddCodeRequest addOfferCodeRequest, boolean price, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartOperationService
      Adds an offer code to the provided Cart.
      1. Determine if the code is valid as a campaign tracking code
      2. If so, add it to the cart as a CampaignRef
      3. Determine if the code is valid as a shared code
      4. If so, add it to the cart
      Specified by:
      addOfferCodeToCart in interface CartOperationService
      Parameters:
      cart - the cart
      addOfferCodeRequest - the add offer code request
      price - whether or not to re-price the cart
      contextInfo - the context info
      Returns:
      An AddCodeToCartResponse describing the results of adding the offer code to the cart
    • buildAddCodeToCartResponse

      protected AddCodeToCartResponse buildAddCodeToCartResponse(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull String code, boolean cartWasRepriced)
      Builds an AddCodeToCartResponse based on the provided cart, code, & whether or not the cart was repriced
      Parameters:
      cart - The updated Cart, including the code and applicable adjustments (discounts).
      code - The offer code that was added to the cart
      cartWasRepriced - Whether or not the cart was repriced after the code was added
      Returns:
      An AddCodeToCartResponse describing the results of adding the offer code to the cart
    • getRelatedAdjustments

      protected List<com.broadleafcommerce.order.common.domain.Adjustment> getRelatedAdjustments(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull String code)
    • getRelatedVouchers

      protected List<com.broadleafcommerce.order.common.domain.Voucher> getRelatedVouchers(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull String code)
    • removeOfferCodeFromCart

      public com.broadleafcommerce.cart.client.domain.Cart removeOfferCodeFromCart(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull String offerCode, boolean price, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartOperationService
      Removes an offer code from the provided Cart, if it exists.
      1. Determine if the code exists as a tracking code on the cart
      2. If so, remove the corresponding CampaignRef
      3. Determine if the offer code exists on the cart
      4. If so, remove it
      Specified by:
      removeOfferCodeFromCart in interface CartOperationService
      Parameters:
      cart - cart cart
      offerCode - the offer code to remove
      price - whether or not to re-price the cart
      contextInfo - the context info
      Returns:
      the cart without the offer code
    • removeOfferAndCampaignCodesFromCart

      public com.broadleafcommerce.cart.client.domain.Cart removeOfferAndCampaignCodesFromCart(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, List<String> codes, boolean allowPriceCart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartOperationService
      Removes the provided offer and campaign codes from the cart and then updates the cart.
      Specified by:
      removeOfferAndCampaignCodesFromCart in interface CartOperationService
      Parameters:
      cart - The id of the cart on which to perform the operation.
      codes - The codes to remove from the cart.
      allowPriceCart - Whether to allow the cart to be priced after updating
      contextInfo - Context information around sandbox and multitenant state.
      Returns:
      The cart with the codes removed.
    • addAttributeToCart

      public com.broadleafcommerce.cart.client.domain.Cart addAttributeToCart(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull AddAttributeRequest addAttributeRequest, boolean price, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartOperationService
      Adds an attribute to the provided Cart.
      Specified by:
      addAttributeToCart in interface CartOperationService
      Parameters:
      cart - the cart
      addAttributeRequest - the add attribute request
      price - whether to allow the cart to be priced after updating
      contextInfo - the context info
      Returns:
      the cart with the attribute added
    • removeAttributeFromCart

      public com.broadleafcommerce.cart.client.domain.Cart removeAttributeFromCart(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull String key, boolean price, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartOperationService
      Removes an attribute to the provided Cart.
      Specified by:
      removeAttributeFromCart in interface CartOperationService
      Parameters:
      cart - the cart
      key - the attribute key
      price - whether to allow the cart to be priced after updating
      contextInfo - the context info
      Returns:
      the cart without the attribute
    • updateContactInfoInCart

      public com.broadleafcommerce.cart.client.domain.Cart updateContactInfoInCart(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull ContactInfoRequest contactInfoRequest, boolean price, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartOperationService
      Updates the contact info for the provided Cart.
      Specified by:
      updateContactInfoInCart in interface CartOperationService
      Parameters:
      cart - the cart
      contactInfoRequest - the contact info request
      price - whether to allow the cart to be priced after updating
      contextInfo - the context info
      Returns:
      the cart with contact info updated
    • bulkUpdateFulfillmentGroupsInCart

      public com.broadleafcommerce.cart.client.domain.Cart bulkUpdateFulfillmentGroupsInCart(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull List<UpdateFulfillmentGroupRequest> updateFulfillmentGroupsRequests, boolean price, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartOperationService
      Updates an existing FulfillmentGroups for the provided Cart.
      Specified by:
      bulkUpdateFulfillmentGroupsInCart in interface CartOperationService
      Parameters:
      cart - the cart
      updateFulfillmentGroupsRequests - the fulfillment group update requests
      price - whether to allow the cart to be priced after updating
      contextInfo - the context info
      Returns:
      the cart with an updated fulfillment group
    • updateFulfillmentGroup

      protected void updateFulfillmentGroup(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup fgToUpdate, @NonNull @NonNull UpdateFulfillmentGroupRequest updateFulfillmentGroupRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • priceCart

      public com.broadleafcommerce.cart.client.domain.Cart priceCart(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable PriceCartRequest priceCartRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartOperationService
      Prices and saves the cart with the provided PriceCartRequest.
      Specified by:
      priceCart in interface CartOperationService
      Parameters:
      cart - the cart
      priceCartRequest - the price cart request
      contextInfo - the context info
      Returns:
      the priced cart
    • priceCart

      public com.broadleafcommerce.cart.client.domain.Cart priceCart(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable PriceCartRequest priceCartRequest, boolean saveCart, Map<String,String> paymentLockTokens, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartOperationService
      Prices cart, processes free gift offers, and saves cart with the provided PriceCartRequest if saveCart is true.
      Specified by:
      priceCart in interface CartOperationService
      Parameters:
      cart - the cart
      priceCartRequest - the price cart request
      saveCart - determines whether to save cart after pricing
      paymentLockTokens - Tokens that grant this service access to act upon the payment. The presence of these tokens indicates that this execution flow owns the lock.
      contextInfo - the context info
      Returns:
      the priced cart
    • reallocateCartTotalAmongstPayments

      public List<PaymentSummary> reallocateCartTotalAmongstPayments(@NonNull @NonNull javax.money.MonetaryAmount newCartTotal, @NonNull @NonNull List<PaymentSummary> paymentSummaries, @NonNull @NonNull Map<String,String> paymentLockTokens, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartOperationService
      Reallocate the cart total among the cart's payments
      Specified by:
      reallocateCartTotalAmongstPayments in interface CartOperationService
      paymentLockTokens - Tokens that grant this service access to act upon the payment. The presence of these tokens indicates that this execution flow owns the lock.
      contextInfo - the context info
    • canUpdatePaymentAmount

      protected boolean canUpdatePaymentAmount(@NonNull @NonNull PaymentSummary paymentSummary)
      This method checks if the payment amount can be changed.
      Returns:
      false if the payment is a single use payment, and it has successfully authorized amount, or it is awaiting 3DS or external interaction result. Otherwise returns true.
    • isPaymentReallocationRequired

      protected boolean isPaymentReallocationRequired(@Nullable javax.money.MonetaryAmount previousCartTotal, @Nullable javax.money.MonetaryAmount newCartTotal)
    • reallocateCartTotalAmongstPayments

      protected void reallocateCartTotalAmongstPayments(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull javax.money.MonetaryAmount newCartTotal, @NonNull @NonNull Map<String,String> paymentLockTokens, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • allocateCartTotalToPayment

      protected PaymentSummary allocateCartTotalToPayment(@NonNull @NonNull PaymentSummary paymentSummary, @NonNull @NonNull javax.money.MonetaryAmount cartTotal, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Hook point to automatically reallocate the cart total to the cart's single payment. Note: if a payment makes use of a single-use token and a successful transaction has already been executed, then the amount cannot be changed. In that case, the payment will need to be redefined.
      Parameters:
      paymentSummary - A summary of the cart's single payment
      cartTotal - The total price of the cart
      contextInfo - the contextInfo for the request
    • allocateCartTotalToPayment

      protected PaymentSummary allocateCartTotalToPayment(@NonNull @NonNull PaymentSummary paymentSummary, @NonNull @NonNull javax.money.MonetaryAmount cartTotal, @Nullable String lockToken, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Hook point to automatically reallocate the cart total to the cart's single payment. Note: if a payment makes use of a single-use token and a successful transaction has already been executed, then the amount cannot be changed. In that case, the payment will need to be redefined.
      Parameters:
      paymentSummary - A summary of the cart's single payment
      cartTotal - The total price of the cart
      lockToken - the token that owns the payment lock
      contextInfo - the contextInfo for the request
    • reallocateCartTotalMultiplePayments

      protected List<PaymentSummary> reallocateCartTotalMultiplePayments(@NonNull @NonNull javax.money.MonetaryAmount cartTotal, @NonNull @NonNull List<PaymentSummary> paymentSummaries, @Nullable Map<String,String> paymentLockTokens, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Hook point to automatically reallocate the cart total amongst the cart's payments. Note: if a payment makes use of a single-use token and a successful transaction has already been executed, then the amount cannot be changed. In that case, the payment will need to be redefined.
      Parameters:
      paymentSummaries - Summaries of the cart's payments
      cartTotal - The total price of the cart
      paymentLockTokens - Tokens that grant this service access to act upon the payment. The presence of these tokens indicates that this execution flow owns the lock.
      contextInfo - the contextInfo for the request
      Returns:
      an updated list of PaymentSummaries
    • priceCartWithCatalogPriceUpdates

      public com.broadleafcommerce.cart.client.domain.Cart priceCartWithCatalogPriceUpdates(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartOperationService
      Reprice the cart, including applying the latest catalog-based prices for each of its items
      Specified by:
      priceCartWithCatalogPriceUpdates in interface CartOperationService
      Parameters:
      cart - The cart on which to perform the operation.
      contextInfo - the context info
      Returns:
      the priced cart
    • recalculateTaxesForCart

      public com.broadleafcommerce.cart.client.domain.Cart recalculateTaxesForCart(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, boolean estimated, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartOperationService
      Recalculates the taxes for the provided Cart.
      Specified by:
      recalculateTaxesForCart in interface CartOperationService
      Parameters:
      cart - the cart
      estimated - hint as to whether taxes should be estimated
      contextInfo - the context info
      Returns:
      the cart with taxes updated
    • recalculateTaxesForCart

      @Deprecated public com.broadleafcommerce.cart.client.domain.Cart recalculateTaxesForCart(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, boolean estimated, boolean actual, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Deprecated.
      Description copied from interface: CartOperationService
      Recalculates the taxes for the provided Cart.
      Specified by:
      recalculateTaxesForCart in interface CartOperationService
      Parameters:
      cart - the cart
      estimated - whether to calculate estimated taxes
      actual - whether to calculate actual taxes
      contextInfo - the context info
      Returns:
      the cart with taxes updated
      See Also:
    • getCurrencyUnit

      protected javax.money.CurrencyUnit getCurrencyUnit(@Nullable javax.money.CurrencySupplier currencySupplier, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Call utility method to determine currency.
      Parameters:
      currencySupplier - An object implementing the CurrencySupplier interface
      contextInfo - the context info to look for currency
      Returns:
      the currency to be used for the request
    • saveCart

      protected com.broadleafcommerce.cart.client.domain.Cart saveCart(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Helper method to encapsulate saving an existing Cart.
      Parameters:
      cart - the cart
      contextInfo - the context info
      Returns:
      the saved cart
    • saveCart

      protected com.broadleafcommerce.cart.client.domain.Cart saveCart(@NonNull @NonNull UpdateCartRequest updateCartRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Helper method to encapsulate saving an existing Cart.
      Parameters:
      updateCartRequest - the UpdateCartRequest
      contextInfo - the context info
      Returns:
      the saved cart
    • removeFulfillmentItemsWithoutCartItems

      @Deprecated(since="2.1.0", forRemoval=true) protected com.broadleafcommerce.cart.client.domain.Cart removeFulfillmentItemsWithoutCartItems(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • createEmptyCart

      protected com.broadleafcommerce.cart.client.domain.Cart createEmptyCart(@Nullable com.broadleafcommerce.order.common.domain.CustomerRef customer, @Nullable javax.money.CurrencyUnit currencyUnit, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, @Nullable CartCreationRequest cartCreationRequest)
      Creates and returns an empty, unsaved Cart with typical defaults.
      Parameters:
      customer - the customer
      currencyUnit - the currency for the cart
      contextInfo - the context info
      cartCreationRequest - API request with info for creating a new cart
      Returns:
      the new empty cart
    • createEmptyCart

      protected com.broadleafcommerce.cart.client.domain.Cart createEmptyCart(@Nullable com.broadleafcommerce.order.common.domain.CustomerRef customer, @Nullable javax.money.CurrencyUnit currencyUnit, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Creates and returns an empty, unsaved Cart with typical defaults.
      Parameters:
      customer - the customer
      currencyUnit - the currency for the cart
      contextInfo - the context info
      Returns:
      the new empty cart
    • defaultCartLocale

      protected void defaultCartLocale(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • defaultCartCurrency

      protected void defaultCartCurrency(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable javax.money.CurrencyUnit currencyUnit)
    • newCart

      protected com.broadleafcommerce.cart.client.domain.Cart newCart()
      Uses the TypeFactory to create a new Cart object.
      Returns:
      the new cart
    • newCartPricing

      protected com.broadleafcommerce.cart.client.domain.CartPricing newCartPricing()
      Uses the TypeFactory to create a new CartPricing object.
      Returns:
      the new cart pricing
    • newCartCreationRequest

      protected CartCreationRequest newCartCreationRequest()
    • newCartStatus

      @Deprecated protected String newCartStatus(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Determines what status should be used when creating new carts.
      Parameters:
      contextInfo - the context info
      Returns:
      the status to be used for a new cart
    • newCartStatus

      protected String newCartStatus(@Nullable String cartType, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Determines what status should be used when creating new carts.
      Parameters:
      cartType - The Cart.getType().
      contextInfo - the context info
      Returns:
      the status to be used for a new cart
    • newBulkAddToCartResponse

      protected BulkAddToCartResponse newBulkAddToCartResponse()
      Instantiates a new BulkAddToCartResponse using the TypeFactory.
      Returns:
      a new bulk add to cart response
    • createItemAndAddToCart

      protected com.broadleafcommerce.cart.client.domain.Cart createItemAndAddToCart(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull AddItemRequest addItemRequest, @Nullable javax.money.CurrencyUnit currencyUnit, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Creates a new item and adds it to the provided Cart.
      Parameters:
      cart - the cart
      addItemRequest - the add item request
      currencyUnit - the currency for the item(s)
      contextInfo - the context info
    • doSoftInventoryReservationIfNecessary

      protected void doSoftInventoryReservationIfNecessary(com.broadleafcommerce.cart.client.domain.Cart cart, List<com.broadleafcommerce.cart.client.domain.CartItem> cartItems, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      If any of the supplied cart items have a reservation strategy of ADD_TO_CART, a soft reservation is performed.
      Parameters:
      cart - The cart
      cartItems - The cart items to check
    • releaseSoftInventoryReservationIfNecessary

      protected void releaseSoftInventoryReservationIfNecessary(com.broadleafcommerce.cart.client.domain.Cart cart, List<com.broadleafcommerce.cart.client.domain.CartItem> cartItemsBeingRemoved, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Releases soft inventory reservations for the removed cart items if any of them have InventoryReservationStrategy.ADD_TO_CART.
      Parameters:
      cart - the cart containing the cart items being removed
      cartItemsBeingRemoved - the cart items being removed
      contextInfo - context information around sandbox and multitenant state
    • createItemsAndAddToCart

      protected BulkAddToCartResponse createItemsAndAddToCart(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, Collection<AddItemRequest> addItemRequests, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Creates new items and adds them to the provided Cart.
      Parameters:
      cart - the cart
      addItemRequests - the add item request
      contextInfo - the context info
    • createItemsAndAddToCart

      protected com.broadleafcommerce.cart.client.domain.Cart createItemsAndAddToCart(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull List<AddItemRequest> addItemRequests, @NonNull @NonNull BulkAddToCartResponse bulkAddToCartResponse, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Create and add the items from the given AddItemRequests to the given Cart.
      Parameters:
      cart - the Cart to add the items to
      addItemRequests - the AddItemRequests to create the items for
      bulkAddToCartResponse - the BulkAddToCartResponse to add the responses to
      contextInfo - the contextInfo for the request
      Returns:
      the updated Cart with the added items
    • identifyCatalogItemsForUpdateItemRequest

      @Deprecated(forRemoval=true) protected CatalogItemList<? extends CatalogItem> identifyCatalogItemsForUpdateItemRequest(@NonNull @NonNull UpdateItemRequest updateItemRequest, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • identifyCatalogItemsForUpdateItemRequest

      protected CatalogItemList<? extends CatalogItem> identifyCatalogItemsForUpdateItemRequest(@NonNull @NonNull UpdateItemRequest updateItemRequest, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @Nullable com.broadleafcommerce.pricing.client.domain.context.PriceContext priceContext, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • buildCatalogItemRequestsForUpdate

      protected Collection<CatalogItemRequest> buildCatalogItemRequestsForUpdate(@NonNull @NonNull Collection<UpdateItemRequest> updateItemRequests, @NonNull @NonNull Collection<com.broadleafcommerce.cart.client.domain.CartItem> cartItems, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • catalogItemRequestAlreadyExist

      protected boolean catalogItemRequestAlreadyExist(@NonNull @NonNull Set<CatalogItemRequest> catalogItemRequests, @NonNull @NonNull UpdateItemRequest updateItemRequest, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Hook point to prevent duplicate CatalogItemRequests from being built based on the CartItem and UpdateItemRequest.

      By default, we filter on the product ID.

      Parameters:
      catalogItemRequests - the list of requests to pass to the CatalogProvider
      updateItemRequest - the UpdateItemRequest containing the details for the update
      cartItem - the CartItem to build the CatalogItemRequest
      contextInfo - context information around sandbox and multitenant state
      Returns:
      true if building a new CatalogItemRequest would be a duplicate of an existing request in catalogItemRequests
    • buildCatalogItemRequest

      protected CatalogItemRequest buildCatalogItemRequest(@NonNull @NonNull UpdateItemRequest updateItemRequest, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Hook point to build the CatalogItemRequest and populate any additional attributes that should be passed to the CatalogProvider when fetching the catalog representation for updating the cart item.
      Parameters:
      updateItemRequest - the UpdateItemRequest containing the details for the update
      cartItem - the CartItem being updated
      contextInfo - context information around sandbox and multitenant state
      Returns:
      the populated CatalogItemRequest for the UpdateItemRequest
    • addUnassignedItemsToFulfillmentGroup

      protected com.broadleafcommerce.cart.client.domain.Cart addUnassignedItemsToFulfillmentGroup(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart)
      Identify CartItems that have not been assigned to a FulfillmentGroup & add them to the relevant FulfillmentGroup.

      If the fulfillment type is FulfillmentType.VIRTUAL, CartOperationServiceProperties.getDefaultVirtualFulfillmentOptionName() will be used to identify the default fulfillment option.

      Parameters:
      cart - The cart whose items may need to be assigned to a fulfillment group
      Returns:
      The updated cart whose items are all assigned to fulfillment groups
    • updateCartAttributes

      protected com.broadleafcommerce.cart.client.domain.Cart updateCartAttributes(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull List<AddItemRequest> successfulAddItemRequests)
      Update cart attributes based on the successful AddItemRequests
      Parameters:
      cart - The cart that was added to
      successfulAddItemRequests - List of AddItemRequests that were successfully processed
      Returns:
      The updated cart
    • updateFulfillmentItem

      protected void updateFulfillmentItem(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem)
      Updates the FulfillmentItem corresponding to the CartItem, keeping them in sync.
      Parameters:
      cart - Cart to which the items belong
      cartItem - CartItem with updates to be carried over to a FulfillmentItem
    • calculateMerchandiseTotalAmountForFulfillmentItemUpdate

      protected javax.money.MonetaryAmount calculateMerchandiseTotalAmountForFulfillmentItemUpdate(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem fulfillmentCartItem, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.FulfillmentItem fulfillmentItem, int totalQuantity)
      Calculates the FulfillmentItem.getMerchandiseTotalAmount() for the cart item. The totalQuantity divided by the item.getQuantity() is used to calculate the total amount for the fulfillment item when we have a bundle product with a dependent item whose quantity is greater than one. Take for example the below scenario:
      • bundle item quantity = 3
      • bundle price = $9.99
      • dependent item price = $15
      • dependent item quantity = 4
      In this case, the prorated dependent items price will be $9.99 (the bundle price is prorated to the dependent items) and the fulfillment item quantity will be 3 * 4 = 12. The fulfillment total will be $9.99 * (12 / 4) = $29,97, that is equal to $9.99 * 3 = 29,97.
      Parameters:
      cart - Cart to which the items belong
      fulfillmentCartItem - the CartItem which has been updated
      fulfillmentItem - the FulfillmentItem which we are trying to price
      totalQuantity - the total quantity of the dependent item
      Returns:
      the merchandise total for the FulfillmentItem
    • addCampaignCodeIfExistsOnCart

      @Deprecated protected boolean addCampaignCodeIfExistsOnCart(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull String code, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Deprecated.
      Deprecated as of 1.8, if using OfferService 2.0, this method is not used
    • addCampaignForCodeIfExists

      @Deprecated protected boolean addCampaignForCodeIfExists(String code, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Deprecated.
      Deprecated as of 1.8, if using OfferService 2.0, this method is not used
      Adds a code to the Cart if it belongs to a campaign.
      Parameters:
      code - Code to be added that might match a campaign.
      cart - Cart to add the code to.
      contextInfo - the context info
      Returns:
      The CampaignRef.getCampaignTrackingId() for the added campaign.
    • populateCartItemUpdates

      protected boolean populateCartItemUpdates(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull @NonNull UpdateItemRequest request)
      Takes the changes from the UpdateItemRequest and populates them onto the CartItem.
      Parameters:
      cartItem - The CartItem to be updated with changes from request
      request - The UpdateItemRequest with changes for cartItem
      Returns:
      Whether cartItem should be revalidated after updates are populated.
    • populateCartUpdatesFromUpdateItemRequest

      protected boolean populateCartUpdatesFromUpdateItemRequest(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull UpdateItemRequest request)
      Takes the changes from the UpdateItemRequest and populates them onto the Cart.
      Parameters:
      cart - The Cart to be updated with changes from request
      request - The UpdateItemRequest with changes for cart
      Returns:
      Whether CartItem referenced in request should be revalidated after updates are populated.
    • validateCartItemBeforeUpdate

      protected void validateCartItemBeforeUpdate(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull @NonNull UpdateItemRequest updateItemRequest)
      Validates the CartItem being updated against UpdateItemRequest before the actual cart item update.

      By default, the CartItem being updated is only being validated against free gift requirements.

      Parameters:
      cartItem - the CartItem being updated
      updateItemRequest - the UpdateItemRequest containing the details for the update
    • validateFreeGiftItemForUpdate

      protected void validateFreeGiftItemForUpdate(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull @NonNull UpdateItemRequest updateItemRequest)
      If the given CartItem is a free gift item, validates that its quantity is not being changed.

      By default, the quantity of a free gift item can only be changed by the system. This is because free gift items have their own specific behaviors, and the details of free gift items should only be modified by the system internally.

      Parameters:
      cartItem - the CartItem to validate
      updateItemRequest - the UpdateItemRequest containing the details for the update
    • validateCartItemAfterUpdate

      protected void validateCartItemAfterUpdate(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull @NonNull CatalogItemList<? extends CatalogItem> catalogItemList, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • invalidateFulfillmentGroupOverride

      protected void invalidateFulfillmentGroupOverride(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem)
    • addOfferCodeIfUsable

      protected boolean addOfferCodeIfUsable(String code, boolean isForCampaign, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Adds the code to Cart.getOfferCodes() if it's usable.
      Parameters:
      code - The code to be added
      cart - The cart to add the code to
      Returns:
      Whether the code was added.
      Throws:
      AddCodeException - if the code cannot be added for any reason. This is usually because the code is invalid or has already been used the maximum number of times. Note that if the code matched a CampaignRef, then no exception is thrown here even if the code is not usable for the purpose of adding an OfferRef because it was still usable in a general sense to add the campaign. AddCodeException.getReasonType() will typically match the code's CodeUsabilityInfo.getCodeUsabilityType() and can be used on the frontend to determine messaging.
    • buildCampaignRef

      @Deprecated protected com.broadleafcommerce.order.common.domain.CampaignRef buildCampaignRef(String code, String trackingId)
      Deprecated.
      Deprecated as of 1.8, if using OfferService 2.0, this method is not used
    • doesCartContainCampaignForCode

      @Deprecated protected final boolean doesCartContainCampaignForCode(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, String code)
      Deprecated.
      Determines whether the Cart contains a CampaignRef that matches the code.
      Parameters:
      cart - Cart with campaigns to match against
      code - Code to match with
      Returns:
      Whether the cart contains a campaign for the code
    • getMessage

      protected String getMessage(@NonNull @NonNull String errorMessage, @Nullable Object... args)
    • getFulfillmentGroupById

      protected Supplier<com.broadleafcommerce.cart.client.domain.FulfillmentGroup> getFulfillmentGroupById(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, String fulfillmentGroupId)
      Gets the fulfillment group by the provided ID. By default this will be the owning Cart's ID and the index of the group in Cart.getFulfillmentGroups(). You can simply provide the index for the fulfillment group to perform the operation.

      Example: Cart has id "12345", so the first fulfillment group has id "12345-0". If you want to find the fulfillment group, you can provide "0" to this method along with the cart to get it.

      Parameters:
      cart - The cart on which to find the fulfillment group
      fulfillmentGroupId - The ID for the fulfillment group to find. Usually defaults to the index of the group in Cart.getFulfillmentGroups().
      Returns:
      The corresponding FulfillmentGroup for the given cart and relative number.
    • getRequiredCartItem

      protected com.broadleafcommerce.cart.client.domain.CartItem getRequiredCartItem(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull String cartItemId)
      Gets a cart item from the cart by its ID. Throws an error if the item could not be found.
      Parameters:
      cart - the cart to search the items of
      cartItemId - the item ID to look for
      Returns:
      the item with the given cart ID
      Throws:
      com.broadleafcommerce.data.tracking.core.exception.EntityMissingException - when no item with the ID exists in the cart
    • buildCartItem

      protected com.broadleafcommerce.cart.client.domain.CartItem buildCartItem(@NonNull @NonNull AddItemRequest addItemRequest, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable javax.money.CurrencyUnit currencyUnit, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Populates a new cart item from the AddItemRequest. This will populate info from the CatalogProvider to ensure that all the important catalog info is present on the item and is correct. After that population, the cart item will be validated based on the product's included products and product options.
      Parameters:
      addItemRequest - Request from which to populate new CartItems.
      cart - The cart of the new CartItems
      currencyUnit - the currency for the cart item(s)
      Returns:
      Populated CartItems.
      Throws:
      CartItemValidationException - Thrown if the cart item is misconfigured based on the related product's included products and product options.
    • buildCartItems

      protected DefaultCartOperationService.BulkCartItemCreationResponse buildCartItems(@NonNull @NonNull Collection<AddItemRequest> addItemRequests, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable javax.money.CurrencyUnit currencyUnit, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Populates new cart items from the AddItemRequests. This will populate info from the CatalogProvider to ensure that all the important catalog info is present on the item and is correct. After that population, the cart item will be validated based on the product's included products and product options.
      Parameters:
      addItemRequests - Request from which to populate new CartItems.
      cart - The cart of the new CartItems
      currencyUnit - the currency for the cart items
      Returns:
      Populated CartItems.
      Throws:
      CartItemValidationException - Thrown if the cart item is misconfigured based on the related product's included products and product options.
    • buildCatalogItemRequestsForAdd

      protected Collection<CatalogItemRequest> buildCatalogItemRequestsForAdd(@NonNull @NonNull Collection<AddItemRequest> addItemRequests, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • catalogItemRequestAlreadyExist

      protected boolean catalogItemRequestAlreadyExist(@NonNull @NonNull Set<CatalogItemRequest> catalogItemRequests, @NonNull @NonNull AddItemRequest addItemRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Hook point to prevent duplicate CatalogItemRequests from being built based on the AddItemRequest.

      By default, we filter on the product ID.

      Parameters:
      catalogItemRequests - the list of requests to pass to the CatalogProvider
      addItemRequest - the AddItemRequest containing the details for the new cart item
      contextInfo - context information around sandbox and multitenant state
      Returns:
      true if building a new CatalogItemRequest would be a duplicate of an existing request in catalogItemRequests
    • buildCatalogItemRequest

      protected CatalogItemRequest buildCatalogItemRequest(@NonNull @NonNull AddItemRequest addItemRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Hook point to create the CatalogItemRequest and populate any additional attributes that should be passed to the CatalogProvider when fetching the catalog representation for adding the cart item.
      Parameters:
      addItemRequest - the AddItemRequest containing the details for the new cart item
      contextInfo - context information around sandbox and multitenant state
      Returns:
      the populated CatalogItemRequest for the AddItemRequest
    • identifyCatalogItemsForAddItemRequests

      @Deprecated(forRemoval=true) protected CatalogItemList<? extends CatalogItem> identifyCatalogItemsForAddItemRequests(@NonNull @NonNull Collection<AddItemRequest> addItemRequests, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • identifyCatalogItemsForAddItemRequests

      protected CatalogItemList<? extends CatalogItem> identifyCatalogItemsForAddItemRequests(@NonNull @NonNull Collection<AddItemRequest> addItemRequests, @Nullable com.broadleafcommerce.pricing.client.domain.context.PriceContext priceContext, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • isAllCustomQuoteItemRequests

      protected boolean isAllCustomQuoteItemRequests(@NonNull @NonNull Collection<AddItemRequest> addItemRequests)
      Determines if all the given AddItemRequests are for DefaultCartItemTypes.CUSTOM_QUOTE_ITEM.
    • identifyAddItemRequestsForCatalogItems

      protected List<AddItemRequest> identifyAddItemRequestsForCatalogItems(@NonNull @NonNull Collection<AddItemRequest> addItemRequests, @NonNull @NonNull CatalogItemList<? extends CatalogItem> catalogItemList)
      Attempts to identify the AddItemRequest's related CatalogItem from the provided CatalogItemList.

      By default, this identifies the catalog item by the product ID.

      Parameters:
      addItemRequests - The list of AddItemRequests whose CatalogItem we're attempting to find.
      catalogItemList - The CatalogItemList that we expect to contain the CartItem's CatalogItem.
      Returns:
      the CartItem's related CatalogItem.
    • identifyAddItemRequestsForCustomQuoteItems

      protected List<AddItemRequest> identifyAddItemRequestsForCustomQuoteItems(@NonNull @NonNull Collection<AddItemRequest> addItemRequests)
    • createCartItem

      protected com.broadleafcommerce.cart.client.domain.CartItem createCartItem(@NonNull @NonNull AddItemRequest addItemRequest, @Nullable javax.money.CurrencyUnit currencyUnit, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Creates a CartItem based on the provided AddItemRequest
      Parameters:
      addItemRequest - the request which contains the info to build a cart item
      currencyUnit - the currency for the cart item
      Returns:
      the newly created cart item
    • populateFromRequest

      protected com.broadleafcommerce.cart.client.domain.CartItem populateFromRequest(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull @NonNull AddItemRequest addItemRequest, @Nullable javax.money.CurrencyUnit currencyUnit, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Populates the cart item fields based on the request.
      Parameters:
      cartItem - the cart item to populate
      addItemRequest - the request which contains the info to build a cart item
      currencyUnit - the currency for the cart item
      contextInfo - the contextInfo for the request
      Returns:
      the populated cart item
    • populateCartItemFromNonCatalogItemRequest

      protected void populateCartItemFromNonCatalogItemRequest(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull @NonNull NonCatalogItemDetails nonCatalogItemDetails, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Populates the given CartItem based on the given NonCatalogItemDetails.

      Note that NonCatalogItemDetails.getPrice() is used to create an price override only if the currently authenticated user is a sales rep.

      Parameters:
      cartItem - the cart item to populate
      nonCatalogItemDetails - the dto which contains the non-catalog item details
      contextInfo - the contextInfo for the request
    • addNonCatalogItemPriceOverride

      protected void addNonCatalogItemPriceOverride(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull @NonNull NonCatalogItemDetails nonCatalogItemDetails, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Adds an price override for the given CartItem based on NonCatalogItemDetails.getPrice().
      Parameters:
      cartItem - the cart item to populate
      nonCatalogItemDetails - the dto which contains the non-catalog item details
      contextInfo - the contextInfo for the request
    • getProductType

      @Nullable protected Object getProductType(com.broadleafcommerce.cart.client.domain.CartItem cartItem)
    • updateInventorySerializationValueIfNecessary

      protected void updateInventorySerializationValueIfNecessary(com.broadleafcommerce.cart.client.domain.CartItem cartItem)
      Updates the inventory's serialization value in CartItem.getInternalAttributes() based on CartItem.getAttributeChoices().

      The value is removed from CartItem.getInternalAttributes() if it doesn't exist.

      Parameters:
      cartItem - the CartItem to populate the inventory's serialization value for
    • buildItemAttributeChoices

      protected Map<String,com.broadleafcommerce.order.common.domain.AttributeChoiceValue> buildItemAttributeChoices(@NonNull @NonNull Map<String,String> requestItemAttributeChoices)
    • validateCartItem

      protected void validateCartItem(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull CatalogItemList<? extends CatalogItem> catalogItemList, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Validates that the CartItem includes enough information to correctly represent the product or one of the product's variants.
      Parameters:
      cartItem - The CartItem that is being validated
      cart - The CartItem's owning cart
      catalogItemList - The CatalogItemList that should contain the CartItem's related CatalogItem
      contextInfo - The contextInfo for the request
    • buildValidationFailure

      protected AddItemFailure buildValidationFailure(@NonNull @NonNull AddItemRequest addItemRequest, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem)
      Builds an AddItemFailure based on the provided AddItemRequest & CartItem representing an invalid add to cart request
      Parameters:
      addItemRequest - The request that was used to build the CartItem
      cartItem - The cart item that holds the validation failures
      Returns:
      an AddItemFailure based on the provided AddItemRequest & CartItem
    • getCatalogItemKeyForMissingEntities

      protected String getCatalogItemKeyForMissingEntities(AddItemRequest addItemRequest)
      Hook point to determine what the missing entities map is keyed on from the AddItemRequest.

      By default, this is set to the product ID.

      Parameters:
      addItemRequest - the request which contains the info to build a cart item
      Returns:
      the key for the catalog item missing entities map
    • createFulfillmentGroupForItems

      protected void createFulfillmentGroupForItems(@NonNull @NonNull Collection<? extends com.broadleafcommerce.cart.client.domain.CartItem> cartItems, @NonNull @NonNull String fulfillmentType, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.cart.client.domain.CartItem parentCartItem)
    • resolveTaxAddressSource

      protected String resolveTaxAddressSource(String fulfillmentType)
      Determines the tax address source that should be used for FulfillmentGroup.getTaxAddressSource() for the given fulfillment type.
      Parameters:
      fulfillmentType - the fulfillment type from which to determine the tax address source
      Returns:
      the tax address source that should be used
    • buildGroupReferenceNumber

      protected String buildGroupReferenceNumber(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart)
      Builds a FulfillmentGroup.getReferenceNumber() for a new group.
      Parameters:
      cart - Cart that owns the group
      Returns:
      The new reference number
    • buildGroupReferenceNumber

      protected String buildGroupReferenceNumber(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, String fulfillmentGroupId)
      Builds a FulfillmentGroup.getReferenceNumber() for the given cart and group ID.
      Parameters:
      cart - Cart that owns the group
      fulfillmentGroupId - ID of the fulfillment group for which to build a reference number. Usually defaults to the index of the group in Cart.getFulfillmentGroups().
      Returns:
      The new reference number
    • addItemsToFulfillmentGroup

      protected void addItemsToFulfillmentGroup(@NonNull @NonNull Collection<? extends com.broadleafcommerce.cart.client.domain.CartItem> cartItems, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup fulfillmentGroup, @NonNull @NonNull javax.money.CurrencyUnit expectedCurrency, @Nullable com.broadleafcommerce.cart.client.domain.CartItem parentCartItem)
    • updatesForBundleFulfillmentItems

      protected void updatesForBundleFulfillmentItems(com.broadleafcommerce.cart.client.domain.CartItem parentCartItem, com.broadleafcommerce.cart.client.domain.FulfillmentItem fulfillmentItem)
    • insertItems

      protected void insertItems(com.broadleafcommerce.cart.client.domain.Cart cart, List<com.broadleafcommerce.cart.client.domain.CartItem> itemsToAdd, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • addItemToFulfillmentGroup

      protected void addItemToFulfillmentGroup(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, Set<String> assignedCartItemIds, @Nullable com.broadleafcommerce.cart.client.domain.CartItem parentCartItem)
      Assigns the cart item and its dependent cart items to the fulfillment group. If the fulfillment group doesn't exist it will be created. This method doesn't create the fulfillment item for the DefaultProductType.BUNDLE items.
      Parameters:
      cart - the cart whose items may need to be assigned to a fulfillment group
      cartItem - the cart item for which to create add the fulfillment item
      assignedCartItemIds - the set of the cart item ids for which the fulfillment item is already exists
      parentCartItem - the parent cart item for the specified cart item. Usually, this is the item that has the dependent cart items
    • addCustomQuoteItemToFulfillmentGroup

      protected void addCustomQuoteItemToFulfillmentGroup(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, Set<String> assignedCartItemIds)
      A hook point to assign the custom quote item to the fulfillment group if needed.

      By default, it does nothing.

      Parameters:
      cart - the cart whose items may need to be assigned to a fulfillment group
      cartItem - the custom quote item to add
      assignedCartItemIds - the set of the cart item ids for which the fulfillment item is already exists
    • resolveDefaultFulfillmentType

      @Nullable protected String resolveDefaultFulfillmentType(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem)
      Determines the default FulfillmentType for the provided CartItem
      Parameters:
      cartItem - The cart item whose default fulfillment type must be determined
      Returns:
      The default fulfillment type for the provided cart item
    • removeItemsFromFulfillmentGroup

      protected void removeItemsFromFulfillmentGroup(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, List<com.broadleafcommerce.cart.client.domain.CartItem> cartItems)
    • getCartItemIdsWithDependentItem

      protected Map<String,com.broadleafcommerce.cart.client.domain.CartItem> getCartItemIdsWithDependentItem(List<com.broadleafcommerce.cart.client.domain.CartItem> cartItems)
    • resetFulfillmentGroupReferenceNumbers

      @Deprecated(since="2.1.0", forRemoval=true) protected void resetFulfillmentGroupReferenceNumbers(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • repriceCartIfPricingIsStale

      protected Optional<com.broadleafcommerce.cart.client.domain.Cart> repriceCartIfPricingIsStale(Optional<com.broadleafcommerce.cart.client.domain.Cart> optionalCart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Called during cart resolution to check if the catalog prices on the cart are stale, and if so, updates those prices and resets the time since they were last changed. Also sets the values for `staleCartPricingResultHolder` for checkout validation.
      Parameters:
      optionalCart - Cart to be checked and priced
      contextInfo - The contextInfo for the request
      Returns:
    • shouldRepriceCartIfPricingStale

      protected boolean shouldRepriceCartIfPricingStale(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Decides whether a cart should be repriced in case it's prices are stale. For example, if the cart is submitted, then prices should be considered finalized & the stale repricing logic should not be engaged.
      Parameters:
      cart - Cart with info to be checked
      contextInfo - The contextInfo for the request
      Returns:
      whether a cart should be repriced if the pricing is stale
    • getCartTotalChangeMessage

      protected String getCartTotalChangeMessage(javax.money.MonetaryAmount latestCartPrice)
    • createCartAlert

      protected com.broadleafcommerce.cart.client.domain.CartAlert createCartAlert(String message)
    • retrieveInProcessCartByCustomerIdAndApplicationId

      public Optional<com.broadleafcommerce.cart.client.domain.Cart> retrieveInProcessCartByCustomerIdAndApplicationId(@NonNull @NonNull String customerId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartOperationService
      Retrieve the in-process cart for the provided customer.
      Specified by:
      retrieveInProcessCartByCustomerIdAndApplicationId in interface CartOperationService
      Parameters:
      customerId - The id of the customer for which to perform the operation.
      contextInfo - Context information around sandbox and multitenant state.
      Returns:
      The in-process cart for the provided customer.
    • retrieveInProcessCartByCartId

      public Optional<com.broadleafcommerce.cart.client.domain.Cart> retrieveInProcessCartByCartId(@NonNull @NonNull String cartId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartOperationService
      Retrieve the cart for the provided id, as long as it is in-process.
      Specified by:
      retrieveInProcessCartByCartId in interface CartOperationService
      Parameters:
      cartId - The id of the cart on which to perform the operation.
      contextInfo - Context information around sandbox and multitenant state.
      Returns:
      The in-process cart for the provided id.
    • retrieveCsrCartByCartId

      public Optional<com.broadleafcommerce.cart.client.domain.Cart> retrieveCsrCartByCartId(@NonNull @NonNull String cartId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartOperationService
      Retrieve the cart for the provided id, as long as it is CSR-owned.
      Specified by:
      retrieveCsrCartByCartId in interface CartOperationService
      Parameters:
      cartId - The id of the cart on which to perform the operation.
      contextInfo - Context information around sandbox and multitenant state.
      Returns:
      The CSR-owned cart for the provided id.
    • retrieveTestCartByCartId

      public Optional<com.broadleafcommerce.cart.client.domain.Cart> retrieveTestCartByCartId(@NonNull @NonNull String cartId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartOperationService
      Retrieve the cart for the provided id, as long as it is a test cart.
      Specified by:
      retrieveTestCartByCartId in interface CartOperationService
      Parameters:
      cartId - The id of the cart on which to perform the operation.
      contextInfo - Context information around sandbox and multitenant state.
      Returns:
      The test cart for the provided id.
    • retrieveCartByCartIdWithStatus

      protected Optional<com.broadleafcommerce.cart.client.domain.Cart> retrieveCartByCartIdWithStatus(@NonNull @NonNull String cartId, com.broadleafcommerce.cart.client.domain.enums.CartStatus status, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • retrieveCsrOwnedCartByCustomerIdAndApplicationId

      public Optional<com.broadleafcommerce.cart.client.domain.Cart> retrieveCsrOwnedCartByCustomerIdAndApplicationId(@NonNull @NonNull String customerId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartOperationService
      Retrieve the CSR-owned cart for the provided customer.
      Specified by:
      retrieveCsrOwnedCartByCustomerIdAndApplicationId in interface CartOperationService
      Parameters:
      customerId - The id of the customer for which to perform the operation.
      contextInfo - Context information around sandbox and multitenant state.
      Returns:
      The CSR-owned cart for the provided customer.
    • addToCart

      public com.broadleafcommerce.cart.client.domain.Cart addToCart(@NonNull @NonNull AddItemRequest addItemRequest, @Nullable com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.order.common.domain.CustomerRef customerRef, boolean allowPriceCart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartOperationService
      Add an item to the customer's current cart based on the provided untrusted information. By default, this includes the following steps:
      1. Retrieve catalog information for the item
      2. Check inventory
      3. Create item and add it to the cart (un-priced)
      4. Price the item and cart, using offers and price lists (optional)
      5. Update the cart and it's items (optional)
      Specified by:
      addToCart in interface CartOperationService
      Parameters:
      addItemRequest - Add an item to the customer's current cart based on the provided untrusted information.
      cart - The cart to be added to. If not provided, then a new cart will be produced.
      customerRef - The cart's owning customer. Can be null if anonymous.
      allowPriceCart - Whether to allow the cart to be priced after updating
      contextInfo - Context information around sandbox and multitenant state.
      Returns:
      The cart with the item added.
    • bulkAddToCart

      public BulkAddToCartResponse bulkAddToCart(@NonNull @NonNull Collection<AddItemRequest> addItemRequests, @Nullable com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.order.common.domain.CustomerRef customerRef, boolean allowPriceCart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartOperationService
      Add a list of items to the customer's current cart based on the provided untrusted information. By default, this includes the following steps:
      1. Retrieve catalog information for the items
      2. Check inventory
      3. Create item and add it to the cart (un-priced)
      4. Price the item and cart, using offers and price lists (optional)
      5. Update the cart and it's items (optional)
      Specified by:
      bulkAddToCart in interface CartOperationService
      Parameters:
      addItemRequests - Add a list of items to the customer's current cart based on the provided untrusted information.
      cart - The id of the cart to be added to. If not provided, then a new cart will be produced.
      customerRef - The cart's owning customer. Can be null if anonymous.
      allowPriceCart - Whether the cart should be priced after updating
      contextInfo - Context information around sandbox and multitenant state.
      Returns:
      The cart with the items added.
    • updateCartItem

      public com.broadleafcommerce.cart.client.domain.Cart updateCartItem(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull UpdateItemRequest updateItemRequest, boolean allowPriceCart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartOperationService
      Update the cart item.
      Specified by:
      updateCartItem in interface CartOperationService
      Parameters:
      cart - The id of the cart on which to perform the operation.
      updateItemRequest - The cart item to use to update the details of the current cart item.
      allowPriceCart - Whether to allow the cart to be priced after updating
      contextInfo - Context information around sandbox and multitenant state.
      Returns:
      The cart with the updated item.
    • removeCartItems

      public com.broadleafcommerce.cart.client.domain.Cart removeCartItems(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, Collection<String> cartItemIds, boolean allowPriceCart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartOperationService
      Remove items from the cart.
      Specified by:
      removeCartItems in interface CartOperationService
      Parameters:
      cart - The id of the cart on which to perform the operation.
      cartItemIds - The ids of the cart items on which to perform the operation.
      allowPriceCart - Whether to allow the cart to be priced after updating
      contextInfo - Context information around sandbox and multitenant state.
      Returns:
      The cart with the item removed.
    • updateCartContactInfo

      public com.broadleafcommerce.cart.client.domain.Cart updateCartContactInfo(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull ContactInfoRequest contactInfoRequest, boolean allowPriceCart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartOperationService
      Update contact information to allow business users to contact the customer if needed.
      Specified by:
      updateCartContactInfo in interface CartOperationService
      Parameters:
      cart - The cart that hold the contact info.
      contactInfoRequest - The contact info that is to be added to the cart.
      allowPriceCart - Whether to allow the cart to be priced after updating
      contextInfo - Context information around sandbox and multitenant state.
      Returns:
      The cart with updated contact info.
    • addCodeToCart

      public AddCodeToCartResponse addCodeToCart(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull AddCodeRequest codeRequest, boolean allowPriceCart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartOperationService
      1. Retrieve the cart
      2. Determine if the code is valid as a campaign tracking code
      3. If so, add it to the cart as a CampaignRef
      4. Determine if the code is valid as a shared code
      5. If so, add it to the cart
      6. Update the cart
      7. Price the cart, using offers and price lists (optional)
      8. Update the cart and its items (optional)
      Specified by:
      addCodeToCart in interface CartOperationService
      Parameters:
      cart - The id of the cart on which to perform the operation.
      codeRequest - The payload of the request to add a code to the cart.
      allowPriceCart - Whether to allow the cart to be priced after updating
      contextInfo - Context information around sandbox and multitenant state.
      Returns:
      An AddCodeToCartResponse describing the results of adding the offer code to the cart
    • updateFulfillmentGroup

      public com.broadleafcommerce.cart.client.domain.Cart updateFulfillmentGroup(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, String fulfillmentGroupId, @NonNull @NonNull UpdateFulfillmentGroupRequest fulfillmentGroupRequest, boolean allowPriceCart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartOperationService
      Update the fulfillment group.
      Specified by:
      updateFulfillmentGroup in interface CartOperationService
      Parameters:
      cart - The id of the cart on which to perform the operation.
      fulfillmentGroupId - The id of the fulfillment group on which to perform the operation.
      fulfillmentGroupRequest - The fulfillment group updates to be applied to the existing fulfillment group.
      allowPriceCart - Whether to allow the cart to be priced after updating
      contextInfo - Context information around sandbox and multitenant state.
      Returns:
      The Cart for which the updated fulfillment group is a part.
    • releasePaymentFinalizationLock

      public com.broadleafcommerce.cart.client.domain.Cart releasePaymentFinalizationLock(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: CartOperationService
      For carts in the DefaultCartStatuses.AWAITING_PAYMENT_FINALIZATION status, this method updates the cart status to DefaultCartStatuses.IN_PROCESS allowing the customer to once again edit the cart. Additionally, it should make the cart's related entities, like the cart's payments, editable once again.
      Specified by:
      releasePaymentFinalizationLock in interface CartOperationService
      Parameters:
      cart - the cart to be unlocked
      contextInfo - Context information around sandbox and multitenant state
      Returns:
      the unlocked cart
    • releasePaymentFinalizationLockIfExpired

      protected Optional<com.broadleafcommerce.cart.client.domain.Cart> releasePaymentFinalizationLockIfExpired(Optional<com.broadleafcommerce.cart.client.domain.Cart> optionalCart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • paymentFinalizationLockIsExpired

      protected boolean paymentFinalizationLockIsExpired(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • getMostRecentPaymentFinalizationTimestamp

      @Nullable protected Instant getMostRecentPaymentFinalizationTimestamp(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • getPaymentFinalizationTimestamps

      protected Map<String,String> getPaymentFinalizationTimestamps(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart)
    • hasPaymentFinalizationLock

      protected boolean hasPaymentFinalizationLock(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart)
    • processPaymentsForReleasedPaymentFinalizationLock

      protected void processPaymentsForReleasedPaymentFinalizationLock(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull LockPaymentsResponse lockPaymentsResponse, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • unlockCartPayments

      protected void unlockCartPayments(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull Map<String,String> paymentLockTokens, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Sends a request to PaymentTransactionServices to unlock the cart's payments, based on the lock tokens that were previously obtained via PaymentProvider.lockAndRetrieveCartPayments(Cart, ContextInfo).
      Parameters:
      cart - The cart whose payments are being unlocked
      paymentLockTokens - Map of PaymentSummary ids to lock tokens
      contextInfo - The context of the user's request
    • validateCartStatusChangeRequest

      protected void validateCartStatusChangeRequest(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull UpdateCartStatusRequest request, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Takes a UpdateCartStatusRequest and validates that the targeted cart can have its status changed. By default, the only valid statuses that can be changed are DefaultCartStatuses.IN_PROCESS, DefaultCartStatuses.REJECTED, and DefaultCartStatuses.REQUIRES_APPROVAL.
      Parameters:
      cart - The cart to be changed
      request - The request with the details of how to change the cart status
      contextInfo - Additional sandbox and multitenant info
    • isUsingCollectOnDelivery

      protected boolean isUsingCollectOnDelivery(@Nullable com.broadleafcommerce.cart.client.domain.FulfillmentGroup fulfillmentGroup)
    • hasDeselectedCOD

      protected boolean hasDeselectedCOD(@Nullable com.broadleafcommerce.cart.client.domain.FulfillmentGroup fulfillmentGroup)
    • handleCODStatusChange

      protected boolean handleCODStatusChange(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable Map<String,String> paymentLockTokens, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, @Nullable com.broadleafcommerce.cart.client.domain.FulfillmentGroup fulfillmentGroup)
      Handles when Collect on Delivery is selected or de-selected. This will validate updates as to the cart as well that may cause Collect on Delivery to become invalid based on the cart price, fulfillment option, etc. If COD was de-selected, this will archive COD payments and remove Fee cart items related to COD.
      Parameters:
      cart - Cart to be updated
      paymentLockTokens - Lock tokens to lock payment if needing to archive any when COD is de-selected
      contextInfo - Additional sandbox or multitenant info
      fulfillmentGroup - The fulfillment group marked as using COD
      Returns:
      Whether one or more CartItems were added representing a COD fee if selected or whether such items were removed because COD was de-selected.
      Throws:
      CODPaymentMethodNotApplicableException - When COD is selected but the update to be performed on the cart would invalidate its usage. This allows the user to change be alerted and change their mind before losing COD.
    • handleDeSelectCODBeforeUpdate

      protected boolean handleDeSelectCODBeforeUpdate(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup fulfillmentGroup, @Nullable Map<String,String> paymentLockTokens, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Handles when Collect on Delivery is selected or de-selected. This will validate updates as to the cart as well that may cause Collect on Delivery to become invalid based on the cart price, fulfillment option, etc.
      Parameters:
      cart - Cart to be updated
      fulfillmentGroup - The fulfillment group marked as using COD
      paymentLockTokens - Lock tokens to lock payment if needing to archive any when COD is de-selected
      contextInfo - Additional sandbox or multitenant info
      Returns:
      Whether one or more CartItems representing a COD fee were removed.
    • handleSelectCODBeforeUpdate

      protected boolean handleSelectCODBeforeUpdate(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup fulfillmentGroup, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Handles when Collect on Delivery is selected. This will validate updates as to the cart as well that may cause Collect on Delivery to become invalid based on the cart price, fulfillment option, etc.
      Parameters:
      cart - Cart to be updated
      fulfillmentGroup - The fulfillment group marked as using COD
      contextInfo - Additional sandbox or multitenant info
      Returns:
      Whether a new CartItem was added representing a COD fee.
      Throws:
      CODPaymentMethodNotApplicableException - When COD is selected but the update to be performed on the cart would invalidate its usage. This allows the user to change be alerted and change their mind before losing COD.
    • getCODCheckoutPaymentMethodOption

      protected CheckoutPaymentMethodOption getCODCheckoutPaymentMethodOption(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • validateCollectOnDeliverySelection

      protected void validateCollectOnDeliverySelection(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • validateCollectOnDeliverySelection

      protected void validateCollectOnDeliverySelection(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup fulfillmentGroup, @NonNull @NonNull CheckoutPaymentMethodOption codCheckoutPaymentMethodOption, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Validates that Collect on Delivery is still applicable given the updated cart state.
      Parameters:
      cart - Cart to be updated
      fulfillmentGroup - Fulfillment group marked as using COD
      codCheckoutPaymentMethodOption - COD CheckoutPaymentMethodOption
      contextInfo - Additional multitenant or sandbox info.
      Throws:
      CODPaymentMethodNotApplicableException - When COD is no longer valid for the requested updates to the cart.
    • doFulfillmentExclusionsPassForCOD

      protected boolean doFulfillmentExclusionsPassForCOD(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup fulfillmentGroup, @NonNull @NonNull CheckoutPaymentMethodOption codCheckoutPaymentMethodOption)
    • doFulfillmentInclusionsPassForCOD

      protected boolean doFulfillmentInclusionsPassForCOD(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup fulfillmentGroup, @NonNull @NonNull CheckoutPaymentMethodOption codCheckoutPaymentMethodOption)
    • isCartMaxTotalAllowedForCOD

      protected boolean isCartMaxTotalAllowedForCOD(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull CheckoutPaymentMethodOption codCheckoutPaymentMethodOption)
    • isCartMinTotalAllowedForCOD

      protected boolean isCartMinTotalAllowedForCOD(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull CheckoutPaymentMethodOption codCheckoutPaymentMethodOption)
    • buildCODFeeCartItem

      protected com.broadleafcommerce.cart.client.domain.CartItem buildCODFeeCartItem(CheckoutPaymentMethodOption.FeeDto fee)
    • isCartItemCODFee

      protected boolean isCartItemCODFee(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem)
    • handleSetDeselectedCODAttribute

      protected void handleSetDeselectedCODAttribute(@NonNull @NonNull UpdateFulfillmentGroupRequest updateFulfillmentGroupRequest, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup fgToUpdate)
      Sets a temporary attribute on the fullfillment group if the COD status attribute has gone from selected to not selected. This informs the update logic later on that related payments should be archived and fee cart items for COD should be removed.
      Parameters:
      updateFulfillmentGroupRequest - Request to update a fulfillment group
      fgToUpdate - Fulfillment group to update
    • getPriceContext

      @Nullable protected com.broadleafcommerce.pricing.client.domain.context.PriceContext getPriceContext(@Nullable Locale locale, @Nullable javax.money.CurrencyUnit currency)
    • getProviders

      protected CartOperationServiceProviders getProviders()
    • getCartPricingService

      protected CartPricingService getCartPricingService()
    • getCartItemConfigurationService

      protected CartItemConfigurationService<? extends CatalogItem> getCartItemConfigurationService()
    • getCartItemCatalogInformationService

      protected CartItemCatalogInformationService<? extends CatalogItem> getCartItemCatalogInformationService()
    • getAuthenticationUtils

      protected com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils getAuthenticationUtils()
    • getTypeFactory

      protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
    • getProperties

      protected CartOperationServiceProperties getProperties()
    • getCartItemMergingService

      protected CartItemMergingService<com.broadleafcommerce.cart.client.domain.CartItem> getCartItemMergingService()
    • getMessageSource

      protected org.springframework.context.MessageSource getMessageSource()
    • getTaxService

      protected TaxService getTaxService()
    • getStaleCartPricingResultHolder

      protected StaleCartPricingResultHolder getStaleCartPricingResultHolder()
    • getOfferUtils

      protected CartOperationServiceOfferUtils getOfferUtils()
    • setOfferUtils

      @Autowired public void setOfferUtils(CartOperationServiceOfferUtils offerUtils)
    • getStaleCartItemsService

      protected StaleCartItemsService getStaleCartItemsService()
    • setStaleCartItemsService

      @Autowired public void setStaleCartItemsService(StaleCartItemsService staleCartItemsService)
    • getPaymentProvider

      protected PaymentProvider<PaymentSummary> getPaymentProvider()
    • setPaymentProvider

      @Autowired public void setPaymentProvider(PaymentProvider<PaymentSummary> paymentProvider)
    • getCheckoutPaymentMethodService

      protected CheckoutPaymentMethodService getCheckoutPaymentMethodService()
    • setCheckoutPaymentMethodService

      @Autowired public void setCheckoutPaymentMethodService(CheckoutPaymentMethodService checkoutPaymentMethodService)
    • getSpelRuleEvaluationService

      protected com.broadleafcommerce.rulesengine.expression.service.SpelRuleEvaluationService getSpelRuleEvaluationService()
    • setSpelRuleEvaluationService

      @Autowired public void setSpelRuleEvaluationService(com.broadleafcommerce.rulesengine.expression.service.SpelRuleEvaluationService spelRuleEvaluationService)
    • setInventoryAvailabilityService

      @Autowired public void setInventoryAvailabilityService(InventoryAvailabilityService<CatalogItem> inventoryAvailabilityService)
    • getInventoryAvailabilityService

      protected InventoryAvailabilityService<CatalogItem> getInventoryAvailabilityService()
    • setQuoteAuthUtils

      @Autowired public void setQuoteAuthUtils(QuoteAuthUtils quoteAuthUtils)
    • getQuoteAuthUtils

      protected QuoteAuthUtils getQuoteAuthUtils()
    • setQuoteProperties

      @Autowired public void setQuoteProperties(com.broadleafcommerce.cart.client.properties.QuoteProperties quoteProperties)
    • getQuoteProperties

      protected com.broadleafcommerce.cart.client.properties.QuoteProperties getQuoteProperties()
    • setCartUtils

      @Autowired public void setCartUtils(CartUtils cartUtils)
    • getCartUtils

      protected CartUtils getCartUtils()
    • setCartStatusManager

      @Autowired @Lazy public void setCartStatusManager(CartStatusManager cartStatusManager)
    • getCartStatusManager

      protected CartStatusManager getCartStatusManager()
    • setExternalPaymentTransactionProperties

      @Autowired(required=false) public void setExternalPaymentTransactionProperties(@Nullable ExternalPaymentTransactionProperties externalPaymentTransactionProperties)
    • getExternalPaymentTransactionProperties

      @Nullable protected ExternalPaymentTransactionProperties getExternalPaymentTransactionProperties()
    • getObjectMapper

      protected com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
    • setObjectMapper

      @Autowired public void setObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)