From 67aee9bdc67ba32e3f6db3545d8083cf78dffdf4 Mon Sep 17 00:00:00 2001 From: Dennis Reimann Date: Wed, 29 Sep 2021 14:33:49 +0200 Subject: [PATCH] Improve display and structure of payment related configuration --- BTCPayServer/Controllers/StoresController.cs | 2 + .../Models/StoreViewModels/StoreViewModel.cs | 2 + BTCPayServer/Views/Stores/UpdateStore.cshtml | 182 +++++++++--------- 3 files changed, 100 insertions(+), 86 deletions(-) diff --git a/BTCPayServer/Controllers/StoresController.cs b/BTCPayServer/Controllers/StoresController.cs index 90ff15373..98e6f246c 100644 --- a/BTCPayServer/Controllers/StoresController.cs +++ b/BTCPayServer/Controllers/StoresController.cs @@ -578,6 +578,8 @@ namespace BTCPayServer.Controllers vm.PayJoinEnabled = storeBlob.PayJoinEnabled; vm.HintWallet = storeBlob.Hints.Wallet; vm.HintLightning = storeBlob.Hints.Lightning; + vm.IsOnchainSetup = vm.DerivationSchemes.Any(scheme => !string.IsNullOrWhiteSpace(scheme.Value)); + vm.IsLightningSetup = vm.LightningNodes.Any(scheme => !string.IsNullOrWhiteSpace(scheme.Address)); (bool canUseHotWallet, _) = await CanUseHotWallet(); vm.CanUsePayJoin = canUseHotWallet && store diff --git a/BTCPayServer/Models/StoreViewModels/StoreViewModel.cs b/BTCPayServer/Models/StoreViewModels/StoreViewModel.cs index 54fe28dd5..8a48cfb09 100644 --- a/BTCPayServer/Models/StoreViewModels/StoreViewModel.cs +++ b/BTCPayServer/Models/StoreViewModels/StoreViewModel.cs @@ -89,6 +89,8 @@ namespace BTCPayServer.Models.StoreViewModels [Display(Name = "Enable Payjoin/P2EP")] public bool PayJoinEnabled { get; set; } public bool CanUsePayJoin { get; set; } + public bool IsOnchainSetup { get; set; } + public bool IsLightningSetup { get; set; } public bool HintWallet { get; set; } public bool HintLightning { get; set; } diff --git a/BTCPayServer/Views/Stores/UpdateStore.cshtml b/BTCPayServer/Views/Stores/UpdateStore.cshtml index 56cf1f2f0..14a03cb01 100644 --- a/BTCPayServer/Views/Stores/UpdateStore.cshtml +++ b/BTCPayServer/Views/Stores/UpdateStore.cshtml @@ -182,98 +182,108 @@ - -

Payment

-
- - - - - -
- @if (Model.CanUsePayJoin) + + @if (Model.IsOnchainSetup || Model.IsLightningSetup) { +

Payment

+
+ + + + + +
+
+ + + + + +
-
- - - + + + + +
+ + minutes +
+ +
+
+ + + + +
+ + percent +
+ +
+ @if (Model.IsOnchainSetup) + { +
Onchain
+ @if (Model.CanUsePayJoin) + { +
+
+ + + + + +
+ +
+ } +
+ + +
+ + minutes +
+
- -
+
+ + + + + + + +
+ } + @if (Model.IsLightningSetup) + { +
Lightning
+
+ + + +

+ Available placeholders: + {StoreName} {ItemDescription} {OrderId} +

+
+ } } -
- - - - - -
-
- - - - -
- - minutes -
- -
-
- - - - -
- - minutes -
- -
-
- - - - -
- - percent -
- -
-
- - - - - - - -
-
- - - -

- Available placeholders: - {StoreName} {ItemDescription} {OrderId} -

-
-