mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-19 06:54:19 +01:00
allow language parameter in pay button endpoint
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Web;
|
||||||
using BTCPayServer.Filters;
|
using BTCPayServer.Filters;
|
||||||
using BTCPayServer.Models;
|
using BTCPayServer.Models;
|
||||||
using BTCPayServer.Models.StoreViewModels;
|
using BTCPayServer.Models.StoreViewModels;
|
||||||
@@ -58,7 +59,15 @@ namespace BTCPayServer.Controllers
|
|||||||
RedirectURL = model.BrowserRedirect,
|
RedirectURL = model.BrowserRedirect,
|
||||||
FullNotifications = true
|
FullNotifications = true
|
||||||
}, store, HttpContext.Request.GetAbsoluteRoot(), cancellationToken: cancellationToken);
|
}, 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ namespace BTCPayServer.Models.StoreViewModels
|
|||||||
public string NotifyEmail { get; set; }
|
public string NotifyEmail { get; set; }
|
||||||
|
|
||||||
public string StoreId { get; set; }
|
public string StoreId { get; set; }
|
||||||
|
public string Language { get; set; }
|
||||||
|
|
||||||
// Data that influences Pay Button UI, but not invoice creation
|
// Data that influences Pay Button UI, but not invoice creation
|
||||||
public string UrlRoot { get; set; }
|
public string UrlRoot { get; set; }
|
||||||
|
|||||||
Reference in New Issue
Block a user