2020-11-08 03:29:36 +01:00
|
|
|
@using System.Text.RegularExpressions
|
2021-11-24 10:55:11 +01:00
|
|
|
@using BTCPayServer.Lightning
|
2021-10-29 08:25:43 +02:00
|
|
|
@model PaymentMethodsViewModel
|
2017-09-13 16:50:36 +02:00
|
|
|
@{
|
2017-10-27 10:53:04 +02:00
|
|
|
Layout = "../Shared/_NavLayout.cshtml";
|
2021-12-31 08:36:38 +01:00
|
|
|
ViewData.SetActivePage(StoreNavPages.PaymentMethods, "Wallets", Context.GetStoreData().Id);
|
2020-07-22 15:28:31 +02:00
|
|
|
}
|
|
|
|
|
2017-09-13 16:50:36 +02:00
|
|
|
<div class="row">
|
2020-10-23 17:15:07 +02:00
|
|
|
<div class="col-lg-10 col-xl-9">
|
2021-04-08 15:32:42 +02:00
|
|
|
@if (!ViewContext.ModelState.IsValid)
|
|
|
|
{
|
|
|
|
<div asp-validation-summary="All" class="text-danger"></div>
|
|
|
|
}
|
2020-10-23 20:04:13 +02:00
|
|
|
<div class="mb-5">
|
2020-12-02 07:45:00 +01:00
|
|
|
<h4 class="mb-3">Wallet</h4>
|
2020-10-23 20:04:13 +02:00
|
|
|
@if (Model.HintWallet)
|
|
|
|
{
|
2020-12-02 07:45:00 +01:00
|
|
|
<p>Set up your wallet to receive payments at your store.</p>
|
2020-10-23 20:04:13 +02:00
|
|
|
}
|
|
|
|
<ul class="list-group mb-3">
|
2020-10-23 17:15:07 +02:00
|
|
|
@foreach (var scheme in Model.DerivationSchemes.OrderBy(scheme => scheme.Collapsed))
|
|
|
|
{
|
2020-12-08 15:32:04 +01:00
|
|
|
var isSetUp = !string.IsNullOrWhiteSpace(scheme.Value);
|
|
|
|
|
2021-07-12 14:16:41 +02:00
|
|
|
<li class="list-group-item bg-tile @(scheme.Collapsed ? "assets-collapsed": "")">
|
2020-12-08 15:32:04 +01:00
|
|
|
<div class="d-flex align-items-center">
|
|
|
|
<span class="d-flex flex-wrap flex-fill flex-column flex-sm-row">
|
2021-05-19 04:39:27 +02:00
|
|
|
<strong class="me-3">@scheme.Crypto</strong>
|
2020-12-08 15:32:04 +01:00
|
|
|
@if (isSetUp)
|
2020-10-23 20:04:13 +02:00
|
|
|
{
|
2021-05-19 04:39:27 +02:00
|
|
|
<span title="@scheme.Value" data-bs-toggle="tooltip" class="d-flex me-3">
|
2020-12-08 15:32:04 +01:00
|
|
|
<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>
|
|
|
|
}
|
2020-10-23 20:04:13 +02:00
|
|
|
</span>
|
|
|
|
@if (scheme.WalletSupported)
|
2020-10-23 17:15:07 +02:00
|
|
|
{
|
2021-05-19 04:39:27 +02:00
|
|
|
<a asp-action="WalletTransactions" asp-controller="Wallets" asp-route-walletId="@scheme.WalletId" class="text-secondary me-3">Manage Wallet</a>
|
2020-10-23 17:15:07 +02:00
|
|
|
}
|
2020-10-23 20:04:13 +02:00
|
|
|
}
|
|
|
|
</span>
|
2020-12-09 09:45:25 +01:00
|
|
|
<span class="d-flex align-items-center fw-semibold">
|
2020-12-08 15:32:04 +01:00
|
|
|
@if (isSetUp)
|
2020-12-02 07:45:00 +01:00
|
|
|
{
|
2021-04-26 22:28:24 +02:00
|
|
|
<form method="post"
|
|
|
|
asp-action="SetWalletEnabled"
|
|
|
|
asp-route-cryptoCode="@scheme.Crypto"
|
|
|
|
asp-route-storeId="@Model.Id"
|
|
|
|
class="d-flex align-items-center"
|
2021-10-29 08:25:43 +02:00
|
|
|
style="min-width:7rem">
|
2021-05-19 04:39:27 +02:00
|
|
|
<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>
|
2021-04-26 22:28:24 +02:00
|
|
|
@if (scheme.Enabled)
|
|
|
|
{
|
|
|
|
<span class="text-primary">
|
|
|
|
Enabled
|
|
|
|
</span>
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
<span class="text-muted">
|
|
|
|
Disabled
|
|
|
|
</span>
|
|
|
|
}
|
|
|
|
</form>
|
2021-10-29 08:25:43 +02:00
|
|
|
<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
|
2021-02-11 11:48:54 +01:00
|
|
|
</a>
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-05-19 04:39:27 +02:00
|
|
|
<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">
|
2021-02-11 11:48:54 +01:00
|
|
|
Setup
|
|
|
|
</a>
|
2020-12-02 07:45:00 +01:00
|
|
|
}
|
2020-10-23 20:04:13 +02:00
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</li>
|
2020-10-23 17:15:07 +02:00
|
|
|
}
|
2020-10-23 20:04:13 +02:00
|
|
|
</ul>
|
|
|
|
@if (Model.DerivationSchemes.Any(scheme => scheme.Collapsed))
|
|
|
|
{
|
|
|
|
<script>
|
2021-07-12 14:16:41 +02:00
|
|
|
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";
|
|
|
|
});
|
2020-10-23 20:04:13 +02:00
|
|
|
});
|
|
|
|
</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>
|
2020-10-16 01:20:23 +02:00
|
|
|
|
2020-10-23 20:04:13 +02:00
|
|
|
<div class="mb-5">
|
2020-12-02 07:45:00 +01:00
|
|
|
<h4 class="mb-3">Lightning</h4>
|
2020-10-23 20:04:13 +02:00
|
|
|
@if (Model.HintLightning)
|
|
|
|
{
|
2020-12-02 07:45:00 +01:00
|
|
|
<p>A connection to a Lightning node is required to receive Lightning payments.</p>
|
2020-10-23 20:04:13 +02:00
|
|
|
}
|
|
|
|
<ul class="list-group mb-3">
|
2020-10-23 17:15:07 +02:00
|
|
|
@foreach (var scheme in Model.LightningNodes)
|
|
|
|
{
|
2020-12-08 15:32:04 +01:00
|
|
|
var isSetUp = !string.IsNullOrWhiteSpace(scheme.Address);
|
|
|
|
|
2020-12-02 07:45:00 +01:00
|
|
|
<li class="list-group-item bg-tile">
|
2020-12-08 15:32:04 +01:00
|
|
|
<div class="d-flex align-items-center">
|
|
|
|
<span class="d-flex flex-wrap flex-fill flex-column flex-sm-row">
|
2021-05-19 04:39:27 +02:00
|
|
|
<strong class="me-3">@scheme.CryptoCode</strong>
|
2020-12-08 15:32:04 +01:00
|
|
|
@if (isSetUp)
|
2020-10-23 20:04:13 +02:00
|
|
|
{
|
2021-11-24 10:55:11 +01:00
|
|
|
<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"
|
2021-04-20 12:23:50 +02:00
|
|
|
asp-controller="PublicLightningNodeInfo"
|
|
|
|
asp-action="ShowLightningNodeInfo"
|
|
|
|
asp-route-cryptoCode="@scheme.CryptoCode"
|
|
|
|
asp-route-storeId="@Model.Id"
|
|
|
|
target="_blank">
|
|
|
|
Public Node Info
|
|
|
|
</a>
|
2020-10-23 20:04:13 +02:00
|
|
|
}
|
|
|
|
</span>
|
2020-12-09 09:45:25 +01:00
|
|
|
<span class="d-flex align-items-center fw-semibold">
|
2020-12-08 15:32:04 +01:00
|
|
|
@if (isSetUp)
|
2020-12-02 07:45:00 +01:00
|
|
|
{
|
2021-04-26 22:28:24 +02:00
|
|
|
<form method="post"
|
|
|
|
asp-action="SetLightningNodeEnabled"
|
|
|
|
asp-route-cryptoCode="@scheme.CryptoCode"
|
|
|
|
asp-route-storeId="@Model.Id"
|
|
|
|
class="d-flex align-items-center"
|
2021-10-29 08:25:43 +02:00
|
|
|
style="min-width:7rem">
|
2021-05-19 04:39:27 +02:00
|
|
|
<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>
|
2021-04-26 22:28:24 +02:00
|
|
|
@if (scheme.Enabled)
|
|
|
|
{
|
|
|
|
<span class="text-primary">
|
|
|
|
Enabled
|
|
|
|
</span>
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
<span class="text-muted">
|
|
|
|
Disabled
|
|
|
|
</span>
|
|
|
|
}
|
|
|
|
</form>
|
2021-10-29 08:25:43 +02:00
|
|
|
<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>
|
2020-12-02 07:45:00 +01:00
|
|
|
}
|
2020-10-23 20:04:13 +02:00
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</li>
|
2020-10-23 17:15:07 +02:00
|
|
|
}
|
2020-10-23 20:04:13 +02:00
|
|
|
</ul>
|
2020-10-23 17:15:07 +02:00
|
|
|
</div>
|
2020-10-16 01:20:23 +02:00
|
|
|
|
2021-04-08 15:32:42 +02:00
|
|
|
<form method="post">
|
2021-10-29 08:25:43 +02:00
|
|
|
<h4 class="mb-3">Payment</h4>
|
2020-10-23 17:15:07 +02:00
|
|
|
<div class="form-group">
|
2021-10-29 08:25:43 +02:00
|
|
|
<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>
|
2020-10-23 17:15:07 +02:00
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
2021-10-29 08:25:43 +02:00
|
|
|
<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>
|
2020-10-23 17:15:07 +02:00
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
2021-10-29 08:25:43 +02:00
|
|
|
<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>
|
2020-10-23 17:15:07 +02:00
|
|
|
</div>
|
2021-10-25 08:18:02 +02:00
|
|
|
|
2021-10-29 08:25:43 +02:00
|
|
|
<button name="command" type="submit" class="btn btn-primary px-4" value="Save" id="Save">Save</button>
|
2020-10-23 17:15:07 +02:00
|
|
|
</form>
|
2017-10-27 10:53:04 +02:00
|
|
|
</div>
|
2017-09-13 16:50:36 +02:00
|
|
|
</div>
|
|
|
|
|
2021-05-19 04:39:27 +02:00
|
|
|
@section PageFootContent {
|
2021-04-08 15:32:42 +02:00
|
|
|
<partial name="_ValidationScriptsPartial" />
|
2017-09-13 16:50:36 +02:00
|
|
|
}
|