/// <summary> /// Gets live rates regarding the passed currency /// </summary> /// <param name="currencyCode">Currency code; pass null to use primary exchange rate currency</param> /// <returns> /// A task that represents the asynchronous operation /// The task result contains the exchange rates /// </returns> public virtual async Task <IList <ExchangeRate> > GetCurrencyLiveRatesAsync(string currencyCode = null) { var exchangeRateProvider = await _exchangeRatePluginManager.LoadPrimaryPluginAsync() ?? throw new Exception("Active exchange rate provider cannot be loaded"); currencyCode ??= (await GetCurrencyByIdAsync(_currencySettings.PrimaryExchangeRateCurrencyId))?.CurrencyCode ?? throw new NopException("Primary exchange rate currency is not set"); return(await exchangeRateProvider.GetCurrencyLiveRatesAsync(currencyCode)); }
public async Task CanLoadActiveExchangeRateProvider() { var provider = await _exchangeRatePluginManager.LoadPrimaryPluginAsync(); provider.Should().NotBeNull(); }