mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 14:34:23 +01:00
Allow cancelling a non paid pending invoice in payment requests (#815)
* allow cancel on un paid new invoices in payment requests * start work on cancel pr payment * finish up cancel action * final touch and add tests
This commit is contained in:
committed by
Nicolas Dorier
parent
60a361f963
commit
be844978c1
@@ -80,6 +80,7 @@ namespace BTCPayServer.PaymentRequest
|
||||
|
||||
var paymentStats = _AppService.GetContributionsByPaymentMethodId(blob.Currency, invoices, true);
|
||||
var amountDue = blob.Amount - paymentStats.TotalCurrency;
|
||||
var pendingInvoice = invoices.SingleOrDefault(entity => entity.Status == InvoiceStatus.New);
|
||||
|
||||
return new ViewPaymentRequestViewModel(pr)
|
||||
{
|
||||
@@ -90,7 +91,9 @@ namespace BTCPayServer.PaymentRequest
|
||||
AmountDueFormatted = _currencies.FormatCurrency(amountDue, blob.Currency),
|
||||
CurrencyData = _currencies.GetCurrencyData(blob.Currency, true),
|
||||
LastUpdated = DateTime.Now,
|
||||
AnyPendingInvoice = invoices.Any(entity => entity.Status == InvoiceStatus.New),
|
||||
AnyPendingInvoice = pendingInvoice != null,
|
||||
PendingInvoiceHasPayments = pendingInvoice != null &&
|
||||
pendingInvoice.ExceptionStatus != InvoiceExceptionStatus.None,
|
||||
Invoices = invoices.Select(entity => new ViewPaymentRequestViewModel.PaymentRequestInvoice()
|
||||
{
|
||||
Id = entity.Id,
|
||||
|
||||
Reference in New Issue
Block a user