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