diff --git a/BTCPayServer.Tests/AltcoinTests/AltcoinTests.cs b/BTCPayServer.Tests/AltcoinTests/AltcoinTests.cs index 942e488ba..39ff00187 100644 --- a/BTCPayServer.Tests/AltcoinTests/AltcoinTests.cs +++ b/BTCPayServer.Tests/AltcoinTests/AltcoinTests.cs @@ -613,7 +613,7 @@ namespace BTCPayServer.Tests user.RegisterDerivationScheme("LTC"); var apps = user.GetController(); var vm = Assert.IsType(Assert.IsType(apps.CreateApp().Result).Model); - vm.Name = "test"; + vm.AppName = "test"; vm.SelectedAppType = AppType.PointOfSale.ToString(); Assert.IsType(apps.CreateApp(vm).Result); var appId = Assert.IsType(Assert.IsType(apps.ListApps().Result).Model) diff --git a/BTCPayServer.Tests/CrowdfundTests.cs b/BTCPayServer.Tests/CrowdfundTests.cs index 0f83f3ab8..4ce8a9f07 100644 --- a/BTCPayServer.Tests/CrowdfundTests.cs +++ b/BTCPayServer.Tests/CrowdfundTests.cs @@ -38,8 +38,8 @@ namespace BTCPayServer.Tests var apps2 = user2.GetController(); var vm = Assert.IsType(Assert.IsType(apps.CreateApp().Result).Model); Assert.NotNull(vm.SelectedAppType); - Assert.Null(vm.Name); - vm.Name = "test"; + Assert.Null(vm.AppName); + vm.AppName = "test"; vm.SelectedAppType = AppType.Crowdfund.ToString(); var redirectToAction = Assert.IsType(apps.CreateApp(vm).Result); Assert.Equal(nameof(apps.UpdateCrowdfund), redirectToAction.ActionName); @@ -75,7 +75,7 @@ namespace BTCPayServer.Tests user.RegisterDerivationScheme("BTC"); var apps = user.GetController(); var vm = Assert.IsType(Assert.IsType(apps.CreateApp().Result).Model); - vm.Name = "test"; + vm.AppName = "test"; vm.SelectedAppType = AppType.Crowdfund.ToString(); Assert.IsType(apps.CreateApp(vm).Result); var appId = Assert.IsType(Assert.IsType(apps.ListApps().Result).Model) @@ -168,7 +168,7 @@ namespace BTCPayServer.Tests await user.SetNetworkFeeMode(NetworkFeeMode.Never); var apps = user.GetController(); var vm = Assert.IsType(Assert.IsType(apps.CreateApp().Result).Model); - vm.Name = "test"; + vm.AppName = "test"; vm.SelectedAppType = AppType.Crowdfund.ToString(); Assert.IsType(apps.CreateApp(vm).Result); var appId = Assert.IsType(Assert.IsType(apps.ListApps().Result).Model) diff --git a/BTCPayServer.Tests/POSTests.cs b/BTCPayServer.Tests/POSTests.cs index 2880305c4..e87df2546 100644 --- a/BTCPayServer.Tests/POSTests.cs +++ b/BTCPayServer.Tests/POSTests.cs @@ -29,7 +29,7 @@ namespace BTCPayServer.Tests user.RegisterDerivationScheme("BTC"); var apps = user.GetController(); var vm = Assert.IsType(Assert.IsType(apps.CreateApp().Result).Model); - vm.Name = "test"; + vm.AppName = "test"; vm.SelectedAppType = AppType.PointOfSale.ToString(); Assert.IsType(apps.CreateApp(vm).Result); var appId = Assert.IsType(Assert.IsType(apps.ListApps().Result).Model) diff --git a/BTCPayServer.Tests/SeleniumTests.cs b/BTCPayServer.Tests/SeleniumTests.cs index c50dc949e..6f91d2e24 100644 --- a/BTCPayServer.Tests/SeleniumTests.cs +++ b/BTCPayServer.Tests/SeleniumTests.cs @@ -524,7 +524,7 @@ namespace BTCPayServer.Tests s.Driver.FindElement(By.Id("Apps")).Click(); s.Driver.FindElement(By.Id("CreateNewApp")).Click(); - s.Driver.FindElement(By.Name("Name")).SendKeys("PoS" + Guid.NewGuid()); + s.Driver.FindElement(By.Name("AppName")).SendKeys("PoS" + Guid.NewGuid()); s.Driver.FindElement(By.Id("SelectedAppType")).SendKeys("Point of Sale"); s.Driver.FindElement(By.Id("SelectedStore")).SendKeys(storeName); s.Driver.FindElement(By.Id("Create")).Click(); @@ -565,7 +565,7 @@ namespace BTCPayServer.Tests s.Driver.FindElement(By.Id("Apps")).Click(); s.Driver.FindElement(By.Id("CreateNewApp")).Click(); - s.Driver.FindElement(By.Name("Name")).SendKeys("CF" + Guid.NewGuid()); + s.Driver.FindElement(By.Name("AppName")).SendKeys("CF" + Guid.NewGuid()); s.Driver.FindElement(By.Id("SelectedAppType")).SendKeys("Crowdfund"); s.Driver.FindElement(By.Id("SelectedStore")).SendKeys(storeName); s.Driver.FindElement(By.Id("Create")).Click(); diff --git a/BTCPayServer.Tests/UnitTest1.cs b/BTCPayServer.Tests/UnitTest1.cs index 49f297abd..1d4e79770 100644 --- a/BTCPayServer.Tests/UnitTest1.cs +++ b/BTCPayServer.Tests/UnitTest1.cs @@ -2944,8 +2944,8 @@ namespace BTCPayServer.Tests var apps2 = user2.GetController(); var vm = Assert.IsType(Assert.IsType(apps.CreateApp().Result).Model); Assert.NotNull(vm.SelectedAppType); - Assert.Null(vm.Name); - vm.Name = "test"; + Assert.Null(vm.AppName); + vm.AppName = "test"; vm.SelectedAppType = AppType.PointOfSale.ToString(); var redirectToAction = Assert.IsType(apps.CreateApp(vm).Result); Assert.Equal(nameof(apps.UpdatePointOfSale), redirectToAction.ActionName); diff --git a/BTCPayServer/Controllers/AppsController.Crowdfund.cs b/BTCPayServer/Controllers/AppsController.Crowdfund.cs index e7b8b79e3..8ed9f1717 100644 --- a/BTCPayServer/Controllers/AppsController.Crowdfund.cs +++ b/BTCPayServer/Controllers/AppsController.Crowdfund.cs @@ -33,6 +33,7 @@ namespace BTCPayServer.Controllers Title = settings.Title, StoreId = app.StoreDataId, StoreName = app.StoreData?.StoreName, + AppName = app.Name, Enabled = settings.Enabled, EnforceTargetAmount = settings.EnforceTargetAmount, StartDate = settings.StartDate, @@ -121,6 +122,7 @@ namespace BTCPayServer.Controllers return View(vm); } + app.Name = vm.AppName; var newSettings = new CrowdfundSettings() { Title = vm.Title, diff --git a/BTCPayServer/Controllers/AppsController.PointOfSale.cs b/BTCPayServer/Controllers/AppsController.PointOfSale.cs index e7dcde226..24fc30de0 100644 --- a/BTCPayServer/Controllers/AppsController.PointOfSale.cs +++ b/BTCPayServer/Controllers/AppsController.PointOfSale.cs @@ -103,6 +103,7 @@ namespace BTCPayServer.Controllers Id = appId, StoreId = app.StoreDataId, StoreName = app.StoreData?.StoreName, + AppName = app.Name, Title = settings.Title, DefaultView = settings.DefaultView, ShowCustomAmount = settings.ShowCustomAmount, @@ -187,6 +188,8 @@ namespace BTCPayServer.Controllers { return View(vm); } + + app.Name = vm.AppName; app.SetSettings(new PointOfSaleSettings { Title = vm.Title, diff --git a/BTCPayServer/Controllers/AppsController.cs b/BTCPayServer/Controllers/AppsController.cs index 8f92886b5..0d8e649d7 100644 --- a/BTCPayServer/Controllers/AppsController.cs +++ b/BTCPayServer/Controllers/AppsController.cs @@ -163,7 +163,7 @@ namespace BTCPayServer.Controllers var appData = new AppData { StoreDataId = selectedStore, - Name = vm.Name, + Name = vm.AppName, AppType = appType.ToString() }; diff --git a/BTCPayServer/Models/AppViewModels/CreateAppViewModel.cs b/BTCPayServer/Models/AppViewModels/CreateAppViewModel.cs index f535d5d66..5a47377a9 100644 --- a/BTCPayServer/Models/AppViewModels/CreateAppViewModel.cs +++ b/BTCPayServer/Models/AppViewModels/CreateAppViewModel.cs @@ -21,7 +21,7 @@ namespace BTCPayServer.Models.AppViewModels [Required] [MaxLength(50)] [MinLength(1)] - public string Name { get; set; } + public string AppName { get; set; } [Display(Name = "Store")] public string SelectedStore { get; set; } diff --git a/BTCPayServer/Models/AppViewModels/UpdateCrowdfundViewModel.cs b/BTCPayServer/Models/AppViewModels/UpdateCrowdfundViewModel.cs index 26b390246..a2eb96d2b 100644 --- a/BTCPayServer/Models/AppViewModels/UpdateCrowdfundViewModel.cs +++ b/BTCPayServer/Models/AppViewModels/UpdateCrowdfundViewModel.cs @@ -10,9 +10,16 @@ namespace BTCPayServer.Models.AppViewModels { public string StoreId { get; set; } public string StoreName { get; set; } + + [Required] + [MaxLength(50)] + [MinLength(1)] + [Display(Name = "App Name")] + public string AppName { get; set; } [Required] [MaxLength(30)] + [Display(Name = "Display Title")] public string Title { get; set; } public string Tagline { get; set; } diff --git a/BTCPayServer/Models/AppViewModels/UpdatePointOfSaleViewModel.cs b/BTCPayServer/Models/AppViewModels/UpdatePointOfSaleViewModel.cs index 6aa930e6f..1498b659d 100644 --- a/BTCPayServer/Models/AppViewModels/UpdatePointOfSaleViewModel.cs +++ b/BTCPayServer/Models/AppViewModels/UpdatePointOfSaleViewModel.cs @@ -10,9 +10,16 @@ namespace BTCPayServer.Models.AppViewModels { public string StoreId { get; set; } public string StoreName { get; set; } + + [Required] + [MaxLength(50)] + [MinLength(1)] + [Display(Name = "App Name")] + public string AppName { get; set; } [Required] [MaxLength(30)] + [Display(Name = "Display Title")] public string Title { get; set; } [MaxLength(5)] public string Currency { get; set; } diff --git a/BTCPayServer/Views/Apps/CreateApp.cshtml b/BTCPayServer/Views/Apps/CreateApp.cshtml index 7b9c74ed0..457f5f8db 100644 --- a/BTCPayServer/Views/Apps/CreateApp.cshtml +++ b/BTCPayServer/Views/Apps/CreateApp.cshtml @@ -26,9 +26,9 @@
- - - + + +
diff --git a/BTCPayServer/Views/Apps/UpdateCrowdfund.cshtml b/BTCPayServer/Views/Apps/UpdateCrowdfund.cshtml index d0a6cd402..b234f7b3d 100644 --- a/BTCPayServer/Views/Apps/UpdateCrowdfund.cshtml +++ b/BTCPayServer/Views/Apps/UpdateCrowdfund.cshtml @@ -19,7 +19,7 @@
-

@ViewData["PageTitle"]

+

@ViewData["PageTitle"] - @Model.AppName

@@ -27,6 +27,11 @@
+
+ + + +
diff --git a/BTCPayServer/Views/Apps/UpdatePointOfSale.cshtml b/BTCPayServer/Views/Apps/UpdatePointOfSale.cshtml index b98bb2da2..7ce6ad95e 100644 --- a/BTCPayServer/Views/Apps/UpdatePointOfSale.cshtml +++ b/BTCPayServer/Views/Apps/UpdatePointOfSale.cshtml @@ -1,4 +1,4 @@ -@using BTCPayServer.Services.Apps +@using BTCPayServer.Services.Apps @addTagHelper *, BundlerMinifier.TagHelpers @model UpdatePointOfSaleViewModel @{ @@ -8,14 +8,19 @@
-

@ViewData["PageTitle"]

+

@ViewData["PageTitle"] - @Model.AppName

- +
+
+ + + +