Class InclusiveTaxHelper

java.lang.Object
com.broadleafcommerce.order.service.util.InclusiveTaxHelper

public class InclusiveTaxHelper extends Object
Utility to facilitate getting inclusive taxes from OrderFulfillmentItemTaxDetail. Includes predicates for filtering inclusive/exclusive taxes, filtering merchandise/fulfillment taxes, and summing tax/taxable amount fields. This class only includes methods that are needed by the framework. Extensions of this class can use the included predicates to easily compose new tax calculation methods as needed. This class includes duplicate methods from the InclusiveTaxHelper in OrderOperationServices.
Author:
Susana Cruz (susanaccruz)
  • Field Details

    • DEFAULT_FULFILLMENT_TAX_NAME

      public static final String DEFAULT_FULFILLMENT_TAX_NAME
      Default name of the TaxDetail for taxes associated with fulfillment, shipping, and handling.
      See Also:
  • Constructor Details

    • InclusiveTaxHelper

      public InclusiveTaxHelper()
  • Method Details

    • getAllIncludedTax

      public javax.money.MonetaryAmount getAllIncludedTax(com.broadleafcommerce.order.client.domain.OrderFulfillment orderFulfillment)
      Get the sum of all (merchandise and fulfillment) inclusive taxes from the given OrderFulfillment.
      Parameters:
      orderFulfillment - The OrderFulfillment to operate on.
      Returns:
      The sum of all (merchandise and fulfillment) inclusive taxes from the given OrderFulfillment.
    • getFulfillmentIncludedTax

      public javax.money.MonetaryAmount getFulfillmentIncludedTax(com.broadleafcommerce.order.client.domain.OrderFulfillment orderFulfillment)
      Get the sum of fulfillment inclusive taxes from the given OrderFulfillment.
      Parameters:
      orderFulfillment - The OrderFulfillment to operate on.
      Returns:
      The sum of fulfillment inclusive taxes from the given OrderFulfillment.
    • getFulfillmentNonIncludedTax

      public javax.money.MonetaryAmount getFulfillmentNonIncludedTax(com.broadleafcommerce.order.client.domain.OrderFulfillmentItem orderFulfillmentItem, javax.money.CurrencyUnit currency)
      Get the sum of fulfillment non-included taxes from the given OrderFulfillmentItem.
      Parameters:
      orderFulfillmentItem - The OrderFulfillmentItem to operate on.
      Returns:
      The sum of fulfillment non-included taxes from the given OrderFulfillmentItem.
    • getFulfillmentNonIncludedTax

      public javax.money.MonetaryAmount getFulfillmentNonIncludedTax(OrderFulfillmentItemView orderFulfillmentItemView, javax.money.CurrencyUnit currency)
      Get the sum of fulfillment non-included taxes from the given OrderFulfillmentItemView.
      Parameters:
      orderFulfillmentItemView - The OrderFulfillmentItemView to operate on.
      Returns:
      The sum of fulfillment non-included taxes from the given OrderFulfillmentItemView.
    • getFulfillmentIncludedTax

      public javax.money.MonetaryAmount getFulfillmentIncludedTax(OrderFulfillmentView orderFulfillmentView)
      Get the sum of fulfillment inclusive taxes from the given OrderFulfillmentView.
      Parameters:
      orderFulfillmentView - The OrderFulfillmentView to operate on.
      Returns:
      The sum of fulfillment inclusive taxes from the given OrderFulfillmentView.
    • getFulfillmentIncludedTax

      public javax.money.MonetaryAmount getFulfillmentIncludedTax(com.broadleafcommerce.order.client.domain.OrderFulfillmentItem orderFulfillmentItem, javax.money.CurrencyUnit currency)
      Get the sum of fulfillment inclusive taxes from the given OrderFulfillmentItem.
      Parameters:
      orderFulfillmentItem - The OrderFulfillmentItem to operate on.
      currency - The CurrencyUnit to use.
      Returns:
      The sum of fulfillment inclusive taxes from the given OrderFulfillmentItem.
    • getFulfillmentIncludedTax

      public javax.money.MonetaryAmount getFulfillmentIncludedTax(OrderFulfillmentItemView orderFulfillmentItemView, javax.money.CurrencyUnit currency)
      Get the sum of fulfillment inclusive taxes from the given OrderFulfillmentItemView.
      Parameters:
      orderFulfillmentItemView - The OrderFulfillmentItemView to operate on.
      currency - The CurrencyUnit to use.
      Returns:
      The sum of fulfillment inclusive taxes from the given OrderFulfillmentItemView.
    • getMerchIncludedTax

      public javax.money.MonetaryAmount getMerchIncludedTax(com.broadleafcommerce.order.client.domain.OrderFulfillment orderFulfillment)
      Get the sum of merchandise inclusive taxes from the given OrderFulfillment.
      Parameters:
      orderFulfillment - The OrderFulfillment to operate on.
      Returns:
      The sum of merchandise inclusive taxes from the given OrderFulfillment.
    • getMerchIncludedTax

      public javax.money.MonetaryAmount getMerchIncludedTax(OrderFulfillmentView orderFulfillmentView)
      Get the sum of merchandise inclusive taxes from the given OrderFulfillmentView.
      Parameters:
      orderFulfillmentView - The OrderFulfillmentView to operate on.
      Returns:
      The sum of merchandise inclusive taxes from the given OrderFulfillmentView.
    • getMerchIncludedTax

      public javax.money.MonetaryAmount getMerchIncludedTax(com.broadleafcommerce.order.client.domain.OrderFulfillmentItem orderFulfillmentItem, javax.money.CurrencyUnit currency)
      Get the sum of inclusive merchandise taxes from the given OrderFulfillmentItem.
      Parameters:
      orderFulfillmentItem - The OrderFulfillmentItem on which to operate.
      currency - The currency of the operation.
      Returns:
      The sum of inclusive merchandise taxes from the given OrderFulfillmentItem.
    • getMerchIncludedTax

      public javax.money.MonetaryAmount getMerchIncludedTax(OrderFulfillmentItemView orderFulfillmentItemView, javax.money.CurrencyUnit currency)
      Get the sum of inclusive merchandise taxes from the given OrderFulfillmentItemView.
      Parameters:
      orderFulfillmentItemView - The OrderFulfillmentItemView on which to operate.
      currency - The currency of the operation.
      Returns:
      The sum of inclusive merchandise taxes from the given OrderFulfillmentItemView.
    • calculateTaxesWithPredicates

      protected <T> javax.money.MonetaryAmount calculateTaxesWithPredicates(Stream<T> stream, Predicate<T> isFulfillmentTaxPredicate, Predicate<T> isTaxInclusivePredicate, Function<T,javax.money.MonetaryAmount> fieldPredicate, javax.money.CurrencyUnit currency)
    • sumTaxCalculated

      protected javax.money.MonetaryAmount sumTaxCalculated(com.broadleafcommerce.order.client.domain.OrderFulfillmentItemTaxDetail orderFulfillmentItemTaxDetail)
    • sumTaxableAmount

      protected javax.money.MonetaryAmount sumTaxableAmount(com.broadleafcommerce.order.client.domain.OrderFulfillmentItemTaxDetail orderFulfillmentItemTaxDetail)
    • updateTaxRelatedFields

      public void updateTaxRelatedFields(com.broadleafcommerce.order.client.domain.OrderFulfillment orderFulfillment)
    • updateTaxRelatedFields

      public void updateTaxRelatedFields(OrderFulfillmentView orderFulfillmentView)
    • updateIncludedTaxFields

      protected void updateIncludedTaxFields(com.broadleafcommerce.order.client.domain.OrderFulfillment orderFulfillment)
    • updateIncludedTaxFields

      protected void updateIncludedTaxFields(OrderFulfillmentView orderFulfillmentView)
    • updateNonIncludedTaxFields

      protected void updateNonIncludedTaxFields(com.broadleafcommerce.order.client.domain.OrderFulfillment orderFulfillment)
    • updateNonIncludedTaxFields

      protected void updateNonIncludedTaxFields(OrderFulfillmentView orderFulfillmentView)
    • updateItemTotal

      protected void updateItemTotal(com.broadleafcommerce.order.client.domain.OrderFulfillment orderFulfillment)
    • updateItemTotal

      protected void updateItemTotal(OrderFulfillmentView orderFulfillmentView)
    • isInclusiveTax

      protected boolean isInclusiveTax(com.broadleafcommerce.order.client.domain.OrderFulfillmentItemTaxDetail taxDetail)
    • isExclusiveTax

      protected boolean isExclusiveTax(com.broadleafcommerce.order.client.domain.OrderFulfillmentItemTaxDetail taxDetail)
    • passthroughFilter

      protected boolean passthroughFilter(Object o)
    • isFulfillmentFeeTaxDetail

      protected boolean isFulfillmentFeeTaxDetail(com.broadleafcommerce.order.client.domain.OrderFulfillmentItemTaxDetail taxDetail)
    • isMerchandiseTaxDetail

      protected boolean isMerchandiseTaxDetail(com.broadleafcommerce.order.client.domain.OrderFulfillmentItemTaxDetail taxDetail)
    • isFulfillmentTaxName

      protected boolean isFulfillmentTaxName(String taxName)
    • getFulfillmentTaxName

      protected String getFulfillmentTaxName()