Class InclusiveTaxHelper
java.lang.Object
com.broadleafcommerce.orderoperation.service.util.InclusiveTaxHelper
Utility to facilitate getting inclusive taxes from
FulfillmentItemTaxDetail
and
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.
Duplicate methods of this class may be found in OrderServices.- Author:
- Cade Rea (cade-rea)
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Default name of theTaxDetail
for taxes associated with fulfillment, shipping, and handling. -
Constructor Summary
-
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.cart.client.domain.FulfillmentItem fulfillmentItem, javax.money.CurrencyUnit currency) Get the sum of all (merchandise and fulfillment) inclusive taxes from the givenFulfillmentItem
.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.cart.client.domain.FulfillmentGroup fulfillmentGroup) Get the sum of inclusive fulfillment taxes from the givenFulfillmentGroup
.javax.money.MonetaryAmount
getFulfillmentIncludedTax
(com.broadleafcommerce.cart.client.domain.FulfillmentItem fulfillmentItem, javax.money.CurrencyUnit currency) Get the sum of inclusive fulfillment taxes from the givenFulfillmentItem
.javax.money.MonetaryAmount
getFulfillmentIncludedTax
(com.broadleafcommerce.order.client.domain.OrderFulfillment orderFulfillment) Get the sum of fulfillment inclusive taxes from the givenOrderFulfillment
.protected String
javax.money.MonetaryAmount
getMerchIncludedTax
(com.broadleafcommerce.cart.client.domain.FulfillmentItem fulfillmentItem, javax.money.CurrencyUnit currency) Get the sum of inclusive merchandise taxes from the givenFulfillmentItem
.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
.protected boolean
isExclusiveTax
(com.broadleafcommerce.cart.client.domain.FulfillmentItemTaxDetail taxDetail) protected boolean
isExclusiveTax
(com.broadleafcommerce.order.client.domain.OrderFulfillmentItemTaxDetail taxDetail) protected boolean
isFulfillmentFeeTaxDetail
(com.broadleafcommerce.cart.client.domain.FulfillmentItemTaxDetail taxDetail) protected boolean
isFulfillmentFeeTaxDetail
(com.broadleafcommerce.order.client.domain.OrderFulfillmentItemTaxDetail taxDetail) protected boolean
isFulfillmentTaxName
(String taxName) protected boolean
isInclusiveTax
(com.broadleafcommerce.cart.client.domain.FulfillmentItemTaxDetail taxDetail) protected boolean
isInclusiveTax
(com.broadleafcommerce.order.client.domain.OrderFulfillmentItemTaxDetail taxDetail) protected boolean
isMerchandiseTaxDetail
(com.broadleafcommerce.cart.client.domain.FulfillmentItemTaxDetail taxDetail) protected boolean
isMerchandiseTaxDetail
(com.broadleafcommerce.order.client.domain.OrderFulfillmentItemTaxDetail taxDetail) protected boolean
protected javax.money.MonetaryAmount
sumTaxableAmount
(com.broadleafcommerce.cart.client.domain.FulfillmentItemTaxDetail fulfillmentItemTaxDetail) protected javax.money.MonetaryAmount
sumTaxableAmount
(com.broadleafcommerce.order.client.domain.OrderFulfillmentItemTaxDetail orderFulfillmentItemTaxDetail) protected javax.money.MonetaryAmount
sumTaxCalculated
(com.broadleafcommerce.cart.client.domain.FulfillmentItemTaxDetail fulfillmentItemTaxDetail) protected javax.money.MonetaryAmount
sumTaxCalculated
(com.broadleafcommerce.order.client.domain.OrderFulfillmentItemTaxDetail orderFulfillmentItemTaxDetail)
-
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.cart.client.domain.FulfillmentItem fulfillmentItem, javax.money.CurrencyUnit currency) Get the sum of all (merchandise and fulfillment) inclusive taxes from the givenFulfillmentItem
.- Parameters:
fulfillmentItem
- TheFulfillmentItem
on which to operate.currency
- The currency of the operation.- Returns:
- The sum of inclusive taxes on the given
FulfillmentItem
.
-
getMerchIncludedTax
public javax.money.MonetaryAmount getMerchIncludedTax(com.broadleafcommerce.cart.client.domain.FulfillmentItem fulfillmentItem, javax.money.CurrencyUnit currency) Get the sum of inclusive merchandise taxes from the givenFulfillmentItem
.- Parameters:
fulfillmentItem
- TheFulfillmentItem
on which to operate.currency
- The currency of the operation.- Returns:
- The sum of inclusive merchandise taxes from the given
FulfillmentItem
.
-
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
.
-
getFulfillmentIncludedTax
public javax.money.MonetaryAmount getFulfillmentIncludedTax(com.broadleafcommerce.cart.client.domain.FulfillmentItem fulfillmentItem, javax.money.CurrencyUnit currency) Get the sum of inclusive fulfillment taxes from the givenFulfillmentItem
.- Parameters:
fulfillmentItem
- TheFulfillmentItem
on which to operate.currency
- The currency of the operation.- Returns:
- The sum of inclusive fulfillment taxes from the given
FulfillmentItem
.
-
getFulfillmentIncludedTax
public javax.money.MonetaryAmount getFulfillmentIncludedTax(com.broadleafcommerce.cart.client.domain.FulfillmentGroup fulfillmentGroup) Get the sum of inclusive fulfillment taxes from the givenFulfillmentGroup
.- Parameters:
fulfillmentGroup
- TheFulfillmentGroup
whoseFulfillmentItem's
contain the fulfillment taxes asFulfillmentItemTaxDetails
.- Returns:
- The sum of inclusive fulfillment taxes from the given
FulfillmentGroup
.
-
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
.
-
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
.
-
calculateTaxesWithPredicates
-
sumTaxCalculated
protected javax.money.MonetaryAmount sumTaxCalculated(com.broadleafcommerce.cart.client.domain.FulfillmentItemTaxDetail fulfillmentItemTaxDetail) -
sumTaxCalculated
protected javax.money.MonetaryAmount sumTaxCalculated(com.broadleafcommerce.order.client.domain.OrderFulfillmentItemTaxDetail orderFulfillmentItemTaxDetail) -
sumTaxableAmount
protected javax.money.MonetaryAmount sumTaxableAmount(com.broadleafcommerce.cart.client.domain.FulfillmentItemTaxDetail fulfillmentItemTaxDetail) -
sumTaxableAmount
protected javax.money.MonetaryAmount sumTaxableAmount(com.broadleafcommerce.order.client.domain.OrderFulfillmentItemTaxDetail orderFulfillmentItemTaxDetail) -
isInclusiveTax
protected boolean isInclusiveTax(com.broadleafcommerce.cart.client.domain.FulfillmentItemTaxDetail taxDetail) -
isExclusiveTax
protected boolean isExclusiveTax(com.broadleafcommerce.cart.client.domain.FulfillmentItemTaxDetail taxDetail) -
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.cart.client.domain.FulfillmentItemTaxDetail taxDetail) -
isMerchandiseTaxDetail
protected boolean isMerchandiseTaxDetail(com.broadleafcommerce.cart.client.domain.FulfillmentItemTaxDetail taxDetail) -
isFulfillmentFeeTaxDetail
protected boolean isFulfillmentFeeTaxDetail(com.broadleafcommerce.order.client.domain.OrderFulfillmentItemTaxDetail taxDetail) -
isMerchandiseTaxDetail
protected boolean isMerchandiseTaxDetail(com.broadleafcommerce.order.client.domain.OrderFulfillmentItemTaxDetail taxDetail) -
isFulfillmentTaxName
-
getFulfillmentTaxName
-