Custom redirect_url for PoS (#1924)

This commit is contained in:
Mario Dian
2020-10-13 15:51:28 +08:00
committed by GitHub
parent 9dcd8b6edf
commit ad22d3fd91
4 changed files with 14 additions and 1 deletions

View File

@@ -82,6 +82,7 @@ namespace BTCPayServer.Controllers
public string Description { get; set; } public string Description { get; set; }
public string NotificationUrl { get; set; } public string NotificationUrl { get; set; }
public string RedirectUrl { get; set; }
public bool? RedirectAutomatically { get; set; } public bool? RedirectAutomatically { get; set; }
} }
@@ -115,6 +116,7 @@ namespace BTCPayServer.Controllers
EmbeddedCSS = settings.EmbeddedCSS, EmbeddedCSS = settings.EmbeddedCSS,
Description = settings.Description, Description = settings.Description,
NotificationUrl = settings.NotificationUrl, NotificationUrl = settings.NotificationUrl,
RedirectUrl = settings.RedirectUrl,
SearchTerm = $"storeid:{app.StoreDataId}", SearchTerm = $"storeid:{app.StoreDataId}",
RedirectAutomatically = settings.RedirectAutomatically.HasValue ? settings.RedirectAutomatically.Value ? "true" : "false" : "" RedirectAutomatically = settings.RedirectAutomatically.HasValue ? settings.RedirectAutomatically.Value ? "true" : "false" : ""
}; };
@@ -191,6 +193,7 @@ namespace BTCPayServer.Controllers
CustomTipPercentages = ListSplit(vm.CustomTipPercentages), CustomTipPercentages = ListSplit(vm.CustomTipPercentages),
CustomCSSLink = vm.CustomCSSLink, CustomCSSLink = vm.CustomCSSLink,
NotificationUrl = vm.NotificationUrl, NotificationUrl = vm.NotificationUrl,
RedirectUrl = vm.RedirectUrl,
Description = vm.Description, Description = vm.Description,
EmbeddedCSS = vm.EmbeddedCSS, EmbeddedCSS = vm.EmbeddedCSS,
RedirectAutomatically = string.IsNullOrEmpty(vm.RedirectAutomatically) ? (bool?)null : bool.Parse(vm.RedirectAutomatically) RedirectAutomatically = string.IsNullOrEmpty(vm.RedirectAutomatically) ? (bool?)null : bool.Parse(vm.RedirectAutomatically)

View File

@@ -203,7 +203,9 @@ namespace BTCPayServer.Controllers
OrderId = orderId, OrderId = orderId,
NotificationURL = NotificationURL =
string.IsNullOrEmpty(notificationUrl) ? settings.NotificationUrl : notificationUrl, string.IsNullOrEmpty(notificationUrl) ? settings.NotificationUrl : notificationUrl,
RedirectURL = redirectUrl ?? Request.GetDisplayUrl(), RedirectURL = !string.IsNullOrEmpty(redirectUrl) ? redirectUrl
: !string.IsNullOrEmpty(settings.RedirectUrl) ? settings.RedirectUrl
: Request.GetDisplayUrl(),
FullNotifications = true, FullNotifications = true,
ExtendedNotifications = true, ExtendedNotifications = true,
PosData = string.IsNullOrEmpty(posData) ? null : posData, PosData = string.IsNullOrEmpty(posData) ? null : posData,

View File

@@ -33,6 +33,9 @@ namespace BTCPayServer.Models.AppViewModels
[Display(Name = "Callback Notification Url")] [Display(Name = "Callback Notification Url")]
[Uri] [Uri]
public string NotificationUrl { get; set; } public string NotificationUrl { get; set; }
[Display(Name = "Redirect Url")]
[Uri]
public string RedirectUrl { get; set; }
[Required] [Required]
[MaxLength(30)] [MaxLength(30)]

View File

@@ -94,6 +94,11 @@
<input asp-for="NotificationUrl" class="form-control" /> <input asp-for="NotificationUrl" class="form-control" />
<span asp-validation-for="NotificationUrl" class="text-danger"></span> <span asp-validation-for="NotificationUrl" class="text-danger"></span>
</div> </div>
<div class="form-group">
<label asp-for="RedirectUrl" class="control-label"></label>
<input asp-for="RedirectUrl" class="form-control" />
<span asp-validation-for="RedirectUrl" class="text-danger"></span>
</div>
<div class="form-group"> <div class="form-group">
<label asp-for="RedirectAutomatically" class="control-label"></label>* <label asp-for="RedirectAutomatically" class="control-label"></label>*
<select asp-for="RedirectAutomatically" asp-items="Model.RedirectAutomaticallySelectList" class="form-control"></select> <select asp-for="RedirectAutomatically" asp-items="Model.RedirectAutomaticallySelectList" class="form-control"></select>