mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-19 09:54:30 +01:00
allow changing the payjoin key easily later
This commit is contained in:
parent
32938479ac
commit
148b04e9ba
@ -124,7 +124,7 @@ namespace BTCPayServer.Tests
|
||||
s.GoToInvoiceCheckout(invoiceId);
|
||||
var bip21 = s.Driver.FindElement(By.ClassName("payment__details__instruction__open-wallet__btn"))
|
||||
.GetAttribute("href");
|
||||
Assert.DoesNotContain("bpu=", bip21);
|
||||
Assert.DoesNotContain($"{PayjoinClient.BIP21EndpointKey}=", bip21);
|
||||
|
||||
s.GoToHome();
|
||||
s.GoToStore(receiver.storeId);
|
||||
@ -143,7 +143,7 @@ namespace BTCPayServer.Tests
|
||||
s.GoToInvoiceCheckout(invoiceId);
|
||||
bip21 = s.Driver.FindElement(By.ClassName("payment__details__instruction__open-wallet__btn"))
|
||||
.GetAttribute("href");
|
||||
Assert.Contains("bpu=", bip21);
|
||||
Assert.Contains($"{PayjoinClient.BIP21EndpointKey}=", bip21);
|
||||
|
||||
s.GoToWalletSend(senderWalletId);
|
||||
s.Driver.FindElement(By.Id("bip21parse")).Click();
|
||||
@ -175,7 +175,7 @@ namespace BTCPayServer.Tests
|
||||
s.GoToInvoiceCheckout(invoiceId);
|
||||
bip21 = s.Driver.FindElement(By.ClassName("payment__details__instruction__open-wallet__btn"))
|
||||
.GetAttribute("href");
|
||||
Assert.Contains("bpu", bip21);
|
||||
Assert.Contains($"{PayjoinClient.BIP21EndpointKey}", bip21);
|
||||
|
||||
s.GoToWalletSend(senderWalletId);
|
||||
s.Driver.FindElement(By.Id("bip21parse")).Click();
|
||||
@ -416,7 +416,7 @@ namespace BTCPayServer.Tests
|
||||
var invoice = senderUser.BitPay.CreateInvoice(
|
||||
new Invoice() {Price = 100, Currency = "USD", FullNotifications = true});
|
||||
//payjoin is not enabled by default.
|
||||
Assert.DoesNotContain("bpu", invoice.CryptoInfo.First().PaymentUrls.BIP21);
|
||||
Assert.DoesNotContain($"{PayjoinClient.BIP21EndpointKey}", invoice.CryptoInfo.First().PaymentUrls.BIP21);
|
||||
cashCow.SendToAddress(BitcoinAddress.Create(invoice.BitcoinAddress, cashCow.Network),
|
||||
Money.Coins(0.06m));
|
||||
|
||||
|
@ -19,6 +19,7 @@ using System.Threading.Tasks;
|
||||
using BTCPayServer.Lightning;
|
||||
using BTCPayServer.Lightning.CLightning;
|
||||
using BTCPayServer.Models;
|
||||
using BTCPayServer.Services;
|
||||
using BTCPayServer.Views.Manage;
|
||||
using BTCPayServer.Views.Stores;
|
||||
using Newtonsoft.Json;
|
||||
@ -332,7 +333,7 @@ namespace BTCPayServer.Tests
|
||||
GoToInvoiceCheckout(invoiceId);
|
||||
var bip21 = Driver.FindElement(By.ClassName("payment__details__instruction__open-wallet__btn"))
|
||||
.GetAttribute("href");
|
||||
Assert.Contains("bpu", bip21);
|
||||
Assert.Contains($"{PayjoinClient.BIP21EndpointKey}", bip21);
|
||||
|
||||
GoToWalletSend(walletId);
|
||||
Driver.FindElement(By.Id("bip21parse")).Click();
|
||||
|
@ -366,7 +366,7 @@ namespace BTCPayServer.Tests
|
||||
var parsedBip21 = new BitcoinUrlBuilder(
|
||||
invoice.CryptoInfo.First(c => c.CryptoCode == network.NetworkSet.CryptoCode).PaymentUrls.BIP21,
|
||||
network);
|
||||
return parsedBip21.UnknowParameters.TryGetValue("bpu", out var uri) ? new Uri(uri, UriKind.Absolute) : null;
|
||||
return parsedBip21.UnknowParameters.TryGetValue($"{PayjoinClient.BIP21EndpointKey}", out var uri) ? new Uri(uri, UriKind.Absolute) : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace BTCPayServer.Payments.PayJoin
|
||||
{
|
||||
[Route("{cryptoCode}/bpu")]
|
||||
[Route("{cryptoCode}/" + PayjoinClient.BIP21EndpointKey)]
|
||||
public class PayJoinEndpointController : ControllerBase
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -15,6 +15,7 @@ namespace BTCPayServer.Services
|
||||
{
|
||||
public class PayjoinClient
|
||||
{
|
||||
public const string BIP21EndpointKey = "bpu";
|
||||
private readonly ExplorerClientProvider _explorerClientProvider;
|
||||
private HttpClient _httpClient;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user