mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 22:14:26 +01:00
Fix warnings
This commit is contained in:
@@ -622,7 +622,7 @@ retry:
|
|||||||
string currency = "USD")
|
string currency = "USD")
|
||||||
{
|
{
|
||||||
var storeController = user.GetController<UIStoresController>();
|
var storeController = user.GetController<UIStoresController>();
|
||||||
var vm = (RatesViewModel)((ViewResult)storeController.Rates()).Model;
|
var vm = (RatesViewModel)((ViewResult)await storeController.Rates()).Model;
|
||||||
vm.PrimarySource.PreferredExchange = exchange;
|
vm.PrimarySource.PreferredExchange = exchange;
|
||||||
await storeController.Rates(vm);
|
await storeController.Rates(vm);
|
||||||
var invoice2 = await user.BitPay.CreateInvoiceAsync(
|
var invoice2 = await user.BitPay.CreateInvoiceAsync(
|
||||||
|
|||||||
@@ -1286,7 +1286,7 @@ namespace BTCPayServer.Tests
|
|||||||
Assert.Equal(Money.Coins(1.0m), invoice1.BtcPrice);
|
Assert.Equal(Money.Coins(1.0m), invoice1.BtcPrice);
|
||||||
|
|
||||||
var storeController = user.GetController<UIStoresController>();
|
var storeController = user.GetController<UIStoresController>();
|
||||||
var vm = (RatesViewModel)((ViewResult)storeController.Rates()).Model;
|
var vm = (RatesViewModel)((ViewResult)await storeController.Rates()).Model;
|
||||||
Assert.Equal(0.0, vm.Spread);
|
Assert.Equal(0.0, vm.Spread);
|
||||||
vm.Spread = 40;
|
vm.Spread = 40;
|
||||||
await storeController.Rates(vm);
|
await storeController.Rates(vm);
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ $"You can't set the preferredSource if you are using custom scripts");
|
|||||||
.RateProviderFactory
|
.RateProviderFactory
|
||||||
.AvailableRateProviders
|
.AvailableRateProviders
|
||||||
.FirstOrDefault(s =>
|
.FirstOrDefault(s =>
|
||||||
s.Id.Equals(configuration.PreferredSource,
|
(s.Id ?? "").Equals(configuration.PreferredSource,
|
||||||
StringComparison.InvariantCultureIgnoreCase))?.Id;
|
StringComparison.InvariantCultureIgnoreCase))?.Id;
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(configuration.PreferredSource))
|
if (string.IsNullOrEmpty(configuration.PreferredSource))
|
||||||
|
|||||||
@@ -21,11 +21,11 @@ namespace BTCPayServer.Controllers;
|
|||||||
public partial class UIStoresController
|
public partial class UIStoresController
|
||||||
{
|
{
|
||||||
[HttpGet("{storeId}/rates")]
|
[HttpGet("{storeId}/rates")]
|
||||||
public IActionResult Rates()
|
public async Task<IActionResult> Rates()
|
||||||
{
|
{
|
||||||
var storeBlob = CurrentStore.GetStoreBlob();
|
var storeBlob = CurrentStore.GetStoreBlob();
|
||||||
var vm = new RatesViewModel();
|
var vm = new RatesViewModel();
|
||||||
SetViewModel(vm, storeBlob);
|
await SetViewModel(vm, storeBlob);
|
||||||
return View(vm);
|
return View(vm);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ public partial class UIStoresController
|
|||||||
|
|
||||||
if (!ModelState.IsValid)
|
if (!ModelState.IsValid)
|
||||||
{
|
{
|
||||||
SetViewModel(model, storeBlob);
|
await SetViewModel(model, storeBlob);
|
||||||
return View(model);
|
return View(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,7 +99,7 @@ public partial class UIStoresController
|
|||||||
}
|
}
|
||||||
else if (command == "Test")
|
else if (command == "Test")
|
||||||
{
|
{
|
||||||
SetViewModel(model, storeBlob);
|
await SetViewModel(model, storeBlob);
|
||||||
if (string.IsNullOrWhiteSpace(model.ScriptTest))
|
if (string.IsNullOrWhiteSpace(model.ScriptTest))
|
||||||
{
|
{
|
||||||
ModelState.AddModelError(nameof(model.ScriptTest), StringLocalizer["Fill out currency pair to test for (like {0})", "BTC_USD,BTC_CAD"]);
|
ModelState.AddModelError(nameof(model.ScriptTest), StringLocalizer["Fill out currency pair to test for (like {0})", "BTC_USD,BTC_CAD"]);
|
||||||
@@ -230,20 +230,20 @@ public partial class UIStoresController
|
|||||||
.OrderBy(s => s.DisplayName, StringComparer.OrdinalIgnoreCase).ToList();
|
.OrderBy(s => s.DisplayName, StringComparer.OrdinalIgnoreCase).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetViewModel(RatesViewModel vm, StoreBlob storeBlob)
|
private async Task SetViewModel(RatesViewModel vm, StoreBlob storeBlob)
|
||||||
{
|
{
|
||||||
vm.AvailableExchanges = GetAvailableExchanges();
|
vm.AvailableExchanges = GetAvailableExchanges();
|
||||||
vm.PrimarySource = new();
|
vm.PrimarySource = new();
|
||||||
vm.FallbackSource = new() { IsFallback = true };
|
vm.FallbackSource = new() { IsFallback = true };
|
||||||
SetViewModel(vm.PrimarySource, storeBlob.GetRateSettings(false), storeBlob);
|
await SetViewModel(vm.PrimarySource, storeBlob.GetRateSettings(false), storeBlob);
|
||||||
if (storeBlob.GetRateSettings(true) is { } r)
|
if (storeBlob.GetRateSettings(true) is { } r)
|
||||||
{
|
{
|
||||||
vm.HasFallback = true;
|
vm.HasFallback = true;
|
||||||
SetViewModel(vm.FallbackSource, r, storeBlob);
|
await SetViewModel(vm.FallbackSource, r, storeBlob);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetViewModel(vm.FallbackSource, new(), storeBlob);
|
await SetViewModel(vm.FallbackSource, new(), storeBlob);
|
||||||
}
|
}
|
||||||
|
|
||||||
vm.Spread = (double)(storeBlob.Spread * 100m);
|
vm.Spread = (double)(storeBlob.Spread * 100m);
|
||||||
|
|||||||
Reference in New Issue
Block a user