public interface CalculationService
FindDiscountValuesStrategy, FindTaxValuesStrategy, FindPriceStrategy. Also payment and
delivery costs are resolved using strategies FindDeliveryCostStrategy and FindPaymentCostStrategy.
Whether order needs to be calculated or not is up to the implementation of OrderRequiresCalculationStrategy.
All methods should be executed in transaction.| Modifier and Type | Method and Description |
|---|---|
void |
calculate(AbstractOrderModel order)
Calculates the given order and all its entries unless they're already calculated and the order has not been
modified.
|
void |
calculate(AbstractOrderModel order,
java.util.Date date)
Calculates the given order and all its entries unless they're already calculated and the order has not been
modified.
|
void |
calculateTotals(AbstractOrderEntryModel entry,
boolean recalculate)
Recalculates given entries total prices and re-applies tax and discount values.
|
void |
calculateTotals(AbstractOrderModel order,
boolean recalculate)
(re)calculates all totals for the given order.
|
void |
recalculate(AbstractOrderEntryModel entry)
Calculates this entry even if the entry was calculated before.
|
void |
recalculate(AbstractOrderModel order)
recalculates the whole order and all its entries.
|
void |
recalculate(AbstractOrderModel order,
java.util.Date date)
recalculates the whole order and all its entries.
|
boolean |
requiresCalculation(AbstractOrderModel order)
Return
Boolean.TRUE in case if order needs to be calculated. |
void calculate(AbstractOrderModel order) throws CalculationException
So this method will fetch prices, taxes and discounts (using spring configurable strategies) for uncalculated or modified entries only - all other will remain unchanged. If at least one entry has been calculated or the order itself has been modified the totals will be calculated as well.
if you merely like to adjust totals while keeping prices, taxes and discounts you should call
calculateTotals(AbstractOrderModel, boolean) instead (e.g. if just a quantity has changed or prices have
been imported and cannot be found via price factory ).
order - target AbstractOrderModelCalculationException - if a pricefactory error occurred.boolean requiresCalculation(AbstractOrderModel order)
Boolean.TRUE in case if order needs to be calculated. Default implementation use
calculationStrategy to get this information.void calculate(AbstractOrderModel order, java.util.Date date) throws CalculationException
So this method will fetch prices, taxes and discounts (using spring configured strategies) for uncalculated or modified entries only - all other will remain unchanged. If at least one entry has been calculated or the order itself has been modified the totals will be calculated as well.
if you merely like to adjust totals while keeping prices, taxes and discounts you should call
calculateTotals(AbstractOrderModel, boolean) instead (e.g. if just a quantity has changed or prices have
been imported and cannot be found via price factory ).
order - target AbstractOrderModeldate - assumes a given date to perform calculations for - be careful with that since this method will calculate
modified or uncalculated entries only, so the given date may not apply to all entries!CalculationException - if a pricefactory error occurredvoid recalculate(AbstractOrderModel order) throws CalculationException
if you merely like to adjust totals while keeping prices, taxes and discounts you should call
calculateTotals(AbstractOrderModel, boolean) instead (e.g. if just a quantity has changed or prices have
been imported and cannot be found via price factory ).
order - target AbstractOrderModelCalculationException - if a pricefactory error occurred.void recalculate(AbstractOrderModel order, java.util.Date date) throws CalculationException
FindPriceStrategy,
FindDeliveryCostStrategy, FindTaxValuesStrategy, etc... ).
if you merely like to adjust totals while keeping prices, taxes and discounts you should call
calculateTotals(AbstractOrderModel, boolean) instead (e.g. if just a quantity has changed or prices have
been imported and cannot be found via price factory ).
order - target AbstractOrderModeldate - the date to calculate prices forCalculationException - if a pricefactory error occurredvoid calculateTotals(AbstractOrderModel order, boolean recalculate) throws CalculationException
order - target AbstractOrderModelrecalculate - forces setting total even if order is marked as calculatedCalculationExceptionvoid calculateTotals(AbstractOrderEntryModel entry, boolean recalculate)
entry - target AbstractOrderEntryModelrecalculate - forces the recalculation of the abstract order entry.void recalculate(AbstractOrderEntryModel entry) throws CalculationException
If prices should be left as currently set but the entry totals have to be consolidated (e.g. when the quantity has
changed) call calculateTotals(AbstractOrderEntryModel,boolean) instead !
entry - target AbstractOrderEntryModelCalculationException - if a pricefactory error occurredCopyright © 2018 SAP SE. All Rights Reserved.