Class DefaultFulfillmentSplittingService
- All Implemented Interfaces:
FulfillmentSplittingService<com.broadleafcommerce.order.client.domain.OrderFulfillment>
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultFulfillmentSplittingService(com.broadleafcommerce.common.extension.TypeFactory typeFactory, FulfillmentSplitRoundingService roundingService, FulfillmentOperationHelper helper) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidassignOrderFulfillmentNumbers(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments, String originalFulfillmentNumber) Assigns theorderFulfillmentNumbersfor the splitfulfillments.protected <T> BiConsumer<Function<T,javax.money.MonetaryAmount>, BiConsumer<T, javax.money.MonetaryAmount>> bindAmountSplitter(List<BigDecimal> splitProportions, T original, List<T> splits) Produces aBiConsumerwhich can split a certain amount betweenoriginalandsplitwith a specific splitting proportion.protected voidcalculateAndSplitTotalFulfillmentPrices(com.broadleafcommerce.order.client.domain.OrderFulfillment original, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> splits) Calculate theOrderFulfillment#totalFulfillmentPricefor thesplitsbased on their totals, and then give the remainder from the original amount to theoriginal.protected javax.money.MonetaryAmountcalculateFulfillmentItemsTotal(com.broadleafcommerce.order.client.domain.OrderFulfillment fulfillment) protected javax.money.MonetaryAmountcalculateMerchandiseTotal(com.broadleafcommerce.order.client.domain.OrderFulfillment fulfillment) protected voidcopyTaxDetails(com.broadleafcommerce.order.client.domain.OrderFulfillmentItem originalItem, com.broadleafcommerce.order.client.domain.OrderFulfillmentItem splitItem) Copies thetax detailsfrom the original item to the new item.protected com.broadleafcommerce.order.client.domain.OrderFulfillmentcreateSplitFulfillment(com.broadleafcommerce.order.client.domain.OrderFulfillment original) Set up a new cloneOrderFulfillmentto be used for the requested part of the fulfillment to split off.protected com.broadleafcommerce.order.client.domain.OrderFulfillmentItemcreateSplitItem(com.broadleafcommerce.order.client.domain.OrderFulfillmentItem item) Set up a new cloneOrderFulfillmentItemto be used for the split quantity of the fulfillment item.protected <T> javax.money.MonetaryAmountgetAmountTotal(@NonNull List<T> objects, @NonNull Function<T, javax.money.MonetaryAmount> amountGetter, @NonNull javax.money.CurrencyUnit currency) Helper method to sum up theMonetaryAmountsfor each given object using the givenamountGetter function.protected FulfillmentOperationHelperprotected OrderOperationServiceOfferUtilsprotected List<BigDecimal>getPerFulfillmentMerchandiseSplits(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments) Determine the proportions by which per-fulfillment prices should be split.protected List<BigDecimal>getPerFulfillmentPriceSplits(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments) Determine the proportions by which per-fulfillment prices should be split.protected FulfillmentSplitRoundingServiceprotected List<javax.money.MonetaryAmount>getSplitFulfillmentIncludedTaxes(com.broadleafcommerce.order.client.domain.OrderFulfillment original, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> splits) Get the included tax for the fulfillment total of the new split fulfillments.protected List<javax.money.MonetaryAmount>getSplitFulfillmentPriceTaxes(com.broadleafcommerce.order.client.domain.OrderFulfillment original, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> splits) Get the tax just for the fulfillment prices for the new split fulfillments, not including tax on the merchandise price.protected List<com.broadleafcommerce.order.client.domain.OrderFulfillment>getSplitFulfillments(com.broadleafcommerce.order.client.domain.OrderFulfillment original, List<List<com.broadleafcommerce.order.client.domain.OrderFulfillmentItem>> splitItems) Gets a list of splitOrderFulfillmentsfrom the given list of splitOrderFulfillmentItems.protected List<javax.money.MonetaryAmount>getSplitMerchandiseIncludedTaxes(com.broadleafcommerce.order.client.domain.OrderFulfillment original, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> splits) Get the included tax for the merchandise total of the new split fulfillments.protected List<javax.money.MonetaryAmount>getSplitMerchandiseTotalTaxes(com.broadleafcommerce.order.client.domain.OrderFulfillment original, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> splits) Get the tax for the merchandise total of the new split fulfillments, not including tax on the fulfillment price.protected com.broadleafcommerce.common.extension.TypeFactoryvoidsetOfferUtils(OrderOperationServiceOfferUtils offerUtils) protected <T> voidsplitAmount(Function<T, javax.money.MonetaryAmount> getAmount, BiConsumer<T, javax.money.MonetaryAmount> setAmount, List<BigDecimal> splitProportions, T original, List<T> splits) Splits a certain amount fromoriginalbetween all of the splitoriginalandsplits.List<com.broadleafcommerce.order.client.domain.OrderFulfillment>splitFulfillment(com.broadleafcommerce.order.client.domain.OrderFulfillment original, List<Map<String, Integer>> itemQuantities) Splits the given fulfillment into multiple.splitItems(List<com.broadleafcommerce.order.client.domain.OrderFulfillmentItem> items, List<Map<String, Integer>> itemQuantities) Split the fulfillment items into two lists based on the requesteditemQuantitiesto split.protected voidsplitRequestedItem(com.broadleafcommerce.order.client.domain.OrderFulfillmentItem item, List<Integer> requestedQuantities, List<com.broadleafcommerce.order.client.domain.OrderFulfillmentItem> leftover, List<List<com.broadleafcommerce.order.client.domain.OrderFulfillmentItem>> splits, List<Map<String, String>> newItemIdsByOriginalItemIds) Split the fulfillment item quantities between the split item lists.protected voidupdateAdjustments(List<BigDecimal> splitProportions, List<com.broadleafcommerce.order.common.domain.Adjustment> original, List<List<com.broadleafcommerce.order.common.domain.Adjustment>> splits) Splits the original adjustment amounts fromoriginalbetweenoriginalandsplit, based on thesplitProportion.protected voidupdateFulfillmentAdjustmentsTotal(List<BigDecimal> splitProportions, com.broadleafcommerce.order.client.domain.OrderFulfillment original, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> splits) Handles splittingOrderFulfillment.getFulfillmentAdjustmentsTotal().protected voidupdateFulfillmentCharge(List<BigDecimal> splitProportions, com.broadleafcommerce.order.client.domain.OrderFulfillment original, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> splits) Split the originalOrderFulfillment.fulfillmentChargebetween the split fulfillments.protected voidupdateFulfillmentFulfillmentPricing(com.broadleafcommerce.order.client.domain.OrderFulfillment original, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> splits, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> allFulfillments) Handles splitting and prorating the fulfillment pricing.protected voidupdateFulfillmentMerchandisePricing(com.broadleafcommerce.order.client.domain.OrderFulfillment original, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> splits, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> allFulfillments) Handles splitting and prorating the merchandise pricing.protected voidupdateFulfillmentPricing(com.broadleafcommerce.order.client.domain.OrderFulfillment original, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> splits) Update the price amounts for the newly split fulfillments.protected voidupdateFulfillmentProratedAdjustments(List<BigDecimal> splitProportions, com.broadleafcommerce.order.client.domain.OrderFulfillment original, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> splits) Handles splittingOrderFulfillment.getProratedOrderFulfillmentAdjustments().protected voidupdateGrandTotal(com.broadleafcommerce.order.client.domain.OrderFulfillment original, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> splits) Update theOrderFulfillment.grandTotalfor thesplitsbased on their totals, and then give the remainder from the original amount to theoriginal.protected voidupdateItemPricing(Integer originalQuantity, com.broadleafcommerce.order.client.domain.OrderFulfillmentItem originalItem, List<com.broadleafcommerce.order.client.domain.OrderFulfillmentItem> splitItems) Update the price amounts for the new split fulfillment item quantities.protected voidupdateItemPricingAmounts(List<BigDecimal> splitProportions, com.broadleafcommerce.order.client.domain.OrderFulfillmentItem original, List<com.broadleafcommerce.order.client.domain.OrderFulfillmentItem> splits) Splits the original pricing amounts fromoriginalbetweenoriginalandsplit, based on thesplitProportion.protected voidupdateMerchandiseTotal(List<BigDecimal> splitProportions, com.broadleafcommerce.order.client.domain.OrderFulfillment original, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> splits) Split the originalOrderFulfillment.merchandiseTotalbetween the split fulfillments.protected voidupdateSplitItemsQualifierFulfillmentItemDetails(List<List<com.broadleafcommerce.order.client.domain.OrderFulfillmentItem>> splits, List<Map<String, String>> newItemIdsByOriginalItemIds) Builds and adds the qualifier fulfillment itemOfferItemDetailsfor newly created split fulfillment items.protected voidupdateTaxDetailsAmounts(List<BigDecimal> splitProportions, List<com.broadleafcommerce.order.client.domain.OrderFulfillmentItemTaxDetail> original, List<List<com.broadleafcommerce.order.client.domain.OrderFulfillmentItemTaxDetail>> splits) protected voidupdateTaxFieldsAmounts(List<BigDecimal> splitProportions, com.broadleafcommerce.order.client.domain.OrderFulfillmentItem original, List<com.broadleafcommerce.order.client.domain.OrderFulfillmentItem> splits) protected voidupdateTotalFulfillmentPrices(List<BigDecimal> splitProportions, com.broadleafcommerce.order.client.domain.OrderFulfillment original, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> splits) Calculate and split theOrderFulfillment#totalFulfillmentPricebetween the split fulfillments.protected voidupdateTotalTaxes(com.broadleafcommerce.order.client.domain.OrderFulfillment original, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> splits) Split the originalOrderFulfillment#totalTaxbetween the split fulfillments.
-
Constructor Details
-
DefaultFulfillmentSplittingService
public DefaultFulfillmentSplittingService(com.broadleafcommerce.common.extension.TypeFactory typeFactory, FulfillmentSplitRoundingService roundingService, FulfillmentOperationHelper helper)
-
-
Method Details
-
splitFulfillment
public List<com.broadleafcommerce.order.client.domain.OrderFulfillment> splitFulfillment(com.broadleafcommerce.order.client.domain.OrderFulfillment original, List<Map<String, Integer>> itemQuantities) Description copied from interface:FulfillmentSplittingServiceSplits the given fulfillment into multiple. The first split fulfillment will contain the remainder of the original fulfillment, while the rest will contain the portions requested byitemQuantities.- Specified by:
splitFulfillmentin interfaceFulfillmentSplittingService<com.broadleafcommerce.order.client.domain.OrderFulfillment>- Parameters:
original- the original fulfillment to splititemQuantities- the quantities of each item to put into each fulfillment, with each map having the fulfillment item ID as the key, and the quantity to include in that fulfillment as the value- Returns:
- a list containing the original fulfillment now containing the remainder of the original fulfillment, and all of the new fulfillments each containing the items requested
-
getSplitFulfillments
protected List<com.broadleafcommerce.order.client.domain.OrderFulfillment> getSplitFulfillments(com.broadleafcommerce.order.client.domain.OrderFulfillment original, List<List<com.broadleafcommerce.order.client.domain.OrderFulfillmentItem>> splitItems) Gets a list of splitOrderFulfillmentsfrom the given list of splitOrderFulfillmentItems.- Parameters:
original- the originalOrderFulfillmentprior the splitsplitItems- a list ofOrderFulfillmentItemsrepresenting how they're split- Returns:
- a list of split
OrderFulfillmentsfrom the given list of splitOrderFulfillmentItems
-
createSplitFulfillment
protected com.broadleafcommerce.order.client.domain.OrderFulfillment createSplitFulfillment(com.broadleafcommerce.order.client.domain.OrderFulfillment original) Set up a new cloneOrderFulfillmentto be used for the requested part of the fulfillment to split off.- Parameters:
original- the fulfillment to clone to be split- Returns:
- a new fulfillment with no items matching the non-unique values of the original
-
splitItems
protected List<List<com.broadleafcommerce.order.client.domain.OrderFulfillmentItem>> splitItems(List<com.broadleafcommerce.order.client.domain.OrderFulfillmentItem> items, List<Map<String, Integer>> itemQuantities) Split the fulfillment items into two lists based on the requesteditemQuantitiesto split.- Parameters:
items- the list of fulfillment items to splititemQuantities- requested items and their quantities to split- Returns:
- two lists of fulfillment items, the first with the remaining items, and the second
with the split item quantities requested by
itemQuantities
-
updateSplitItemsQualifierFulfillmentItemDetails
protected void updateSplitItemsQualifierFulfillmentItemDetails(List<List<com.broadleafcommerce.order.client.domain.OrderFulfillmentItem>> splits, List<Map<String, String>> newItemIdsByOriginalItemIds) Builds and adds the qualifier fulfillment itemOfferItemDetailsfor newly created split fulfillment items.Whenever split fulfillment items are created, their ids are changed. Therefore we need to create new qualifier fulfillment item
OfferItemDetailswith the newids.- Parameters:
splits- lists of fulfillment items which were split from the original fulfillmentsnewItemIdsByOriginalItemIds- maps of new fulfillment item ids by original fulfillment item ids prior the split
-
splitRequestedItem
protected void splitRequestedItem(com.broadleafcommerce.order.client.domain.OrderFulfillmentItem item, List<Integer> requestedQuantities, List<com.broadleafcommerce.order.client.domain.OrderFulfillmentItem> leftover, List<List<com.broadleafcommerce.order.client.domain.OrderFulfillmentItem>> splits, List<Map<String, String>> newItemIdsByOriginalItemIds) Split the fulfillment item quantities between the split item lists.- Parameters:
item- the fulfillment item to splitrequestedQuantities- the quantities to put into each ofsplitsleftover- list of remaining fulfillment items which were not requestedsplits- lists of fulfillment items which were requestednewItemIdsByOriginalItemIds- maps of new fulfillment item ids by original fulfillment item ids prior the split
-
createSplitItem
protected com.broadleafcommerce.order.client.domain.OrderFulfillmentItem createSplitItem(com.broadleafcommerce.order.client.domain.OrderFulfillmentItem item) Set up a new cloneOrderFulfillmentItemto be used for the split quantity of the fulfillment item.- Parameters:
item- the fulfillment item to clone to be split- Returns:
- a new fulfillment item with no quantity matching the non-unique values of the original item
-
copyTaxDetails
protected void copyTaxDetails(com.broadleafcommerce.order.client.domain.OrderFulfillmentItem originalItem, com.broadleafcommerce.order.client.domain.OrderFulfillmentItem splitItem) Copies thetax detailsfrom the original item to the new item.- Parameters:
originalItem- The original fulfillment itemsplitItem- The split item
-
updateItemPricing
protected void updateItemPricing(Integer originalQuantity, com.broadleafcommerce.order.client.domain.OrderFulfillmentItem originalItem, List<com.broadleafcommerce.order.client.domain.OrderFulfillmentItem> splitItems) Update the price amounts for the new split fulfillment item quantities.Splits amounts proportionally based on the quantity of each new item.
- Parameters:
originalQuantity- the original quantity of the item before splittingoriginalItem- the split item with the quantity that was leftoversplitItems- the split items with the quantities that are being split off
-
updateTaxDetailsAmounts
protected void updateTaxDetailsAmounts(List<BigDecimal> splitProportions, List<com.broadleafcommerce.order.client.domain.OrderFulfillmentItemTaxDetail> original, List<List<com.broadleafcommerce.order.client.domain.OrderFulfillmentItemTaxDetail>> splits) -
updateTaxFieldsAmounts
protected void updateTaxFieldsAmounts(List<BigDecimal> splitProportions, com.broadleafcommerce.order.client.domain.OrderFulfillmentItem original, List<com.broadleafcommerce.order.client.domain.OrderFulfillmentItem> splits) -
updateAdjustments
protected void updateAdjustments(List<BigDecimal> splitProportions, List<com.broadleafcommerce.order.common.domain.Adjustment> original, List<List<com.broadleafcommerce.order.common.domain.Adjustment>> splits) Splits the original adjustment amounts fromoriginalbetweenoriginalandsplit, based on thesplitProportion.- Parameters:
splitProportions- the decimal fractions of the amounts being split offoriginal- the split adjustments for the leftover items or fulfillmentssplits- the split adjustments for the items or fulfillments being split off
-
updateItemPricingAmounts
protected void updateItemPricingAmounts(List<BigDecimal> splitProportions, com.broadleafcommerce.order.client.domain.OrderFulfillmentItem original, List<com.broadleafcommerce.order.client.domain.OrderFulfillmentItem> splits) Splits the original pricing amounts fromoriginalbetweenoriginalandsplit, based on thesplitProportion.- Parameters:
splitProportions- the decimal fractions of the amounts being split offoriginal- the original item with the quantity that was leftoversplits- the split item with the quantities that are being split off
-
updateFulfillmentPricing
protected void updateFulfillmentPricing(com.broadleafcommerce.order.client.domain.OrderFulfillment original, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> splits) Update the price amounts for the newly split fulfillments.- Parameters:
original- the original fulfillment, which is now only a split partsplits- the fulfillments which were split off from the original
-
updateFulfillmentMerchandisePricing
protected void updateFulfillmentMerchandisePricing(com.broadleafcommerce.order.client.domain.OrderFulfillment original, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> splits, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> allFulfillments) Handles splitting and prorating the merchandise pricing.- Parameters:
original- Original fulfillment that was splitsplits- The new fulfillments made by splittingoriginalallFulfillments- All of the fulfillments. Used to determine ratios for prorating the original pricing.
-
updateFulfillmentFulfillmentPricing
protected void updateFulfillmentFulfillmentPricing(com.broadleafcommerce.order.client.domain.OrderFulfillment original, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> splits, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> allFulfillments) Handles splitting and prorating the fulfillment pricing.- Parameters:
original- Original fulfillment that was splitsplits- The new fulfillments made by splittingoriginalallFulfillments- All of the fulfillments. Used to determine ratios for prorating the original pricing.
-
updateFulfillmentProratedAdjustments
protected void updateFulfillmentProratedAdjustments(List<BigDecimal> splitProportions, com.broadleafcommerce.order.client.domain.OrderFulfillment original, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> splits) Handles splittingOrderFulfillment.getProratedOrderFulfillmentAdjustments().- Parameters:
splitProportions- The ratios used to prorate the original pricing among the new fulfillments.original- Original fulfillment that was splitsplits- The new fulfillments made by splittingoriginal
-
updateFulfillmentAdjustmentsTotal
protected void updateFulfillmentAdjustmentsTotal(List<BigDecimal> splitProportions, com.broadleafcommerce.order.client.domain.OrderFulfillment original, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> splits) Handles splittingOrderFulfillment.getFulfillmentAdjustmentsTotal().- Parameters:
splitProportions- The ratios used to prorate the original pricing among the new fulfillments.original- Original fulfillment that was splitsplits- The new fulfillments made by splittingoriginal
-
getPerFulfillmentPriceSplits
protected List<BigDecimal> getPerFulfillmentPriceSplits(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments) Determine the proportions by which per-fulfillment prices should be split.The default is to split proportionally based on the total of the
OrderFulfillmentItem.fulfillmentTotalfor each fulfillment.- Parameters:
fulfillments- the fulfillments which were split, including the original/leftover- Returns:
- list of the proportions by which per-fulfillment prices should be split for each fulfillment
-
calculateFulfillmentItemsTotal
protected javax.money.MonetaryAmount calculateFulfillmentItemsTotal(com.broadleafcommerce.order.client.domain.OrderFulfillment fulfillment) -
getPerFulfillmentMerchandiseSplits
protected List<BigDecimal> getPerFulfillmentMerchandiseSplits(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments) Determine the proportions by which per-fulfillment prices should be split.The default is to split proportionally based on the total of the
OrderFulfillmentItem.merchandiseTotalfor each fulfillment.- Parameters:
fulfillments- the fulfillments which were split, including the original/leftover- Returns:
- list of the proportions by which per-fulfillment prices should be split for each fulfillment
-
calculateMerchandiseTotal
protected javax.money.MonetaryAmount calculateMerchandiseTotal(com.broadleafcommerce.order.client.domain.OrderFulfillment fulfillment) -
updateMerchandiseTotal
protected void updateMerchandiseTotal(List<BigDecimal> splitProportions, com.broadleafcommerce.order.client.domain.OrderFulfillment original, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> splits) Split the originalOrderFulfillment.merchandiseTotalbetween the split fulfillments.- Parameters:
splitProportions- the decimal fractions of the amounts being split offoriginal- the original fulfillment with the leftover item quantitiessplits- the fulfillments which were split off from the original
-
updateFulfillmentCharge
protected void updateFulfillmentCharge(List<BigDecimal> splitProportions, com.broadleafcommerce.order.client.domain.OrderFulfillment original, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> splits) Split the originalOrderFulfillment.fulfillmentChargebetween the split fulfillments.- Parameters:
splitProportions- the decimal fractions of the amounts being split offoriginal- the original fulfillment with the leftover item quantitiessplits- the fulfillments which were split off from the original
-
updateTotalFulfillmentPrices
protected void updateTotalFulfillmentPrices(List<BigDecimal> splitProportions, com.broadleafcommerce.order.client.domain.OrderFulfillment original, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> splits) Calculate and split theOrderFulfillment#totalFulfillmentPricebetween the split fulfillments.If it is an overridden price, it will be split proportionally.
Otherwise, the amount for the
originalfulfillment will be calculated based on its other totals, and then the remainder from the original amount will be set on thesplitfulfillment.- Parameters:
splitProportions- the decimal fractions of the amounts being split offoriginal- the original fulfillment with the leftover item quantitiessplits- the fulfillments which were split off from the original
-
calculateAndSplitTotalFulfillmentPrices
protected void calculateAndSplitTotalFulfillmentPrices(com.broadleafcommerce.order.client.domain.OrderFulfillment original, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> splits) Calculate theOrderFulfillment#totalFulfillmentPricefor thesplitsbased on their totals, and then give the remainder from the original amount to theoriginal.- Parameters:
original- the original fulfillment with the leftover item quantitiessplits- the fulfillments which were split off from the original
-
updateTotalTaxes
protected void updateTotalTaxes(com.broadleafcommerce.order.client.domain.OrderFulfillment original, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> splits) Split the originalOrderFulfillment#totalTaxbetween the split fulfillments.The
splittax will be its merchandise total tax plus a portion of the original fulfillment tax, based on the split fulfillment taxable amounts. Theoriginaltax will be the remainder of the original amount left over.- Parameters:
original- the original fulfillment with the leftover item quantitiessplits- the fulfillments which were split off from the original
-
getSplitFulfillmentPriceTaxes
protected List<javax.money.MonetaryAmount> getSplitFulfillmentPriceTaxes(com.broadleafcommerce.order.client.domain.OrderFulfillment original, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> splits) Get the tax just for the fulfillment prices for the new split fulfillments, not including tax on the merchandise price.- Parameters:
original- the original fulfillment with the leftover item quantitiessplits- the fulfillments which were split off from the original- Returns:
- the fulfillment price taxes for each of the new
splitsfulfillments
-
getSplitMerchandiseTotalTaxes
protected List<javax.money.MonetaryAmount> getSplitMerchandiseTotalTaxes(com.broadleafcommerce.order.client.domain.OrderFulfillment original, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> splits) Get the tax for the merchandise total of the new split fulfillments, not including tax on the fulfillment price.- Parameters:
original- the original fulfillment with the leftover item quantitiessplits- the fulfillments which were split off from the original- Returns:
- the merchandise total taxes for each of the new
splitsfulfillments
-
getSplitMerchandiseIncludedTaxes
protected List<javax.money.MonetaryAmount> getSplitMerchandiseIncludedTaxes(com.broadleafcommerce.order.client.domain.OrderFulfillment original, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> splits) Get the included tax for the merchandise total of the new split fulfillments.- Parameters:
original- the original fulfillment with the leftover item quantitiessplits- the fulfillments which were split off from the original- Returns:
- the merchandise included taxes for each of the new
splitsfulfillments
-
getSplitFulfillmentIncludedTaxes
protected List<javax.money.MonetaryAmount> getSplitFulfillmentIncludedTaxes(com.broadleafcommerce.order.client.domain.OrderFulfillment original, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> splits) Get the included tax for the fulfillment total of the new split fulfillments.- Parameters:
original- the original fulfillment with the leftover item quantitiessplits- the fulfillments which were split off from the original- Returns:
- the fulfillment included taxes for each of the new
splitsfulfillments
-
updateGrandTotal
protected void updateGrandTotal(com.broadleafcommerce.order.client.domain.OrderFulfillment original, List<com.broadleafcommerce.order.client.domain.OrderFulfillment> splits) Update theOrderFulfillment.grandTotalfor thesplitsbased on their totals, and then give the remainder from the original amount to theoriginal.- Parameters:
original- the original fulfillment with the leftover item quantitiessplits- the fulfillments which were split off from the original
-
bindAmountSplitter
protected <T> BiConsumer<Function<T,javax.money.MonetaryAmount>, bindAmountSplitterBiConsumer<T, javax.money.MonetaryAmount>> (List<BigDecimal> splitProportions, T original, List<T> splits) Produces aBiConsumerwhich can split a certain amount betweenoriginalandsplitwith a specific splitting proportion.- Type Parameters:
T- the type of the split domain- Parameters:
splitProportions- the decimal fractions of the amounts being split offoriginal- the original domain, which will be updated to the leftover amountsplits- the parts of the domain which are being split off- Returns:
- a function which, when called with the getter and setter for an amount on
DefaultFulfillmentSplittingService, can split that amount fromoriginalbetween bothoriginalandsplitbased on the givensplitProportion
-
splitAmount
protected <T> void splitAmount(Function<T, javax.money.MonetaryAmount> getAmount, BiConsumer<T, javax.money.MonetaryAmount> setAmount, List<BigDecimal> splitProportions, T original, List<T> splits) Splits a certain amount fromoriginalbetween all of the splitoriginalandsplits. The split amount is not rounded, and must be reconciled later.- Type Parameters:
T- the type of the split domain- Parameters:
getAmount- getter onDefaultFulfillmentSplittingServiceto get the amount to splitsetAmount- setter onDefaultFulfillmentSplittingServiceto set the split amountsplitProportions- the decimal fractions of the amounts being split offoriginal- the original domain, which will be updated to the leftover amountsplits- the parts of the domain which are being split off
-
assignOrderFulfillmentNumbers
protected void assignOrderFulfillmentNumbers(List<com.broadleafcommerce.order.client.domain.OrderFulfillment> fulfillments, String originalFulfillmentNumber) Assigns theorderFulfillmentNumbersfor the splitfulfillments.The new numbers are the number of the original fulfillment, followed by an incrementing sequence count for each split fulfillment. For example, splitting a fulfillment with the number
VENDOR-1into two would produceVENDOR-1-1andVENDOR-1-2.If there was no number for the original fulfillment, this will not assign any new fulfillment numbers.
- Parameters:
fulfillments- the generated fulfillments to assign new numbers fororiginalFulfillmentNumber- the order fulfillment number of the original fulfillment
-
getAmountTotal
protected <T> javax.money.MonetaryAmount getAmountTotal(@NonNull @NonNull List<T> objects, @NonNull @NonNull Function<T, javax.money.MonetaryAmount> amountGetter, @NonNull @NonNull javax.money.CurrencyUnit currency) Helper method to sum up theMonetaryAmountsfor each given object using the givenamountGetter function.- Type Parameters:
T- the type of the object- Parameters:
objects- a list of objects to sumamountGetter- theFunctionused to get theMonetaryAmountsfrom the given objectscurrency- theCurrencyUnit- Returns:
- the total amount summed from the given objects
-
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory() -
getRoundingService
-
getHelper
-
getOfferUtils
-
setOfferUtils
-