remove lnurl from crowdfund as per requests

This commit is contained in:
Kukks 2022-06-29 15:33:24 +02:00 committed by Andrew Camilleri
parent cf747f1e07
commit 4eabe91cee
5 changed files with 4 additions and 91 deletions

View file

@ -1796,35 +1796,7 @@ namespace BTCPayServer.Tests
var payoutsData = await ctx.Payouts.Where(p => p.PullPaymentDataId == pullPaymentId).ToListAsync();
Assert.True(payoutsData.All(p => p.State == PayoutState.Completed));
});
//lnurl crowdfund support
s.GoToStore();
s.Driver.FindElement(By.Id("StoreNav-CreateApp")).Click();
s.Driver.FindElement(By.Name("AppName")).SendKeys("CF" + Guid.NewGuid());
s.Driver.FindElement(By.Id("SelectedAppType")).SendKeys("Crowdfund");
s.Driver.FindElement(By.Id("Create")).Click();
Assert.Contains("App successfully created", s.FindAlertMessage().Text);
s.Driver.FindElement(By.Id("Title")).SendKeys("Kukkstarter");
s.Driver.FindElement(By.CssSelector("div.note-editable.card-block")).SendKeys("1BTC = 1BTC");
s.Driver.FindElement(By.Id("SaveSettings")).Click();
Assert.Contains("App updated", s.FindAlertMessage().Text);
s.Driver.FindElement(By.Id("ViewApp")).Click();
var windows = s.Driver.WindowHandles;
Assert.Equal(2, windows.Count);
s.Driver.SwitchTo().Window(windows[1]);
s.Driver.FindElement(By.CssSelector("#crowdfund-body-contribution-container .perk")).Click();
s.Driver.FindElement(By.PartialLinkText("LNURL")).Click();
lnurl = s.Driver.FindElement(By.ClassName("lnurl"))
.GetAttribute("href");
LNURL.LNURL.Parse(lnurl, out tag);
s.Driver.Close();
s.Driver.SwitchTo().Window(windows[0]);
}
[Fact]

View file

@ -359,8 +359,7 @@ namespace BTCPayServer.Hosting
services.AddSingleton<IUIExtension>(new UIExtension("LNURL/LightningAddressNav",
"store-integrations-nav"));
services.AddSingleton<IUIExtension>(new UIExtension("LNURL/LightningAddressOption",
"store-integrations-list"));services.AddSingleton<IUIExtension>(new UIExtension("LNURL/CrowdfundLNURL",
"crowdfund-head"));
"store-integrations-list"));
services.AddSingleton<IHostedService, LightningListener>();
services.AddSingleton<PaymentMethodHandlerDictionary>();

View file

@ -1,36 +0,0 @@
@using BTCPayServer.Services.Stores
@using BTCPayServer.Payments.Lightning
@using BTCPayServer.Abstractions.Extensions
@model BTCPayServer.Models.AppViewModels.ViewCrowdfundViewModel
@inject BTCPayNetworkProvider BTCPayNetworkProvider
@inject StoreRepository StoreRepository
@{
Context.Request.Query.TryGetValue("cryptocode", out var cryptoCodeValues);
var cryptoCode = cryptoCodeValues.FirstOrDefault() ?? "BTC";
var store = await StoreRepository.FindStore(Model.StoreId);
var supported = store.GetSupportedPaymentMethods(BTCPayNetworkProvider).OfType<LNURLPaySupportedPaymentMethod>().FirstOrDefault(method => method.CryptoCode == cryptoCode);
if (supported != null && !store.GetEnabledPaymentIds(BTCPayNetworkProvider).Contains(supported.PaymentId))
{
supported = null;
}
if (supported != null)
{
var lnurls = Model.Perks.Select(item => (item.Id, LNURL.LNURL.EncodeUri(new Uri(Context.Request.GetAbsoluteUri(Url.Action("GetLNURLForApp", "UILNURL", new
{
cryptoCode = supported.CryptoCode,
appid = Model.AppId,
ItemCode = item.Id
}))), "payRequest", supported.UseBech32Scheme))).ToDictionary(tuple => tuple.Id, tuple => tuple.Item2);
lnurls.Add("", LNURL.LNURL.EncodeUri(new Uri(Context.Request.GetAbsoluteUri(Url.Action("GetLNURLForApp", "UILNURL", new
{
cryptoCode = supported.CryptoCode,
appid = Model.AppId,
}))), "payRequest", supported.UseBech32Scheme));
<script>
window.lnurl = true;
window.lnurlItems = @Safe.Json(lnurls);
</script>
}
}

View file

@ -345,28 +345,8 @@
</div>
<p class="card-text overflow-hidden" v-if="perk.description" v-html="perk.description"></p>
<ul class="nav justify-content-center text-dark my-2" v-if="expanded && lnurl">
<li class="nav-item">
<a class="nav-link"
v-bind:class="{ 'active': 'standard' == currentMode}" href="#" v-on:click="currentMode = 'standard'">
Standard
</a>
</li>
<li class="nav-item">
<a class="nav-link"
v-bind:class="{ 'active': 'lnurl' == currentMode}" href="#" v-on:click="currentMode = 'lnurl'">
LNURL
</a>
</li>
</ul>
<div class="d-flex flex-column align-items-center" style="max-width:500px;" v-if="expanded && 'lnurl' == currentMode" :id="'perk-form'+ perk.id">
<qrcode class="rounded-2" style="width:256px; height: 256px;" v-bind:value="lnurlItems[perk.id??'']" :options="{ width: 256, margin: 1, color: {dark:'#000', light:'#f5f5f7'} }"></qrcode>
<a :href="lnurlItems[perk.id??'']" class="btn btn-secondary d-print-none mt-3 lnurl" style="width:256px;" rel="noreferrer noopener">
Open in wallet
</a>
</div>
<div class="input-group" style="max-width:500px;" v-else-if="expanded && 'standard' == currentMode" :id="'perk-form'+ perk.id">
<div class="input-group" style="max-width:500px;" v-else-if="expanded" :id="'perk-form'+ perk.id">
<input
v-if="perk.price.type !== 0"
:disabled="!active"

View file

@ -23,9 +23,7 @@ document.addEventListener("DOMContentLoaded",function (ev) {
data: function () {
return {
amount: null,
expanded: false,
lnurl: window.lnurl,
currentMode: 'standard'
expanded: false
}
},
computed: {