Webhooks: Re-add OverPaid property to WebhookInvoiceSettledEvent (#5538)

Fixes #5496.
This commit is contained in:
d11n 2023-12-06 01:21:04 +01:00 committed by GitHub
parent d050c8e3b2
commit 3f344f2c0c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 2 deletions

View file

@ -63,6 +63,7 @@ namespace BTCPayServer.Client.Models
}
public bool ManuallyMarked { get; set; }
public bool OverPaid { get; set; }
}
public class WebhookInvoiceInvalidEvent : WebhookInvoiceEvent

View file

@ -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<WebhookInvoiceProcessingEvent>(WebhookEventType.InvoiceProcessing,
c =>

View file

@ -72,7 +72,8 @@ public class InvoiceWebhookProvider : WebhookProvider<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);