Crowdfund: Fix redirect URL fallback

As the request for invoice creation is issued via web socket, the display URL ends up being the hob connection URL. This replaces it with the actual app URL and fixes #4930.
This commit is contained in:
Dennis Reimann 2023-05-02 13:15:16 +02:00 committed by Andrew Camilleri
parent b9b11e722c
commit 8b8f72129c

View File

@ -174,6 +174,8 @@ namespace BTCPayServer.Plugins.Crowdfund.Controllers
try
{
var appPath = await _appService.ViewLink(app);
var appUrl = HttpContext.Request.GetAbsoluteUri(appPath);
var invoice = await _invoiceController.CreateInvoiceCore(new BitpayCreateInvoiceRequest()
{
OrderId = AppService.GetAppOrderId(app),
@ -186,12 +188,12 @@ namespace BTCPayServer.Plugins.Crowdfund.Controllers
FullNotifications = true,
ExtendedNotifications = true,
SupportedTransactionCurrencies = paymentMethods,
RedirectURL = request.RedirectUrl ?? Request.GetDisplayUrl(),
RedirectURL = request.RedirectUrl ?? appUrl,
}, store, HttpContext.Request.GetAbsoluteRoot(),
new List<string>() { AppService.GetAppInternalTag(appId) },
cancellationToken, (entity) =>
new List<string> { AppService.GetAppInternalTag(appId) },
cancellationToken, entity =>
{
entity.Metadata.OrderUrl = Request.GetDisplayUrl();
entity.Metadata.OrderUrl = appUrl;
});
if (request.RedirectToCheckout)