mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-03-03 17:36:59 +01:00
make checkout param more generic and add it to pay button generator
This commit is contained in:
parent
b808aa4971
commit
11670d0c0f
4 changed files with 28 additions and 5 deletions
|
@ -59,13 +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);
|
||||||
if (string.IsNullOrEmpty(model.Language))
|
if (string.IsNullOrEmpty(model.CheckoutQueryString))
|
||||||
{
|
{
|
||||||
return Redirect(invoice.Data.Url);
|
return Redirect(invoice.Data.Url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var additionalParamValues = HttpUtility.ParseQueryString(model.CheckoutQueryString);
|
||||||
var uriBuilder = new UriBuilder(invoice.Data.Url);
|
var uriBuilder = new UriBuilder(invoice.Data.Url);
|
||||||
var paramValues = HttpUtility.ParseQueryString(uriBuilder.Query);
|
var paramValues = HttpUtility.ParseQueryString(uriBuilder.Query);
|
||||||
paramValues.Add("lang", model.Language);
|
paramValues.Add(additionalParamValues);
|
||||||
uriBuilder.Query = paramValues.ToString();
|
uriBuilder.Query = paramValues.ToString();
|
||||||
return Redirect(uriBuilder.Uri.AbsoluteUri);
|
return Redirect(uriBuilder.Uri.AbsoluteUri);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +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; }
|
public string CheckoutQueryString { 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; }
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
@model PayButtonViewModel
|
@model PayButtonViewModel
|
||||||
@{
|
@{
|
||||||
Layout = "../Shared/_NavLayout.cshtml";
|
Layout = "../Shared/_NavLayout.cshtml";
|
||||||
ViewData.SetActivePageAndTitle(StoreNavPages.PayButton);
|
ViewData.SetActivePageAndTitle(StoreNavPages.PayButton);
|
||||||
|
@ -140,6 +140,24 @@
|
||||||
Finally <i>Browser Redirect</i> defines where BtcPayServer will redirect customer after puchase is completed.
|
Finally <i>Browser Redirect</i> defines where BtcPayServer will redirect customer after puchase is completed.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<h3>Advanced</h3>
|
||||||
|
<br />
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-7">
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Checkout Additional Query String</label>
|
||||||
|
<input name="checkoutQueryString" type="text" class="form-control" placeholder="(optional)"
|
||||||
|
v-model="srvModel.checkoutQueryString" v-on:change="inputChanges"
|
||||||
|
:class="{'is-invalid': errors.has('checkoutQueryString') }">
|
||||||
|
<small class="text-danger">{{ errors.first('checkoutQueryString') }}</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-5">
|
||||||
|
<br />
|
||||||
|
This parameter allows you to specify additional query string paramters that should be appended to the checkout page once the invoice is created. For example, <kbd>lang=da-DK</kbd> would load the checkout page in Danishby default.
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<hr />
|
<hr />
|
||||||
<h3>Generated code</h3>
|
<h3>Generated code</h3>
|
||||||
<div class="row" v-show="!errors.any()">
|
<div class="row" v-show="!errors.any()">
|
||||||
|
|
|
@ -26,7 +26,7 @@ function esc(input) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Vue.use(VeeValidate);
|
Vue.use(VeeValidate);
|
||||||
const dictionary = {
|
var dictionary = {
|
||||||
en: {
|
en: {
|
||||||
attributes: {
|
attributes: {
|
||||||
price: 'Price', checkoutDesc: 'Checkout Description', orderId: 'Order Id',
|
price: 'Price', checkoutDesc: 'Checkout Description', orderId: 'Order Id',
|
||||||
|
@ -97,6 +97,9 @@ function inputChanges(event, buttonSize) {
|
||||||
if (srvModel.notifyEmail) {
|
if (srvModel.notifyEmail) {
|
||||||
html += addinput("notifyEmail", srvModel.notifyEmail);
|
html += addinput("notifyEmail", srvModel.notifyEmail);
|
||||||
}
|
}
|
||||||
|
if (srvModel.checkoutQueryString) {
|
||||||
|
html += addinput("checkoutQueryString", srvModel.checkoutQueryString);
|
||||||
|
}
|
||||||
|
|
||||||
html += '\n <input type="image" src="' + esc(srvModel.payButtonImageUrl) + '" name="submit" style="width:' + width +
|
html += '\n <input type="image" src="' + esc(srvModel.payButtonImageUrl) + '" name="submit" style="width:' + width +
|
||||||
'" alt="Pay with BtcPay, Self-Hosted Bitcoin Payment Processor">';
|
'" alt="Pay with BtcPay, Self-Hosted Bitcoin Payment Processor">';
|
||||||
|
|
Loading…
Add table
Reference in a new issue