diff --git a/BTCPayServer.Tests/UnitTest1.cs b/BTCPayServer.Tests/UnitTest1.cs index c4c876c84..fb909ee72 100644 --- a/BTCPayServer.Tests/UnitTest1.cs +++ b/BTCPayServer.Tests/UnitTest1.cs @@ -2094,7 +2094,11 @@ namespace BTCPayServer.Tests Assert.Contains("&lightning=", paymentMethodSecond.InvoiceBitcoinUrlQR); Assert.StartsWith("BITCOIN:", paymentMethodSecond.InvoiceBitcoinUrlQR); var split = paymentMethodSecond.InvoiceBitcoinUrlQR.Split('?')[0]; - Assert.True($"BITCOIN:{paymentMethodSecond.BtcAddress.ToUpperInvariant()}" == split); + + // Standard for uppercase Bech32 addresses in QR codes is still not implemented in all wallets + // When it is widely propagated consider uncommenting these lines + //Assert.True($"BITCOIN:{paymentMethodSecond.BtcAddress.ToUpperInvariant()}" == split); + Assert.True($"BITCOIN:{paymentMethodSecond.BtcAddress}" == split); } } diff --git a/BTCPayServer/Payments/Bitcoin/BitcoinLikePaymentHandler.cs b/BTCPayServer/Payments/Bitcoin/BitcoinLikePaymentHandler.cs index 7a90d7e8c..443383384 100644 --- a/BTCPayServer/Payments/Bitcoin/BitcoinLikePaymentHandler.cs +++ b/BTCPayServer/Payments/Bitcoin/BitcoinLikePaymentHandler.cs @@ -71,15 +71,17 @@ namespace BTCPayServer.Payments.Bitcoin .Replace("bitcoin:", "BITCOIN:", StringComparison.OrdinalIgnoreCase) + lightningFallback.ToUpperInvariant().Replace("LIGHTNING=", "lightning=", StringComparison.OrdinalIgnoreCase); - if (bech32Prefixes.Any(a => model.BtcAddress.StartsWith(a, StringComparison.OrdinalIgnoreCase))) - { - model.InvoiceBitcoinUrlQR = model.InvoiceBitcoinUrlQR.Replace( - $"BITCOIN:{model.BtcAddress}", $"BITCOIN:{model.BtcAddress.ToUpperInvariant()}", - StringComparison.OrdinalIgnoreCase - ); - } + // Standard for uppercase Bech32 addresses in QR codes is still not implemented in all wallets + // When it is widely propagated consider uncommenting these lines + //if (bech32Prefixes.Any(a => model.BtcAddress.StartsWith(a, StringComparison.OrdinalIgnoreCase))) + //{ + // model.InvoiceBitcoinUrlQR = model.InvoiceBitcoinUrlQR.Replace( + // $"BITCOIN:{model.BtcAddress}", $"BITCOIN:{model.BtcAddress.ToUpperInvariant()}", + // StringComparison.OrdinalIgnoreCase + // ); + //} } - private static string[] bech32Prefixes = new[] { "bc1", "tb1", "bcrt1" }; + //private static string[] bech32Prefixes = new[] { "bc1", "tb1", "bcrt1" }; public override string GetCryptoImage(PaymentMethodId paymentMethodId) {