mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-20 02:28:31 +01:00
e2d0b7c5f7
* Set store context in cookie
* Fix page id usages in view
* Move Pay Button to nav
* Move integrations to plugins nav
* Store switch links to wallet if present
* Test fixes
* Nav fixes
* Fix altcoin view
* Main nav updates
* Wallet setttings nav update
* Move storeId cookie fallback to cookie auth handler
* View fixes
* Test fixes
* Fix profile check
* Rename integrations nav extension point to store-integrations-nav-list
* Allow strings for Active page/category for plugins
* Make invoice list filter based on store context
* Do not set context if we are running authorizer through tag helper
* Fix test and unfiltered invoices
* Add permission helper for wallet links
* Add sanity checks for payment requests and invoices
* Store context in home controller
* Fix PayjoinViaUI test
* Store context for notifications
* Minor UI improvements
* Store context for userstores and vault controller
* Bring back integrations page
* Rename notifications nav pages file
* Fix user stores controller policies
* Controller policy fixes from code review
* CookieAuthHandler: Simplify CanViewInvoices case
* Revert "Controller policy fixes from code review"
This reverts commit 97e8b8379c
.
* Simplify LayoutSimple
* Fix CanViewInvoices condition
Co-authored-by: Kukks <evilkukka@gmail.com>
242 lines
14 KiB
Plaintext
242 lines
14 KiB
Plaintext
@using System.Text.RegularExpressions
|
|
@using BTCPayServer.Lightning
|
|
@model PaymentMethodsViewModel
|
|
@{
|
|
Layout = "../Shared/_NavLayout.cshtml";
|
|
ViewData.SetActivePage(StoreNavPages.PaymentMethods, "Wallets", Context.GetStoreData().Id);
|
|
}
|
|
|
|
<div class="row">
|
|
<div class="col-lg-10 col-xl-9">
|
|
@if (!ViewContext.ModelState.IsValid)
|
|
{
|
|
<div asp-validation-summary="All" class="text-danger"></div>
|
|
}
|
|
<div class="mb-5">
|
|
<h4 class="mb-3">Wallet</h4>
|
|
@if (Model.HintWallet)
|
|
{
|
|
<p>Set up your wallet to receive payments at your store.</p>
|
|
}
|
|
<ul class="list-group mb-3">
|
|
@foreach (var scheme in Model.DerivationSchemes.OrderBy(scheme => scheme.Collapsed))
|
|
{
|
|
var isSetUp = !string.IsNullOrWhiteSpace(scheme.Value);
|
|
|
|
<li class="list-group-item bg-tile @(scheme.Collapsed ? "assets-collapsed": "")">
|
|
<div class="d-flex align-items-center">
|
|
<span class="d-flex flex-wrap flex-fill flex-column flex-sm-row">
|
|
<strong class="me-3">@scheme.Crypto</strong>
|
|
@if (isSetUp)
|
|
{
|
|
<span title="@scheme.Value" data-bs-toggle="tooltip" class="d-flex me-3">
|
|
<span class="text-truncate text-secondary" style="max-width:8ch">@scheme.Value</span>
|
|
@if (scheme.Value.Length > 20)
|
|
{
|
|
<span class="text-nowrap text-secondary">@Regex.Match(scheme.Value, @"((?:-\[(?:[^\]])+\])+|\S{6})$").Value</span>
|
|
}
|
|
</span>
|
|
@if (scheme.WalletSupported)
|
|
{
|
|
<a asp-action="WalletTransactions" asp-controller="Wallets" asp-route-walletId="@scheme.WalletId" class="text-secondary me-3">Manage Wallet</a>
|
|
}
|
|
}
|
|
</span>
|
|
<span class="d-flex align-items-center fw-semibold">
|
|
@if (isSetUp)
|
|
{
|
|
<form method="post"
|
|
asp-action="SetWalletEnabled"
|
|
asp-route-cryptoCode="@scheme.Crypto"
|
|
asp-route-storeId="@Model.Id"
|
|
class="d-flex align-items-center"
|
|
style="min-width:7rem">
|
|
<button type="submit" class="btcpay-toggle me-2 @if (scheme.Enabled) { @("btcpay-toggle--active") }" name="Enabled" value="@(scheme.Enabled ? "false" : "true")" id="@($"{scheme.Crypto}WalletEnabled")">@(scheme.Enabled ? "Disable" : "Enable")</button>
|
|
@if (scheme.Enabled)
|
|
{
|
|
<span class="text-primary">
|
|
Enabled
|
|
</span>
|
|
}
|
|
else
|
|
{
|
|
<span class="text-muted">
|
|
Disabled
|
|
</span>
|
|
}
|
|
</form>
|
|
<span class="text-light mx-2">|</span>
|
|
<a asp-action="WalletSettings" asp-route-cryptoCode="@scheme.Crypto" asp-route-storeId="@Model.Id" id="@($"Modify{scheme.Crypto}")" class="btn btn-link px-1 py-1 fw-semibold">
|
|
Settings
|
|
</a>
|
|
}
|
|
else
|
|
{
|
|
<a asp-action="SetupWallet" asp-route-cryptoCode="@scheme.Crypto" asp-route-storeId="@Model.Id" id="@($"Modify{scheme.Crypto}")" class="btn btn-primary btn-sm ms-4 px-3 py-1 fw-semibold">
|
|
Setup
|
|
</a>
|
|
}
|
|
</span>
|
|
</div>
|
|
</li>
|
|
}
|
|
</ul>
|
|
@if (Model.DerivationSchemes.Any(scheme => scheme.Collapsed))
|
|
{
|
|
<script>
|
|
document.addEventListener("DOMContentLoaded", (event) => {
|
|
var collapsed = document.getElementsByClassName("assets-collapsed");
|
|
for (let collapsedElement of collapsed) {
|
|
collapsedElement.style.display = 'none';
|
|
}
|
|
document
|
|
.getElementById("toggle-assets")
|
|
.addEventListener("click", function (){
|
|
var collapsed = document.getElementsByClassName("assets-collapsed");
|
|
for (let collapsedElement of collapsed) {
|
|
collapsedElement.style.display = 'block';
|
|
}
|
|
document.getElementById("toggle-assets").style.display="none";
|
|
});
|
|
});
|
|
</script>
|
|
<button class="btn btn-link text-secondary mb-3 p-0 only-for-js" id="toggle-assets" type="button">Show additional assets</button>
|
|
}
|
|
</div>
|
|
|
|
<div class="mb-5">
|
|
<h4 class="mb-3">Lightning</h4>
|
|
@if (Model.HintLightning)
|
|
{
|
|
<p>A connection to a Lightning node is required to receive Lightning payments.</p>
|
|
}
|
|
<ul class="list-group mb-3">
|
|
@foreach (var scheme in Model.LightningNodes)
|
|
{
|
|
var isSetUp = !string.IsNullOrWhiteSpace(scheme.Address);
|
|
|
|
<li class="list-group-item bg-tile">
|
|
<div class="d-flex align-items-center">
|
|
<span class="d-flex flex-wrap flex-fill flex-column flex-sm-row">
|
|
<strong class="me-3">@scheme.CryptoCode</strong>
|
|
@if (isSetUp)
|
|
{
|
|
<span class="text-truncate text-secondary me-3" style="max-width:150px;">
|
|
@if (LightningConnectionString.TryParse(scheme.Address, out var cs))
|
|
{
|
|
<span>@typeof(LightningConnectionType).DisplayName(cs.ConnectionType.ToString())</span>
|
|
<span>@cs.BaseUri.Host</span>
|
|
}
|
|
else
|
|
{
|
|
@scheme.Address
|
|
}
|
|
</span>
|
|
<a class="text-secondary me-3"
|
|
asp-controller="PublicLightningNodeInfo"
|
|
asp-action="ShowLightningNodeInfo"
|
|
asp-route-cryptoCode="@scheme.CryptoCode"
|
|
asp-route-storeId="@Model.Id"
|
|
target="_blank">
|
|
Public Node Info
|
|
</a>
|
|
}
|
|
</span>
|
|
<span class="d-flex align-items-center fw-semibold">
|
|
@if (isSetUp)
|
|
{
|
|
<form method="post"
|
|
asp-action="SetLightningNodeEnabled"
|
|
asp-route-cryptoCode="@scheme.CryptoCode"
|
|
asp-route-storeId="@Model.Id"
|
|
class="d-flex align-items-center"
|
|
style="min-width:7rem">
|
|
<button type="submit" class="btcpay-toggle me-2 @if (scheme.Enabled) { @("btcpay-toggle--active") }" name="Enabled" value="@(scheme.Enabled ? "false" : "true")" id="@($"{scheme.CryptoCode}LightningEnabled")">@(scheme.Enabled ? "Disable" : "Enable")e</button>
|
|
@if (scheme.Enabled)
|
|
{
|
|
<span class="text-primary">
|
|
Enabled
|
|
</span>
|
|
}
|
|
else
|
|
{
|
|
<span class="text-muted">
|
|
Disabled
|
|
</span>
|
|
}
|
|
</form>
|
|
<span class="text-light mx-2">|</span>
|
|
<a asp-action="LightningSettings" asp-route-cryptoCode="@scheme.CryptoCode" asp-route-storeId="@Model.Id" id="@($"Modify-Lightning{scheme.CryptoCode}")" class="btn btn-link px-1 py-1 fw-semibold">
|
|
Settings
|
|
</a>
|
|
}
|
|
else
|
|
{
|
|
<a asp-action="SetupLightningNode" asp-route-cryptoCode="@scheme.CryptoCode" asp-route-storeId="@Model.Id" id="@($"Modify-Lightning{scheme.CryptoCode}")" class="btn btn-primary btn-sm ms-4 px-3 py-1 fw-semibold">
|
|
Setup
|
|
</a>
|
|
}
|
|
</span>
|
|
</div>
|
|
</li>
|
|
}
|
|
</ul>
|
|
</div>
|
|
|
|
<form method="post">
|
|
<h4 class="mb-3">Payment</h4>
|
|
<div class="form-group">
|
|
<label asp-for="DefaultCurrency" class="form-label"></label>
|
|
<input asp-for="DefaultCurrency" class="form-control" style="max-width:10ch;" />
|
|
<span asp-validation-for="DefaultCurrency" class="text-danger"></span>
|
|
</div>
|
|
<div class="form-group d-flex align-items-center">
|
|
<input asp-for="AnyoneCanCreateInvoice" type="checkbox" class="btcpay-toggle me-2"/>
|
|
<label asp-for="AnyoneCanCreateInvoice" class="form-label mb-0 me-1"></label>
|
|
<a href="https://docs.btcpayserver.org/FAQ/Stores/#allow-anyone-to-create-invoice" target="_blank" rel="noreferrer noopener">
|
|
<span class="fa fa-question-circle-o text-secondary" title="More information..."></span>
|
|
</a>
|
|
</div>
|
|
<div class="form-group mt-4">
|
|
<label asp-for="NetworkFeeMode" class="form-label"></label>
|
|
<a href="https://docs.btcpayserver.org/FAQ/Stores/#add-network-fee-to-invoice-vary-with-mining-fees" target="_blank" rel="noreferrer noopener">
|
|
<span class="fa fa-question-circle-o text-secondary" title="More information..."></span>
|
|
</a>
|
|
<select asp-for="NetworkFeeMode" class="form-select">
|
|
<option value="MultiplePaymentsOnly">... only if the customer makes more than one payment for the invoice</option>
|
|
<option value="Always">... on every payment</option>
|
|
<option value="Never">Never add network fee</option>
|
|
</select>
|
|
</div>
|
|
<div class="form-group">
|
|
<label asp-for="InvoiceExpiration" class="form-label"></label>
|
|
<a href="https://docs.btcpayserver.org/FAQ/Stores/#invoice-expires-if-the-full-amount-has-not-been-paid-after-minutes" target="_blank" rel="noreferrer noopener">
|
|
<span class="fa fa-question-circle-o text-secondary" title="More information..."></span>
|
|
</a>
|
|
<div class="input-group">
|
|
<input asp-for="InvoiceExpiration" class="form-control" style="max-width:10ch;"/>
|
|
<span class="input-group-text">minutes</span>
|
|
</div>
|
|
<span asp-validation-for="InvoiceExpiration" class="text-danger"></span>
|
|
</div>
|
|
<div class="form-group">
|
|
<label asp-for="PaymentTolerance" class="form-label"></label>
|
|
<a href="https://docs.btcpayserver.org/FAQ/Stores/#consider-the-invoice-paid-even-if-the-paid-amount-is-less-than-expected" target="_blank" rel="noreferrer noopener">
|
|
<span class="fa fa-question-circle-o text-secondary" title="More information..."></span>
|
|
</a>
|
|
<div class="input-group">
|
|
<input asp-for="PaymentTolerance" class="form-control" style="max-width:10ch;"/>
|
|
<span class="input-group-text">percent</span>
|
|
</div>
|
|
<span asp-validation-for="PaymentTolerance" class="text-danger"></span>
|
|
</div>
|
|
|
|
<button name="command" type="submit" class="btn btn-primary px-4" value="Save" id="Save">Save</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
@section PageFootContent {
|
|
<partial name="_ValidationScriptsPartial" />
|
|
}
|