P
- as productU
- as userpublic class DefaultTaxStrategy<P extends Product,U extends User> extends AbstractChargeStrategy<P,U> implements TaxStrategy<P,U>
taxStrategy
productService, scanHierarchy
Constructor and Description |
---|
DefaultTaxStrategy() |
Modifier and Type | Method and Description |
---|---|
<CONTEXT> Amount |
calculate(P product,
Number quantity,
U user,
String currency,
List<PromotionForUser> promotions,
CONTEXT context)
Assumes tax data is represented in %, Number and the calculation is is a Tax% on (sale or regular price).
|
<DATA> DATA |
getTaxDataForProduct(P product)
Taxes are ususally applicable to all components
So provide convenient reusable method for getting Tax Data
By Default this matches DefaultTaxStrategy and gets data for #getRepresentativeProduct(Product, "taxData") |
Boolean |
getTaxReverseCaculated()
If true implies any Taxation amount should not be Added to the
Amount.getTotal()
and that for all calculations the tax is inclusive, but the calculation available in Amount.getTax()
If false; one should Add include the tax over the Amount.getBase() to get the Amount.getTotal() |
void |
setTaxReverseCaculated(Boolean taxReverseCaculated)
If true implies any Taxation amount should not be Added to the
Amount.getTotal()
and that for all calculations the tax is inclusive, but the calculation available in Amount.getTax()
If false; one should Add include the tax over the Amount.getBase() to get the Amount.getTotal() |
applyTax, calculate, getTaxStrategy, getVersion, setTaxStrategy
getProductService, getRepresentativeProduct, isScanHierarchy, setProductService, setScanHierarchy
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
calculate
getVersion
public <CONTEXT> Amount calculate(P product, Number quantity, U user, String currency, List<PromotionForUser> promotions, CONTEXT context)
calculate
in interface ChargeStrategy<P extends Product,U extends User>
product
- as Pquantity
- as Numberuser
- as U @NUllable truecurrency
- as String @nullable true. A null implies default currencyAmount
with Amount.getTax()
representing the tax and Amount.getTaxReverseCaculated()
is the Tax is
already available in final Price, and just provided here for Reverse Calculations.public Boolean getTaxReverseCaculated()
Amount.getTotal()
and that for all calculations the tax is inclusive, but the calculation available in Amount.getTax()
Amount.getBase()
to get the Amount.getTotal()
getTaxReverseCaculated
in interface TaxStrategy<P extends Product,U extends User>
public void setTaxReverseCaculated(Boolean taxReverseCaculated)
Amount.getTotal()
and that for all calculations the tax is inclusive, but the calculation available in Amount.getTax()
Amount.getBase()
to get the Amount.getTotal()
public <DATA> DATA getTaxDataForProduct(P product)
DefaultTaxStrategy
and gets data for #getRepresentativeProduct(Product, "taxData")
getTaxDataForProduct
in interface TaxStrategy<P extends Product,U extends User>
product
- Copyright © 2018. All rights reserved.