Add boolean overPaid to the invoice settled webhook

This commit is contained in:
nicolas.dorier
2021-10-27 14:51:31 +09:00
parent 1ecd1c1e54
commit f7a0b91ec1
3 changed files with 13 additions and 1 deletions

View File

@@ -73,6 +73,7 @@ namespace BTCPayServer.Client.Models
public bool AfterExpiration { get; set; } public bool AfterExpiration { get; set; }
public string PaymentMethod { get; set; } public string PaymentMethod { get; set; }
public InvoicePaymentMethodDataModel.Payment Payment { get; set; } public InvoicePaymentMethodDataModel.Payment Payment { get; set; }
public bool OverPaid { get; set; }
} }
public class WebhookInvoicePaymentSettledEvent : WebhookInvoiceReceivedPaymentEvent public class WebhookInvoicePaymentSettledEvent : WebhookInvoiceReceivedPaymentEvent

View File

@@ -244,7 +244,8 @@ namespace BTCPayServer.HostedServices
{ {
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(), PaymentMethod = invoiceEvent.Payment.GetPaymentMethodId().ToStringNormalized(),
Payment = GreenFieldInvoiceController.ToPaymentModel(invoiceEvent.Invoice, invoiceEvent.Payment) Payment = GreenFieldInvoiceController.ToPaymentModel(invoiceEvent.Invoice, invoiceEvent.Payment),
OverPaid = invoiceEvent.Invoice.ExceptionStatus == InvoiceExceptionStatus.PaidOver,
}; };
default: default:
return null; return null;

View File

@@ -674,6 +674,16 @@
"nullable": false "nullable": false
} }
} }
},
{
"type": "object",
"properties": {
"overPaid": {
"type": "boolean",
"description": "Whether this invoice has received more money than expected",
"nullable": false
}
}
} }
] ]
}, },