diff --git a/BTCPayServer.Tests/SeleniumTests.cs b/BTCPayServer.Tests/SeleniumTests.cs index 5e1d7c4b57..3aba6ac158 100644 --- a/BTCPayServer.Tests/SeleniumTests.cs +++ b/BTCPayServer.Tests/SeleniumTests.cs @@ -988,14 +988,14 @@ public async Task CanCreateAppPoS() Assert.True(s.Driver.PageSource.Contains("Tea shop"), "Unable to create PoS"); Assert.True(s.Driver.PageSource.Contains("Cart"), "PoS not showing correct default view"); Assert.True(s.Driver.PageSource.Contains("Take my money"), "PoS not showing correct default view"); - Assert.Equal(5, s.Driver.FindElements(By.CssSelector(".posItem:not(.d-none)")).Count); + Assert.Equal(6, s.Driver.FindElements(By.CssSelector(".posItem:not(.d-none)")).Count); var drinks = s.Driver.FindElement(By.CssSelector("label[for='Category-Drinks']")); Assert.Equal("Drinks", drinks.Text); drinks.Click(); Assert.Single(s.Driver.FindElements(By.CssSelector(".posItem:not(.d-none)"))); s.Driver.FindElement(By.CssSelector("label[for='Category-*']")).Click(); - Assert.Equal(5, s.Driver.FindElements(By.CssSelector(".posItem:not(.d-none)")).Count); + Assert.Equal(6, s.Driver.FindElements(By.CssSelector(".posItem:not(.d-none)")).Count); s.Driver.Url = posBaseUrl + "/static"; Assert.False(s.Driver.PageSource.Contains("Cart"), "Static PoS not showing correct view"); diff --git a/BTCPayServer.Tests/ThirdPartyTests.cs b/BTCPayServer.Tests/ThirdPartyTests.cs index c004f24b1d..9fb3ffc578 100644 --- a/BTCPayServer.Tests/ThirdPartyTests.cs +++ b/BTCPayServer.Tests/ThirdPartyTests.cs @@ -292,7 +292,7 @@ public void CanSolveTheDogesRatesOnKraken() [Fact] public async Task CanGetRateCryptoCurrenciesByDefault() { - string[] brokenShitcoins = { }; + string[] brokenShitcoins = { "BTG", "BTX" }; var provider = new BTCPayNetworkProvider(ChainName.Mainnet); var factory = FastTests.CreateBTCPayRateFactory(); var fetcher = new RateFetcher(factory); @@ -306,9 +306,13 @@ public async Task CanGetRateCryptoCurrenciesByDefault() foreach ((CurrencyPair key, Task value) in result) { var rateResult = await value; - TestLogs.LogInformation($"Testing {key}"); - if (brokenShitcoins.Contains(key.ToString())) + if (brokenShitcoins.Contains(key.Left)) + { + TestLogs.LogInformation($"Skipping {key} because it is marked as broken"); continue; + } + + TestLogs.LogInformation($"Testing {key}"); Assert.True(rateResult.BidAsk != null, $"Impossible to get the rate {rateResult.EvaluatedRule}"); } @@ -325,9 +329,12 @@ public async Task CanGetRateCryptoCurrenciesByDefault() foreach ((CurrencyPair key, Task value) in result) { var rateResult = await value; - TestLogs.LogInformation($"Testing {key} when default currency is {k.Key}"); - if (brokenShitcoins.Contains(key.ToString())) + if (brokenShitcoins.Contains(key.Left)) + { + TestLogs.LogInformation($"Skipping {key} because it is marked as broken"); continue; + } + TestLogs.LogInformation($"Testing {key} when default currency is {k.Key}"); Assert.True(rateResult.BidAsk != null, $"Impossible to get the rate {rateResult.EvaluatedRule}"); } } diff --git a/BTCPayServer.Tests/UnitTest1.cs b/BTCPayServer.Tests/UnitTest1.cs index dc78784a76..8a0b342563 100644 --- a/BTCPayServer.Tests/UnitTest1.cs +++ b/BTCPayServer.Tests/UnitTest1.cs @@ -2859,7 +2859,7 @@ public async void CanUseLocalProviderFiles() using var tester = CreateServerTester(); await tester.StartAsync(); var user = tester.NewAccount(); - user.GrantAccess(); + await user.GrantAccessAsync(); var controller = tester.PayTester.GetController(user.UserId, user.StoreId); var fileSystemStorageConfiguration = Assert.IsType(Assert @@ -2874,7 +2874,6 @@ public async void CanUseLocalProviderFiles() Assert.Equal(StorageProvider.FileSystem, shouldBeRedirectingToLocalStorageConfigPage.RouteValues["provider"]); - await CanUploadRemoveFiles(controller); } @@ -2906,7 +2905,7 @@ internal static async Task CanUploadRemoveFiles(UIServerController controller) //create a temporary link to file var tmpLinkGenerate = Assert.IsType(await controller.CreateTemporaryFileUrl(fileId, - new UIServerController.CreateTemporaryFileUrlViewModel() + new UIServerController.CreateTemporaryFileUrlViewModel { IsDownload = true, TimeAmount = 1, diff --git a/BTCPayServer/Storage/Services/Providers/FileSystemStorage/FileSystemFileProviderService.cs b/BTCPayServer/Storage/Services/Providers/FileSystemStorage/FileSystemFileProviderService.cs index e51a15cea7..54dc318add 100644 --- a/BTCPayServer/Storage/Services/Providers/FileSystemStorage/FileSystemFileProviderService.cs +++ b/BTCPayServer/Storage/Services/Providers/FileSystemStorage/FileSystemFileProviderService.cs @@ -52,7 +52,7 @@ public override async Task GetFileUrl(Uri baseUri, StoredFile storedFile BlobUrlAccess access = BlobUrlAccess.Read) { - var localFileDescriptor = new TemporaryLocalFileDescriptor() + var localFileDescriptor = new TemporaryLocalFileDescriptor { Expiry = expiry, FileId = storedFile.Id, @@ -60,9 +60,11 @@ public override async Task GetFileUrl(Uri baseUri, StoredFile storedFile }; var name = Guid.NewGuid().ToString(); var fullPath = Path.Combine(_datadirs.Value.TempStorageDir, name); - if (!File.Exists(fullPath)) + var fileInfo = new FileInfo(fullPath); + if (!fileInfo.Exists) { - await File.Create(fullPath).DisposeAsync(); + fileInfo.Directory?.Create(); + await File.Create(fileInfo.FullName).DisposeAsync(); } await File.WriteAllTextAsync(Path.Combine(_datadirs.Value.TempStorageDir, name), JsonConvert.SerializeObject(localFileDescriptor)); diff --git a/BTCPayServer/Views/Shared/PointOfSale/Public/Cart.cshtml b/BTCPayServer/Views/Shared/PointOfSale/Public/Cart.cshtml index 75155095be..3e6b7e0b8e 100644 --- a/BTCPayServer/Views/Shared/PointOfSale/Public/Cart.cshtml +++ b/BTCPayServer/Views/Shared/PointOfSale/Public/Cart.cshtml @@ -1,8 +1,6 @@ @using BTCPayServer.Plugins.PointOfSale.Models @using BTCPayServer.Services -@using Newtonsoft.Json.Linq; -@using BTCPayServer.Abstractions.TagHelpers -@using Microsoft.AspNetCore.Mvc.TagHelpers +@using Newtonsoft.Json.Linq @inject DisplayFormatter DisplayFormatter @inject BTCPayServer.Security.ContentSecurityPolicies Csp @model BTCPayServer.Plugins.PointOfSale.Models.ViewPointOfSaleViewModel @@ -65,8 +63,8 @@ ? item.PriceType == ViewPointOfSaleViewModel.ItemPriceType.Topup ? Model.CustomButtonText : Model.ButtonText : item.BuyButtonText; buttonText = buttonText.Replace("{0}", formatted).Replace("{Price}", formatted); - var categories = new JArray(item.Categories ?? Array.Empty()); -
+ var categories = new JArray(item.Categories ?? new object[] { }); +
@if (!string.IsNullOrWhiteSpace(item.Image)) { diff --git a/BTCPayServer/wwwroot/pos/cart.js b/BTCPayServer/wwwroot/pos/cart.js index ccb1863a26..ce1477e7a3 100644 --- a/BTCPayServer/wwwroot/pos/cart.js +++ b/BTCPayServer/wwwroot/pos/cart.js @@ -160,10 +160,8 @@ document.addEventListener("DOMContentLoaded",function () { } }, mounted() { - const self =this; - nextTick(() => { - self.$cart = new bootstrap.Offcanvas("#cart", {backdrop: false}) - }) + this.$cart = new bootstrap.Offcanvas(this.$refs.cart, { backdrop: false }) + window.addEventListener('pagehide', () => { if (this.payButtonLoading) { this.unsetPayButtonLoading();