mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-01-19 05:33:31 +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:
parent
b5ad5a5f6f
commit
ddb07a7ba9
@ -214,7 +214,7 @@ namespace BTCPayServer.Controllers
|
||||
{
|
||||
InvoiceId = i.Id,
|
||||
OrderId = i.Metadata?.OrderId,
|
||||
OrderUrl = i.Metadata?.OrderUrl,
|
||||
RedirectUrl = i.RedirectURL?.AbsoluteUri ?? i.Metadata?.OrderUrl,
|
||||
Status = i.Status,
|
||||
Currency = i.Currency,
|
||||
Timestamp = i.InvoiceTime,
|
||||
@ -250,10 +250,12 @@ namespace BTCPayServer.Controllers
|
||||
receiptData.Remove(key);
|
||||
}
|
||||
}
|
||||
// assign the rest to additional data
|
||||
// assign the rest to additional data and remove empty values
|
||||
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 ReceiptOptions ReceiptOptions { 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();
|
||||
if (choice is not null)
|
||||
{
|
||||
receiptData = JObject.FromObject(new Dictionary<string, string>
|
||||
{
|
||||
{"Title", choice.Title},
|
||||
{"Description", choice.Description},
|
||||
});
|
||||
var dict = new Dictionary<string, string> { { "Title", choice.Title } };
|
||||
if (!string.IsNullOrEmpty(choice.Description)) dict["Description"] = choice.Description;
|
||||
receiptData = JObject.FromObject(dict);
|
||||
}
|
||||
else if (jposData is not null)
|
||||
{
|
||||
|
@ -173,9 +173,9 @@
|
||||
</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>
|
||||
</main>
|
||||
|
Loading…
Reference in New Issue
Block a user