Set new LN defaults (#3325)

fixes #3324
This commit is contained in:
Andrew Camilleri 2022-01-25 04:17:39 +01:00 committed by GitHub
parent 5661798601
commit e917796fce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 13 deletions

View File

@ -1348,13 +1348,9 @@ namespace BTCPayServer.Tests
s.GoToStore(StoreNavPages.Payment);
s.AddLightningNode(LightningConnectionType.CLightning, false);
s.GoToLightningSettings();
// LNURL is false by default
Assert.False(s.Driver.FindElement(By.Id("LNURLEnabled")).Selected);
// LNURL settings are not expanded when LNURL is disabled
Assert.DoesNotContain("show", s.Driver.FindElement(By.Id("LNURLSettings")).GetAttribute("class"));
s.Driver.SetCheckbox(By.Id("LNURLEnabled"), true);
SudoForceSaveLightningSettingsRightNowAndFast(s, cryptoCode);
// LNURL is true by default
Assert.True(s.Driver.FindElement(By.Id("LNURLEnabled")).Selected);
// Topup Invoice test
var i = s.CreateInvoice(storeId, null, cryptoCode);
s.GoToInvoiceCheckout(i);
@ -1389,6 +1385,9 @@ namespace BTCPayServer.Tests
// Standard invoice test
s.GoToStore(storeId);
s.GoToLightningSettings();
s.Driver.SetCheckbox(By.Id("LNURLStandardInvoiceEnabled"), true);
SudoForceSaveLightningSettingsRightNowAndFast(s, cryptoCode);
i = s.CreateInvoice(storeId, 0.0000001m, cryptoCode);
s.GoToInvoiceCheckout(i);
s.Driver.FindElement(By.ClassName("payment__currencies")).Click();
@ -1475,6 +1474,7 @@ namespace BTCPayServer.Tests
s.GoToLightningSettings();
s.Driver.SetCheckbox(By.Id("LNURLEnabled"), true);
s.Driver.SetCheckbox(By.Id("DisableBolt11PaymentMethod"), true);
s.Driver.SetCheckbox(By.Id("LNURLStandardInvoiceEnabled"), true);
s.Driver.FindElement(By.Id("save")).Click();
Assert.Contains($"{cryptoCode} Lightning settings successfully updated", s.FindAlertMessage().Text);
var invForPP = s.CreateInvoice(0.0000001m, cryptoCode);
@ -1560,12 +1560,6 @@ namespace BTCPayServer.Tests
s.GoToStore(s.StoreId, StoreNavPages.Payment);
s.AddLightningNode(LightningConnectionType.LndREST, false);
//ensure ln address is not available as lnurl is not configured
s.Driver.AssertElementNotFound(By.Id("StoreNav-LightningAddress"));
s.GoToLightningSettings();
s.Driver.SetCheckbox(By.Id("LNURLEnabled"), true);
SudoForceSaveLightningSettingsRightNowAndFast(s, cryptoCode);
s.Driver.FindElement(By.Id("StoreNav-LightningAddress")).Click();

View File

@ -164,6 +164,13 @@ namespace BTCPayServer.Controllers
var lnurl = new PaymentMethodId(vm.CryptoCode, PaymentTypes.LNURLPay);
store.SetStoreBlob(storeBlob);
store.SetSupportedPaymentMethod(paymentMethodId, paymentMethod);
store.SetSupportedPaymentMethod(lnurl, new LNURLPaySupportedPaymentMethod()
{
CryptoCode = vm.CryptoCode,
UseBech32Scheme = true,
EnableForStandardInvoices = false,
LUD12Enabled = false
});
await _Repo.UpdateStore(store);
TempData[WellKnownTempData.SuccessMessage] = $"{network.CryptoCode} Lightning node updated.";