diff --git a/BTCPayServer.Client/Models/WebhookInvoiceEvent.cs b/BTCPayServer.Client/Models/WebhookInvoiceEvent.cs index e9fe448aa..d4b6945f6 100644 --- a/BTCPayServer.Client/Models/WebhookInvoiceEvent.cs +++ b/BTCPayServer.Client/Models/WebhookInvoiceEvent.cs @@ -63,6 +63,7 @@ namespace BTCPayServer.Client.Models } public bool ManuallyMarked { get; set; } + public bool OverPaid { get; set; } } public class WebhookInvoiceInvalidEvent : WebhookInvoiceEvent diff --git a/BTCPayServer.Tests/UnitTest1.cs b/BTCPayServer.Tests/UnitTest1.cs index d4d6a0d5b..03e48594c 100644 --- a/BTCPayServer.Tests/UnitTest1.cs +++ b/BTCPayServer.Tests/UnitTest1.cs @@ -1984,7 +1984,7 @@ namespace BTCPayServer.Tests Assert.Single(textSearchResult); }); - invoice = user.BitPay.GetInvoice(invoice.Id, Facade.Merchant); + invoice = await user.BitPay.GetInvoiceAsync(invoice.Id, Facade.Merchant); Assert.Equal(1000.0m, invoice.TaxIncluded); Assert.Equal(5000.0m, invoice.Price); Assert.Equal(Money.Coins(0), invoice.BtcPaid); @@ -2104,6 +2104,7 @@ namespace BTCPayServer.Tests c => { Assert.False(c.ManuallyMarked); + Assert.True(c.OverPaid); }); user.AssertHasWebhookEvent(WebhookEventType.InvoiceProcessing, c => diff --git a/BTCPayServer/HostedServices/Webhooks/InvoiceWebhookProvider.cs b/BTCPayServer/HostedServices/Webhooks/InvoiceWebhookProvider.cs index 3cbe2c407..d768c1d07 100644 --- a/BTCPayServer/HostedServices/Webhooks/InvoiceWebhookProvider.cs +++ b/BTCPayServer/HostedServices/Webhooks/InvoiceWebhookProvider.cs @@ -72,7 +72,8 @@ public class InvoiceWebhookProvider : WebhookProvider case InvoiceEventCode.MarkedCompleted: return new WebhookInvoiceSettledEvent(storeId) { - ManuallyMarked = eventCode == InvoiceEventCode.MarkedCompleted + ManuallyMarked = eventCode == InvoiceEventCode.MarkedCompleted, + OverPaid = invoiceEvent.Invoice.ExceptionStatus == InvoiceExceptionStatus.PaidOver }; case InvoiceEventCode.Created: return new WebhookInvoiceEvent(WebhookEventType.InvoiceCreated, storeId);