Fix tests and potential regression

This commit is contained in:
nicolas.dorier
2025-06-11 09:47:42 +09:00
parent 79d6bc9fb5
commit d30a8a7530
3 changed files with 5 additions and 3 deletions

View File

@@ -32,7 +32,9 @@ namespace BTCPayServer.Rating.Providers
{ {
string[] parts = property.Name.Split('_'); string[] parts = property.Name.Split('_');
decimal value = property.Value.Value<decimal>(); decimal value = property.Value.Value<decimal>();
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(); return pairRates.ToArray();
} }

View File

@@ -133,7 +133,7 @@ namespace BTCPayServer.Tests
public async Task CanQueryDirectProviders() public async Task CanQueryDirectProviders()
{ {
// TODO: Check once in a while whether or not they are working again // 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 skipped = 0;
var factory = FastTests.CreateBTCPayRateFactory(); var factory = FastTests.CreateBTCPayRateFactory();
var directlySupported = factory.AvailableRateProviders.Where(s => s.Source == RateSource.Direct) var directlySupported = factory.AvailableRateProviders.Where(s => s.Source == RateSource.Direct)

View File

@@ -323,7 +323,7 @@ namespace BTCPayServer.Plugins.PointOfSale.Controllers
var receiptData = new PosReceiptData(); var receiptData = new PosReceiptData();
var summary = order.Calculate(); 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) if (!isTopup)
{ {
jposData.ItemsTotal = summary.ItemsTotal; jposData.ItemsTotal = summary.ItemsTotal;