From d30a8a7530969d91ff39a56656550f385f0821ee Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Wed, 11 Jun 2025 09:47:42 +0900 Subject: [PATCH] Fix tests and potential regression --- BTCPayServer.Rating/Providers/BitnobRateProvider.cs | 4 +++- BTCPayServer.Tests/ThirdPartyTests.cs | 2 +- .../PointOfSale/Controllers/UIPointOfSaleController.cs | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/BTCPayServer.Rating/Providers/BitnobRateProvider.cs b/BTCPayServer.Rating/Providers/BitnobRateProvider.cs index 54d08fee8..3d766fc9d 100644 --- a/BTCPayServer.Rating/Providers/BitnobRateProvider.cs +++ b/BTCPayServer.Rating/Providers/BitnobRateProvider.cs @@ -32,7 +32,9 @@ namespace BTCPayServer.Rating.Providers { string[] parts = property.Name.Split('_'); decimal value = property.Value.Value(); - pairRates.Add(new PairRate(new CurrencyPair("BTC", parts[1]), new BidAsk(value))); + // When API is broken, they return 0 rate + if (value != 0m) + pairRates.Add(new PairRate(new CurrencyPair("BTC", parts[1]), new BidAsk(value))); } return pairRates.ToArray(); } diff --git a/BTCPayServer.Tests/ThirdPartyTests.cs b/BTCPayServer.Tests/ThirdPartyTests.cs index 768ec5669..49dbc56c3 100644 --- a/BTCPayServer.Tests/ThirdPartyTests.cs +++ b/BTCPayServer.Tests/ThirdPartyTests.cs @@ -133,7 +133,7 @@ namespace BTCPayServer.Tests public async Task CanQueryDirectProviders() { // TODO: Check once in a while whether or not they are working again - string[] brokenShitcoinCasinos = { "binance", "coinbasepro" }; + string[] brokenShitcoinCasinos = { "bitnob", "binance", "coinbasepro" }; var skipped = 0; var factory = FastTests.CreateBTCPayRateFactory(); var directlySupported = factory.AvailableRateProviders.Where(s => s.Source == RateSource.Direct) diff --git a/BTCPayServer/Plugins/PointOfSale/Controllers/UIPointOfSaleController.cs b/BTCPayServer/Plugins/PointOfSale/Controllers/UIPointOfSaleController.cs index 0cfa1dd2c..e9ae4595f 100644 --- a/BTCPayServer/Plugins/PointOfSale/Controllers/UIPointOfSaleController.cs +++ b/BTCPayServer/Plugins/PointOfSale/Controllers/UIPointOfSaleController.cs @@ -323,7 +323,7 @@ namespace BTCPayServer.Plugins.PointOfSale.Controllers var receiptData = new PosReceiptData(); var summary = order.Calculate(); - var isTopup = selectedChoices.FirstOrDefault().Price is null && currentView == PosViewType.Static; + var isTopup = selectedChoices?.FirstOrDefault()?.Price is null && currentView == PosViewType.Static; if (!isTopup) { jposData.ItemsTotal = summary.ItemsTotal;