Interface CurrencyConversionService

All Known Implementing Classes:
DefaultCurrencyConversionService, NoOpCurrencyConversionService

public interface CurrencyConversionService
Implementations of this service provide support for currency conversions.
Author:
Brian Polster (bpolster)
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    canCovert(javax.money.CurrencyUnit from, javax.money.CurrencyUnit to)
    Determine if conversion support is available based on a currencyCode from and to.
    javax.money.MonetaryAmount
    convert(javax.money.MonetaryAmount fromAmount, javax.money.CurrencyUnit toCurrency)
    Return a MonetaryAmount by applying a currency conversion from the fromAmount to the target currency.
    <P extends com.broadleafcommerce.pricing.client.domain.PriceInfo>
    void
    populateCurrencyConversionDetails(Collection<P> priceInfos, com.broadleafcommerce.pricing.client.domain.context.PriceInfoContext priceInfoContext, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Converts the currencies on the priceable fields on the priceInfos from the existing currency into the PriceInfoContext.getRequestedCurrency().
  • Method Details

    • canCovert

      boolean canCovert(javax.money.CurrencyUnit from, javax.money.CurrencyUnit to)
      Determine if conversion support is available based on a currencyCode from and to.
      Parameters:
      from - The currency to convert from.
      to - The currency to convert to.
      Returns:
      whether the currency can be converted
    • convert

      javax.money.MonetaryAmount convert(javax.money.MonetaryAmount fromAmount, javax.money.CurrencyUnit toCurrency)
      Return a MonetaryAmount by applying a currency conversion from the fromAmount to the target currency.
      Parameters:
      fromAmount - The MonetaryAmount to convert.
      toCurrency - The currency to convert to.
      Returns:
      A MonetaryAmount in the target currency.
    • populateCurrencyConversionDetails

      <P extends com.broadleafcommerce.pricing.client.domain.PriceInfo> void populateCurrencyConversionDetails(Collection<P> priceInfos, com.broadleafcommerce.pricing.client.domain.context.PriceInfoContext priceInfoContext, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Converts the currencies on the priceable fields on the priceInfos from the existing currency into the PriceInfoContext.getRequestedCurrency(). The converted currencies are stored on the PriceInfo.getConvertedPriceTypeDetails().
      Parameters:
      priceInfos - The priceInfos having the currencies to convert.
      priceInfoContext - The PriceInfoContext containing the requested currency of the cart.
      contextInfo - Context information regarding the current API request
      Since:
      Pricing Services 2.2.0, Release Train 2.3.0