Fix GetInvoicesWithPendingPayments

This commit is contained in:
nicolas.dorier 2024-09-18 18:11:15 +09:00
parent 2d2c1d5f2d
commit df651a2157
No known key found for this signature in database
GPG key ID: 6618763EF09186FE

View file

@ -93,8 +93,9 @@ namespace BTCPayServer.Services.Invoices
public async Task<InvoiceEntity[]> GetInvoicesWithPendingPayments(PaymentMethodId paymentMethodId, bool includeAddresses = false)
{
var pmi = paymentMethodId.ToString();
using var ctx = _applicationDbContextFactory.CreateContext();
var invoiceIds = (await ctx.Payments.Where(p => PaymentData.IsPending(p.Status)).Select(p => p.InvoiceDataId).ToArrayAsync()).Distinct().ToArray();
var invoiceIds = (await ctx.Payments.Where(p => PaymentData.IsPending(p.Status) && p.Type == pmi).Select(p => p.InvoiceDataId).ToArrayAsync()).Distinct().ToArray();
if (invoiceIds.Length is 0)
return Array.Empty<InvoiceEntity>();
return await GetInvoices(new InvoiceQuery()