mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 22:14:26 +01:00
Add payjoin option to hot wallet setup (#2450)
* Add payjoin option to hot wallet setup Enables payjoin by default when creating a hot wallet and offers the user an opt-out. Test fix * Display PayJoin option only if it is available * Test fixes * Update hot wallet checks * Test fix after rebase * Use toggle buttons for enabling options
This commit is contained in:
@@ -466,7 +466,6 @@ namespace BTCPayServer.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return View(model);
|
||||
@@ -558,12 +557,9 @@ namespace BTCPayServer.Controllers
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
[HttpGet]
|
||||
[Route("{storeId}")]
|
||||
public IActionResult UpdateStore()
|
||||
|
||||
[HttpGet("{storeId}")]
|
||||
public async Task<IActionResult> UpdateStore()
|
||||
{
|
||||
var store = HttpContext.GetStoreData();
|
||||
if (store == null)
|
||||
@@ -586,12 +582,17 @@ namespace BTCPayServer.Controllers
|
||||
vm.PayJoinEnabled = storeBlob.PayJoinEnabled;
|
||||
vm.HintWallet = storeBlob.Hints.Wallet;
|
||||
vm.HintLightning = storeBlob.Hints.Lightning;
|
||||
|
||||
(bool canUseHotWallet, _) = await CanUseHotWallet();
|
||||
vm.CanUsePayJoin = canUseHotWallet && store
|
||||
.GetSupportedPaymentMethods(_NetworkProvider)
|
||||
.OfType<DerivationSchemeSettings>()
|
||||
.Any(settings => settings.Network.SupportPayJoin && settings.IsHotWallet);
|
||||
|
||||
return View(vm);
|
||||
}
|
||||
|
||||
|
||||
[HttpPost]
|
||||
[Route("{storeId}")]
|
||||
|
||||
[HttpPost("{storeId}")]
|
||||
public async Task<IActionResult> UpdateStore(StoreViewModel model, string command = null)
|
||||
{
|
||||
bool needUpdate = false;
|
||||
@@ -635,11 +636,7 @@ namespace BTCPayServer.Controllers
|
||||
{
|
||||
var problematicPayjoinEnabledMethods = CurrentStore.GetSupportedPaymentMethods(_NetworkProvider)
|
||||
.OfType<DerivationSchemeSettings>()
|
||||
.Where(settings =>
|
||||
settings.Network.SupportPayJoin &&
|
||||
string.IsNullOrEmpty(_ExplorerProvider.GetExplorerClient(settings.Network)
|
||||
.GetMetadata<string>(settings.AccountDerivation,
|
||||
WellknownMetadataKeys.Mnemonic)))
|
||||
.Where(settings => settings.Network.SupportPayJoin && !settings.IsHotWallet)
|
||||
.Select(settings => settings.PaymentId.CryptoCode)
|
||||
.ToArray();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user