public class DefaultOndemandTaxCalculationService extends java.lang.Object implements OndemandTaxCalculationService
OndemandTaxCalculationService to return the exact tax values for each unit of a line entry.
It is important to note that the tax values may not be perfectly divisible by the quantity which would result in a
loss of cents. The rounding scale is set to two as this is what the third parties will accept.| Constructor and Description |
|---|
DefaultOndemandTaxCalculationService() |
| Modifier and Type | Method and Description |
|---|---|
java.math.BigDecimal |
calculatePreciseUnitTax(java.util.Collection<TaxValue> taxValues,
double quantity,
boolean isNet)
Calculate the unit tax to send with a precision of 2.
|
java.lang.Double |
calculateShippingCost(AbstractOrderModel abstractOrder)
If the order is net the shipping cost is the delivery cost of the order otherwise the shipping cost is the
delivery cost of the order minus the difference of the order's total tax and all entry's tax.
|
java.math.BigDecimal |
calculateShippingTax(AbstractOrderModel abstractOrder)
Calculates the shipping tax.
|
java.math.BigDecimal |
calculateTotalTax(AbstractOrderModel abstractOrder) |
protected java.math.BigDecimal |
getGrossCalculatedTotalTax(AbstractOrderModel abstractOrder)
Method to calculate the total tax of the gross order entries' taxes that contributes to the order's total tax.
|
protected java.math.BigDecimal |
getOrderEntriesTotalTax(AbstractOrderModel abstractOrder)
Method to calculate the precise sum of the order entries' taxes.
|
public DefaultOndemandTaxCalculationService()
public java.math.BigDecimal calculatePreciseUnitTax(java.util.Collection<TaxValue> taxValues, double quantity, boolean isNet)
calculatePreciseUnitTax in interface OndemandTaxCalculationServicetaxValues - - taxValues associated with the order or order entryquantity - - quantity to determine the unit tax valueisNet - - boolean to determine which tax values need to be summedpublic java.math.BigDecimal calculateTotalTax(AbstractOrderModel abstractOrder)
calculateTotalTax in interface OndemandTaxCalculationServicepublic java.math.BigDecimal calculateShippingTax(AbstractOrderModel abstractOrder)
calculateShippingTax in interface OndemandTaxCalculationServiceabstractOrder - - the order for which to calculate the shipping costspublic java.lang.Double calculateShippingCost(AbstractOrderModel abstractOrder)
calculateShippingCost in interface OndemandTaxCalculationServiceprotected java.math.BigDecimal getGrossCalculatedTotalTax(AbstractOrderModel abstractOrder)
abstractOrder - protected java.math.BigDecimal getOrderEntriesTotalTax(AbstractOrderModel abstractOrder)
abstractOrder - Copyright © 2018 SAP SE. All Rights Reserved.