allow language parameter in pay button endpoint

This commit is contained in:
Andrew Camilleri
2019-06-18 18:31:20 +02:00
parent d1f1bc93b3
commit b808aa4971
2 changed files with 11 additions and 1 deletions

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Web;
using BTCPayServer.Filters;
using BTCPayServer.Models;
using BTCPayServer.Models.StoreViewModels;
@@ -58,7 +59,15 @@ namespace BTCPayServer.Controllers
RedirectURL = model.BrowserRedirect,
FullNotifications = true
}, store, HttpContext.Request.GetAbsoluteRoot(), cancellationToken: cancellationToken);
return Redirect(invoice.Data.Url);
if (string.IsNullOrEmpty(model.Language))
{
return Redirect(invoice.Data.Url);
}
var uriBuilder = new UriBuilder(invoice.Data.Url);
var paramValues = HttpUtility.ParseQueryString(uriBuilder.Query);
paramValues.Add("lang", model.Language);
uriBuilder.Query = paramValues.ToString();
return Redirect(uriBuilder.Uri.AbsoluteUri);
}
}
}