diff --git a/BTCPayServer.Tests/Checkoutv2Tests.cs b/BTCPayServer.Tests/Checkoutv2Tests.cs index 282046a14..dc101f6c3 100644 --- a/BTCPayServer.Tests/Checkoutv2Tests.cs +++ b/BTCPayServer.Tests/Checkoutv2Tests.cs @@ -231,7 +231,7 @@ namespace BTCPayServer.Tests Assert.True(s.Driver.FindElement(By.Id("LNURLEnabled")).Selected); Assert.True(s.Driver.FindElement(By.Id("LNURLStandardInvoiceEnabled")).Selected); - // BIP21 with topup invoice + // BIP21 with top-up invoice invoiceId = s.CreateInvoice(amount: null); s.GoToInvoiceCheckout(invoiceId); s.Driver.WaitUntilAvailable(By.Id("Checkout-v2")); @@ -250,7 +250,7 @@ namespace BTCPayServer.Tests Assert.StartsWith($"bitcoin:{address.ToUpperInvariant()}?lightning=LNURL", qrValue); s.Driver.FindElement(By.Id("PayByLNURL")); - // Expiry message should not show amount for topup invoice + // Expiry message should not show amount for top-up invoice expirySeconds = s.Driver.FindElement(By.Id("ExpirySeconds")); expirySeconds.Clear(); expirySeconds.SendKeys("5"); diff --git a/BTCPayServer/Data/Payouts/LightningLike/LightningLikePayoutHandler.cs b/BTCPayServer/Data/Payouts/LightningLike/LightningLikePayoutHandler.cs index 4f776fbd1..789c63390 100644 --- a/BTCPayServer/Data/Payouts/LightningLike/LightningLikePayoutHandler.cs +++ b/BTCPayServer/Data/Payouts/LightningLike/LightningLikePayoutHandler.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; using System.Linq; using System.Net.Http; -using System.Text; using System.Threading; using System.Threading.Tasks; using BTCPayServer.Abstractions.Models; @@ -15,8 +14,6 @@ using LNURL; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using NBitcoin; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; namespace BTCPayServer.Data.Payouts.LightningLike { diff --git a/BTCPayServer/Data/Payouts/PayoutExtensions.cs b/BTCPayServer/Data/Payouts/PayoutExtensions.cs index 03f7e65e3..8e5f04a9a 100644 --- a/BTCPayServer/Data/Payouts/PayoutExtensions.cs +++ b/BTCPayServer/Data/Payouts/PayoutExtensions.cs @@ -77,7 +77,6 @@ namespace BTCPayServer.Data this IEnumerable payoutHandlers, StoreData storeData) { return (await Task.WhenAll(payoutHandlers.Select(handler => handler.GetSupportedPaymentMethods(storeData)))).SelectMany(ids => ids).ToList(); - } } } diff --git a/BTCPayServer/Plugins/NFC/NFCController.cs b/BTCPayServer/Plugins/NFC/NFCController.cs index a39400d94..db43ac429 100644 --- a/BTCPayServer/Plugins/NFC/NFCController.cs +++ b/BTCPayServer/Plugins/NFC/NFCController.cs @@ -58,7 +58,7 @@ namespace BTCPayServer.Plugins.NFC if (!methods.TryGetValue(new PaymentMethodId("BTC", PaymentTypes.LNURLPay), out var lnurlPaymentMethod) && !methods.TryGetValue(new PaymentMethodId("BTC", PaymentTypes.LightningLike), out lnPaymentMethod)) { - return BadRequest("destination for lnurlw was not specified"); + return BadRequest("Destination for lnurlw was not specified"); } Uri uri; @@ -68,7 +68,7 @@ namespace BTCPayServer.Plugins.NFC uri = LNURL.LNURL.Parse(request.Lnurl, out tag); if (uri is null) { - return BadRequest("lnurl was malformed"); + return BadRequest("LNURL was malformed"); } } catch (Exception e) @@ -76,10 +76,9 @@ namespace BTCPayServer.Plugins.NFC return BadRequest(e.Message); } - if (!string.IsNullOrEmpty(tag) && !tag.Equals("withdrawRequest")) { - return BadRequest("lnurl was not lnurl-withdraw"); + return BadRequest("LNURL was not LNURL-Withdraw"); } var httpClient = _httpClientFactory.CreateClient(uri.IsOnion() @@ -98,7 +97,7 @@ namespace BTCPayServer.Plugins.NFC if (info?.Callback is null) { - return BadRequest("Could not fetch info from lnurl-withdraw "); + return BadRequest("Could not fetch info from LNURL-Withdraw"); } httpClient = _httpClientFactory.CreateClient(info.Callback.IsOnion() @@ -106,7 +105,6 @@ namespace BTCPayServer.Plugins.NFC : LightningLikePayoutHandler.LightningLikePayoutHandlerClearnetNamedClient); string bolt11 = null; - if (lnPaymentMethod is not null) { if (lnPaymentMethod.GetPaymentMethodDetails() is LightningLikePaymentMethodDetails { Activated: false } lnPMD) @@ -120,17 +118,19 @@ namespace BTCPayServer.Plugins.NFC if (invoice.Type == InvoiceType.TopUp && request.Amount is not null) { due = new LightMoney(request.Amount.Value, LightMoneyUnit.Satoshi); - }else if (invoice.Type == InvoiceType.TopUp) + } + else if (invoice.Type == InvoiceType.TopUp) { - return BadRequest("This is a topup invoice and you need to provide the amount in sats to pay."); + return BadRequest("This is a top-up invoice and you need to provide the amount in sats to pay."); } else { - due = new LightMoney(lnPaymentMethod.Calculate().Due); + due = new LightMoney(lnPaymentMethod.Calculate().Due); } + if (info.MinWithdrawable > due || due > info.MaxWithdrawable) { - return BadRequest("invoice amount is not payable with the lnurl allowed amounts."); + return BadRequest("Invoice amount is not payable with the LNURL allowed amounts."); } if (lnPMD?.Activated is true) @@ -145,13 +145,14 @@ namespace BTCPayServer.Plugins.NFC if (invoice.Type == InvoiceType.TopUp && request.Amount is not null) { due = new Money(request.Amount.Value, MoneyUnit.Satoshi); - }else if (invoice.Type == InvoiceType.TopUp) + } + else if (invoice.Type == InvoiceType.TopUp) { - return BadRequest("This is a topup invoice and you need to provide the amount in sats to pay."); + return BadRequest("This is a top-up invoice and you need to provide the amount in sats to pay."); } else { - due = lnurlPaymentMethod.Calculate().Due; + due = lnurlPaymentMethod.Calculate().Due; } var amount = LightMoney.Satoshis(due.Satoshi); diff --git a/BTCPayServer/Views/Shared/ShowQR.cshtml b/BTCPayServer/Views/Shared/ShowQR.cshtml index d39b45869..da5bf502f 100644 --- a/BTCPayServer/Views/Shared/ShowQR.cshtml +++ b/BTCPayServer/Views/Shared/ShowQR.cshtml @@ -14,7 +14,7 @@ -