Add Refunds list to Invoice details page

(this is missing the refunded badge and progress as I have another PR that makes this easier to compute to show)
This commit is contained in:
Kukks
2022-06-03 12:08:16 +02:00
committed by Andrew Camilleri
parent 04c3191795
commit 29080e9d7d
5 changed files with 413 additions and 304 deletions

View File

@@ -93,6 +93,7 @@ namespace BTCPayServer.Controllers
IncludeAddresses = true,
IncludeEvents = true,
IncludeArchived = true,
IncludeRefunds = true,
})).FirstOrDefault();
if (invoice == null)
return NotFound();
@@ -116,7 +117,9 @@ namespace BTCPayServer.Controllers
ExpirationDate = invoice.ExpirationTime,
MonitoringDate = invoice.MonitoringExpiration,
Fiat = _CurrencyNameTable.DisplayFormatCurrency(invoice.Price, invoice.Currency),
TaxIncluded = _CurrencyNameTable.DisplayFormatCurrency(invoice.Metadata.TaxIncluded ?? 0.0m, invoice.Currency),
TaxIncluded = invoice.Metadata.TaxIncluded is null
? null
: _CurrencyNameTable.DisplayFormatCurrency(invoice.Metadata.TaxIncluded ?? 0.0m, invoice.Currency),
NotificationUrl = invoice.NotificationURL?.AbsoluteUri,
RedirectUrl = invoice.RedirectURL?.AbsoluteUri,
TypedMetadata = invoice.Metadata,
@@ -125,6 +128,7 @@ namespace BTCPayServer.Controllers
PosData = PosDataParser.ParsePosData(invoice.Metadata.PosData),
Archived = invoice.Archived,
CanRefund = CanRefund(invoiceState),
Refunds = invoice.Refunds,
ShowCheckout = invoice.Status == InvoiceStatusLegacy.New,
Deliveries = (await _InvoiceRepository.GetWebhookDeliveries(invoiceId))
.Select(c => new Models.StoreViewModels.DeliveryViewModel(c))
@@ -412,8 +416,8 @@ namespace BTCPayServer.Controllers
{
InvoiceId = new[] { invoiceId },
UserId = GetUserId(),
IncludeAddresses = true,
IncludeEvents = true,
IncludeAddresses = false,
IncludeEvents = false,
IncludeArchived = true,
})).FirstOrDefault();
if (invoice == null)