public class OrderUtils extends Object
| Constructor and Description |
|---|
OrderUtils() |
| Modifier and Type | Method and Description |
|---|---|
BigDecimal |
applyRounding(BigDecimal price,
String currencyIsoCode)
Applies the scaling and rounding to a given price, based on declared currency code
|
BigDecimal |
convertCurrency(String sourceCurrencyIsoCode,
String targetCurrencyIsoCode,
BigDecimal sourceValue)
given the source and target currency codes, converts the value from one currency to another
|
OrderCharge |
createShippingCharge(Currency currency,
boolean absolute,
BigDecimal value)
Creates an
OrderCharge of AbstractCharge.ChargeType.SHIPPING for the given values. |
protected CommonI18NService |
getCommonI18NService() |
protected CurrencyModel |
getCurrency(String currencyCode) |
protected Optional<Integer> |
getDigitsOfCurrency(String currencyIsoCode) |
protected OrderEntryModel |
getEntry(List<OrderEntryModel> entries,
Integer entryNumber) |
protected Map<OrderEntryModel,Long> |
getEntryQuantityMap(OrderModel order,
Map<Integer,Long> quantities) |
protected ModelService |
getModelService() |
void |
setCommonI18NService(CommonI18NService commonI18NService) |
void |
setModelService(ModelService modelService) |
void |
updateOrderQuantities(OrderModel order,
Map<Integer,Long> quantities)
Updates multiple order entry quantities at once.
|
public OrderCharge createShippingCharge(Currency currency, boolean absolute, BigDecimal value)
OrderCharge of AbstractCharge.ChargeType.SHIPPING for the given values.currency - the currency to useabsolute - whether the shipping charge is percentage-based or absolute.value - the value of the chargepublic BigDecimal applyRounding(BigDecimal price, String currencyIsoCode)
price - - the value to apply the rounding tocurrencyIsoCode - - currency codepublic BigDecimal convertCurrency(String sourceCurrencyIsoCode, String targetCurrencyIsoCode, BigDecimal sourceValue)
sourceCurrencyIsoCode - - source currency codetargetCurrencyIsoCode - - target currency codesourceValue - - the source value to apply the conversion forprotected CurrencyModel getCurrency(String currencyCode) throws RuleEvaluationException
RuleEvaluationExceptionpublic void updateOrderQuantities(OrderModel order, Map<Integer,Long> quantities)
order - the order to update order entry quantities atquantities - the entry specific quantities as map of { entry number -> quantity }protected Map<OrderEntryModel,Long> getEntryQuantityMap(OrderModel order, Map<Integer,Long> quantities)
protected OrderEntryModel getEntry(List<OrderEntryModel> entries, Integer entryNumber)
protected CommonI18NService getCommonI18NService()
public void setCommonI18NService(CommonI18NService commonI18NService)
protected ModelService getModelService()
public void setModelService(ModelService modelService)
Copyright © 2017 SAP SE. All Rights Reserved.