java.lang.Object
com.broadleafcommerce.promotion.offer.web.context.EnhancedOrder
All Implemented Interfaces:
com.broadleafcommerce.promotion.offer.client.web.context.Order<EnhancedOrderLineItem,EnhancedFulfillmentGroup>, Serializable

public class EnhancedOrder extends Object implements com.broadleafcommerce.promotion.offer.client.web.context.Order<EnhancedOrderLineItem,EnhancedFulfillmentGroup>, Serializable
See Also:
  • Constructor Details

    • EnhancedOrder

      public EnhancedOrder()
  • Method Details

    • getTimeOfRequest

      public Instant getTimeOfRequest()
      Specified by:
      getTimeOfRequest in interface com.broadleafcommerce.promotion.offer.client.web.context.Order<EnhancedOrderLineItem,EnhancedFulfillmentGroup>
    • getFulfillmentLineItems

      public List<EnhancedFulfillmentLineItem> getFulfillmentLineItems()
    • getSubtotalAsDouble

      public double getSubtotalAsDouble()
    • getSubtotal

      public javax.money.MonetaryAmount getSubtotal()
    • getAdjustedSubtotalWithoutFutureCredits

      public javax.money.MonetaryAmount getAdjustedSubtotalWithoutFutureCredits()
    • getLineItems

      public List<EnhancedLineItem> getLineItems(boolean isForFulfillment)
      Parameters:
      isForFulfillment - determines whether to get fulfillmentLineItems instead of orderLineItems
      Returns:
      the line items of the specified type: Fulfillment or Order
    • getLineItemOfferDetails

      public List<LineItemOfferDetail> getLineItemOfferDetails(boolean isForFulfillment)
    • getAllLineItemOfferDetails

      public List<LineItemOfferDetail> getAllLineItemOfferDetails()
    • initializeFulfillmentItems

      public void initializeFulfillmentItems(com.broadleafcommerce.common.extension.TypeFactory offerFactory)
    • buildFulfillmentLineItem

      protected void buildFulfillmentLineItem(EnhancedFulfillmentLineItem enhancedFulfillmentLineItem, EnhancedOrderLineItem orderLineItem, int remainingQty)
    • calculateRemainingQuantity

      protected int calculateRemainingQuantity(EnhancedOrderLineItem orderItem)
    • determineFulfillmentGroupForOrderItem

      protected Optional<EnhancedFulfillmentGroup> determineFulfillmentGroupForOrderItem(EnhancedOrderLineItem orderItem)
    • populateFulfillmentItemsWithOrderItems

      public void populateFulfillmentItemsWithOrderItems()
      Populate each of the order's EnhancedFulfillmentGroup.getFulfillmentItems() fulfillment group's fulfillment items} with the corresponding order's order items using EnhancedFulfillmentLineItem.getRelatedOrderLineItemNumber().
    • populateItemCurrencies

      public void populateItemCurrencies()
    • buildOrderItemHierarchies

      public void buildOrderItemHierarchies()
    • initializeOrderItemOfferDetails

      public void initializeOrderItemOfferDetails(@NonNull com.broadleafcommerce.common.extension.TypeFactory offerFactory)
    • initializeFulfillmentItemOfferDetails

      public void initializeFulfillmentItemOfferDetails(@NonNull com.broadleafcommerce.common.extension.TypeFactory offerFactory)
    • calculateSubtotalWithAdjustments

      public javax.money.MonetaryAmount calculateSubtotalWithAdjustments()
    • calculateSubtotalWithAdjustmentsForSegment

      public javax.money.MonetaryAmount calculateSubtotalWithAdjustmentsForSegment(String segment)
    • calculateSubtotalWithAdjustments

      public javax.money.MonetaryAmount calculateSubtotalWithAdjustments(boolean isForFulfillment)
    • calculateItemAdjustmentsTotal

      public javax.money.MonetaryAmount calculateItemAdjustmentsTotal(boolean isForFulfillment)
    • calculateSubtotalWithoutAdjustments

      public javax.money.MonetaryAmount calculateSubtotalWithoutAdjustments()
    • getTotalAdjustmentsValue

      public javax.money.MonetaryAmount getTotalAdjustmentsValue()
    • getTotalFulfillmentGroupAdjustments

      public javax.money.MonetaryAmount getTotalFulfillmentGroupAdjustments()
    • getTotalFulfillmentAdjustments

      public javax.money.MonetaryAmount getTotalFulfillmentAdjustments()
    • getTotalFutureCredits

      public javax.money.MonetaryAmount getTotalFutureCredits()
    • getFulfillmentGroupFutureCredits

      protected javax.money.MonetaryAmount getFulfillmentGroupFutureCredits()
    • getFinalItemAdjustmentsValue

      public javax.money.MonetaryAmount getFinalItemAdjustmentsValue(boolean isForFulfillment)
    • getItemFutureCredits

      public javax.money.MonetaryAmount getItemFutureCredits(boolean isForFulfillment)
    • calculateItemAdjustmentsValue

      public javax.money.MonetaryAmount calculateItemAdjustmentsValue(boolean isForFulfillment, boolean useSaleAdjustments)
    • setAdjustedSubtotal

      public void setAdjustedSubtotal()
    • calculateOrderAdjustmentTotal

      public javax.money.MonetaryAmount calculateOrderAdjustmentTotal()
    • calculateOrderFutureCredits

      public javax.money.MonetaryAmount calculateOrderFutureCredits()
    • isTotalitarianItemOfferApplied

      public boolean isTotalitarianItemOfferApplied()
    • isTotalitarianOrderOfferApplied

      public boolean isTotalitarianOrderOfferApplied()
    • isTotalitarianOfferApplied

      public boolean isTotalitarianOfferApplied()
      Whether any adjustment for this order or it's items is a result of a totalitarian offer, such that it's Offer.getCombinabilityType() is CombinabilityType.NONE.
      Returns:
      Whether any adjustment for this order or it's items is a result of a totalitarian offer, such that it's Offer.getCombinabilityType() is CombinabilityType.NONE.
    • finalizeOrderItemPrices

      public void finalizeOrderItemPrices()
    • addChildrenForItem

      protected void addChildrenForItem(EnhancedOrderLineItem parent, Collection<EnhancedOrderLineItem> allPotentialChildren)
    • isNonCombinableOrderOfferApplied

      protected boolean isNonCombinableOrderOfferApplied()
    • removeAllFulfillmentOfferAdjustments

      public void removeAllFulfillmentOfferAdjustments()
    • removeAllItemOfferAdjustments

      public void removeAllItemOfferAdjustments(boolean isForFulfillment)
      Remove all adjustments for all order items.
    • isRunFulfillmentAndItemOffers

      public boolean isRunFulfillmentAndItemOffers()
      Whether Offers of type DiscountTargetType.FULFILLMENT_GROUP or DiscountTargetType.FULFILLMENT_GROUP_ITEM should be run against this order's fulfillment groups and fulfillment items.
      Returns:
      Whether Offers of type DiscountTargetType.FULFILLMENT_GROUP or DiscountTargetType.FULFILLMENT_GROUP_ITEM should be run against this order's fulfillment groups and fulfillment items.
    • getAllLineItems

      public List<EnhancedLineItem> getAllLineItems()
    • getAdjustedTotalWithoutFutureCredits

      public javax.money.MonetaryAmount getAdjustedTotalWithoutFutureCredits()
      Returns the adjusted subtotal of the order by adding the adjusted subtotal with the adjusted fulfillment total.
      Returns:
      the adjusted subtotal of the order
    • getAdjustedFulfillmentTotalWithoutFutureCredits

      public javax.money.MonetaryAmount getAdjustedFulfillmentTotalWithoutFutureCredits()
    • populateLineItemsBySegment

      public void populateLineItemsBySegment()
    • getOrderLineItemsForOfferSegment

      public List<EnhancedOrderLineItem> getOrderLineItemsForOfferSegment(String segment)
    • removeCodesResponses

      public void removeCodesResponses(Offer offer)
    • removeCodesResponses

      public void removeCodesResponses(Offer offer, int timesUsed)
    • determinePossibleNumberOfCodesUsedPerOffer

      protected int determinePossibleNumberOfCodesUsedPerOffer(List<OfferCode> codeList, int timesUsed)
    • removeCodeResponse

      public void removeCodeResponse(String code)
    • updateCodesResponses

      public void updateCodesResponses(Offer offer, com.broadleafcommerce.promotion.offer.client.web.context.discounts.CodeResponse response)
    • updateCodesResponses

      public void updateCodesResponses(Offer offer, com.broadleafcommerce.promotion.offer.client.web.context.discounts.CodeResponse response, Set<String> immutableOfferCodes)
    • updateCodeResponse

      public void updateCodeResponse(String code, com.broadleafcommerce.promotion.offer.client.web.context.discounts.CodeResponse response)
    • getOrderNumber

      public String getOrderNumber()
      Specified by:
      getOrderNumber in interface com.broadleafcommerce.promotion.offer.client.web.context.Order<EnhancedOrderLineItem,EnhancedFulfillmentGroup>
    • getOrderLineItems

      public List<EnhancedOrderLineItem> getOrderLineItems()
      Specified by:
      getOrderLineItems in interface com.broadleafcommerce.promotion.offer.client.web.context.Order<EnhancedOrderLineItem,EnhancedFulfillmentGroup>
    • getFulfillmentGroups

      public List<EnhancedFulfillmentGroup> getFulfillmentGroups()
      Specified by:
      getFulfillmentGroups in interface com.broadleafcommerce.promotion.offer.client.web.context.Order<EnhancedOrderLineItem,EnhancedFulfillmentGroup>
    • getFreeGiftItems

      public List<com.broadleafcommerce.promotion.offer.client.web.context.info.FreeGiftItem> getFreeGiftItems()
    • getVouchers

      public List<com.broadleafcommerce.promotion.offer.client.web.context.info.Voucher> getVouchers()
    • getCodes

      public com.broadleafcommerce.promotion.offer.client.web.context.Codes getCodes()
      Specified by:
      getCodes in interface com.broadleafcommerce.promotion.offer.client.web.context.Order<EnhancedOrderLineItem,EnhancedFulfillmentGroup>
    • getOfferCodes

      public List<com.broadleafcommerce.promotion.offer.client.web.context.OfferCodeDto> getOfferCodes()
    • getCodeResponseMap

      public Map<String,com.broadleafcommerce.promotion.offer.client.web.context.discounts.CodeResponse> getCodeResponseMap()
      Map of codes and reasons they were not applied.
    • getSegmentLineItemsMap

      public Map<String,List<EnhancedOrderLineItem>> getSegmentLineItemsMap()
    • getSegments

      public Set<String> getSegments()
    • getOfferCodeData

      public OfferCodeData getOfferCodeData()
    • isRunOrderAndItemOffers

      public boolean isRunOrderAndItemOffers()
      Specified by:
      isRunOrderAndItemOffers in interface com.broadleafcommerce.promotion.offer.client.web.context.Order<EnhancedOrderLineItem,EnhancedFulfillmentGroup>
    • getAttributes

      public Map<String,Object> getAttributes()
      Specified by:
      getAttributes in interface com.broadleafcommerce.promotion.offer.client.web.context.Order<EnhancedOrderLineItem,EnhancedFulfillmentGroup>
    • getLocale

      public Locale getLocale()
      Specified by:
      getLocale in interface com.broadleafcommerce.promotion.offer.client.web.context.Order<EnhancedOrderLineItem,EnhancedFulfillmentGroup>
    • getCurrency

      public javax.money.CurrencyUnit getCurrency()
      Specified by:
      getCurrency in interface com.broadleafcommerce.promotion.offer.client.web.context.Order<EnhancedOrderLineItem,EnhancedFulfillmentGroup>
    • getCustomerContext

      public com.broadleafcommerce.promotion.offer.client.web.context.CustomerContext getCustomerContext()
      Specified by:
      getCustomerContext in interface com.broadleafcommerce.promotion.offer.client.web.context.Order<EnhancedOrderLineItem,EnhancedFulfillmentGroup>
    • getOrderSubmitDate

      public Instant getOrderSubmitDate()
    • getCartSubtotal

      public javax.money.MonetaryAmount getCartSubtotal()
    • getAdjustedSubtotal

      public javax.money.MonetaryAmount getAdjustedSubtotal()
    • getOrderAdjustments

      public List<OrderOfferAdjustment> getOrderAdjustments()
    • getTotalFufillmentCharges

      public javax.money.MonetaryAmount getTotalFufillmentCharges()
    • setOrderNumber

      public void setOrderNumber(String orderNumber)
      Specified by:
      setOrderNumber in interface com.broadleafcommerce.promotion.offer.client.web.context.Order<EnhancedOrderLineItem,EnhancedFulfillmentGroup>
    • setOrderLineItems

      public void setOrderLineItems(List<EnhancedOrderLineItem> orderLineItems)
      Specified by:
      setOrderLineItems in interface com.broadleafcommerce.promotion.offer.client.web.context.Order<EnhancedOrderLineItem,EnhancedFulfillmentGroup>
    • setFulfillmentGroups

      public void setFulfillmentGroups(List<EnhancedFulfillmentGroup> fulfillmentGroups)
      Specified by:
      setFulfillmentGroups in interface com.broadleafcommerce.promotion.offer.client.web.context.Order<EnhancedOrderLineItem,EnhancedFulfillmentGroup>
    • setFreeGiftItems

      public void setFreeGiftItems(List<com.broadleafcommerce.promotion.offer.client.web.context.info.FreeGiftItem> freeGiftItems)
    • setVouchers

      public void setVouchers(List<com.broadleafcommerce.promotion.offer.client.web.context.info.Voucher> vouchers)
    • setCodes

      public void setCodes(com.broadleafcommerce.promotion.offer.client.web.context.Codes codes)
      Specified by:
      setCodes in interface com.broadleafcommerce.promotion.offer.client.web.context.Order<EnhancedOrderLineItem,EnhancedFulfillmentGroup>
    • setOfferCodes

      public void setOfferCodes(List<com.broadleafcommerce.promotion.offer.client.web.context.OfferCodeDto> offerCodes)
    • setCodeResponseMap

      public void setCodeResponseMap(Map<String,com.broadleafcommerce.promotion.offer.client.web.context.discounts.CodeResponse> codeResponseMap)
      Map of codes and reasons they were not applied.
    • setSegmentLineItemsMap

      public void setSegmentLineItemsMap(Map<String,List<EnhancedOrderLineItem>> segmentLineItemsMap)
    • setSegments

      public void setSegments(Set<String> segments)
    • setOfferCodeData

      public void setOfferCodeData(OfferCodeData offerCodeData)
    • setRunOrderAndItemOffers

      public void setRunOrderAndItemOffers(boolean runOrderAndItemOffers)
      Specified by:
      setRunOrderAndItemOffers in interface com.broadleafcommerce.promotion.offer.client.web.context.Order<EnhancedOrderLineItem,EnhancedFulfillmentGroup>
    • setAttributes

      public void setAttributes(Map<String,Object> attributes)
      Specified by:
      setAttributes in interface com.broadleafcommerce.promotion.offer.client.web.context.Order<EnhancedOrderLineItem,EnhancedFulfillmentGroup>
    • setLocale

      public void setLocale(Locale locale)
      Specified by:
      setLocale in interface com.broadleafcommerce.promotion.offer.client.web.context.Order<EnhancedOrderLineItem,EnhancedFulfillmentGroup>
    • setCurrency

      public void setCurrency(javax.money.CurrencyUnit currency)
      Specified by:
      setCurrency in interface com.broadleafcommerce.promotion.offer.client.web.context.Order<EnhancedOrderLineItem,EnhancedFulfillmentGroup>
    • setCustomerContext

      public void setCustomerContext(com.broadleafcommerce.promotion.offer.client.web.context.CustomerContext customerContext)
      Specified by:
      setCustomerContext in interface com.broadleafcommerce.promotion.offer.client.web.context.Order<EnhancedOrderLineItem,EnhancedFulfillmentGroup>
    • setTimeOfRequest

      public void setTimeOfRequest(Instant timeOfRequest)
      Specified by:
      setTimeOfRequest in interface com.broadleafcommerce.promotion.offer.client.web.context.Order<EnhancedOrderLineItem,EnhancedFulfillmentGroup>
    • setOrderSubmitDate

      public void setOrderSubmitDate(Instant orderSubmitDate)
    • setCartSubtotal

      public void setCartSubtotal(javax.money.MonetaryAmount cartSubtotal)
    • setAdjustedSubtotal

      public void setAdjustedSubtotal(javax.money.MonetaryAmount adjustedSubtotal)
    • setOrderAdjustments

      public void setOrderAdjustments(List<OrderOfferAdjustment> orderAdjustments)
    • setTotalFufillmentCharges

      public void setTotalFufillmentCharges(javax.money.MonetaryAmount totalFufillmentCharges)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object