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 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.order.client.domain.OrderFulfillment orderFulfillment) Get the sum of all (merchandise and fulfillment) inclusive taxes from the givenOrderFulfillment.javax.money.MonetaryAmountgetFulfillmentIncludedTax(com.broadleafcommerce.order.client.domain.OrderFulfillment orderFulfillment) Get the sum of fulfillment inclusive taxes from the givenOrderFulfillment.javax.money.MonetaryAmountgetFulfillmentIncludedTax(com.broadleafcommerce.order.client.domain.OrderFulfillmentItem orderFulfillmentItem, javax.money.CurrencyUnit currency) Get the sum of fulfillment inclusive taxes from the givenOrderFulfillmentItem.javax.money.MonetaryAmountgetFulfillmentIncludedTax(OrderFulfillmentItemView orderFulfillmentItemView, javax.money.CurrencyUnit currency) Get the sum of fulfillment inclusive taxes from the givenOrderFulfillmentItemView.javax.money.MonetaryAmountgetFulfillmentIncludedTax(OrderFulfillmentView orderFulfillmentView) Get the sum of fulfillment inclusive taxes from the givenOrderFulfillmentView.javax.money.MonetaryAmountgetFulfillmentNonIncludedTax(com.broadleafcommerce.order.client.domain.OrderFulfillmentItem orderFulfillmentItem, javax.money.CurrencyUnit currency) Get the sum of fulfillment non-included taxes from the givenOrderFulfillmentItem.javax.money.MonetaryAmountgetFulfillmentNonIncludedTax(OrderFulfillmentItemView orderFulfillmentItemView, javax.money.CurrencyUnit currency) Get the sum of fulfillment non-included taxes from the givenOrderFulfillmentItemView.protected Stringjavax.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.javax.money.MonetaryAmountgetMerchIncludedTax(OrderFulfillmentItemView orderFulfillmentItemView, javax.money.CurrencyUnit currency) Get the sum of inclusive merchandise taxes from the givenOrderFulfillmentItemView.javax.money.MonetaryAmountgetMerchIncludedTax(OrderFulfillmentView orderFulfillmentView) Get the sum of merchandise inclusive taxes from the givenOrderFulfillmentView.protected booleanisExclusiveTax(com.broadleafcommerce.order.client.domain.OrderFulfillmentItemTaxDetail taxDetail) protected booleanisFulfillmentFeeTaxDetail(com.broadleafcommerce.order.client.domain.OrderFulfillmentItemTaxDetail taxDetail) protected booleanisFulfillmentTaxName(String taxName) protected booleanisInclusiveTax(com.broadleafcommerce.order.client.domain.OrderFulfillmentItemTaxDetail taxDetail) protected booleanisMerchandiseTaxDetail(com.broadleafcommerce.order.client.domain.OrderFulfillmentItemTaxDetail taxDetail) protected booleanprotected javax.money.MonetaryAmountsumTaxableAmount(com.broadleafcommerce.order.client.domain.OrderFulfillmentItemTaxDetail orderFulfillmentItemTaxDetail) protected javax.money.MonetaryAmountsumTaxCalculated(com.broadleafcommerce.order.client.domain.OrderFulfillmentItemTaxDetail orderFulfillmentItemTaxDetail) protected voidupdateIncludedTaxFields(com.broadleafcommerce.order.client.domain.OrderFulfillment orderFulfillment) protected voidupdateIncludedTaxFields(OrderFulfillmentView orderFulfillmentView) protected voidupdateItemTotal(com.broadleafcommerce.order.client.domain.OrderFulfillment orderFulfillment) protected voidupdateItemTotal(OrderFulfillmentView orderFulfillmentView) protected voidupdateNonIncludedTaxFields(com.broadleafcommerce.order.client.domain.OrderFulfillment orderFulfillment) protected voidupdateNonIncludedTaxFields(OrderFulfillmentView orderFulfillmentView) voidupdateTaxRelatedFields(com.broadleafcommerce.order.client.domain.OrderFulfillment orderFulfillment) voidupdateTaxRelatedFields(OrderFulfillmentView orderFulfillmentView)
-
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.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.
-
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- TheOrderFulfillmentItemto 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- TheOrderFulfillmentItemViewto 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- TheOrderFulfillmentViewto 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- TheOrderFulfillmentItemto operate on.currency- TheCurrencyUnitto 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- TheOrderFulfillmentItemViewto operate on.currency- TheCurrencyUnitto 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- TheOrderFulfillmentto 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- TheOrderFulfillmentViewto 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- TheOrderFulfillmentItemon 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- TheOrderFulfillmentItemViewon 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
-