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
FieldsModifier and TypeFieldDescriptionstatic final StringDefault name of theTaxDetailfor taxes associated with fulfillment, shipping, and handling. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected <T> javax.money.MonetaryAmountcalculateTaxesWithPredicates(Stream<T> stream, Predicate<T> isFulfillmentTaxPredicate, Predicate<T> isTaxInclusivePredicate, Function<T, javax.money.MonetaryAmount> fieldPredicate, javax.money.CurrencyUnit currency) javax.money.MonetaryAmountgetAllIncludedTax(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.MonetaryAmountgetAllIncludedTax(com.broadleafcommerce.order.client.domain.OrderFulfillment orderFulfillment) Get the sum of all (merchandise and fulfillment) inclusive taxes from the givenOrderFulfillment.javax.money.MonetaryAmountgetFulfillmentIncludedTax(com.broadleafcommerce.cart.client.domain.FulfillmentGroup fulfillmentGroup) Get the sum of inclusive fulfillment taxes from the givenFulfillmentGroup.javax.money.MonetaryAmountgetFulfillmentIncludedTax(com.broadleafcommerce.cart.client.domain.FulfillmentItem fulfillmentItem, javax.money.CurrencyUnit currency) Get the sum of inclusive fulfillment taxes from the givenFulfillmentItem.javax.money.MonetaryAmountgetFulfillmentIncludedTax(com.broadleafcommerce.order.client.domain.OrderFulfillment orderFulfillment) Get the sum of fulfillment inclusive taxes from the givenOrderFulfillment.protected Stringjavax.money.MonetaryAmountgetMerchIncludedTax(com.broadleafcommerce.cart.client.domain.FulfillmentItem fulfillmentItem, javax.money.CurrencyUnit currency) Get the sum of inclusive merchandise taxes from the givenFulfillmentItem.javax.money.MonetaryAmountgetMerchIncludedTax(com.broadleafcommerce.order.client.domain.OrderFulfillment orderFulfillment) Get the sum of merchandise inclusive taxes from the givenOrderFulfillment.javax.money.MonetaryAmountgetMerchIncludedTax(com.broadleafcommerce.order.client.domain.OrderFulfillmentItem orderFulfillmentItem, javax.money.CurrencyUnit currency) Get the sum of inclusive merchandise taxes from the givenOrderFulfillmentItem.protected booleanisExclusiveTax(com.broadleafcommerce.cart.client.domain.FulfillmentItemTaxDetail taxDetail) protected booleanisExclusiveTax(com.broadleafcommerce.order.client.domain.OrderFulfillmentItemTaxDetail taxDetail) protected booleanisFulfillmentFeeTaxDetail(com.broadleafcommerce.cart.client.domain.FulfillmentItemTaxDetail taxDetail) protected booleanisFulfillmentFeeTaxDetail(com.broadleafcommerce.order.client.domain.OrderFulfillmentItemTaxDetail taxDetail) protected booleanisFulfillmentTaxName(String taxName) protected booleanisInclusiveTax(com.broadleafcommerce.cart.client.domain.FulfillmentItemTaxDetail taxDetail) protected booleanisInclusiveTax(com.broadleafcommerce.order.client.domain.OrderFulfillmentItemTaxDetail taxDetail) protected booleanisMerchandiseTaxDetail(com.broadleafcommerce.cart.client.domain.FulfillmentItemTaxDetail taxDetail) protected booleanisMerchandiseTaxDetail(com.broadleafcommerce.order.client.domain.OrderFulfillmentItemTaxDetail taxDetail) protected booleanprotected javax.money.MonetaryAmountsumTaxableAmount(com.broadleafcommerce.cart.client.domain.FulfillmentItemTaxDetail fulfillmentItemTaxDetail) protected javax.money.MonetaryAmountsumTaxableAmount(com.broadleafcommerce.order.client.domain.OrderFulfillmentItemTaxDetail orderFulfillmentItemTaxDetail) protected javax.money.MonetaryAmountsumTaxCalculated(com.broadleafcommerce.cart.client.domain.FulfillmentItemTaxDetail fulfillmentItemTaxDetail) protected javax.money.MonetaryAmountsumTaxCalculated(com.broadleafcommerce.order.client.domain.OrderFulfillmentItemTaxDetail orderFulfillmentItemTaxDetail)
-
Field Details
-
DEFAULT_FULFILLMENT_TAX_NAME
Default name of theTaxDetailfor 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- TheFulfillmentItemon 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- TheFulfillmentItemon 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- TheOrderFulfillmentto 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- TheFulfillmentItemon 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- TheFulfillmentGroupwhoseFulfillmentItem'scontain 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- TheOrderFulfillmentto 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- TheOrderFulfillmentto 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- TheOrderFulfillmentItemon 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
-