mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 14:34:23 +01:00
Payment Settled Webhook event (#2944)
* Payment Settled Webhook event resolves #2691 * Move payment methods to payment services
This commit is contained in:
@@ -9,6 +9,7 @@ using System.Threading;
|
||||
using System.Threading.Channels;
|
||||
using System.Threading.Tasks;
|
||||
using BTCPayServer.Client.Models;
|
||||
using BTCPayServer.Controllers.GreenField;
|
||||
using BTCPayServer.Data;
|
||||
using BTCPayServer.Events;
|
||||
using BTCPayServer.Logging;
|
||||
@@ -183,6 +184,8 @@ namespace BTCPayServer.HostedServices
|
||||
return new WebhookInvoiceEvent(WebhookEventType.InvoiceCreated);
|
||||
case WebhookEventType.InvoiceReceivedPayment:
|
||||
return new WebhookInvoiceReceivedPaymentEvent(WebhookEventType.InvoiceReceivedPayment);
|
||||
case WebhookEventType.InvoicePaymentSettled:
|
||||
return new WebhookInvoicePaymentSettledEvent(WebhookEventType.InvoicePaymentSettled);
|
||||
case WebhookEventType.InvoiceProcessing:
|
||||
return new WebhookInvoiceProcessingEvent(WebhookEventType.InvoiceProcessing);
|
||||
case WebhookEventType.InvoiceExpired:
|
||||
@@ -232,7 +235,16 @@ namespace BTCPayServer.HostedServices
|
||||
case InvoiceEventCode.ReceivedPayment:
|
||||
return new WebhookInvoiceReceivedPaymentEvent(WebhookEventType.InvoiceReceivedPayment)
|
||||
{
|
||||
AfterExpiration = invoiceEvent.Invoice.Status.ToModernStatus() == InvoiceStatus.Expired || invoiceEvent.Invoice.Status.ToModernStatus() == InvoiceStatus.Invalid
|
||||
AfterExpiration = invoiceEvent.Invoice.Status.ToModernStatus() == InvoiceStatus.Expired || invoiceEvent.Invoice.Status.ToModernStatus() == InvoiceStatus.Invalid,
|
||||
PaymentMethod = invoiceEvent.Payment.GetPaymentMethodId().ToStringNormalized(),
|
||||
Payment = GreenFieldInvoiceController.ToPaymentModel(invoiceEvent.Invoice, invoiceEvent.Payment)
|
||||
};
|
||||
case InvoiceEventCode.PaymentSettled:
|
||||
return new WebhookInvoiceReceivedPaymentEvent(WebhookEventType.InvoicePaymentSettled)
|
||||
{
|
||||
AfterExpiration = invoiceEvent.Invoice.Status.ToModernStatus() == InvoiceStatus.Expired || invoiceEvent.Invoice.Status.ToModernStatus() == InvoiceStatus.Invalid,
|
||||
PaymentMethod = invoiceEvent.Payment.GetPaymentMethodId().ToStringNormalized(),
|
||||
Payment = GreenFieldInvoiceController.ToPaymentModel(invoiceEvent.Invoice, invoiceEvent.Payment)
|
||||
};
|
||||
default:
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user