diff --git a/BTCPayServer/Models/PaymentRequestViewModels/ListPaymentRequestsViewModel.cs b/BTCPayServer/Models/PaymentRequestViewModels/ListPaymentRequestsViewModel.cs
index c3f189c0b..a76ab1f08 100644
--- a/BTCPayServer/Models/PaymentRequestViewModels/ListPaymentRequestsViewModel.cs
+++ b/BTCPayServer/Models/PaymentRequestViewModels/ListPaymentRequestsViewModel.cs
@@ -159,6 +159,7 @@ namespace BTCPayServer.Models.PaymentRequestViewModels
public DateTime ReceivedDate { get; set; }
public string Link { get; set; }
public string Id { get; set; }
+ public string Destination { get; set; }
}
}
}
diff --git a/BTCPayServer/PaymentRequest/PaymentRequestService.cs b/BTCPayServer/PaymentRequest/PaymentRequestService.cs
index 4655327d1..9b47e6b45 100644
--- a/BTCPayServer/PaymentRequest/PaymentRequestService.cs
+++ b/BTCPayServer/PaymentRequest/PaymentRequestService.cs
@@ -102,6 +102,44 @@ namespace BTCPayServer.PaymentRequest
Invoices = invoices.Select(entity =>
{
var state = entity.GetInvoiceState();
+ var payments = entity
+ .GetPayments(true)
+ .Select(paymentEntity =>
+ {
+ var paymentData = paymentEntity.GetCryptoPaymentData();
+ var paymentMethodId = paymentEntity.GetPaymentMethodId();
+ if (paymentData is null || paymentMethodId is null)
+ {
+ return null;
+ }
+
+ string txId = paymentData.GetPaymentId();
+ string link = GetTransactionLink(paymentMethodId, txId);
+ var paymentMethod = entity.GetPaymentMethod(paymentMethodId);
+ var amount = paymentData.GetValue();
+ var rate = paymentMethod.Rate;
+ var paid = (amount - paymentEntity.NetworkFee) * rate;
+
+ return new ViewPaymentRequestViewModel.PaymentRequestInvoicePayment
+ {
+ Amount = amount,
+ Paid = paid,
+ ReceivedDate = paymentEntity.ReceivedTime.DateTime,
+ PaidFormatted = _currencies.FormatCurrency(paid, blob.Currency),
+ RateFormatted = _currencies.FormatCurrency(rate, blob.Currency),
+ PaymentMethod = paymentMethodId.ToPrettyString(),
+ Link = link,
+ Id = txId,
+ Destination = paymentData.GetDestination()
+ };
+ })
+ .Where(payment => payment != null)
+ .ToList();
+
+ if (state.Status == InvoiceStatusLegacy.Invalid ||
+ state.Status == InvoiceStatusLegacy.Expired && !payments.Any())
+ return null;
+
return new ViewPaymentRequestViewModel.PaymentRequestInvoice
{
Id = entity.Id,
@@ -111,40 +149,11 @@ namespace BTCPayServer.PaymentRequest
ExpiryDate = entity.ExpirationTime.DateTime,
State = state,
StateFormatted = state.ToString(),
- Payments = entity
- .GetPayments(true)
- .Select(paymentEntity =>
- {
- var paymentData = paymentEntity.GetCryptoPaymentData();
- var paymentMethodId = paymentEntity.GetPaymentMethodId();
- if (paymentData is null || paymentMethodId is null)
- {
- return null;
- }
-
- string txId = paymentData.GetPaymentId();
- string link = GetTransactionLink(paymentMethodId, txId);
- var paymentMethod = entity.GetPaymentMethod(paymentMethodId);
- var amount = paymentData.GetValue();
- var rate = paymentMethod.Rate;
- var paid = (amount - paymentEntity.NetworkFee) * rate;
-
- return new ViewPaymentRequestViewModel.PaymentRequestInvoicePayment
- {
- Amount = amount,
- Paid = paid,
- ReceivedDate = paymentEntity.ReceivedTime.DateTime,
- PaidFormatted = _currencies.FormatCurrency(paid, blob.Currency),
- RateFormatted = _currencies.FormatCurrency(rate, blob.Currency),
- PaymentMethod = paymentMethodId.ToPrettyString(),
- Link = link,
- Id = txId
- };
- })
- .Where(payment => payment != null)
- .ToList()
+ Payments = payments
};
- }).ToList()
+ })
+ .Where(invoice => invoice != null)
+ .ToList()
};
}
diff --git a/BTCPayServer/Views/PaymentRequest/ViewPaymentRequest.cshtml b/BTCPayServer/Views/PaymentRequest/ViewPaymentRequest.cshtml
index e1426547f..21af94b55 100644
--- a/BTCPayServer/Views/PaymentRequest/ViewPaymentRequest.cshtml
+++ b/BTCPayServer/Views/PaymentRequest/ViewPaymentRequest.cshtml
@@ -9,27 +9,27 @@
ViewData["Title"] = Model.Title;
Layout = null;
var theme = await _settingsRepository.GetTheme();
- string StatusTextClass(InvoiceState state)
+ string StatusClass(InvoiceState state)
{
switch (state.Status.ToModernStatus())
{
case InvoiceStatus.Settled:
case InvoiceStatus.Processing:
- return "text-success";
+ return "success";
case InvoiceStatus.Expired:
switch (state.ExceptionStatus)
{
case InvoiceExceptionStatus.PaidLate:
case InvoiceExceptionStatus.PaidPartial:
case InvoiceExceptionStatus.PaidOver:
- return "text-warning";
+ return "warning";
default:
- return "text-danger";
+ return "danger";
}
case InvoiceStatus.Invalid:
- return "text-danger";
+ return "danger";
default:
- return "text-warning";
+ return "warning";
}
}
}
@@ -56,6 +56,11 @@
@*We need to make sure btcpay.js is not bundled, else it will not work if there is a RootPath*@
@Safe.Raw(Model.EmbeddedCSS)
+