Repository: btcpayserver/btcpayserver (csharp)

Issue:
[Bug]: Webhook InvoiceSettled, field overPaid gone
### What is your BTCPay version?

BTCPay v1.11.7

### How did you deploy BTCPay Server?

docker

### What happened?

On the InvoiceSettled and InvoiceProcessing event the formerly available property `overPaid` is missing. This breaks implementations relying on that field.

See docs [here](https://docs.btcpayserver.org/API/Greenfield/v1/#operation/Webhook_InvoiceSettled) and [here](https://docs.btcpayserver.org/API/Greenfield/v1/#operation/Webhook_InvoiceProcessing)

Webhook:
```
{
"manuallyMarked": false,
"deliveryId": "LJMTFbSEobW7mpmAbfVzJv",
"webhookId": "V9YybsYgDaguxf98N54SJr",
"originalDeliveryId": "LJMTFbSEobW7mpmAbfVzJv",
"isRedelivery": false,
"type": "InvoiceSettled",
"timestamp": 1700562873,
"storeId": "HUZAUrnnsHztegnRKHhe9LQMcykQVq1Uaj8UyEbkgcWS",
"invoiceId": "4cLstvvUwbmTRpdQ3nAPCG",
"metadata": {
"orderId": "167",
"taxIncluded": 0
}
}
```

### How did you encounter this bug?

receiving and processing that webhook event causing an error

### Relevant log output

_No response_

### What browser do you use?

_No response_

### Additional information

_No response_

### Are you sure this is a bug report?

- [X] I confirm this is a bug report

Pull request:
Fixes #5496.

Patch:
diff --git a/BTCPayServer.Client/Models/WebhookInvoiceEvent.cs b/BTCPayServer.Client/Models/WebhookInvoiceEvent.cs
index e9fe448aab..d4b6945f6b 100644
--- a/BTCPayServer.Client/Models/WebhookInvoiceEvent.cs
+++ b/BTCPayServer.Client/Models/WebhookInvoiceEvent.cs
@@ -63,6 +63,7 @@ public WebhookInvoiceSettledEvent(string storeId) : base(WebhookEventType.Invoic
         }
 
         public bool ManuallyMarked { get; set; }
+        public bool OverPaid { get; set; }
     }
 
     public class WebhookInvoiceInvalidEvent : WebhookInvoiceEvent
diff --git a/BTCPayServer/HostedServices/Webhooks/InvoiceWebhookProvider.cs b/BTCPayServer/HostedServices/Webhooks/InvoiceWebhookProvider.cs
index 3cbe2c4072..d768c1d072 100644
--- a/BTCPayServer/HostedServices/Webhooks/InvoiceWebhookProvider.cs
+++ b/BTCPayServer/HostedServices/Webhooks/InvoiceWebhookProvider.cs
@@ -72,7 +72,8 @@ protected override WebhookInvoiceEvent GetWebhookEvent(InvoiceEvent invoiceEvent
             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);


Test patch:
diff --git a/BTCPayServer.Tests/UnitTest1.cs b/BTCPayServer.Tests/UnitTest1.cs
index d4d6a0d5b6..03e48594cd 100644
--- a/BTCPayServer.Tests/UnitTest1.cs
+++ b/BTCPayServer.Tests/UnitTest1.cs
@@ -1984,7 +1984,7 @@ public async Task InvoiceFlowThroughDifferentStatesCorrectly()
                 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 @@ public async Task InvoiceFlowThroughDifferentStatesCorrectly()
                 c =>
                 {
                     Assert.False(c.ManuallyMarked);
+                    Assert.True(c.OverPaid);
                 });
             user.AssertHasWebhookEvent<WebhookInvoiceProcessingEvent>(WebhookEventType.InvoiceProcessing,
                 c =>