mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 22:14:26 +01:00
Receipt page fixes (#6079)
* Receipt: Don't assign empty values to data; hide present empty values * Receipt: Use same URL on "Return to Store" link as on invoice
This commit is contained in:
@@ -214,7 +214,7 @@ namespace BTCPayServer.Controllers
|
|||||||
{
|
{
|
||||||
InvoiceId = i.Id,
|
InvoiceId = i.Id,
|
||||||
OrderId = i.Metadata?.OrderId,
|
OrderId = i.Metadata?.OrderId,
|
||||||
OrderUrl = i.Metadata?.OrderUrl,
|
RedirectUrl = i.RedirectURL?.AbsoluteUri ?? i.Metadata?.OrderUrl,
|
||||||
Status = i.Status,
|
Status = i.Status,
|
||||||
Currency = i.Currency,
|
Currency = i.Currency,
|
||||||
Timestamp = i.InvoiceTime,
|
Timestamp = i.InvoiceTime,
|
||||||
@@ -250,10 +250,12 @@ namespace BTCPayServer.Controllers
|
|||||||
receiptData.Remove(key);
|
receiptData.Remove(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// assign the rest to additional data
|
// assign the rest to additional data and remove empty values
|
||||||
if (receiptData.Any())
|
if (receiptData.Any())
|
||||||
{
|
{
|
||||||
vm.AdditionalData = receiptData;
|
vm.AdditionalData = receiptData
|
||||||
|
.Where(x => !string.IsNullOrEmpty(x.Value.ToString()))
|
||||||
|
.ToDictionary(x => x.Key, x => x.Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,6 @@ namespace BTCPayServer.Models.InvoicingModels
|
|||||||
public Dictionary<string, object> CartData { get; set; }
|
public Dictionary<string, object> CartData { get; set; }
|
||||||
public ReceiptOptions ReceiptOptions { get; set; }
|
public ReceiptOptions ReceiptOptions { get; set; }
|
||||||
public List<ViewPaymentRequestViewModel.PaymentRequestInvoicePayment> Payments { get; set; }
|
public List<ViewPaymentRequestViewModel.PaymentRequestInvoicePayment> Payments { get; set; }
|
||||||
public string OrderUrl { get; set; }
|
public string RedirectUrl { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -348,11 +348,9 @@ namespace BTCPayServer.Plugins.PointOfSale.Controllers
|
|||||||
var receiptData = new JObject();
|
var receiptData = new JObject();
|
||||||
if (choice is not null)
|
if (choice is not null)
|
||||||
{
|
{
|
||||||
receiptData = JObject.FromObject(new Dictionary<string, string>
|
var dict = new Dictionary<string, string> { { "Title", choice.Title } };
|
||||||
{
|
if (!string.IsNullOrEmpty(choice.Description)) dict["Description"] = choice.Description;
|
||||||
{"Title", choice.Title},
|
receiptData = JObject.FromObject(dict);
|
||||||
{"Description", choice.Description},
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
else if (jposData is not null)
|
else if (jposData is not null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -173,9 +173,9 @@
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@if (!string.IsNullOrEmpty(Model.OrderUrl))
|
@if (!string.IsNullOrEmpty(Model.RedirectUrl))
|
||||||
{
|
{
|
||||||
<a href="@Model.OrderUrl" class="btn btn-secondary rounded-pill mx-auto mt-3" rel="noreferrer noopener" target="_blank">Return to @(string.IsNullOrEmpty(Model.StoreName) ? "store" : Model.StoreName)</a>
|
<a href="@Model.RedirectUrl" class="btn btn-secondary rounded-pill mx-auto mt-3" rel="noreferrer noopener" target="_blank">Return to @(string.IsNullOrEmpty(Model.StoreName) ? "store" : Model.StoreName)</a>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|||||||
Reference in New Issue
Block a user