Make InvoicePaymentSettled return correct afterExpiration value

fixes #3966
This commit is contained in:
Kukks
2022-08-01 11:16:26 +02:00
parent c53fcde12a
commit 2317a7df55
2 changed files with 7 additions and 3 deletions

View File

@@ -540,7 +540,7 @@ namespace BTCPayServer.Services.Invoices
return invoice;
}
private InvoiceEntity ToEntity(Data.InvoiceData invoice)
public InvoiceEntity ToEntity(Data.InvoiceData invoice)
{
var entity = invoice.GetBlob(_btcPayNetworkProvider);
PaymentMethodDictionary paymentMethods = null;

View File

@@ -15,12 +15,16 @@ namespace BTCPayServer.Services.Invoices
{
private readonly ApplicationDbContextFactory _applicationDbContextFactory;
private readonly BTCPayNetworkProvider _btcPayNetworkProvider;
private readonly InvoiceRepository _invoiceRepository;
private readonly EventAggregator _eventAggregator;
public PaymentService(EventAggregator eventAggregator, ApplicationDbContextFactory applicationDbContextFactory, BTCPayNetworkProvider btcPayNetworkProvider)
public PaymentService(EventAggregator eventAggregator,
ApplicationDbContextFactory applicationDbContextFactory,
BTCPayNetworkProvider btcPayNetworkProvider, InvoiceRepository invoiceRepository)
{
_applicationDbContextFactory = applicationDbContextFactory;
_btcPayNetworkProvider = btcPayNetworkProvider;
_invoiceRepository = invoiceRepository;
_eventAggregator = eventAggregator;
}
/// <summary>
@@ -109,7 +113,7 @@ namespace BTCPayServer.Services.Invoices
foreach (KeyValuePair<string, (PaymentEntity entity, CryptoPaymentData)> payment in paymentsDict)
{
var dbPayment = dbPayments[payment.Key];
var invBlob = dbPayment.InvoiceData.GetBlob(_btcPayNetworkProvider);
var invBlob = _invoiceRepository.ToEntity(dbPayment.InvoiceData);
var dbPaymentEntity = dbPayment.GetBlob(_btcPayNetworkProvider);
var wasConfirmed = dbPayment.GetBlob(_btcPayNetworkProvider).GetCryptoPaymentData()
.PaymentConfirmed(dbPaymentEntity, invBlob.SpeedPolicy);