diff --git a/BTCPayServer/BTCPayServer.csproj b/BTCPayServer/BTCPayServer.csproj index 337c8dfe4..053b1a092 100644 --- a/BTCPayServer/BTCPayServer.csproj +++ b/BTCPayServer/BTCPayServer.csproj @@ -2,7 +2,7 @@ Exe netcoreapp2.0 - 1.0.2.8 + 1.0.2.9 NU1701,CA1816,CA1308,CA1810,CA2208 diff --git a/BTCPayServer/Controllers/RateController.cs b/BTCPayServer/Controllers/RateController.cs index 35a000497..9f5f9a4a2 100644 --- a/BTCPayServer/Controllers/RateController.cs +++ b/BTCPayServer/Controllers/RateController.cs @@ -36,11 +36,12 @@ namespace BTCPayServer.Controllers [BitpayAPIConstraint] public async Task GetRates(string currencyPairs, string storeId) { + storeId = storeId ?? this.HttpContext.GetStoreData()?.Id; var result = await GetRates2(currencyPairs, storeId); - var rates = (result as JsonResult)?.Value as NBitpayClient.Rate[]; + var rates = (result as JsonResult)?.Value as Rate[]; if (rates == null) return result; - return Json(new DataWrapper(rates)); + return Json(new DataWrapper(rates)); } [Route("api/rates")] @@ -54,8 +55,9 @@ namespace BTCPayServer.Controllers return result; } - - var store = await _StoreRepo.FindStore(storeId); + var store = this.HttpContext.GetStoreData(); + if(store == null || store.Id != storeId) + store = await _StoreRepo.FindStore(storeId); if (store == null) { var result = Json(new BitpayErrorsModel() { Error = "Store not found" }); @@ -86,6 +88,7 @@ namespace BTCPayServer.Controllers { CryptoCode = r.Pair.Left, Code = r.Pair.Right, + CurrencyPair = r.Pair.ToString(), Name = _CurrencyNameTable.GetCurrencyData(r.Pair.Right)?.Name, Value = r.Value.Value }).Where(n => n.Name != null).ToArray()); @@ -106,6 +109,14 @@ namespace BTCPayServer.Controllers get; set; } + + [JsonProperty(PropertyName = "currencyPair")] + public string CurrencyPair + { + get; + set; + } + [JsonProperty(PropertyName = "code")] public string Code {