mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 06:24:24 +01:00
add redirect automatically to checkout experience/ store settings
This commit is contained in:
@@ -79,7 +79,7 @@ namespace BTCPayServer.Controllers
|
|||||||
public string CustomCSSLink { get; set; }
|
public string CustomCSSLink { get; set; }
|
||||||
public string NotificationEmail { get; set; }
|
public string NotificationEmail { get; set; }
|
||||||
public string NotificationUrl { get; set; }
|
public string NotificationUrl { get; set; }
|
||||||
public bool RedirectAutomatically { get; set; }
|
public bool? RedirectAutomatically { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
@@ -107,7 +107,7 @@ namespace BTCPayServer.Controllers
|
|||||||
CustomCSSLink = settings.CustomCSSLink,
|
CustomCSSLink = settings.CustomCSSLink,
|
||||||
NotificationEmail = settings.NotificationEmail,
|
NotificationEmail = settings.NotificationEmail,
|
||||||
NotificationUrl = settings.NotificationUrl,
|
NotificationUrl = settings.NotificationUrl,
|
||||||
RedirectAutomatically = settings.RedirectAutomatically
|
RedirectAutomatically = settings.RedirectAutomatically.HasValue? settings.RedirectAutomatically.Value? "true": "false" : ""
|
||||||
};
|
};
|
||||||
if (HttpContext?.Request != null)
|
if (HttpContext?.Request != null)
|
||||||
{
|
{
|
||||||
@@ -183,7 +183,7 @@ namespace BTCPayServer.Controllers
|
|||||||
CustomCSSLink = vm.CustomCSSLink,
|
CustomCSSLink = vm.CustomCSSLink,
|
||||||
NotificationUrl = vm.NotificationUrl,
|
NotificationUrl = vm.NotificationUrl,
|
||||||
NotificationEmail = vm.NotificationEmail,
|
NotificationEmail = vm.NotificationEmail,
|
||||||
RedirectAutomatically = vm.RedirectAutomatically
|
RedirectAutomatically = string.IsNullOrEmpty(vm.RedirectAutomatically)? (bool?) null: bool.Parse(vm.RedirectAutomatically)
|
||||||
|
|
||||||
});
|
});
|
||||||
await UpdateAppSettings(app);
|
await UpdateAppSettings(app);
|
||||||
|
|||||||
@@ -271,7 +271,7 @@ namespace BTCPayServer.Controllers
|
|||||||
FullNotifications = true,
|
FullNotifications = true,
|
||||||
ExtendedNotifications = true,
|
ExtendedNotifications = true,
|
||||||
PosData = string.IsNullOrEmpty(posData) ? null : posData,
|
PosData = string.IsNullOrEmpty(posData) ? null : posData,
|
||||||
RedirectAutomatically = settings.RedirectAutomatically
|
RedirectAutomatically = settings.RedirectAutomatically,
|
||||||
}, store, HttpContext.Request.GetAbsoluteRoot(),
|
}, store, HttpContext.Request.GetAbsoluteRoot(),
|
||||||
new List<string>() {AppService.GetAppInternalTag(appId)},
|
new List<string>() {AppService.GetAppInternalTag(appId)},
|
||||||
cancellationToken);
|
cancellationToken);
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ namespace BTCPayServer.Controllers
|
|||||||
entity.ServerUrl = serverUrl;
|
entity.ServerUrl = serverUrl;
|
||||||
entity.FullNotifications = invoice.FullNotifications || invoice.ExtendedNotifications;
|
entity.FullNotifications = invoice.FullNotifications || invoice.ExtendedNotifications;
|
||||||
entity.ExtendedNotifications = invoice.ExtendedNotifications;
|
entity.ExtendedNotifications = invoice.ExtendedNotifications;
|
||||||
|
|
||||||
if (invoice.NotificationURL != null &&
|
if (invoice.NotificationURL != null &&
|
||||||
Uri.TryCreate(invoice.NotificationURL, UriKind.Absolute, out var notificationUri) &&
|
Uri.TryCreate(invoice.NotificationURL, UriKind.Absolute, out var notificationUri) &&
|
||||||
(notificationUri.Scheme == "http" || notificationUri.Scheme == "https"))
|
(notificationUri.Scheme == "http" || notificationUri.Scheme == "https"))
|
||||||
@@ -125,7 +126,8 @@ namespace BTCPayServer.Controllers
|
|||||||
if (!Uri.IsWellFormedUriString(entity.RedirectURL, UriKind.Absolute))
|
if (!Uri.IsWellFormedUriString(entity.RedirectURL, UriKind.Absolute))
|
||||||
entity.RedirectURL = null;
|
entity.RedirectURL = null;
|
||||||
|
|
||||||
entity.RedirectAutomatically = invoice.RedirectAutomatically;
|
entity.RedirectAutomatically =
|
||||||
|
invoice.RedirectAutomatically.GetValueOrDefault(storeBlob.RedirectAutomatically);
|
||||||
|
|
||||||
entity.Status = InvoiceStatus.New;
|
entity.Status = InvoiceStatus.New;
|
||||||
entity.SpeedPolicy = ParseSpeedPolicy(invoice.TransactionSpeed, store.SpeedPolicy);
|
entity.SpeedPolicy = ParseSpeedPolicy(invoice.TransactionSpeed, store.SpeedPolicy);
|
||||||
|
|||||||
@@ -356,6 +356,7 @@ namespace BTCPayServer.Controllers
|
|||||||
vm.OnChainMinValue = storeBlob.OnChainMinValue?.ToString() ?? "";
|
vm.OnChainMinValue = storeBlob.OnChainMinValue?.ToString() ?? "";
|
||||||
vm.LightningMaxValue = storeBlob.LightningMaxValue?.ToString() ?? "";
|
vm.LightningMaxValue = storeBlob.LightningMaxValue?.ToString() ?? "";
|
||||||
vm.LightningAmountInSatoshi = storeBlob.LightningAmountInSatoshi;
|
vm.LightningAmountInSatoshi = storeBlob.LightningAmountInSatoshi;
|
||||||
|
vm.RedirectAutomatically = storeBlob.RedirectAutomatically;
|
||||||
return View(vm);
|
return View(vm);
|
||||||
}
|
}
|
||||||
void SetCryptoCurrencies(CheckoutExperienceViewModel vm, Data.StoreData storeData)
|
void SetCryptoCurrencies(CheckoutExperienceViewModel vm, Data.StoreData storeData)
|
||||||
@@ -420,6 +421,7 @@ namespace BTCPayServer.Controllers
|
|||||||
blob.OnChainMinValue = onchainMinValue;
|
blob.OnChainMinValue = onchainMinValue;
|
||||||
blob.LightningMaxValue = lightningMaxValue;
|
blob.LightningMaxValue = lightningMaxValue;
|
||||||
blob.LightningAmountInSatoshi = model.LightningAmountInSatoshi;
|
blob.LightningAmountInSatoshi = model.LightningAmountInSatoshi;
|
||||||
|
blob.RedirectAutomatically = model.RedirectAutomatically;
|
||||||
if (StoreData.SetStoreBlob(blob))
|
if (StoreData.SetStoreBlob(blob))
|
||||||
{
|
{
|
||||||
needUpdate = true;
|
needUpdate = true;
|
||||||
|
|||||||
@@ -449,6 +449,7 @@ namespace BTCPayServer.Data
|
|||||||
public Dictionary<string, string> WalletKeyPathRoots { get; set; } = new Dictionary<string, string>();
|
public Dictionary<string, string> WalletKeyPathRoots { get; set; } = new Dictionary<string, string>();
|
||||||
|
|
||||||
public EmailSettings EmailSettings { get; set; }
|
public EmailSettings EmailSettings { get; set; }
|
||||||
|
public bool RedirectAutomatically { get; set; }
|
||||||
|
|
||||||
public IPaymentFilter GetExcludedPaymentMethods()
|
public IPaymentFilter GetExcludedPaymentMethods()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
using BTCPayServer.Validation;
|
using BTCPayServer.Validation;
|
||||||
|
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||||
|
|
||||||
namespace BTCPayServer.Models.AppViewModels
|
namespace BTCPayServer.Models.AppViewModels
|
||||||
{
|
{
|
||||||
@@ -54,8 +56,28 @@ namespace BTCPayServer.Models.AppViewModels
|
|||||||
public string CustomCSSLink { get; set; }
|
public string CustomCSSLink { get; set; }
|
||||||
|
|
||||||
public string Id { get; set; }
|
public string Id { get; set; }
|
||||||
|
|
||||||
[Display(Name = "Redirect invoice to redirect url automatically after paid")]
|
[Display(Name = "Redirect invoice to redirect url automatically after paid")]
|
||||||
public bool RedirectAutomatically { get; set; }
|
public string RedirectAutomatically { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public SelectList RedirectAutomaticallySelectList =>
|
||||||
|
new SelectList(new List< SelectListItem>()
|
||||||
|
{
|
||||||
|
new SelectListItem()
|
||||||
|
{
|
||||||
|
Text = "Yes",
|
||||||
|
Value = "true"
|
||||||
|
},
|
||||||
|
new SelectListItem()
|
||||||
|
{
|
||||||
|
Text = "No",
|
||||||
|
Value = "false"
|
||||||
|
},
|
||||||
|
new SelectListItem()
|
||||||
|
{
|
||||||
|
Text = "Use Store Settings",
|
||||||
|
Value = ""
|
||||||
|
}
|
||||||
|
}, nameof(SelectListItem.Value), nameof(SelectListItem.Text), RedirectAutomatically);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,6 +81,6 @@ namespace BTCPayServer.Models
|
|||||||
public string Token { get; set; }
|
public string Token { get; set; }
|
||||||
|
|
||||||
[JsonProperty(PropertyName = "redirectAutomatically", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
[JsonProperty(PropertyName = "redirectAutomatically", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public bool RedirectAutomatically { get; set; }
|
public bool? RedirectAutomatically { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,6 +49,9 @@ namespace BTCPayServer.Models.StoreViewModels
|
|||||||
|
|
||||||
[Display(Name = "Display lightning payment amounts in Satoshis")]
|
[Display(Name = "Display lightning payment amounts in Satoshis")]
|
||||||
public bool LightningAmountInSatoshi { get; set; }
|
public bool LightningAmountInSatoshi { get; set; }
|
||||||
|
|
||||||
|
[Display(Name = "Redirect invoice to redirect url automatically after paid")]
|
||||||
|
public bool RedirectAutomatically { get; set; }
|
||||||
|
|
||||||
public void SetLanguages(LanguageService langService, string defaultLang)
|
public void SetLanguages(LanguageService langService, string defaultLang)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -118,10 +118,9 @@
|
|||||||
<input type="email" asp-for="NotificationEmail" class="form-control" />
|
<input type="email" asp-for="NotificationEmail" class="form-control" />
|
||||||
<span asp-validation-for="NotificationEmail" class="text-danger"></span>
|
<span asp-validation-for="NotificationEmail" class="text-danger"></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label asp-for="RedirectAutomatically"></label>
|
<label asp-for="RedirectAutomatically" class="control-label"></label>*
|
||||||
<input asp-for="RedirectAutomatically" type="checkbox" class="form-check" />
|
<select asp-for="RedirectAutomatically" asp-items="Model.RedirectAutomaticallySelectList" class="form-control"></select>
|
||||||
<span asp-validation-for="RedirectAutomatically" class="text-danger"></span>
|
<span asp-validation-for="RedirectAutomatically" class="text-danger"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|||||||
@@ -57,6 +57,12 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label asp-for="LightningAmountInSatoshi"></label>
|
<label asp-for="LightningAmountInSatoshi"></label>
|
||||||
<input asp-for="LightningAmountInSatoshi" type="checkbox" class="form-check" />
|
<input asp-for="LightningAmountInSatoshi" type="checkbox" class="form-check" />
|
||||||
|
<span asp-validation-for="LightningAmountInSatoshi" class="text-danger"></span>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label asp-for="RedirectAutomatically"></label>
|
||||||
|
<input asp-for="RedirectAutomatically" type="checkbox" class="form-check" />
|
||||||
|
<span asp-validation-for="RedirectAutomatically" class="text-danger"></span>
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<button name="command" type="submit" class="btn btn-primary" value="Save">Save</button>
|
<button name="command" type="submit" class="btn btn-primary" value="Save">Save</button>
|
||||||
|
|||||||
Reference in New Issue
Block a user