mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-03-03 17:36:59 +01:00
Fix: Lightning Listener not listening on Lightning payment after activating when using lazy payments (#2524)
This commit is contained in:
parent
a8cf6ee8a2
commit
778a0f7e8d
4 changed files with 33 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
||||||
using BTCPayServer.Services.Invoices;
|
using BTCPayServer.Services.Invoices;
|
||||||
|
|
||||||
namespace BTCPayServer.Events
|
namespace BTCPayServer.Events
|
||||||
{
|
{
|
||||||
|
|
24
BTCPayServer/Events/InvoicePaymentMethodActivated.cs
Normal file
24
BTCPayServer/Events/InvoicePaymentMethodActivated.cs
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
using BTCPayServer.Payments;
|
||||||
|
using BTCPayServer.Services.Invoices;
|
||||||
|
|
||||||
|
namespace BTCPayServer.Events
|
||||||
|
{
|
||||||
|
public class InvoicePaymentMethodActivated : IHasInvoiceId
|
||||||
|
{
|
||||||
|
public PaymentMethodId PaymentMethodId { get; }
|
||||||
|
public InvoiceEntity InvoiceEntity { get; }
|
||||||
|
|
||||||
|
public InvoicePaymentMethodActivated(PaymentMethodId paymentMethodId, InvoiceEntity invoiceEntity)
|
||||||
|
{
|
||||||
|
PaymentMethodId = paymentMethodId;
|
||||||
|
InvoiceEntity = invoiceEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string InvoiceId => InvoiceEntity.Id;
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return $"Invoice {InvoiceId} activated payment method {PaymentMethodId}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -168,6 +168,13 @@ namespace BTCPayServer.Payments.Lightning
|
||||||
}
|
}
|
||||||
|
|
||||||
}));
|
}));
|
||||||
|
leases.Add(_Aggregator.Subscribe<Events.InvoicePaymentMethodActivated>(async inv =>
|
||||||
|
{
|
||||||
|
if (inv.PaymentMethodId.PaymentType == LightningPaymentType.Instance)
|
||||||
|
{
|
||||||
|
_CheckInvoices.Writer.TryWrite(inv.InvoiceId);
|
||||||
|
}
|
||||||
|
}));
|
||||||
_CheckingInvoice = CheckingInvoice(_Cts.Token);
|
_CheckingInvoice = CheckingInvoice(_Cts.Token);
|
||||||
_ListenPoller = new Timer(async s =>
|
_ListenPoller = new Timer(async s =>
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,6 +33,7 @@ namespace BTCPayServer.Services.Invoices
|
||||||
prepare);
|
prepare);
|
||||||
eligibleMethodToActivate.SetPaymentMethodDetails(newDetails);
|
eligibleMethodToActivate.SetPaymentMethodDetails(newDetails);
|
||||||
await invoiceRepository.UpdateInvoicePaymentMethod(invoice.Id, eligibleMethodToActivate);
|
await invoiceRepository.UpdateInvoicePaymentMethod(invoice.Id, eligibleMethodToActivate);
|
||||||
|
eventAggregator.Publish(new InvoicePaymentMethodActivated(paymentMethodId, invoice));
|
||||||
}
|
}
|
||||||
catch (PaymentMethodUnavailableException ex)
|
catch (PaymentMethodUnavailableException ex)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue