Class ExchangeRateApiInfoProvider

  • All Implemented Interfaces:
    ExchangeRateInfoProvider

    @ConfigurationProperties(prefix="broadleaf.pricing.exchangeapi")
    public class ExchangeRateApiInfoProvider
    extends Object
    implements ExchangeRateInfoProvider
    This sample ExchangeRateInfoProvider uses an API endpoint to retrieve exchange data. It is modeled as an example for calling the "https://api.exchangeratesapi.io/" apis. The results of this API are not warranted anyway. This class provides an example call to the exchangeapi endpoint and is intended as an example. Implementations are responsible for evaluating the use of this API in production.
    Author:
    Brian Polster (bpolster)
    • Constructor Detail

      • ExchangeRateApiInfoProvider

        public ExchangeRateApiInfoProvider​(@NonNull
                                           @NonNull org.springframework.web.reactive.function.client.WebClient webClient)
    • Method Detail

      • appendBase

        public void appendBase​(org.springframework.web.util.UriComponentsBuilder builder,
                               Optional<String> requestedBaseCurrency)
      • appendSymbols

        public void appendSymbols​(org.springframework.web.util.UriComponentsBuilder builder)
      • getWebClient

        @NonNull
        public @NonNull org.springframework.web.reactive.function.client.WebClient getWebClient()
      • getApiUrl

        public String getApiUrl()
        The 3rd party url to call for exchange rate information.
      • getBaseParameter

        public String getBaseParameter()
        Parameter to use for constructing the base query.
      • getBaseValue

        public String getBaseValue()
        Value to use if baseCurrency is not specified, using null will use the exchangeRateApi default (currently Euro).
      • getSymbolsParameter

        public String getSymbolsParameter()
        Parameter to use to restrict currencies to convert to
      • getSymbolsValue

        public String getSymbolsValue()
        Used as a base parameter value if one is not provided. Use a comma separated list for more than one value. "GBP" or "GPB,EUR"
      • setApiUrl

        public void setApiUrl​(String apiUrl)
        The 3rd party url to call for exchange rate information.
      • setBaseParameter

        public void setBaseParameter​(String baseParameter)
        Parameter to use for constructing the base query.
      • setBaseValue

        public void setBaseValue​(String baseValue)
        Value to use if baseCurrency is not specified, using null will use the exchangeRateApi default (currently Euro).
      • setSymbolsParameter

        public void setSymbolsParameter​(String symbolsParameter)
        Parameter to use to restrict currencies to convert to
      • setSymbolsValue

        public void setSymbolsValue​(String symbolsValue)
        Used as a base parameter value if one is not provided. Use a comma separated list for more than one value. "GBP" or "GPB,EUR"
      • canEqual

        protected boolean canEqual​(Object other)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object