diff --git a/BTCPayServer/Components/StoreRecentInvoices/Default.cshtml b/BTCPayServer/Components/StoreRecentInvoices/Default.cshtml index 6762f6552..eb0c45ed8 100644 --- a/BTCPayServer/Components/StoreRecentInvoices/Default.cshtml +++ b/BTCPayServer/Components/StoreRecentInvoices/Default.cshtml @@ -51,6 +51,10 @@ @invoice.InvoiceId + @if (invoice.Details.Archived) + { + archived + } @invoice.Status.Status.ToModernStatus().ToString() @if (invoice.Status.ExceptionStatus != InvoiceExceptionStatus.None) @@ -58,6 +62,10 @@ @($"({invoice.Status.ExceptionStatus.ToString()})") } + @foreach (var paymentType in invoice.Details.Payments.Select(payment => payment.GetPaymentMethodId()?.PaymentType).Distinct().Where(type => type != null && !string.IsNullOrEmpty(type.GetBadge()))) + { + @paymentType.GetBadge() + } @if (invoice.HasRefund) { diff --git a/BTCPayServer/Components/StoreRecentInvoices/StoreRecentInvoiceViewModel.cs b/BTCPayServer/Components/StoreRecentInvoices/StoreRecentInvoiceViewModel.cs index d32d02cf2..1ff53e7fc 100644 --- a/BTCPayServer/Components/StoreRecentInvoices/StoreRecentInvoiceViewModel.cs +++ b/BTCPayServer/Components/StoreRecentInvoices/StoreRecentInvoiceViewModel.cs @@ -1,4 +1,5 @@ using System; +using BTCPayServer.Models.InvoicingModels; using BTCPayServer.Services.Invoices; namespace BTCPayServer.Components.StoreRecentInvoices; @@ -11,5 +12,7 @@ public class StoreRecentInvoiceViewModel public string Currency { get; set; } public InvoiceState Status { get; set; } public DateTimeOffset Date { get; set; } + + public InvoiceDetailsModel Details { get; set; } public bool HasRefund { get; set; } } diff --git a/BTCPayServer/Components/StoreRecentInvoices/StoreRecentInvoices.cs b/BTCPayServer/Components/StoreRecentInvoices/StoreRecentInvoices.cs index f5738ca90..d8876ed4c 100644 --- a/BTCPayServer/Components/StoreRecentInvoices/StoreRecentInvoices.cs +++ b/BTCPayServer/Components/StoreRecentInvoices/StoreRecentInvoices.cs @@ -3,11 +3,13 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using BTCPayServer.Data; +using BTCPayServer.Models.InvoicingModels; using BTCPayServer.Services.Invoices; using BTCPayServer.Services.Rates; using BTCPayServer.Services.Stores; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; +using NBitcoin; namespace BTCPayServer.Components.StoreRecentInvoices; @@ -53,17 +55,22 @@ public class StoreRecentInvoices : ViewComponent }); vm.Invoices = (from invoice in invoiceEntities - let state = invoice.GetInvoiceState() - select new StoreRecentInvoiceViewModel - { - Date = invoice.InvoiceTime, - Status = state, - HasRefund = invoice.Refunds.Any(), - InvoiceId = invoice.Id, - OrderId = invoice.Metadata.OrderId ?? string.Empty, - Amount = invoice.Price, - Currency = invoice.Currency - }).ToList(); + let state = invoice.GetInvoiceState() + select new StoreRecentInvoiceViewModel + { + Date = invoice.InvoiceTime, + Status = state, + HasRefund = invoice.Refunds.Any(), + InvoiceId = invoice.Id, + OrderId = invoice.Metadata.OrderId ?? string.Empty, + Amount = invoice.Price, + Currency = invoice.Currency, + Details = new InvoiceDetailsModel + { + Archived = invoice.Archived, + Payments = invoice.GetPayments(false) + } + }).ToList(); return View(vm); }