diff --git a/BTCPayServer.Rating/AvailableRateProvider.cs b/BTCPayServer.Rating/AvailableRateProvider.cs index 884da39ac..b21e0189f 100644 --- a/BTCPayServer.Rating/AvailableRateProvider.cs +++ b/BTCPayServer.Rating/AvailableRateProvider.cs @@ -1,3 +1,5 @@ +using System; + namespace BTCPayServer.Rating { public enum RateSource @@ -25,5 +27,13 @@ namespace BTCPayServer.Rating Url = url; Source = source; } + + public string DisplayName => + Source switch + { + RateSource.Direct => Name, + RateSource.Coingecko => $"{Name} (via CoinGecko)", + _ => throw new NotSupportedException(Source.ToString()) + }; } } diff --git a/BTCPayServer.Tests/AltcoinTests/AltcoinTests.cs b/BTCPayServer.Tests/AltcoinTests/AltcoinTests.cs index 6802b2fc1..47b43eb7b 100644 --- a/BTCPayServer.Tests/AltcoinTests/AltcoinTests.cs +++ b/BTCPayServer.Tests/AltcoinTests/AltcoinTests.cs @@ -386,7 +386,7 @@ namespace BTCPayServer.Tests // BTC crash by 50% s.Server.PayTester.ChangeRate("BTC_USD", new Rating.BidAsk(5000.0m / 2.0m, 5100.0m / 2.0m)); - s.GoToStore(StoreNavPages.Payment); + s.GoToStore(); s.Driver.FindElement(By.Id("BOLT11Expiration")).Clear(); s.Driver.FindElement(By.Id("BOLT11Expiration")).SendKeys("5" + Keys.Enter); s.GoToInvoice(invoice.Id); @@ -438,7 +438,7 @@ namespace BTCPayServer.Tests s.GoToInvoiceCheckout(invoiceId); s.Driver.FindElement(By.ClassName("payment__currencies_noborder")); s.GoToHome(); - s.GoToStore(StoreNavPages.Payment); + s.GoToStore(); s.AddDerivationScheme("LTC"); s.AddLightningNode(LightningConnectionType.CLightning); //there should be three now diff --git a/BTCPayServer.Tests/CheckoutUITests.cs b/BTCPayServer.Tests/CheckoutUITests.cs index d42df0aac..2e293f860 100644 --- a/BTCPayServer.Tests/CheckoutUITests.cs +++ b/BTCPayServer.Tests/CheckoutUITests.cs @@ -204,7 +204,7 @@ namespace BTCPayServer.Tests s.GoToRegister(); s.RegisterNewUser(); s.CreateNewStore(); - s.GoToStore(StoreNavPages.Payment); + s.GoToStore(); s.AddDerivationScheme(); var invoiceId = s.CreateInvoice(0.001m, "BTC", "a@x.com"); var invoice = await s.Server.PayTester.InvoiceRepository.GetInvoice(invoiceId); diff --git a/BTCPayServer.Tests/SeleniumTester.cs b/BTCPayServer.Tests/SeleniumTester.cs index 63210c20b..e5cac541d 100644 --- a/BTCPayServer.Tests/SeleniumTester.cs +++ b/BTCPayServer.Tests/SeleniumTester.cs @@ -156,7 +156,6 @@ namespace BTCPayServer.Tests Driver.FindElement(By.Id("StoreNav-StoreSettings")).Click(); Driver.FindElement(By.Id($"SectionNav-{StoreNavPages.General.ToString()}")).Click(); var storeId = Driver.WaitForElement(By.Id("Id")).GetAttribute("value"); - Driver.FindElement(By.Id($"SectionNav-{StoreNavPages.Payment.ToString()}")).Click(); if (keepId) StoreId = storeId; return (name, storeId); @@ -397,7 +396,6 @@ namespace BTCPayServer.Tests public void GoToLightningSettings(string cryptoCode = "BTC") { - GoToStore(StoreNavPages.Payment); Driver.FindElement(By.Id($"StoreNav-Lightning{cryptoCode}")).Click(); // if Lightning is already set up we need to navigate to the settings if (Driver.PageSource.Contains("id=\"SectionNav-LightningSettings\"")) diff --git a/BTCPayServer.Tests/SeleniumTests.cs b/BTCPayServer.Tests/SeleniumTests.cs index 1008d705e..cd961b436 100644 --- a/BTCPayServer.Tests/SeleniumTests.cs +++ b/BTCPayServer.Tests/SeleniumTests.cs @@ -404,7 +404,7 @@ namespace BTCPayServer.Tests (string storeName, string storeId) = s.CreateNewStore(); var storeUrl = $"/stores/{storeId}"; - s.GoToStore(StoreNavPages.Payment); + s.GoToStore(); Assert.Contains(storeName, s.Driver.PageSource); // verify steps for wallet setup are displayed correctly @@ -793,7 +793,7 @@ namespace BTCPayServer.Tests Assert.Contains(server.ServerUri.AbsoluteUri, s.Driver.PageSource); TestLogs.LogInformation("Let's see if we can generate an event"); - s.GoToStore(StoreNavPages.Payment); + s.GoToStore(); s.AddDerivationScheme(); s.CreateInvoice(); var request = await server.GetNextRequest(); @@ -929,7 +929,7 @@ namespace BTCPayServer.Tests var result = await s.Server.ExplorerNode.GetAddressInfoAsync(BitcoinAddress.Create(address, Network.RegTest)); Assert.True(result.IsWatchOnly); - s.GoToStore(storeId, StoreNavPages.Payment); + s.GoToStore(storeId); var mnemonic = s.GenerateWallet(cryptoCode, "", true, true); //lets import and save private keys @@ -1302,7 +1302,7 @@ namespace BTCPayServer.Tests s.RegisterNewUser(true); s.CreateNewStore(); - s.GoToStore(StoreNavPages.Payment); + s.GoToStore(); s.AddLightningNode(LightningConnectionType.CLightning, false); s.GoToLightningSettings(); s.Driver.SetCheckbox(By.Id("LNURLEnabled"), true); @@ -1345,7 +1345,6 @@ namespace BTCPayServer.Tests s.RegisterNewUser(true); (_, string storeId) = s.CreateNewStore(); var network = s.Server.NetworkProvider.GetNetwork(cryptoCode).NBitcoinNetwork; - s.GoToStore(StoreNavPages.Payment); s.AddLightningNode(LightningConnectionType.CLightning, false); s.GoToLightningSettings(); // LNURL is true by default @@ -1558,7 +1557,6 @@ namespace BTCPayServer.Tests //ensure ln address is not available as Lightning is not enable s.Driver.AssertElementNotFound(By.Id("StoreNav-LightningAddress")); - s.GoToStore(s.StoreId, StoreNavPages.Payment); s.AddLightningNode(LightningConnectionType.LndREST, false); s.Driver.FindElement(By.Id("StoreNav-LightningAddress")).Click(); diff --git a/BTCPayServer.Tests/TestAccount.cs b/BTCPayServer.Tests/TestAccount.cs index 49466193b..25b37de54 100644 --- a/BTCPayServer.Tests/TestAccount.cs +++ b/BTCPayServer.Tests/TestAccount.cs @@ -133,13 +133,13 @@ namespace BTCPayServer.Tests }); } - public async Task ModifyPayment(Action modify) + public async Task ModifyPayment(Action modify) { var storeController = GetController(); - var response = storeController.Payment(); - PaymentViewModel payment = (PaymentViewModel)((ViewResult)response).Model; - modify(payment); - await storeController.Payment(payment); + var response = storeController.GeneralSettings(); + GeneralSettingsViewModel settings = (GeneralSettingsViewModel)((ViewResult)response).Model; + modify(settings); + await storeController.GeneralSettings(settings); } public async Task ModifyWalletSettings(Action modify) diff --git a/BTCPayServer.Tests/UnitTest1.cs b/BTCPayServer.Tests/UnitTest1.cs index 871834fe6..69fe3471d 100644 --- a/BTCPayServer.Tests/UnitTest1.cs +++ b/BTCPayServer.Tests/UnitTest1.cs @@ -275,13 +275,13 @@ namespace BTCPayServer.Tests // Set tolerance to 50% var stores = user.GetController(); - var response = stores.Payment(); - var vm = Assert.IsType(Assert.IsType(response).Model); + var response = stores.GeneralSettings(); + var vm = Assert.IsType(Assert.IsType(response).Model); Assert.Equal(0.0, vm.PaymentTolerance); vm.PaymentTolerance = 50.0; - Assert.IsType(stores.Payment(vm).Result); + Assert.IsType(stores.GeneralSettings(vm).Result); - var invoice = user.BitPay.CreateInvoice( + var invoice = await user.BitPay.CreateInvoiceAsync( new Invoice() { Buyer = new Buyer() { email = "test@fwf.com" }, @@ -295,7 +295,7 @@ namespace BTCPayServer.Tests // Pays 75% var invoiceAddress = BitcoinAddress.Create(invoice.CryptoInfo[0].Address, tester.ExplorerNode.Network); - tester.ExplorerNode.SendToAddress(invoiceAddress, + await tester.ExplorerNode.SendToAddressAsync(invoiceAddress, Money.Satoshis(invoice.BtcDue.Satoshi * 0.75m)); TestUtils.Eventually(() => @@ -415,13 +415,13 @@ namespace BTCPayServer.Tests await tester.StartAsync(); await tester.EnsureChannelsSetup(); var user = tester.NewAccount(); - user.GrantAccess(true); + await user.GrantAccessAsync(true); var storeController = user.GetController(); - var storeResponse = storeController.Payment(); + var storeResponse = storeController.GeneralSettings(); Assert.IsType(storeResponse); Assert.IsType(await storeController.SetupLightningNode(user.StoreId, "BTC")); - var testResult = storeController.SetupLightningNode(user.StoreId, new LightningNodeViewModel + storeController.SetupLightningNode(user.StoreId, new LightningNodeViewModel { ConnectionString = $"type=charge;server={tester.MerchantCharge.Client.Uri.AbsoluteUri};allowinsecure=true", SkipPortTest = true // We can't test this as the IP can't be resolved by the test host :( diff --git a/BTCPayServer/Components/MainNav/Default.cshtml b/BTCPayServer/Components/MainNav/Default.cshtml index eb5edd86c..9ff22cd33 100644 --- a/BTCPayServer/Components/MainNav/Default.cshtml +++ b/BTCPayServer/Components/MainNav/Default.cshtml @@ -35,7 +35,7 @@
  • @@ -30,7 +31,7 @@ { if (!isLightningEnabled) { - + You need to setup Lightning first } diff --git a/BTCPayServer/Views/UIApps/ListApps.cshtml b/BTCPayServer/Views/UIApps/ListApps.cshtml index dd3db9c0d..255cd58c7 100644 --- a/BTCPayServer/Views/UIApps/ListApps.cshtml +++ b/BTCPayServer/Views/UIApps/ListApps.cshtml @@ -79,7 +79,7 @@ @if (app.IsOwner) { - @app.StoreName + @app.StoreName } else { diff --git a/BTCPayServer/Views/UIAppsPublic/PointOfSale/Print.cshtml b/BTCPayServer/Views/UIAppsPublic/PointOfSale/Print.cshtml index bb1a401ac..c38f13731 100644 --- a/BTCPayServer/Views/UIAppsPublic/PointOfSale/Print.cshtml +++ b/BTCPayServer/Views/UIAppsPublic/PointOfSale/Print.cshtml @@ -24,14 +24,13 @@ { supported = null; } - } @if (supported is null) { diff --git a/BTCPayServer/Views/UIStores/Dashboard.cshtml b/BTCPayServer/Views/UIStores/Dashboard.cshtml index 433a540d5..64d96b997 100644 --- a/BTCPayServer/Views/UIStores/Dashboard.cshtml +++ b/BTCPayServer/Views/UIStores/Dashboard.cshtml @@ -63,7 +63,7 @@ else } else { - +
    Set up a wallet
    @@ -95,7 +95,7 @@ else } else { -
    +
    Set up a Lightning node
    diff --git a/BTCPayServer/Views/UIStores/GeneralSettings.cshtml b/BTCPayServer/Views/UIStores/GeneralSettings.cshtml index c28da1b6e..b5d480dd9 100644 --- a/BTCPayServer/Views/UIStores/GeneralSettings.cshtml +++ b/BTCPayServer/Views/UIStores/GeneralSettings.cshtml @@ -5,7 +5,7 @@ }
    -
    +
    @if (!ViewContext.ModelState.IsValid) {
    @@ -27,8 +27,64 @@
    +

    Payment

    +
    + + + +
    +
    +
    + + + + + +
    +
    + + + + +
    + + minutes +
    + +
    +
    + + + + +
    + + percent +
    + +
    +
    + +
    + + days +
    + +
    + +

    Services

    diff --git a/BTCPayServer/Views/UIStores/Payment.cshtml b/BTCPayServer/Views/UIStores/Payment.cshtml deleted file mode 100644 index 7d77d8706..000000000 --- a/BTCPayServer/Views/UIStores/Payment.cshtml +++ /dev/null @@ -1,75 +0,0 @@ -@model PaymentViewModel -@{ - Layout = "../Shared/_NavLayout.cshtml"; - ViewData.SetActivePage(StoreNavPages.Payment, "Wallets", Context.GetStoreData().Id); -} - -
    -
    - @if (!ViewContext.ModelState.IsValid) - { -
    - } -
    -

    Payment

    -
    - - - -
    -
    - - - - - -
    -
    - - - - - -
    -
    - - - - -
    - - minutes -
    - -
    -
    - - - - -
    - - percent -
    - -
    -
    - -
    - - days -
    - -
    - - -
    -
    - -@section PageFootContent { - -} diff --git a/BTCPayServer/Views/UIStores/StoreNavPages.cs b/BTCPayServer/Views/UIStores/StoreNavPages.cs index 9ca06d326..8d1f5395e 100644 --- a/BTCPayServer/Views/UIStores/StoreNavPages.cs +++ b/BTCPayServer/Views/UIStores/StoreNavPages.cs @@ -2,6 +2,6 @@ namespace BTCPayServer.Views.Stores { public enum StoreNavPages { - Create, Dashboard, Rates, Payment, OnchainSettings, LightningSettings, Lightning, CheckoutAppearance, General, Tokens, Users, PayButton, Integrations, Webhooks, PullPayments, Payouts + Create, Dashboard, General, Rates, OnchainSettings, LightningSettings, Lightning, CheckoutAppearance, Tokens, Users, PayButton, Integrations, Webhooks, PullPayments, Payouts } } diff --git a/BTCPayServer/Views/UIStores/_LayoutWalletSetup.cshtml b/BTCPayServer/Views/UIStores/_LayoutWalletSetup.cshtml index f1df710bb..ca00311fb 100644 --- a/BTCPayServer/Views/UIStores/_LayoutWalletSetup.cshtml +++ b/BTCPayServer/Views/UIStores/_LayoutWalletSetup.cshtml @@ -13,7 +13,7 @@ @section Navbar { @await RenderSectionAsync("Navbar", false) - + } diff --git a/BTCPayServer/Views/UIStores/_Nav.cshtml b/BTCPayServer/Views/UIStores/_Nav.cshtml index f7b5f8693..a9208bc6f 100644 --- a/BTCPayServer/Views/UIStores/_Nav.cshtml +++ b/BTCPayServer/Views/UIStores/_Nav.cshtml @@ -3,7 +3,6 @@ @if (wallet.IsOwner) { - + } else {
    @wallet.StoreName@wallet.StoreName