Compare commits
5 Commits
lnurl-hook
...
wfoiqnqot
Author | SHA1 | Date | |
---|---|---|---|
c9a75c9890 | |||
5af3233fd6 | |||
08ff2f3173 | |||
22657b66d7 | |||
8b6c7a6061 |
@ -71,7 +71,6 @@ namespace BTCPayServer.Tests
|
||||
Assert.Equal(address, copyAddress);
|
||||
Assert.Equal($"bitcoin:{address.ToUpperInvariant()}", qrValue);
|
||||
s.Driver.ElementDoesNotExist(By.Id("Lightning_BTC"));
|
||||
s.Driver.ElementDoesNotExist(By.Id("PayByLNURL"));
|
||||
|
||||
// Details should show exchange rate
|
||||
s.Driver.ToggleCollapse("PaymentDetails");
|
||||
@ -89,7 +88,6 @@ namespace BTCPayServer.Tests
|
||||
Assert.StartsWith("lightning:lnurl", payUrl);
|
||||
Assert.StartsWith("lnurl", s.Driver.WaitForElement(By.Id("Lightning_BTC")).GetAttribute("value"));
|
||||
s.Driver.ElementDoesNotExist(By.Id("Address_BTC"));
|
||||
s.Driver.FindElement(By.Id("PayByLNURL"));
|
||||
});
|
||||
|
||||
// Default payment method
|
||||
@ -108,7 +106,6 @@ namespace BTCPayServer.Tests
|
||||
Assert.Equal(address, copyAddress);
|
||||
Assert.Equal($"lightning:{address.ToUpperInvariant()}", qrValue);
|
||||
s.Driver.ElementDoesNotExist(By.Id("Address_BTC"));
|
||||
s.Driver.FindElement(By.Id("PayByLNURL"));
|
||||
|
||||
// Lightning amount in sats
|
||||
Assert.Contains("BTC", s.Driver.FindElement(By.Id("AmountDue")).Text);
|
||||
@ -247,7 +244,6 @@ namespace BTCPayServer.Tests
|
||||
Assert.StartsWith("lnbcrt", copyAddressLightning);
|
||||
Assert.StartsWith($"bitcoin:{address.ToUpperInvariant()}?amount=", qrValue);
|
||||
Assert.Contains("&lightning=LNBCRT", qrValue);
|
||||
s.Driver.FindElement(By.Id("PayByLNURL"));
|
||||
|
||||
// Check details
|
||||
s.Driver.ToggleCollapse("PaymentDetails");
|
||||
@ -284,7 +280,6 @@ namespace BTCPayServer.Tests
|
||||
payUrl = s.Driver.FindElement(By.Id("PayInWallet")).GetAttribute("href");
|
||||
Assert.StartsWith("bitcoin:", payUrl);
|
||||
Assert.Contains("&lightning=lnbcrt", payUrl);
|
||||
s.Driver.FindElement(By.Id("PayByLNURL"));
|
||||
|
||||
// Check details
|
||||
s.Driver.ToggleCollapse("PaymentDetails");
|
||||
@ -317,7 +312,6 @@ namespace BTCPayServer.Tests
|
||||
Assert.Equal(address, copyAddressOnchain);
|
||||
Assert.StartsWith("lnurl", copyAddressLightning);
|
||||
Assert.StartsWith($"bitcoin:{address.ToUpperInvariant()}?lightning=LNURL", qrValue);
|
||||
s.Driver.FindElement(By.Id("PayByLNURL"));
|
||||
|
||||
// Check details
|
||||
s.Driver.ToggleCollapse("PaymentDetails");
|
||||
@ -384,7 +378,6 @@ namespace BTCPayServer.Tests
|
||||
payUrl = s.Driver.FindElement(By.Id("PayInWallet")).GetAttribute("href");
|
||||
Assert.StartsWith("bitcoin:", payUrl);
|
||||
Assert.Contains("&lightning=lnbcrt", payUrl);
|
||||
s.Driver.FindElement(By.Id("PayByLNURL"));
|
||||
|
||||
// Language Switch
|
||||
var languageSelect = new SelectElement(s.Driver.FindElement(By.Id("DefaultLang")));
|
||||
|
@ -134,7 +134,6 @@
|
||||
<ProjectReference Include="..\BTCPayServer.Data\BTCPayServer.Data.csproj" />
|
||||
<ProjectReference Include="..\BTCPayServer.Rating\BTCPayServer.Rating.csproj" />
|
||||
<ProjectReference Include="..\BTCPayServer.Common\BTCPayServer.Common.csproj" />
|
||||
<ProjectReference Include="..\Plugins\BTCPayServer.Plugins.Custodians.FakeCustodian\BTCPayServer.Plugins.Custodians.FakeCustodian.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -1,8 +1,13 @@
|
||||
#if DEBUG
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using BTCPayServer.Abstractions.Custodians;
|
||||
using BTCPayServer.Abstractions.Form;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace BTCPayServer.Plugins.Custodians.FakeCustodian;
|
||||
namespace BTCPayServer.Plugins.FakeCustodian;
|
||||
|
||||
public class FakeCustodian : ICustodian
|
||||
{
|
||||
@ -72,3 +77,4 @@ public class FakeCustodianConfig
|
||||
{
|
||||
}
|
||||
}
|
||||
#endif
|
20
BTCPayServer/Plugins/FakeCustodian/FakeCustodianPlugin.cs
Normal file
20
BTCPayServer/Plugins/FakeCustodian/FakeCustodianPlugin.cs
Normal file
@ -0,0 +1,20 @@
|
||||
#if DEBUG
|
||||
using BTCPayServer.Abstractions.Custodians;
|
||||
using BTCPayServer.Abstractions.Models;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace BTCPayServer.Plugins.FakeCustodian;
|
||||
|
||||
public class FakeCustodianPlugin : BaseBTCPayServerPlugin
|
||||
{
|
||||
public override string Identifier { get; } = "BTCPayServer.Plugins.Custodians.Fake";
|
||||
public override string Name { get; } = "Custodian: Fake";
|
||||
public override string Description { get; } = "Adds a fake custodian for testing";
|
||||
|
||||
public override void Execute(IServiceCollection services)
|
||||
{
|
||||
services.AddSingleton<FakeCustodian>();
|
||||
services.AddSingleton<ICustodian, FakeCustodian>(provider => provider.GetRequiredService<FakeCustodian>());
|
||||
}
|
||||
}
|
||||
#endif
|
@ -6,13 +6,11 @@
|
||||
<p id="CheatSuccessMessage" class="alert alert-success text-break" v-if="successMessage" v-text="successMessage"></p>
|
||||
<p id="CheatErrorMessage" class="alert alert-danger text-break" v-if="errorMessage" v-text="errorMessage"></p>
|
||||
<template v-if="isV2">
|
||||
<button class="btn btn-secondary rounded-pill w-100" type="button"
|
||||
:disabled="scanning || submitting" v-on:click="handleClick" :id="btnId"
|
||||
:class="{ 'text-secondary': !supported }">{{btnText}}</button>
|
||||
<button class="btn btn-secondary rounded-pill w-100" type="button" id="PayByNFC"
|
||||
:disabled="scanning || submitting" v-on:click="handleClick">{{btnText}}</button>
|
||||
</template>
|
||||
<bp-loading-button v-else>
|
||||
<button class="action-button" style="margin: 0 45px;width:calc(100% - 90px) !important"
|
||||
:disabled="scanning || submitting" v-on:click="startScan" :id="btnId"
|
||||
<button class="action-button" style="margin: 0 45px;width:calc(100% - 90px) !important" :disabled="scanning || submitting" v-on:click="handleClick" id="PayByNFC"
|
||||
:class="{ 'loading': scanning || submitting, 'action-button': supported, 'btn btn-text w-100': !supported }">
|
||||
<span class="button-text">{{btnText}}</span>
|
||||
<div class="loader-wrapper">
|
||||
@ -44,14 +42,15 @@ Vue.component("lnurl-withdraw-checkout", {
|
||||
!!availablePaymentMethods.find(pm => ['BTC_LNURLPAY', 'BTC_LightningLike'].includes(pm.paymentMethodId)) ||
|
||||
// Or the BIP21 payment URL flags Lightning support
|
||||
!!paymentUrl.match(/lightning=ln/i)
|
||||
return activePaymentMethodId === 'BTC_LNURLPAY' || (
|
||||
const isAvailable = activePaymentMethodId === 'BTC_LNURLPAY' || (
|
||||
// Unified QR/BIP21 case
|
||||
(activePaymentMethodId === 'BTC' && isUnified && lnurlwAvailable) ||
|
||||
// Lightning with LNURL available
|
||||
(activePaymentMethodId === 'BTC_LightningLike' && lnurlwAvailable))
|
||||
return isAvailable && (this.supported || this.testFallback)
|
||||
},
|
||||
btnId () {
|
||||
return this.supported ? 'PayByNFC' : 'PayByLNURL'
|
||||
testFallback () {
|
||||
return !this.supported && window.location.search.match('lnurlwtest=(1|true)')
|
||||
},
|
||||
btnText () {
|
||||
if (this.supported) {
|
||||
@ -89,6 +88,11 @@ Vue.component("lnurl-withdraw-checkout", {
|
||||
this.startScan()
|
||||
}
|
||||
},
|
||||
beforeDestroy () {
|
||||
if (this.readerAbortController) {
|
||||
this.readerAbortController.abort()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async handleClick () {
|
||||
if (this.supported) {
|
||||
@ -140,7 +144,6 @@ Vue.component("lnurl-withdraw-checkout", {
|
||||
|
||||
ndef.onreadingerror = () => {
|
||||
this.errorMessage = "Could not read NFC tag";
|
||||
this.readerAbortController.abort()
|
||||
}
|
||||
|
||||
ndef.onreading = async ({ message, serialNumber }) => {
|
||||
|
@ -11,7 +11,12 @@
|
||||
<div class="row">
|
||||
<div class="col-xxl-constrain col-xl-10">
|
||||
<div class="d-flex align-items-center justify-content-between mb-3">
|
||||
<h3 class="mb-0">@ViewData["Title"]</h3>
|
||||
<h3 class="mb-0">
|
||||
<span>@ViewData["Title"]</span>
|
||||
<a href="https://docs.btcpayserver.org/Forms" target="_blank" rel="noreferrer noopener" title="More information...">
|
||||
<vc:icon symbol="info" />
|
||||
</a>
|
||||
</h3>
|
||||
<a asp-action="Create" asp-route-storeId="@storeId" class="btn btn-primary mt-3 mt-sm-0" role="button" id="CreateForm">
|
||||
<span class="fa fa-plus"></span>
|
||||
Create Form
|
||||
|
@ -137,7 +137,7 @@
|
||||
<vc:icon symbol="caret-down" />
|
||||
</button>
|
||||
<p class="text-center mt-3" v-t="'payment_sent_body'"></p>
|
||||
<p class="text-center" v-if="srvModel.receivedConfirmations !== null && srvModel.requiredConfirmations != null" v-t="{ path: 'payment_sent_confirmations', args: { cryptoCode: realCryptoCode, receivedConfirmations: srvModel.receivedConfirmations, requiredConfirmations: srvModel.requiredConfirmations } }"></p>
|
||||
<p class="text-center" v-if="srvModel.receivedConfirmations !== null && srvModel.requiredConfirmations" v-t="{ path: 'payment_sent_confirmations', args: { cryptoCode: realCryptoCode, receivedConfirmations: srvModel.receivedConfirmations, requiredConfirmations: srvModel.requiredConfirmations } }"></p>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="isSettled" id="settled" key="settled">
|
||||
|
@ -122,6 +122,7 @@
|
||||
@foreach (var pp in Model.PullPayments)
|
||||
{
|
||||
<tr>
|
||||
<td>@pp.StartDate.ToBrowserDate()</td>
|
||||
<td>
|
||||
<a asp-action="EditPullPayment"
|
||||
asp-controller="UIPullPayment"
|
||||
@ -130,7 +131,6 @@
|
||||
@pp.Name
|
||||
</a>
|
||||
</td>
|
||||
<td>@pp.StartDate.ToBrowserDate()</td>
|
||||
<td>@pp.AutoApproveClaims</td>
|
||||
<td class="align-middle">
|
||||
<div class="progress ppProgress" data-pp="@pp.Id" data-bs-toggle="tooltip" data-bs-html="true">
|
||||
|
@ -179,8 +179,7 @@ section dl > div dd {
|
||||
background: rgba(var(--btcpay-black-rgb), 0.85);
|
||||
}
|
||||
.checkout-modal h1,
|
||||
.checkout-modal footer a:hover,
|
||||
.checkout-modal #DefaultLang:hover {
|
||||
.checkout-modal footer a:hover {
|
||||
color: var(--btcpay-white);
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,11 @@ function updateLanguageSelect() {
|
||||
$languageSelect.parentElement.appendChild(element);
|
||||
const width = element.offsetWidth;
|
||||
$languageSelect.parentElement.removeChild(element);
|
||||
$languageSelect.style.setProperty('--text-width', `${width}px`);
|
||||
if (width && width > 0) {
|
||||
$languageSelect.style.setProperty('--text-width', `${width}px`);
|
||||
} else { // in case of modal this might not be rendered properly yet
|
||||
window.requestAnimationFrame(updateLanguageSelect);
|
||||
}
|
||||
}
|
||||
|
||||
function updateLanguage(lang) {
|
||||
|
@ -1,14 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<RootNamespace>BTCPayServer.Plugins.Custodians.FakeCustodian</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\BTCPayServer.Abstractions\BTCPayServer.Abstractions.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -1,19 +0,0 @@
|
||||
using BTCPayServer.Abstractions.Custodians;
|
||||
using BTCPayServer.Abstractions.Models;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace BTCPayServer.Plugins.Custodians.FakeCustodian
|
||||
{
|
||||
public class FakeCustodianPlugin : BaseBTCPayServerPlugin
|
||||
{
|
||||
public override string Identifier { get; } = "BTCPayServer.Plugins.Custodians.Fake";
|
||||
public override string Name { get; } = "Custodian: Fake";
|
||||
public override string Description { get; } = "Adds a fake custodian for testing";
|
||||
|
||||
public override void Execute(IServiceCollection services)
|
||||
{
|
||||
services.AddSingleton<FakeCustodian>();
|
||||
services.AddSingleton<ICustodian, FakeCustodian>(provider => provider.GetRequiredService<FakeCustodian>());
|
||||
}
|
||||
}
|
||||
}
|
@ -37,8 +37,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Plugins", "Plugins", "{1FC7
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BTCPayServer.PluginPacker", "BTCPayServer.PluginPacker\BTCPayServer.PluginPacker.csproj", "{7DC94B25-1CFC-4170-AA41-7BA983E4C0B8}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BTCPayServer.Plugins.Custodians.FakeCustodian", "Plugins\BTCPayServer.Plugins.Custodians.FakeCustodian\BTCPayServer.Plugins.Custodians.FakeCustodian.csproj", "{49E1FE45-FE71-49DF-8701-8394E974BE82}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Altcoins-Debug|Any CPU = Altcoins-Debug|Any CPU
|
||||
@ -271,30 +269,6 @@ Global
|
||||
{7DC94B25-1CFC-4170-AA41-7BA983E4C0B8}.Release|x64.Build.0 = Release|Any CPU
|
||||
{7DC94B25-1CFC-4170-AA41-7BA983E4C0B8}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{7DC94B25-1CFC-4170-AA41-7BA983E4C0B8}.Release|x86.Build.0 = Release|Any CPU
|
||||
{49E1FE45-FE71-49DF-8701-8394E974BE82}.Altcoins-Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{49E1FE45-FE71-49DF-8701-8394E974BE82}.Altcoins-Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{49E1FE45-FE71-49DF-8701-8394E974BE82}.Altcoins-Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{49E1FE45-FE71-49DF-8701-8394E974BE82}.Altcoins-Debug|x64.Build.0 = Debug|Any CPU
|
||||
{49E1FE45-FE71-49DF-8701-8394E974BE82}.Altcoins-Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{49E1FE45-FE71-49DF-8701-8394E974BE82}.Altcoins-Debug|x86.Build.0 = Debug|Any CPU
|
||||
{49E1FE45-FE71-49DF-8701-8394E974BE82}.Altcoins-Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{49E1FE45-FE71-49DF-8701-8394E974BE82}.Altcoins-Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{49E1FE45-FE71-49DF-8701-8394E974BE82}.Altcoins-Release|x64.ActiveCfg = Release|Any CPU
|
||||
{49E1FE45-FE71-49DF-8701-8394E974BE82}.Altcoins-Release|x64.Build.0 = Release|Any CPU
|
||||
{49E1FE45-FE71-49DF-8701-8394E974BE82}.Altcoins-Release|x86.ActiveCfg = Release|Any CPU
|
||||
{49E1FE45-FE71-49DF-8701-8394E974BE82}.Altcoins-Release|x86.Build.0 = Release|Any CPU
|
||||
{49E1FE45-FE71-49DF-8701-8394E974BE82}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{49E1FE45-FE71-49DF-8701-8394E974BE82}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{49E1FE45-FE71-49DF-8701-8394E974BE82}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{49E1FE45-FE71-49DF-8701-8394E974BE82}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{49E1FE45-FE71-49DF-8701-8394E974BE82}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{49E1FE45-FE71-49DF-8701-8394E974BE82}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{49E1FE45-FE71-49DF-8701-8394E974BE82}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{49E1FE45-FE71-49DF-8701-8394E974BE82}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{49E1FE45-FE71-49DF-8701-8394E974BE82}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{49E1FE45-FE71-49DF-8701-8394E974BE82}.Release|x64.Build.0 = Release|Any CPU
|
||||
{49E1FE45-FE71-49DF-8701-8394E974BE82}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{49E1FE45-FE71-49DF-8701-8394E974BE82}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
Reference in New Issue
Block a user