mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 22:14:26 +01:00
Show warning when enabling Payjoin but supported payment methods are not using a hot wallet (#1545)
* Show warning when enabling Payjoin but supported payment methods are not using a hot wallet https://i.imgur.com/RXBhr0n.png fixes #1474 * expose p2p port
This commit is contained in:
@@ -30,6 +30,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
using NBitcoin;
|
||||
using NBitcoin.DataEncoders;
|
||||
using NBXplorer;
|
||||
|
||||
namespace BTCPayServer.Controllers
|
||||
{
|
||||
@@ -545,6 +546,7 @@ namespace BTCPayServer.Controllers
|
||||
Provider = "CoinSwitch"
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
[HttpPost]
|
||||
[Route("{storeId}")]
|
||||
@@ -574,6 +576,7 @@ namespace BTCPayServer.Controllers
|
||||
blob.InvoiceExpiration = model.InvoiceExpiration;
|
||||
blob.LightningDescriptionTemplate = model.LightningDescriptionTemplate ?? string.Empty;
|
||||
blob.PaymentTolerance = model.PaymentTolerance;
|
||||
var payjoinChanged = blob.PayJoinEnabled != model.PayJoinEnabled;
|
||||
blob.PayJoinEnabled = model.PayJoinEnabled;
|
||||
if (CurrentStore.SetStoreBlob(blob))
|
||||
{
|
||||
@@ -583,7 +586,31 @@ namespace BTCPayServer.Controllers
|
||||
if (needUpdate)
|
||||
{
|
||||
await _Repo.UpdateStore(CurrentStore);
|
||||
|
||||
TempData[WellKnownTempData.SuccessMessage] = "Store successfully updated";
|
||||
|
||||
if (payjoinChanged && blob.PayJoinEnabled)
|
||||
{
|
||||
var problematicPayjoinEnabledMethods = CurrentStore.GetSupportedPaymentMethods(_NetworkProvider)
|
||||
.OfType<DerivationSchemeSettings>()
|
||||
.Where(settings =>
|
||||
settings.Network.SupportPayJoin &&
|
||||
string.IsNullOrEmpty(_ExplorerProvider.GetExplorerClient(settings.Network)
|
||||
.GetMetadata<string>(settings.AccountDerivation,
|
||||
WellknownMetadataKeys.Mnemonic)))
|
||||
.Select(settings => settings.PaymentId.CryptoCode)
|
||||
.ToArray();
|
||||
|
||||
if (problematicPayjoinEnabledMethods.Any())
|
||||
{
|
||||
TempData.Remove(WellKnownTempData.SuccessMessage);
|
||||
TempData.SetStatusMessageModel(new StatusMessageModel()
|
||||
{
|
||||
Severity = StatusMessageModel.StatusSeverity.Warning,
|
||||
Html = $"The store was updated successfully. However, payjoin will not work for {string.Join(", ", problematicPayjoinEnabledMethods)} until you configure them to be a <a href='https://docs.btcpayserver.org/features/wallet/hotwallet' class='alert-link' target='_blank'>hot wallet</a>."
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return RedirectToAction(nameof(UpdateStore), new
|
||||
|
||||
Reference in New Issue
Block a user