Class InclusiveTaxHelper
java.lang.Object
com.broadleafcommerce.order.service.util.InclusiveTaxHelper
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Default name of theTaxDetail
for taxes associated with fulfillment, shipping, and handling. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected <T> javax.money.MonetaryAmount
calculateTaxesWithPredicates
(Stream<T> stream, Predicate<T> isFulfillmentTaxPredicate, Predicate<T> isTaxInclusivePredicate, Function<T, javax.money.MonetaryAmount> fieldPredicate, javax.money.CurrencyUnit currency) javax.money.MonetaryAmount
getAllIncludedTax
(com.broadleafcommerce.order.client.domain.OrderFulfillment orderFulfillment) Get the sum of all (merchandise and fulfillment) inclusive taxes from the givenOrderFulfillment
.javax.money.MonetaryAmount
getFulfillmentIncludedTax
(com.broadleafcommerce.order.client.domain.OrderFulfillment orderFulfillment) Get the sum of fulfillment inclusive taxes from the givenOrderFulfillment
.javax.money.MonetaryAmount
getFulfillmentIncludedTax
(com.broadleafcommerce.order.client.domain.OrderFulfillmentItem orderFulfillmentItem, javax.money.CurrencyUnit currency) Get the sum of fulfillment inclusive taxes from the givenOrderFulfillmentItem
.javax.money.MonetaryAmount
getFulfillmentIncludedTax
(OrderFulfillmentItemView orderFulfillmentItemView, javax.money.CurrencyUnit currency) Get the sum of fulfillment inclusive taxes from the givenOrderFulfillmentItemView
.javax.money.MonetaryAmount
getFulfillmentIncludedTax
(OrderFulfillmentView orderFulfillmentView) Get the sum of fulfillment inclusive taxes from the givenOrderFulfillmentView
.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 givenOrderFulfillmentItem
.javax.money.MonetaryAmount
getFulfillmentNonIncludedTax
(OrderFulfillmentItemView orderFulfillmentItemView, javax.money.CurrencyUnit currency) Get the sum of fulfillment non-included taxes from the givenOrderFulfillmentItemView
.protected String
javax.money.MonetaryAmount
getMerchIncludedTax
(com.broadleafcommerce.order.client.domain.OrderFulfillment orderFulfillment) Get the sum of merchandise inclusive taxes from the givenOrderFulfillment
.javax.money.MonetaryAmount
getMerchIncludedTax
(com.broadleafcommerce.order.client.domain.OrderFulfillmentItem orderFulfillmentItem, javax.money.CurrencyUnit currency) Get the sum of inclusive merchandise taxes from the givenOrderFulfillmentItem
.javax.money.MonetaryAmount
getMerchIncludedTax
(OrderFulfillmentItemView orderFulfillmentItemView, javax.money.CurrencyUnit currency) Get the sum of inclusive merchandise taxes from the givenOrderFulfillmentItemView
.javax.money.MonetaryAmount
getMerchIncludedTax
(OrderFulfillmentView orderFulfillmentView) Get the sum of merchandise inclusive taxes from the givenOrderFulfillmentView
.protected boolean
isExclusiveTax
(com.broadleafcommerce.order.client.domain.OrderFulfillmentItemTaxDetail taxDetail) protected boolean
isFulfillmentFeeTaxDetail
(com.broadleafcommerce.order.client.domain.OrderFulfillmentItemTaxDetail taxDetail) protected boolean
isFulfillmentTaxName
(String taxName) protected boolean
isInclusiveTax
(com.broadleafcommerce.order.client.domain.OrderFulfillmentItemTaxDetail taxDetail) protected boolean
isMerchandiseTaxDetail
(com.broadleafcommerce.order.client.domain.OrderFulfillmentItemTaxDetail taxDetail) protected boolean
protected javax.money.MonetaryAmount
sumTaxableAmount
(com.broadleafcommerce.order.client.domain.OrderFulfillmentItemTaxDetail orderFulfillmentItemTaxDetail) protected javax.money.MonetaryAmount
sumTaxCalculated
(com.broadleafcommerce.order.client.domain.OrderFulfillmentItemTaxDetail orderFulfillmentItemTaxDetail) protected void
updateIncludedTaxFields
(com.broadleafcommerce.order.client.domain.OrderFulfillment orderFulfillment) protected void
updateIncludedTaxFields
(OrderFulfillmentView orderFulfillmentView) protected void
updateItemTotal
(com.broadleafcommerce.order.client.domain.OrderFulfillment orderFulfillment) protected void
updateItemTotal
(OrderFulfillmentView orderFulfillmentView) protected void
updateNonIncludedTaxFields
(com.broadleafcommerce.order.client.domain.OrderFulfillment orderFulfillment) protected void
updateNonIncludedTaxFields
(OrderFulfillmentView orderFulfillmentView) void
updateTaxRelatedFields
(com.broadleafcommerce.order.client.domain.OrderFulfillment orderFulfillment) void
updateTaxRelatedFields
(OrderFulfillmentView orderFulfillmentView)
-
Field Details
-
DEFAULT_FULFILLMENT_TAX_NAME
Default name of theTaxDetail
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 givenOrderFulfillment
.- Parameters:
orderFulfillment
- TheOrderFulfillment
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 givenOrderFulfillment
.- Parameters:
orderFulfillment
- TheOrderFulfillment
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 givenOrderFulfillmentItem
.- Parameters:
orderFulfillmentItem
- TheOrderFulfillmentItem
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 givenOrderFulfillmentItemView
.- Parameters:
orderFulfillmentItemView
- TheOrderFulfillmentItemView
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 givenOrderFulfillmentView
.- Parameters:
orderFulfillmentView
- TheOrderFulfillmentView
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 givenOrderFulfillmentItem
.- Parameters:
orderFulfillmentItem
- TheOrderFulfillmentItem
to operate on.currency
- TheCurrencyUnit
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 givenOrderFulfillmentItemView
.- Parameters:
orderFulfillmentItemView
- TheOrderFulfillmentItemView
to operate on.currency
- TheCurrencyUnit
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 givenOrderFulfillment
.- Parameters:
orderFulfillment
- TheOrderFulfillment
to operate on.- Returns:
- The sum of merchandise inclusive taxes from the given
OrderFulfillment
.
-
getMerchIncludedTax
Get the sum of merchandise inclusive taxes from the givenOrderFulfillmentView
.- Parameters:
orderFulfillmentView
- TheOrderFulfillmentView
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 givenOrderFulfillmentItem
.- Parameters:
orderFulfillmentItem
- TheOrderFulfillmentItem
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 givenOrderFulfillmentItemView
.- Parameters:
orderFulfillmentItemView
- TheOrderFulfillmentItemView
on which to operate.currency
- The currency of the operation.- Returns:
- The sum of inclusive merchandise taxes from the given
OrderFulfillmentItemView
.
-
calculateTaxesWithPredicates
-
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
-
updateIncludedTaxFields
protected void updateIncludedTaxFields(com.broadleafcommerce.order.client.domain.OrderFulfillment orderFulfillment) -
updateIncludedTaxFields
-
updateNonIncludedTaxFields
protected void updateNonIncludedTaxFields(com.broadleafcommerce.order.client.domain.OrderFulfillment orderFulfillment) -
updateNonIncludedTaxFields
-
updateItemTotal
protected void updateItemTotal(com.broadleafcommerce.order.client.domain.OrderFulfillment orderFulfillment) -
updateItemTotal
-
isInclusiveTax
protected boolean isInclusiveTax(com.broadleafcommerce.order.client.domain.OrderFulfillmentItemTaxDetail taxDetail) -
isExclusiveTax
protected boolean isExclusiveTax(com.broadleafcommerce.order.client.domain.OrderFulfillmentItemTaxDetail taxDetail) -
passthroughFilter
-
isFulfillmentFeeTaxDetail
protected boolean isFulfillmentFeeTaxDetail(com.broadleafcommerce.order.client.domain.OrderFulfillmentItemTaxDetail taxDetail) -
isMerchandiseTaxDetail
protected boolean isMerchandiseTaxDetail(com.broadleafcommerce.order.client.domain.OrderFulfillmentItemTaxDetail taxDetail) -
isFulfillmentTaxName
-
getFulfillmentTaxName
-