Class DefaultFulfillmentSplitRoundingService

java.lang.Object
com.broadleafcommerce.orderoperation.service.split.DefaultFulfillmentSplitRoundingService
All Implemented Interfaces:
FulfillmentSplitRoundingService

public class DefaultFulfillmentSplitRoundingService extends Object implements FulfillmentSplitRoundingService
  • Constructor Summary

    Constructors
    Constructor
    Description
    DefaultFulfillmentSplitRoundingService(FulfillmentOperationHelper helper, SplitRoundingHelper roundingHelper, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    alignSplitFulfillmentItems(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments)
    Aligns OrderFulfillment.fulfillmentItems so that the same items in each fulfillment are all at the same index.
    protected void
    alignSplitFulfillmentItemTaxDetails(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments)
    Aligns OrderFulfillmentItem.taxDetails so that the same tax details in each fulfillment item are all at the same index.
     
     
    protected com.broadleafcommerce.common.extension.TypeFactory
     
    protected boolean
    hasTaxDetails(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments)
     
    void
    performIndividualItemRounding(List<com.broadleafcommerce.order.client.domain.OrderFulfillmentItem> orderFulfillmentItems, Function<com.broadleafcommerce.order.client.domain.OrderFulfillmentItem,javax.money.MonetaryAmount> getter, BiConsumer<com.broadleafcommerce.order.client.domain.OrderFulfillmentItem,javax.money.MonetaryAmount> setter, javax.money.MonetaryAmount originalTotal)
    Rounds the amounts of the given OrderFulfillmentItems based on the amount getter and setter.
    void
    performRounding(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments)
    Rounds any partial amounts split between the given OrderFulfillments.
    protected void
    removeNullFulfillmentItems(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments)
    Removes any null OrderFulfillment.fulfillmentItems which were added to match items not present in certain fulfillments during #alignSplitFulfillmentItems(OrderFulfillment, OrderFulfillment).
    protected void
    removeNullTaxDetails(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments)
    Removes any null OrderFulfillmentItem.taxDetails which were added to match tax details not present in certain items during alignSplitFulfillmentItemTaxDetails(List).
    protected void
    roundFulfillmentAdjustments(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments, List<javax.money.MonetaryAmount> adjustmentSubtotals)
    Round the amounts in the OrderFulfillment.adjustments on all the split fulfillments.
    protected void
    roundGrandTotal(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments)
    Rounds the OrderFulfillment.grandTotal on all of the split fulfillments.
    protected void
    roundGrandTotalParts(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments)
    Round the amounts which comprise the OrderFulfillment.grandTotal on all of the split fulfillments.
    protected void
    roundItemFulfillmentAdjustments(List<com.broadleafcommerce.order.client.domain.OrderFulfillmentItem> splitItems, com.broadleafcommerce.order.client.domain.OrderFulfillment originalFulfillment)
    Round the amounts that comprise the OrderFulfillmentItem.fulfillmentTotal on all of the split fulfillment items.
    protected void
    roundItemFulfillmentTotals(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments, List<javax.money.MonetaryAmount> itemFulfillmentSubtotals)
    Round the amounts which comprise the item fulfillment subtotal on all of the split fulfillments.
    protected void
    roundItemMerchandiseRefundAmountParts(List<com.broadleafcommerce.order.client.domain.OrderFulfillmentItem> splitItems, com.broadleafcommerce.order.client.domain.OrderFulfillment originalFulfillment)
    Deprecated, for removal: This API element is subject to removal in a future version.
    In favor of {#roundFulfillmentMerchandiseRefundParts(List)}
    protected void
    roundItemMerchandiseTax(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments)
    Round all the items' OrderFulfillmentItem#merchandiseTotalTax and OrderFulfillmentItem.taxDetails on the split fulfillments.
    protected void
    roundItemMerchandiseTotalParts(List<com.broadleafcommerce.order.client.domain.OrderFulfillmentItem> splitItems, com.broadleafcommerce.order.client.domain.OrderFulfillment originalFulfillment)
    Round the amounts which comprise the OrderFulfillmentItem.merchandiseTotal on both the leftover and split items.
    protected void
    roundItemMerchandiseTotals(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments, List<javax.money.MonetaryAmount> merchandiseSubtotals)
    Round the amounts which comprise the item merchandise subtotal on both the leftover and split fulfillments.
    protected void
    roundItemPaymentDistributionDetails(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments)
    Round all the items' OrderFulfillmentItem#merchandiseTotalTax and OrderFulfillmentItem.taxDetails on the split fulfillments.
    protected void
    roundItemProratedOrderAdjustments(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments, List<javax.money.MonetaryAmount> itemProratedOrderAdjustmentsSubtotals)
    Round the amounts which comprise the total prorated order adjustments on all the split fulfillments.
    protected void
    roundItemTaxNoTaxDetails(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments)
     
    protected void
    roundItemTaxWithTaxDetails(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments)
     
    protected void
    roundMerchandiseTotalParts(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments)
    Round the amounts which comprise the OrderFulfillment.merchandiseTotal on all the split fulfillments.
    protected void
    roundTotalFulfillmentPriceParts(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments)
    Round the amounts which comprise the OrderFulfillment#totalFulfillmentPrice on all of the split fulfillments.

    Methods inherited from class java.lang.Object

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

    • DefaultFulfillmentSplitRoundingService

      public DefaultFulfillmentSplitRoundingService(FulfillmentOperationHelper helper, SplitRoundingHelper roundingHelper, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
  • Method Details

    • performRounding

      public void performRounding(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments)
      Description copied from interface: FulfillmentSplitRoundingService
      Rounds any partial amounts split between the given OrderFulfillments.
      Specified by:
      performRounding in interface FulfillmentSplitRoundingService
      Parameters:
      fulfillments - the fulfillments which were split
    • performIndividualItemRounding

      public void performIndividualItemRounding(List<com.broadleafcommerce.order.client.domain.OrderFulfillmentItem> orderFulfillmentItems, Function<com.broadleafcommerce.order.client.domain.OrderFulfillmentItem,javax.money.MonetaryAmount> getter, BiConsumer<com.broadleafcommerce.order.client.domain.OrderFulfillmentItem,javax.money.MonetaryAmount> setter, javax.money.MonetaryAmount originalTotal)
      Description copied from interface: FulfillmentSplitRoundingService
      Rounds the amounts of the given OrderFulfillmentItems based on the amount getter and setter.
      Specified by:
      performIndividualItemRounding in interface FulfillmentSplitRoundingService
      Parameters:
      orderFulfillmentItems - the OrderFulfillmentItems to round
      getter - the getter for the MonetaryAmount field to round
      setter - the setter for the MonetaryAmount field to round
      originalTotal - the original total
    • alignSplitFulfillmentItemTaxDetails

      protected void alignSplitFulfillmentItemTaxDetails(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments)
      Aligns OrderFulfillmentItem.taxDetails so that the same tax details in each fulfillment item are all at the same index. Tax details which do not exist in a certain fulfillment will be represented by a null element.

      This enables keeping track of split tax details adding up to the original tax detail total, since all split tax details will always be at the same index.

      Parameters:
      fulfillments - the fulfillments which were split
    • alignSplitFulfillmentItems

      protected void alignSplitFulfillmentItems(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments)
      Aligns OrderFulfillment.fulfillmentItems so that the same items in each fulfillment are all at the same index. Items which do not exist in a certain fulfillment will be represented by a null element.

      This enables keeping track of split items adding up to the original item total, since all split items will always be at the same index.

      Parameters:
      fulfillments - the fulfillments which were split
    • removeNullFulfillmentItems

      protected void removeNullFulfillmentItems(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments)
      Removes any null OrderFulfillment.fulfillmentItems which were added to match items not present in certain fulfillments during #alignSplitFulfillmentItems(OrderFulfillment, OrderFulfillment).
      Parameters:
      fulfillments - the fulfillments which were split
    • removeNullTaxDetails

      protected void removeNullTaxDetails(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments)
      Removes any null OrderFulfillmentItem.taxDetails which were added to match tax details not present in certain items during alignSplitFulfillmentItemTaxDetails(List).
      Parameters:
      fulfillments - the fulfillments which were split
    • roundGrandTotal

      protected void roundGrandTotal(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments)
      Rounds the OrderFulfillment.grandTotal on all of the split fulfillments.
      Parameters:
      fulfillments - the fulfillments which were split
    • roundGrandTotalParts

      protected void roundGrandTotalParts(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments)
      Round the amounts which comprise the OrderFulfillment.grandTotal on all of the split fulfillments. This includes OrderFulfillment#totalFulfillmentPrice, OrderFulfillment#totalTax, and all of the items' OrderFulfillmentItem#merchandiseTotalAmount and OrderFulfillmentItem.proratedOrderAdjustments.
      Parameters:
      fulfillments - the fulfillments which were split
    • roundTotalFulfillmentPriceParts

      protected void roundTotalFulfillmentPriceParts(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments)
      Round the amounts which comprise the OrderFulfillment#totalFulfillmentPrice on all of the split fulfillments. This includes the OrderFulfillment.fulfillmentCharge, OrderFulfillment.adjustments, and all of the items' OrderFulfillmentItem.fulfillmentTotal.
      Parameters:
      fulfillments - the fulfillments which were split
    • roundItemFulfillmentTotals

      protected void roundItemFulfillmentTotals(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments, List<javax.money.MonetaryAmount> itemFulfillmentSubtotals)
      Round the amounts which comprise the item fulfillment subtotal on all of the split fulfillments. This includes all of the items' OrderFulfillmentItem.fulfillmentTotal.
      Parameters:
      fulfillments - the fulfillments which were split
      itemFulfillmentSubtotals - the target sums for the leftover item fulfillment totals in each fulfillment
    • roundItemFulfillmentAdjustments

      protected void roundItemFulfillmentAdjustments(List<com.broadleafcommerce.order.client.domain.OrderFulfillmentItem> splitItems, com.broadleafcommerce.order.client.domain.OrderFulfillment originalFulfillment)
      Round the amounts that comprise the OrderFulfillmentItem.fulfillmentTotal on all of the split fulfillment items.
      Parameters:
      splitItems - the split parts of an item which was split between fulfillments
      originalFulfillment - the fulfillment which was split
    • roundFulfillmentAdjustments

      protected void roundFulfillmentAdjustments(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments, List<javax.money.MonetaryAmount> adjustmentSubtotals)
      Round the amounts in the OrderFulfillment.adjustments on all the split fulfillments.
      Parameters:
      fulfillments - the fulfillments which were split
      adjustmentSubtotals - the target sums for the leftover item fulfillment totals in each fulfillment
    • roundMerchandiseTotalParts

      protected void roundMerchandiseTotalParts(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments)
      Round the amounts which comprise the OrderFulfillment.merchandiseTotal on all the split fulfillments. This includes the all of the items' OrderFulfillmentItem.merchandiseTotal and OrderFulfillmentItem.proratedOrderAdjustments.
      Parameters:
      fulfillments - the fulfillments which were split
    • roundItemMerchandiseTotals

      protected void roundItemMerchandiseTotals(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments, List<javax.money.MonetaryAmount> merchandiseSubtotals)
      Round the amounts which comprise the item merchandise subtotal on both the leftover and split fulfillments. This includes the all of the items' OrderFulfillmentItem.merchandiseTotal.
      Parameters:
      fulfillments - the fulfillments which were split
      merchandiseSubtotals - the target sums for each split of the leftover item merchandise totals
    • roundItemMerchandiseTotalParts

      protected void roundItemMerchandiseTotalParts(List<com.broadleafcommerce.order.client.domain.OrderFulfillmentItem> splitItems, com.broadleafcommerce.order.client.domain.OrderFulfillment originalFulfillment)
      Round the amounts which comprise the OrderFulfillmentItem.merchandiseTotal on both the leftover and split items. This includes the item's OrderFulfillmentItem.merchandiseSubtotal and OrderFulfillmentItem.merchandiseAdjustmentsTotal.
      Parameters:
      splitItems - the split parts of an item which was split between fulfillments
      originalFulfillment - the fulfillment which was split
    • roundItemMerchandiseRefundAmountParts

      @Deprecated(since="1.7.2", forRemoval=true) protected void roundItemMerchandiseRefundAmountParts(List<com.broadleafcommerce.order.client.domain.OrderFulfillmentItem> splitItems, com.broadleafcommerce.order.client.domain.OrderFulfillment originalFulfillment)
      Deprecated, for removal: This API element is subject to removal in a future version.
      In favor of {#roundFulfillmentMerchandiseRefundParts(List)}
      Round the amounts which comprise the OrderFulfillmentItem.getMerchandiseRefundAmount() on both the leftover and split items. This includes the item's OrderFulfillmentItem.getMerchandiseRefundAmount() and OrderFulfillmentItem.getMerchandiseAdjustmentsTotal().
      Parameters:
      splitItems - the split parts of an item which was split between fulfillments
      originalFulfillment - the fulfillment which was split
    • roundItemProratedOrderAdjustments

      protected void roundItemProratedOrderAdjustments(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments, List<javax.money.MonetaryAmount> itemProratedOrderAdjustmentsSubtotals)
      Round the amounts which comprise the total prorated order adjustments on all the split fulfillments. This includes the all of the items' OrderFulfillmentItem.proratedOrderAdjustments.
      Parameters:
      fulfillments - the fulfillments which were split
      itemProratedOrderAdjustmentsSubtotals - the target sums for the leftover item prorated order adjustments for each split fulfillment
    • roundItemMerchandiseTax

      protected void roundItemMerchandiseTax(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments)
      Round all the items' OrderFulfillmentItem#merchandiseTotalTax and OrderFulfillmentItem.taxDetails on the split fulfillments.
      Parameters:
      fulfillments - the fulfillments which were split
    • roundItemTaxWithTaxDetails

      protected void roundItemTaxWithTaxDetails(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments)
    • roundItemTaxNoTaxDetails

      protected void roundItemTaxNoTaxDetails(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments)
    • hasTaxDetails

      protected boolean hasTaxDetails(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments)
    • roundItemPaymentDistributionDetails

      protected void roundItemPaymentDistributionDetails(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments)
      Round all the items' OrderFulfillmentItem#merchandiseTotalTax and OrderFulfillmentItem.taxDetails on the split fulfillments.
      Parameters:
      fulfillments - the fulfillments which were split
    • getHelper

      protected FulfillmentOperationHelper getHelper()
    • getRoundingHelper

      protected SplitRoundingHelper getRoundingHelper()
    • getTypeFactory

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