Beispiel #1
0
        public async Task <ForexDataResponse> GetLiveForexRates(string tenantId, [FromQuery] string source)
        {
            var ctx = new ForexServiceContext()
            {
                CorrelationId = HttpContext.TraceIdentifier,
                TenantId      = tenantId
            };

            return(await this._forexClient.GetLiveForexData(ctx, source));
        }
Beispiel #2
0
        public async Task <SupportedCurrenciesResponse> GetSupportedCurrenciesAsync(string tenantId)
        {
            var ctx = new ForexServiceContext()
            {
                CorrelationId = HttpContext.TraceIdentifier,
                TenantId      = tenantId
            };

            return(await this._forexClient.GetSupportedCurrenciesAsync(ctx));
        }
        public async Task <SupportedCurrenciesResponse> GetSupportedCurrenciesAsync(ForexServiceContext ctx)
        {
            //Get Access Key from vault;
            var accessKey = this._options.AccessKey;

            var supportedCurrencies = await this._currencyLayerClient.GetSupportedCurrenciesAsync(accessKey);

            return(new SupportedCurrenciesResponse()
            {
                Currencies = supportedCurrencies.Currencies,
                Success = supportedCurrencies.Success,
                ErrorMsg = supportedCurrencies?.Error?.Info
            });
        }
        public async Task <ForexDataResponse> GetLiveForexData(ForexServiceContext ctx, string source)
        {
            var accessKey = this._options.AccessKey;
            var liveData  = await this._currencyLayerClient.GetLiveForexData(accessKey, source);

            //use Automapper here

            return(new ForexDataResponse()
            {
                Quotes = liveData.Quotes,
                Success = liveData.Success,
                ErrorMsg = liveData?.Error?.Info,
                RatesAt = liveData.CurrentDateTime
            });
        }
Beispiel #5
0
 public async Task <SupportedCurrenciesResponse> GetSupportedCurrenciesAsync(ForexServiceContext ctx)
 {
     return(await this._forexService.GetSupportedCurrenciesAsync(ctx));
 }
Beispiel #6
0
 public async Task <ForexDataResponse> GetLiveForexData(ForexServiceContext ctx, string source)
 {
     return(await this._forexService.GetLiveForexData(ctx, source));
 }