Cleanups and unified wording

This commit is contained in:
Dennis Reimann 2023-02-22 11:20:50 +01:00
parent 575b829799
commit 13f9eb0d18
No known key found for this signature in database
GPG key ID: 5009E1797F03F8D0
6 changed files with 18 additions and 21 deletions

View file

@ -231,7 +231,7 @@ namespace BTCPayServer.Tests
Assert.True(s.Driver.FindElement(By.Id("LNURLEnabled")).Selected); Assert.True(s.Driver.FindElement(By.Id("LNURLEnabled")).Selected);
Assert.True(s.Driver.FindElement(By.Id("LNURLStandardInvoiceEnabled")).Selected); Assert.True(s.Driver.FindElement(By.Id("LNURLStandardInvoiceEnabled")).Selected);
// BIP21 with topup invoice // BIP21 with top-up invoice
invoiceId = s.CreateInvoice(amount: null); invoiceId = s.CreateInvoice(amount: null);
s.GoToInvoiceCheckout(invoiceId); s.GoToInvoiceCheckout(invoiceId);
s.Driver.WaitUntilAvailable(By.Id("Checkout-v2")); s.Driver.WaitUntilAvailable(By.Id("Checkout-v2"));
@ -250,7 +250,7 @@ namespace BTCPayServer.Tests
Assert.StartsWith($"bitcoin:{address.ToUpperInvariant()}?lightning=LNURL", qrValue); Assert.StartsWith($"bitcoin:{address.ToUpperInvariant()}?lightning=LNURL", qrValue);
s.Driver.FindElement(By.Id("PayByLNURL")); 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 = s.Driver.FindElement(By.Id("ExpirySeconds"));
expirySeconds.Clear(); expirySeconds.Clear();
expirySeconds.SendKeys("5"); expirySeconds.SendKeys("5");

View file

@ -2,7 +2,6 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Net.Http; using System.Net.Http;
using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using BTCPayServer.Abstractions.Models; using BTCPayServer.Abstractions.Models;
@ -15,8 +14,6 @@ using LNURL;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using NBitcoin; using NBitcoin;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace BTCPayServer.Data.Payouts.LightningLike namespace BTCPayServer.Data.Payouts.LightningLike
{ {

View file

@ -77,7 +77,6 @@ namespace BTCPayServer.Data
this IEnumerable<IPayoutHandler> payoutHandlers, StoreData storeData) this IEnumerable<IPayoutHandler> payoutHandlers, StoreData storeData)
{ {
return (await Task.WhenAll(payoutHandlers.Select(handler => handler.GetSupportedPaymentMethods(storeData)))).SelectMany(ids => ids).ToList(); return (await Task.WhenAll(payoutHandlers.Select(handler => handler.GetSupportedPaymentMethods(storeData)))).SelectMany(ids => ids).ToList();
} }
} }
} }

View file

@ -58,7 +58,7 @@ namespace BTCPayServer.Plugins.NFC
if (!methods.TryGetValue(new PaymentMethodId("BTC", PaymentTypes.LNURLPay), out var lnurlPaymentMethod) && if (!methods.TryGetValue(new PaymentMethodId("BTC", PaymentTypes.LNURLPay), out var lnurlPaymentMethod) &&
!methods.TryGetValue(new PaymentMethodId("BTC", PaymentTypes.LightningLike), out lnPaymentMethod)) !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; Uri uri;
@ -68,7 +68,7 @@ namespace BTCPayServer.Plugins.NFC
uri = LNURL.LNURL.Parse(request.Lnurl, out tag); uri = LNURL.LNURL.Parse(request.Lnurl, out tag);
if (uri is null) if (uri is null)
{ {
return BadRequest("lnurl was malformed"); return BadRequest("LNURL was malformed");
} }
} }
catch (Exception e) catch (Exception e)
@ -76,10 +76,9 @@ namespace BTCPayServer.Plugins.NFC
return BadRequest(e.Message); return BadRequest(e.Message);
} }
if (!string.IsNullOrEmpty(tag) && !tag.Equals("withdrawRequest")) 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() var httpClient = _httpClientFactory.CreateClient(uri.IsOnion()
@ -98,7 +97,7 @@ namespace BTCPayServer.Plugins.NFC
if (info?.Callback is null) 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() httpClient = _httpClientFactory.CreateClient(info.Callback.IsOnion()
@ -106,7 +105,6 @@ namespace BTCPayServer.Plugins.NFC
: LightningLikePayoutHandler.LightningLikePayoutHandlerClearnetNamedClient); : LightningLikePayoutHandler.LightningLikePayoutHandlerClearnetNamedClient);
string bolt11 = null; string bolt11 = null;
if (lnPaymentMethod is not null) if (lnPaymentMethod is not null)
{ {
if (lnPaymentMethod.GetPaymentMethodDetails() is LightningLikePaymentMethodDetails { Activated: false } lnPMD) 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) if (invoice.Type == InvoiceType.TopUp && request.Amount is not null)
{ {
due = new LightMoney(request.Amount.Value, LightMoneyUnit.Satoshi); 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 else
{ {
due = new LightMoney(lnPaymentMethod.Calculate().Due); due = new LightMoney(lnPaymentMethod.Calculate().Due);
} }
if (info.MinWithdrawable > due || due > info.MaxWithdrawable) 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) if (lnPMD?.Activated is true)
@ -145,9 +145,10 @@ namespace BTCPayServer.Plugins.NFC
if (invoice.Type == InvoiceType.TopUp && request.Amount is not null) if (invoice.Type == InvoiceType.TopUp && request.Amount is not null)
{ {
due = new Money(request.Amount.Value, MoneyUnit.Satoshi); 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 else
{ {

View file

@ -14,7 +14,7 @@
<qrcode :value="currentFragment" :options="qrOptions"></qrcode> <qrcode :value="currentFragment" :options="qrOptions"></qrcode>
</component> </component>
</div> </div>
<ul class="nav justify-content-center mt-4 mb-3" v-if="modes && Object.keys(modes).length > 1"> <ul class="nav btcpay-pills justify-content-center mt-4 mb-3" v-if="modes && Object.keys(modes).length > 1">
<li class="nav-item" v-for="(item, key) in modes"> <li class="nav-item" v-for="(item, key) in modes">
<a class="btcpay-pill" :class="{ 'active': key === mode }" href="#" v-on:click="mode = key">{{item.title}}</a> <a class="btcpay-pill" :class="{ 'active': key === mode }" href="#" v-on:click="mode = key">{{item.title}}</a>
</li> </li>

View file

@ -305,7 +305,7 @@
}, },
"enableForStandardInvoices": { "enableForStandardInvoices": {
"type": "boolean", "type": "boolean",
"description": "Whether to allow this payment method to also be used for standard invoices and not just topup invoices." "description": "Whether to allow this payment method to also be used for standard invoices and not just top-up invoices."
}, },
"lud12Enabled": { "lud12Enabled": {
"type": "boolean", "type": "boolean",