Class EnhancedFulfillmentGroup

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

public class EnhancedFulfillmentGroup extends Object implements com.broadleafcommerce.promotion.offer.client.web.context.FulfillmentGroup<EnhancedFulfillmentLineItem>, Serializable
See Also:
  • Field Details

    • adjustedTotal

      protected javax.money.MonetaryAmount adjustedTotal
  • Constructor Details

    • EnhancedFulfillmentGroup

      public EnhancedFulfillmentGroup()
  • Method Details

    • getMerchandiseTotal

      @Nullable public javax.money.MonetaryAmount getMerchandiseTotal()
      Return the total price of all order line items in the fulfillment group.
    • getTotal

      public javax.money.MonetaryAmount getTotal()
      Gets the total for this fulfillment group. This method returns the adjustedTotal and sets the value if it is null. Used primarily by the rules engine to check for fulfillment offers that are only valid for certain group subtotals.
    • getTotalBeforeAdjustments

      public javax.money.MonetaryAmount getTotalBeforeAdjustments()
      Gets the total before adjustments for this fulfillment group. Note that this includes individual items.
    • getTotalBeforeAdjustments

      public javax.money.MonetaryAmount getTotalBeforeAdjustments(String serviceLevel)
      Gets the total before adjustments for this fulfillment group and serviceLevel. Note that this includes individual items.
    • getAdjustmentTotal

      public javax.money.MonetaryAmount getAdjustmentTotal(javax.money.CurrencyUnit currency)
      Calculates the sum of the fulfillment group adjustments. Excludes future credits and item adjustments.
    • getTotalWithoutFutureCredits

      public javax.money.MonetaryAmount getTotalWithoutFutureCredits(javax.money.CurrencyUnit currency)
      Gets the total for this fulfillment group excluding future credits. Note that this includes individual items.
    • getTotalWithAdjustments

      public javax.money.MonetaryAmount getTotalWithAdjustments()
      Calculates the total for this fulfillment group with adjustments. This includes future credit and items.
    • getGroupPriceWithAdjustments

      public javax.money.MonetaryAmount getGroupPriceWithAdjustments()
      Calculates the total for this fulfillment group with adjustments. This includes future credit and excludes items.
    • getGroupPriceWithAdjustmentsForServiceLevel

      public javax.money.MonetaryAmount getGroupPriceWithAdjustmentsForServiceLevel(@NonNull String serviceLevel)
    • itemMatchingServiceLevel

      protected boolean itemMatchingServiceLevel(EnhancedFulfillmentLineItem item, String offerServiceLevel)
    • adjustmentMatchingServiceLevel

      protected boolean adjustmentMatchingServiceLevel(FulfillmentGroupAdjustment adjustment, String offerServiceLevel)
    • getItemsAdjustmentsValue

      public javax.money.MonetaryAmount getItemsAdjustmentsValue(javax.money.CurrencyUnit currency)
      Gets the sum of the fulfillment items total adjustments. Excludes future credits.
    • getAllFutureCreditAdjustmentValue

      public javax.money.MonetaryAmount getAllFutureCreditAdjustmentValue(javax.money.CurrencyUnit currency)
      Gets the sum of all future credit for this fulfillment group (of item and group adjustments).
    • getFulfillmentAdjustmentAmount

      public javax.money.MonetaryAmount getFulfillmentAdjustmentAmount(javax.money.CurrencyUnit currency)
      Calculates the total adjustment for this group and its items. Excludes future credits.
    • canApplyOffer

      public boolean canApplyOffer(CandidateFulfillmentGroupOffer offer)
      Whether the provided offer can be applied to this group.
      Parameters:
      offer - the offer to test
      Returns:
      whether the offer can be applied to this group
    • getAllLineItemOfferDetails

      public List<LineItemOfferDetail> getAllLineItemOfferDetails()
    • removeAllGroupOfferAdjustments

      public void removeAllGroupOfferAdjustments()
    • finalizeItemPrices

      public void finalizeItemPrices()
    • finalizeTotal

      public javax.money.MonetaryAmount finalizeTotal()
      Finalize attached adjustments and return adjusted price.
      Returns:
      The final adjusted price for this EnhancedFulfillmentGroup.
    • removeAllCandidateAdjustments

      public void removeAllCandidateAdjustments()
      Remove all of the groupAdjustments for this EnhancedFulfillmentGroup.
    • removeZeroDollarAdjustments

      protected void removeZeroDollarAdjustments()
    • isNonCombinableGroupOfferApplied

      protected boolean isNonCombinableGroupOfferApplied()
    • setAdjustedTotal

      protected void setAdjustedTotal()
    • sumOnItems

      protected javax.money.MonetaryAmount sumOnItems(javax.money.CurrencyUnit currency, Function<EnhancedFulfillmentLineItem,javax.money.MonetaryAmount> mapAttribute)
      Sums some attribute of the items of this fulfillment group.
      Parameters:
      currency - the currency of the items' values
      mapAttribute - the attribute of the item to map to
      Returns:
      the summed amount of the attributes for each of the fulfillment items
    • sumOnAdjustments

      protected javax.money.MonetaryAmount sumOnAdjustments(javax.money.CurrencyUnit currency, Function<FulfillmentGroupAdjustment,javax.money.MonetaryAmount> mapAttribute)
      Sums some attribute of the adjustments of this fulfillment group.
      Parameters:
      currency - the currency of the adjustments' values
      mapAttribute - the attribute of the adjustment to map to
      Returns:
      the summed amount of the attributes for each of the fulfillment adjustments
    • sumOnAdjustments

      protected javax.money.MonetaryAmount sumOnAdjustments(javax.money.CurrencyUnit currency, Function<FulfillmentGroupAdjustment,javax.money.MonetaryAmount> mapAttribute, Predicate<FulfillmentGroupAdjustment> filter)
      Sums some attribute of the adjustments of this fulfillment group.
      Parameters:
      currency - the currency of the adjustments' values
      mapAttribute - the attribute of the adjustment to map to
      filter - a filter for any of the adjustments
      Returns:
      the summed amount of the attributes for each of the fulfillment adjustments
    • getPriceBeforeAdjustments

      public javax.money.MonetaryAmount getPriceBeforeAdjustments()
      Return the sum of values by service level if populated; otherwise, return the value set directly
      Specified by:
      getPriceBeforeAdjustments in interface com.broadleafcommerce.promotion.offer.client.web.context.FulfillmentGroup<EnhancedFulfillmentLineItem>
      Returns:
      MonetaryAmount for the total fulfillment price or null if unset
    • getPriceBeforeAdjustmentsByServiceLevel

      public Map<String,javax.money.MonetaryAmount> getPriceBeforeAdjustmentsByServiceLevel()
      A map of fulfillment prices before any adjustments by shipping level. The sum of the elements of this MAP must match the value of getPriceBeforeAdjustments(). By default adds the deprecated getFulfillmentOptionName() as a map key and the getPriceBeforeAdjustments() as the value.
      Specified by:
      getPriceBeforeAdjustmentsByServiceLevel in interface com.broadleafcommerce.promotion.offer.client.web.context.FulfillmentGroup<EnhancedFulfillmentLineItem>
    • getId

      public String getId()
      Specified by:
      getId in interface com.broadleafcommerce.promotion.offer.client.web.context.FulfillmentGroup<EnhancedFulfillmentLineItem>
    • getFulfillmentOptionType

      public String getFulfillmentOptionType()
      Specified by:
      getFulfillmentOptionType in interface com.broadleafcommerce.promotion.offer.client.web.context.FulfillmentGroup<EnhancedFulfillmentLineItem>
    • getFulfillmentOptionName

      public String getFulfillmentOptionName()
      Specified by:
      getFulfillmentOptionName in interface com.broadleafcommerce.promotion.offer.client.web.context.FulfillmentGroup<EnhancedFulfillmentLineItem>
    • getDestination

      public com.broadleafcommerce.promotion.offer.client.web.context.Destination getDestination()
      Specified by:
      getDestination in interface com.broadleafcommerce.promotion.offer.client.web.context.FulfillmentGroup<EnhancedFulfillmentLineItem>
    • getFulfillmentItems

      public List<EnhancedFulfillmentLineItem> getFulfillmentItems()
      Specified by:
      getFulfillmentItems in interface com.broadleafcommerce.promotion.offer.client.web.context.FulfillmentGroup<EnhancedFulfillmentLineItem>
    • getPrimaryPhone

      public String getPrimaryPhone()
      Specified by:
      getPrimaryPhone in interface com.broadleafcommerce.promotion.offer.client.web.context.FulfillmentGroup<EnhancedFulfillmentLineItem>
    • getSecondaryPhone

      public String getSecondaryPhone()
      Specified by:
      getSecondaryPhone in interface com.broadleafcommerce.promotion.offer.client.web.context.FulfillmentGroup<EnhancedFulfillmentLineItem>
    • getFaxNumber

      public String getFaxNumber()
      Specified by:
      getFaxNumber in interface com.broadleafcommerce.promotion.offer.client.web.context.FulfillmentGroup<EnhancedFulfillmentLineItem>
    • getAttributes

      public Map<String,Object> getAttributes()
      Specified by:
      getAttributes in interface com.broadleafcommerce.promotion.offer.client.web.context.FulfillmentGroup<EnhancedFulfillmentLineItem>
    • getProratedFulfillmentAdjustments

      public javax.money.MonetaryAmount getProratedFulfillmentAdjustments()
      Prorated fulfillment adjustments for the fulfillment group itself.

      Fulfillment-level adjustments are prorated between the charges of the fulfullment group and those of the individual fulfullment items, the prorated fulfillment adjustments for the items are set at the item level.

      See Also:
    • getGroupAdjustments

      public List<FulfillmentGroupAdjustment> getGroupAdjustments()
    • setId

      public void setId(String id)
      Specified by:
      setId in interface com.broadleafcommerce.promotion.offer.client.web.context.FulfillmentGroup<EnhancedFulfillmentLineItem>
    • setFulfillmentOptionType

      public void setFulfillmentOptionType(String fulfillmentOptionType)
      Specified by:
      setFulfillmentOptionType in interface com.broadleafcommerce.promotion.offer.client.web.context.FulfillmentGroup<EnhancedFulfillmentLineItem>
    • setFulfillmentOptionName

      public void setFulfillmentOptionName(String fulfillmentOptionName)
      Specified by:
      setFulfillmentOptionName in interface com.broadleafcommerce.promotion.offer.client.web.context.FulfillmentGroup<EnhancedFulfillmentLineItem>
    • setDestination

      public void setDestination(com.broadleafcommerce.promotion.offer.client.web.context.Destination destination)
      Specified by:
      setDestination in interface com.broadleafcommerce.promotion.offer.client.web.context.FulfillmentGroup<EnhancedFulfillmentLineItem>
    • setFulfillmentItems

      public void setFulfillmentItems(List<EnhancedFulfillmentLineItem> fulfillmentItems)
      Specified by:
      setFulfillmentItems in interface com.broadleafcommerce.promotion.offer.client.web.context.FulfillmentGroup<EnhancedFulfillmentLineItem>
    • setPrimaryPhone

      public void setPrimaryPhone(String primaryPhone)
      Specified by:
      setPrimaryPhone in interface com.broadleafcommerce.promotion.offer.client.web.context.FulfillmentGroup<EnhancedFulfillmentLineItem>
    • setSecondaryPhone

      public void setSecondaryPhone(String secondaryPhone)
      Specified by:
      setSecondaryPhone in interface com.broadleafcommerce.promotion.offer.client.web.context.FulfillmentGroup<EnhancedFulfillmentLineItem>
    • setFaxNumber

      public void setFaxNumber(String faxNumber)
      Specified by:
      setFaxNumber in interface com.broadleafcommerce.promotion.offer.client.web.context.FulfillmentGroup<EnhancedFulfillmentLineItem>
    • setPriceBeforeAdjustments

      public void setPriceBeforeAdjustments(javax.money.MonetaryAmount priceBeforeAdjustments)
      Specified by:
      setPriceBeforeAdjustments in interface com.broadleafcommerce.promotion.offer.client.web.context.FulfillmentGroup<EnhancedFulfillmentLineItem>
    • setPriceBeforeAdjustmentsByServiceLevel

      public void setPriceBeforeAdjustmentsByServiceLevel(Map<String,javax.money.MonetaryAmount> priceBeforeAdjustmentsByServiceLevel)
    • setAttributes

      public void setAttributes(Map<String,Object> attributes)
      Specified by:
      setAttributes in interface com.broadleafcommerce.promotion.offer.client.web.context.FulfillmentGroup<EnhancedFulfillmentLineItem>
    • setProratedFulfillmentAdjustments

      public void setProratedFulfillmentAdjustments(javax.money.MonetaryAmount proratedFulfillmentAdjustments)
      Prorated fulfillment adjustments for the fulfillment group itself.

      Fulfillment-level adjustments are prorated between the charges of the fulfullment group and those of the individual fulfullment items, the prorated fulfillment adjustments for the items are set at the item level.

      See Also:
    • setGroupAdjustments

      public void setGroupAdjustments(List<FulfillmentGroupAdjustment> groupAdjustments)
    • 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