Fix build warnings (#3870)

Fixes #3866.
This commit is contained in:
d11n
2022-06-15 04:17:10 +02:00
committed by GitHub
parent 3abde67671
commit f48bb5a40a
6 changed files with 32 additions and 23 deletions

View File

@@ -2,21 +2,20 @@ namespace BTCPayServer.Client.Models;
public class AssetPairData
{
public AssetPairData()
{
}
public AssetPairData(string AssetBought, string AssetSold)
public AssetPairData(string assetBought, string assetSold)
{
this.AssetBought = AssetBought;
this.AssetSold = AssetSold;
AssetBought = assetBought;
AssetSold = assetSold;
}
public string AssetBought { set; get; }
public string AssetSold { set; get; }
public string ToString()
public override string ToString()
{
return AssetBought + "/" + AssetSold;
}

View File

@@ -44,7 +44,11 @@ namespace BTCPayServer.Controllers.Greenfield
return validationResult;
}
var defaultCurrency = (await _storeRepository.FindStore(storeId)).GetStoreBlob().DefaultCurrency;
var store = await _storeRepository.FindStore(storeId);
if (store == null)
return this.CreateAPIError(404, "store-not-found", "The store was not found");
var defaultCurrency = store.GetStoreBlob().DefaultCurrency;
var appData = new AppData
{
StoreDataId = storeId,

View File

@@ -86,7 +86,7 @@ namespace BTCPayServer.Controllers
[Authorize(Policy = Policies.CanViewStoreSettings, AuthenticationSchemes = AuthenticationSchemes.Cookie)]
public async Task<IActionResult> Invoice(string invoiceId)
{
var invoice = (await _InvoiceRepository.GetInvoices(new InvoiceQuery()
var invoice = (await _InvoiceRepository.GetInvoices(new InvoiceQuery
{
InvoiceId = new[] { invoiceId },
UserId = GetUserId(),
@@ -99,6 +99,9 @@ namespace BTCPayServer.Controllers
return NotFound();
var store = await _StoreRepository.FindStore(invoice.StoreId);
if (store == null)
return NotFound();
var invoiceState = invoice.GetInvoiceState();
var model = new InvoiceDetailsModel
{
@@ -541,7 +544,11 @@ namespace BTCPayServer.Controllers
var invoice = await _InvoiceRepository.GetInvoice(invoiceId);
if (invoice == null)
return null;
var store = await _StoreRepository.FindStore(invoice.StoreId);
if (store == null)
return null;
bool isDefaultPaymentId = false;
if (paymentMethodId is null)
{

View File

@@ -26,23 +26,22 @@ namespace BTCPayServer.HostedServices
Invoice = invoice;
}
public InvoiceEntity Invoice { get; set; }
public List<object> Events { get; set; } = new List<object>();
public List<object> Events { get; set; } = new ();
bool _Dirty = false;
private bool _Unaffect;
bool _dirty;
public void MarkDirty()
{
_Dirty = true;
_dirty = true;
}
public bool Dirty => _Dirty;
public bool Dirty => _dirty;
bool _IsBlobUpdated;
public bool IsBlobUpdated => _IsBlobUpdated;
bool _isBlobUpdated;
public bool IsBlobUpdated => _isBlobUpdated;
public void BlobUpdated()
{
_IsBlobUpdated = true;
_isBlobUpdated = true;
}
}
@@ -66,10 +65,10 @@ namespace BTCPayServer.HostedServices
_explorerClientProvider = explorerClientProvider;
_notificationSender = notificationSender;
_paymentService = paymentService;
this.Logs = logs;
Logs = logs;
}
readonly CompositeDisposable leases = new CompositeDisposable();
readonly CompositeDisposable _leases = new ();
private void UpdateInvoice(UpdateInvoiceContext context)
@@ -270,11 +269,11 @@ namespace BTCPayServer.HostedServices
_Loop = StartLoop(_Cts.Token);
_ = WaitPendingInvoices();
leases.Add(_eventAggregator.Subscribe<Events.InvoiceNeedUpdateEvent>(b =>
_leases.Add(_eventAggregator.Subscribe<Events.InvoiceNeedUpdateEvent>(b =>
{
Watch(b.InvoiceId);
}));
leases.Add(_eventAggregator.SubscribeAsync<Events.InvoiceEvent>(async b =>
_leases.Add(_eventAggregator.SubscribeAsync<Events.InvoiceEvent>(async b =>
{
if (InvoiceEventNotification.HandlesEvent(b.Name))
{
@@ -410,7 +409,7 @@ namespace BTCPayServer.HostedServices
{
if (_Cts == null)
return;
leases.Dispose();
_leases.Dispose();
_Cts.Cancel();
try
{

View File

@@ -130,7 +130,7 @@ namespace BTCPayServer.PayoutProcessors.OnChain
workingTx = txBuilder.BuildTransaction(true);
transfersProcessing.Add(transferRequest);
}
catch (NotEnoughFundsException e)
catch (NotEnoughFundsException)
{
failedAmount = blob.CryptoAmount;

View File

@@ -33,7 +33,7 @@ namespace BTCPayServer.Services.Stores
{
if (storeId == null)
return null;
using var ctx = _ContextFactory.CreateContext();
await using var ctx = _ContextFactory.CreateContext();
var result = await ctx.FindAsync<StoreData>(storeId).ConfigureAwait(false);
return result;
}