Class DefaultFulfillmentSplitRoundingService

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      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 FulfillmentOperationHelper getHelper()  
      protected SplitRoundingHelper getRoundingHelper()  
      protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()  
      protected boolean hasTaxDetails​(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments)  
      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 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 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.
    • Constructor Detail

      • DefaultFulfillmentSplitRoundingService

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

      • 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
      • 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
      • 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)
      • getTypeFactory

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