diff --git a/BTCPayServer/Components/StoreRecentInvoices/Default.cshtml b/BTCPayServer/Components/StoreRecentInvoices/Default.cshtml
index 66d4350d9..8fbbb156e 100644
--- a/BTCPayServer/Components/StoreRecentInvoices/Default.cshtml
+++ b/BTCPayServer/Components/StoreRecentInvoices/Default.cshtml
@@ -38,6 +38,12 @@
@($"({invoice.Status.ExceptionStatus.ToString()})")
}
+ @if (invoice.HasRefund)
+ {
+
+ Refund
+
+ }
@invoice.AmountCurrency |
diff --git a/BTCPayServer/Components/StoreRecentInvoices/StoreRecentInvoiceViewModel.cs b/BTCPayServer/Components/StoreRecentInvoices/StoreRecentInvoiceViewModel.cs
index 184a6af80..a3f4eb1da 100644
--- a/BTCPayServer/Components/StoreRecentInvoices/StoreRecentInvoiceViewModel.cs
+++ b/BTCPayServer/Components/StoreRecentInvoices/StoreRecentInvoiceViewModel.cs
@@ -10,4 +10,5 @@ public class StoreRecentInvoiceViewModel
public string AmountCurrency { get; set; }
public InvoiceState Status { get; set; }
public DateTimeOffset Date { get; set; }
+ public bool HasRefund { get; set; }
}
diff --git a/BTCPayServer/Components/StoreRecentInvoices/StoreRecentInvoices.cs b/BTCPayServer/Components/StoreRecentInvoices/StoreRecentInvoices.cs
index 72e2fcca4..c4815ac47 100644
--- a/BTCPayServer/Components/StoreRecentInvoices/StoreRecentInvoices.cs
+++ b/BTCPayServer/Components/StoreRecentInvoices/StoreRecentInvoices.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using System.Linq;
using System.Threading.Tasks;
using BTCPayServer.Data;
using BTCPayServer.Services.Invoices;
@@ -39,6 +40,7 @@ public class StoreRecentInvoices : ViewComponent
UserId = userId,
StoreId = new [] { store.Id },
IncludeArchived = false,
+ IncludeRefunds = true,
Take = 5
});
var invoices = new List();
@@ -49,6 +51,7 @@ public class StoreRecentInvoices : ViewComponent
{
Date = invoice.InvoiceTime,
Status = state,
+ HasRefund = invoice.Refunds.Any(),
InvoiceId = invoice.Id,
OrderId = invoice.Metadata.OrderId ?? string.Empty,
AmountCurrency = _currencyNameTable.DisplayFormatCurrency(invoice.Price, invoice.Currency),
diff --git a/BTCPayServer/Controllers/UIInvoiceController.UI.cs b/BTCPayServer/Controllers/UIInvoiceController.UI.cs
index 0cdbb1a49..f7b392d15 100644
--- a/BTCPayServer/Controllers/UIInvoiceController.UI.cs
+++ b/BTCPayServer/Controllers/UIInvoiceController.UI.cs
@@ -826,6 +826,7 @@ namespace BTCPayServer.Controllers
invoiceQuery.StoreId = model.StoreIds;
invoiceQuery.Take = model.Count;
invoiceQuery.Skip = model.Skip;
+ invoiceQuery.IncludeRefunds = true;
var list = await _InvoiceRepository.GetInvoices(invoiceQuery);
model.IncludeArchived = invoiceQuery.IncludeArchived;
@@ -845,6 +846,7 @@ namespace BTCPayServer.Controllers
CanMarkInvalid = state.CanMarkInvalid(),
CanMarkSettled = state.CanMarkComplete(),
Details = InvoicePopulatePayments(invoice),
+ HasRefund = invoice.Refunds.Any(data => !data.PullPaymentData.Archived)
});
}
return View(model);
diff --git a/BTCPayServer/Data/Payouts/LightningLike/LightningLikePayoutHandler.cs b/BTCPayServer/Data/Payouts/LightningLike/LightningLikePayoutHandler.cs
index bc8062b80..37c700d95 100644
--- a/BTCPayServer/Data/Payouts/LightningLike/LightningLikePayoutHandler.cs
+++ b/BTCPayServer/Data/Payouts/LightningLike/LightningLikePayoutHandler.cs
@@ -41,7 +41,7 @@ namespace BTCPayServer.Data.Payouts.LightningLike
public bool CanHandle(PaymentMethodId paymentMethod)
{
- return paymentMethod.PaymentType == LightningPaymentType.Instance &&
+ return (paymentMethod.PaymentType == LightningPaymentType.Instance || paymentMethod.PaymentType == LNURLPayPaymentType.Instance ) &&
_btcPayNetworkProvider.GetNetwork(paymentMethod.CryptoCode)?.SupportLightning is true;
}
diff --git a/BTCPayServer/Models/InvoicingModels/InvoicesModel.cs b/BTCPayServer/Models/InvoicingModels/InvoicesModel.cs
index 4110a4bfa..e2f0ee6e8 100644
--- a/BTCPayServer/Models/InvoicingModels/InvoicesModel.cs
+++ b/BTCPayServer/Models/InvoicingModels/InvoicesModel.cs
@@ -31,5 +31,6 @@ namespace BTCPayServer.Models.InvoicingModels
public string AmountCurrency { get; set; }
public InvoiceDetailsModel Details { get; set; }
+ public bool HasRefund { get; set; }
}
}
diff --git a/BTCPayServer/Services/Invoices/InvoiceEntity.cs b/BTCPayServer/Services/Invoices/InvoiceEntity.cs
index b1c8680cd..42bbb5001 100644
--- a/BTCPayServer/Services/Invoices/InvoiceEntity.cs
+++ b/BTCPayServer/Services/Invoices/InvoiceEntity.cs
@@ -392,7 +392,7 @@ namespace BTCPayServer.Services.Invoices
return GetPayments(network.CryptoCode, accountedOnly);
}
#pragma warning restore CS0618
- public bool Refundable { get; set; }
+ // public bool Refundable { get; set; }
public bool? RequiresRefundEmail { get; set; } = null;
public string RefundMail { get; set; }
[JsonProperty("redirectURL")]
@@ -465,7 +465,6 @@ namespace BTCPayServer.Services.Invoices
ExceptionStatus = ExceptionStatus == InvoiceExceptionStatus.None ? new JValue(false) : new JValue(ExceptionStatusString),
#pragma warning restore CS0618 // Type or member is obsolete
Currency = Currency,
- Flags = new Flags() { Refundable = Refundable },
PaymentSubtotals = new Dictionary(),
PaymentTotals = new Dictionary(),
SupportedTransactionCurrencies = new Dictionary(),
diff --git a/BTCPayServer/Services/Invoices/InvoiceRepository.cs b/BTCPayServer/Services/Invoices/InvoiceRepository.cs
index c0ec2f0f5..73b99a52a 100644
--- a/BTCPayServer/Services/Invoices/InvoiceRepository.cs
+++ b/BTCPayServer/Services/Invoices/InvoiceRepository.cs
@@ -570,7 +570,6 @@ namespace BTCPayServer.Services.Invoices
entity.ExceptionStatus = state.ExceptionStatus;
entity.Status = state.Status;
entity.RefundMail = invoice.CustomerEmail;
- entity.Refundable = false;
if (invoice.AddressInvoices != null)
{
entity.AvailableAddressHashes = invoice.AddressInvoices.Select(a => a.GetAddress() + a.GetPaymentMethodId().ToString()).ToHashSet();
diff --git a/BTCPayServer/Views/UIInvoice/ListInvoices.cshtml b/BTCPayServer/Views/UIInvoice/ListInvoices.cshtml
index 7e96620c3..093447693 100644
--- a/BTCPayServer/Views/UIInvoice/ListInvoices.cshtml
+++ b/BTCPayServer/Views/UIInvoice/ListInvoices.cshtml
@@ -352,6 +352,10 @@
{
@paymentType.GetBadge()
}
+ @if (invoice.HasRefund)
+ {
+ Refund
+ }
@invoice.AmountCurrency |
|