mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2026-01-01 13:14:30 +01:00
ToUpper for lightning invoice part of unified QR code
Ref: https://github.com/btcpayserver/btcpayserver/pull/2060#issuecomment-723828348
This commit is contained in:
@@ -55,18 +55,23 @@ namespace BTCPayServer.Payments.Bitcoin
|
||||
model.IsLightning = false;
|
||||
model.PaymentMethodName = GetPaymentMethodName(network);
|
||||
|
||||
var invoiceBitcoinUrl = cryptoInfo.PaymentUrls.BIP21;
|
||||
|
||||
var lightningFallback = "";
|
||||
if (storeBlob.OnChainWithLnInvoiceFallback)
|
||||
{
|
||||
var lightningInfo = invoiceResponse.CryptoInfo.FirstOrDefault(a =>
|
||||
a.GetpaymentMethodId() == new PaymentMethodId(model.CryptoCode, PaymentTypes.LightningLike));
|
||||
if (!String.IsNullOrEmpty(lightningInfo?.PaymentUrls?.BOLT11))
|
||||
invoiceBitcoinUrl += "&" + lightningInfo.PaymentUrls.BOLT11.Replace("lightning:", "lightning=", StringComparison.OrdinalIgnoreCase);
|
||||
lightningFallback = "&" + lightningInfo.PaymentUrls.BOLT11.Replace("lightning:", "lightning=", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
model.InvoiceBitcoinUrl = invoiceBitcoinUrl;
|
||||
model.InvoiceBitcoinUrlQR = invoiceBitcoinUrl;
|
||||
model.InvoiceBitcoinUrl = cryptoInfo.PaymentUrls.BIP21 + lightningFallback;
|
||||
// We're trying to make as many characters uppercase to make QR smaller
|
||||
// Ref: https://github.com/btcpayserver/btcpayserver/pull/2060#issuecomment-723828348
|
||||
model.InvoiceBitcoinUrlQR = cryptoInfo.PaymentUrls.BIP21
|
||||
// .Replace("bitcoin:", "BITCOIN:", StringComparison.OrdinalIgnoreCase)
|
||||
+ lightningFallback.ToUpperInvariant().Replace("LIGHTNING=", "lightning=", StringComparison.OrdinalIgnoreCase);
|
||||
;
|
||||
}
|
||||
|
||||
public override string GetCryptoImage(PaymentMethodId paymentMethodId)
|
||||
|
||||
Reference in New Issue
Block a user