Class CurrencyUtils

java.lang.Object
de.hybris.platform.ruleengineservices.util.CurrencyUtils

public class CurrencyUtils extends Object
The class provides some utility methods related to Currency functionality.
  • Constructor Details

    • CurrencyUtils

      public CurrencyUtils()
  • Method Details

    • applyRounding

      public BigDecimal applyRounding(BigDecimal price, String currencyIsoCode)
      Applies the scaling and rounding to a given price, based on declared currency code
      Parameters:
      price - - the value to apply the rounding to
      currencyIsoCode - - currency code
      Returns:
      the rounded price
    • convertCurrency

      public BigDecimal convertCurrency(String sourceCurrencyIsoCode, String targetCurrencyIsoCode, BigDecimal sourceValue)
      Given the source and target currency codes, converts the value from one currency to another
      Parameters:
      sourceCurrencyIsoCode - - source currency code
      targetCurrencyIsoCode - - target currency code
      sourceValue - - the source value to apply the conversion for
      Returns:
      the converted value
    • getDigitsOfCurrency

      public Optional<Integer> getDigitsOfCurrency(String currencyIsoCode)
      Provides number of digits defined for the currency that identifies itself by the provided currency iso code
      Parameters:
      currencyIsoCode - currency ISO code
      Returns:
      number of digits for the currency identified by the provided currency code
    • getDigitsOfCurrencyOrDefault

      public Integer getDigitsOfCurrencyOrDefault(String currencyIsoCode)
      Provides number of digits defined for the currency that identifies itself by the provided currency iso code
      Parameters:
      currencyIsoCode - currency ISO code
      Returns:
      number of digits for the currency identified by the provided currency code or default value
    • getCurrency

      public CurrencyModel getCurrency(String currencyCode)
      Provides an instance of CurrencyModel for a given currency code
      Parameters:
      currencyCode - currency code
      Returns:
      instance of CurrencyModel that matches provided currency code
    • getCommonI18NService

      protected CommonI18NService getCommonI18NService()
    • setCommonI18NService

      public void setCommonI18NService(CommonI18NService commonI18NService)