Class DefaultFulfillmentSplitRoundingService
java.lang.Object
com.broadleafcommerce.orderoperation.service.split.DefaultFulfillmentSplitRoundingService
- All Implemented Interfaces:
FulfillmentSplitRoundingService
public class DefaultFulfillmentSplitRoundingService
extends Object
implements FulfillmentSplitRoundingService
-
Constructor Summary
ConstructorDescriptionDefaultFulfillmentSplitRoundingService
(FulfillmentOperationHelper helper, SplitRoundingHelper roundingHelper, com.broadleafcommerce.common.extension.TypeFactory typeFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
alignSplitFulfillmentItems
(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments) AlignsOrderFulfillment.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) AlignsOrderFulfillmentItem.taxDetails
so that the same tax details in each fulfillment item are all at the same index.protected FulfillmentOperationHelper
protected SplitRoundingHelper
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 givenOrderFulfillmentItems
based on the amount getter and setter.void
performRounding
(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments) Rounds any partial amounts split between the givenOrderFulfillments
.protected void
removeNullFulfillmentItems
(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments) Removes any nullOrderFulfillment.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 nullOrderFulfillmentItem.taxDetails
which were added to match tax details not present in certain items duringalignSplitFulfillmentItemTaxDetails(List)
.protected void
roundFulfillmentAdjustments
(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments, List<javax.money.MonetaryAmount> adjustmentSubtotals) Round the amounts in theOrderFulfillment.adjustments
on all the split fulfillments.protected void
roundGrandTotal
(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments) Rounds theOrderFulfillment.grandTotal
on all of the split fulfillments.protected void
roundGrandTotalParts
(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments) Round the amounts which comprise theOrderFulfillment.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 theOrderFulfillmentItem.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.protected void
roundItemMerchandiseTax
(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments) Round all the items'OrderFulfillmentItem#merchandiseTotalTax
andOrderFulfillmentItem.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 theOrderFulfillmentItem.merchandiseTotal
on both theleftover
andsplit
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 theleftover
andsplit
fulfillments.protected void
roundItemPaymentDistributionDetails
(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments) Round all the items'OrderFulfillmentItem#merchandiseTotalTax
andOrderFulfillmentItem.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 theOrderFulfillment.merchandiseTotal
on all the split fulfillments.protected void
roundTotalFulfillmentPriceParts
(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments) Round the amounts which comprise theOrderFulfillment#totalFulfillmentPrice
on all of the split fulfillments.
-
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 givenOrderFulfillments
.- Specified by:
performRounding
in interfaceFulfillmentSplitRoundingService
- 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 givenOrderFulfillmentItems
based on the amount getter and setter.- Specified by:
performIndividualItemRounding
in interfaceFulfillmentSplitRoundingService
- Parameters:
orderFulfillmentItems
- theOrderFulfillmentItems
to roundgetter
- the getter for theMonetaryAmount
field to roundsetter
- the setter for theMonetaryAmount
field to roundoriginalTotal
- the original total
-
alignSplitFulfillmentItemTaxDetails
protected void alignSplitFulfillmentItemTaxDetails(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments) AlignsOrderFulfillmentItem.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 anull
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) AlignsOrderFulfillment.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 anull
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 nullOrderFulfillment.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 nullOrderFulfillmentItem.taxDetails
which were added to match tax details not present in certain items duringalignSplitFulfillmentItemTaxDetails(List)
.- Parameters:
fulfillments
- the fulfillments which were split
-
roundGrandTotal
protected void roundGrandTotal(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments) Rounds theOrderFulfillment.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 theOrderFulfillment.grandTotal
on all of the split fulfillments. This includesOrderFulfillment#totalFulfillmentPrice
,OrderFulfillment#totalTax
, and all of the items'OrderFulfillmentItem#merchandiseTotalAmount
andOrderFulfillmentItem.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 theOrderFulfillment#totalFulfillmentPrice
on all of the split fulfillments. This includes theOrderFulfillment.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 splititemFulfillmentSubtotals
- 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 theOrderFulfillmentItem.fulfillmentTotal
on all of the split fulfillment items.- Parameters:
splitItems
- the split parts of an item which was split between fulfillmentsoriginalFulfillment
- 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 theOrderFulfillment.adjustments
on all the split fulfillments.- Parameters:
fulfillments
- the fulfillments which were splitadjustmentSubtotals
- 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 theOrderFulfillment.merchandiseTotal
on all the split fulfillments. This includes the all of the items'OrderFulfillmentItem.merchandiseTotal
andOrderFulfillmentItem.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 theleftover
andsplit
fulfillments. This includes the all of the items'OrderFulfillmentItem.merchandiseTotal
.- Parameters:
fulfillments
- the fulfillments which were splitmerchandiseSubtotals
- 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 theOrderFulfillmentItem.merchandiseTotal
on both theleftover
andsplit
items. This includes the item'sOrderFulfillmentItem.merchandiseSubtotal
andOrderFulfillmentItem.merchandiseAdjustmentsTotal
.- Parameters:
splitItems
- the split parts of an item which was split between fulfillmentsoriginalFulfillment
- 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 theOrderFulfillmentItem.getMerchandiseRefundAmount()
on both theleftover
andsplit
items. This includes the item'sOrderFulfillmentItem.getMerchandiseRefundAmount()
andOrderFulfillmentItem.getMerchandiseAdjustmentsTotal()
.- Parameters:
splitItems
- the split parts of an item which was split between fulfillmentsoriginalFulfillment
- 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 splititemProratedOrderAdjustmentsSubtotals
- 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
andOrderFulfillmentItem.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
andOrderFulfillmentItem.taxDetails
on the split fulfillments.- Parameters:
fulfillments
- the fulfillments which were split
-
getHelper
-
getRoundingHelper
-
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
-
#roundFulfillmentMerchandiseRefundParts(List)
}