btcpayserver/BTCPayServer/Views/Stores/UpdateStore.cshtml

330 lines
18 KiB
Plaintext
Raw Normal View History

@using System.Text.RegularExpressions
@model StoreViewModel
2017-09-13 16:50:36 +02:00
@{
Layout = "../Shared/_NavLayout.cshtml";
ViewData.SetActivePageAndTitle(StoreNavPages.Index, "General Settings", Context.GetStoreData().StoreName);
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">
@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">
<h4 class="mb-3">Wallet</h4>
2020-10-23 20:04:13 +02:00
@if (Model.HintWallet)
{
<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))
{
var isSetUp = !string.IsNullOrWhiteSpace(scheme.Value);
<li class="list-group-item bg-tile @(scheme.Collapsed ? "collapsed": "")">
<div class="d-flex align-items-center">
<span class="d-flex flex-wrap flex-fill flex-column flex-sm-row">
<strong class="mr-3">@scheme.Crypto</strong>
@if (isSetUp)
2020-10-23 20:04:13 +02:00
{
<span title="@scheme.Value" data-toggle="tooltip" class="d-flex mr-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>
}
2020-10-23 20:04:13 +02:00
</span>
@if (scheme.WalletSupported)
2020-10-23 17:15:07 +02:00
{
<a asp-action="WalletTransactions" asp-controller="Wallets" asp-route-walletId="@scheme.WalletId" class="text-secondary mr-3">Manage Wallet</a>
2020-10-23 17:15:07 +02:00
}
2020-10-23 20:04:13 +02:00
}
</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:7.65rem">
<button type="submit" class="btcpay-toggle mr-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 ml-3 mr-2">|</span>
2021-04-16 15:31:09 +02:00
<a asp-action="ModifyWallet" asp-route-cryptoCode="@scheme.Crypto" asp-route-storeId="@Model.Id" id="@($"Modify{scheme.Crypto}")" class="btn btn-link px-1 py-1 fw-semibold">
Wallet setup redesign (#2164) * Prepare existing layouts and views * Add icon view component and sprite svg * Add wallet setup basics * Add import method view basics * Use external sprite file instead of inline svg * Refactor hardware wallet setup flow * Manually enter an xpub * Prepare other views * Update views and models * Finalize wallet setup flow * Updat tests, part 1 * Update tests, part 2 * Vaul: Fix missing retry button * Add better Scan QR subtext Still tbd. * Make wallet account an advanced setting * Prevent empty xpub * Use textarea for seed input * Remove redundant error message for missing file upload * Confirm store updates after generating a new wallet * Update wording * Modify existing wallets * Fix proposed method name * Suggest using ColdCard Electrum export option only Advise the user to use the electrum export of the coldcard instead of saying either electrum or wasabi export file … the electurm one contains more info, e.g. the wasabi one doesn't include the account key path. * More concise WalletSetupMethod setting * Test fix * Update wallet removal code * Fix back navigation quirk in change wallet case * Fix behaviour on wallet enable/disable * Fix initial wallet setup * Improve modify view and messages * Test fixes * Seed import fix Uses the correct form url for confirming addresses * Quickfixes from design meeting * Add enable toggle switch on modify page * Confirm wallet removal * Update setup view * Update import view * Icon finetuning * Improve import options page * Refactor QR code scanner Allow for usage with and without modal * Update copy and instructions on import pages * Split generate options: Hot wallet and watch-only * Implement hot wallet options correctly * Minor test changes * Navbar improvements * Fix tables * Fix badge color * Routing related updates Thanks @kukks for the suggestions! * Wording updates Thanks @kukks for the suggestions! * Extend address types table for xpub import Thanks @kukks for the suggestions! * Rename controller * Unify precondition checks * Improve removal warning for hot wallets * Add tooltip on why seed import is not recommended * Add tooltip icon * Add Specter import info
2021-02-11 11:48:54 +01:00
Modify
</a>
}
else
{
2021-04-16 15:31:09 +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 ml-4 px-3 py-1 fw-semibold">
Wallet setup redesign (#2164) * Prepare existing layouts and views * Add icon view component and sprite svg * Add wallet setup basics * Add import method view basics * Use external sprite file instead of inline svg * Refactor hardware wallet setup flow * Manually enter an xpub * Prepare other views * Update views and models * Finalize wallet setup flow * Updat tests, part 1 * Update tests, part 2 * Vaul: Fix missing retry button * Add better Scan QR subtext Still tbd. * Make wallet account an advanced setting * Prevent empty xpub * Use textarea for seed input * Remove redundant error message for missing file upload * Confirm store updates after generating a new wallet * Update wording * Modify existing wallets * Fix proposed method name * Suggest using ColdCard Electrum export option only Advise the user to use the electrum export of the coldcard instead of saying either electrum or wasabi export file … the electurm one contains more info, e.g. the wasabi one doesn't include the account key path. * More concise WalletSetupMethod setting * Test fix * Update wallet removal code * Fix back navigation quirk in change wallet case * Fix behaviour on wallet enable/disable * Fix initial wallet setup * Improve modify view and messages * Test fixes * Seed import fix Uses the correct form url for confirming addresses * Quickfixes from design meeting * Add enable toggle switch on modify page * Confirm wallet removal * Update setup view * Update import view * Icon finetuning * Improve import options page * Refactor QR code scanner Allow for usage with and without modal * Update copy and instructions on import pages * Split generate options: Hot wallet and watch-only * Implement hot wallet options correctly * Minor test changes * Navbar improvements * Fix tables * Fix badge color * Routing related updates Thanks @kukks for the suggestions! * Wording updates Thanks @kukks for the suggestions! * Extend address types table for xpub import Thanks @kukks for the suggestions! * Rename controller * Unify precondition checks * Improve removal warning for hot wallets * Add tooltip on why seed import is not recommended * Add tooltip icon * Add Specter import info
2021-02-11 11:48:54 +01:00
Setup
</a>
}
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>
$(document).ready(function () {
$(".collapsed").hide();
$("#toggle-assets").click(function () {
$(".collapsed").show();
});
});
</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-23 20:04:13 +02:00
<div class="mb-5">
<h4 class="mb-3">Lightning</h4>
2020-10-23 20:04:13 +02:00
@if (Model.HintLightning)
{
<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)
{
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="mr-3">@scheme.CryptoCode</strong>
@if (isSetUp)
2020-10-23 20:04:13 +02:00
{
<span class="smMaxWidth text-truncate text-secondary mr-3">@scheme.Address</span>
2021-04-20 12:23:50 +02:00
<a class="text-secondary"
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>
<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:7.65rem">
<button type="submit" class="btcpay-toggle mr-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 ml-3 mr-2">|</span>
}
2021-04-19 16:21:50 +02:00
<a asp-action="SetupLightningNode" asp-route-cryptoCode="@scheme.CryptoCode" asp-route-storeId="@Model.Id" id="@($"Modify-Lightning{scheme.CryptoCode}")" class="btn btn-@(isSetUp ? "link px-1" : "primary btn-sm ml-4 px-3") py-1 fw-semibold">
@(isSetUp ? "Modify" : "Setup")
2020-10-23 20:04:13 +02:00
</a>
</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>
<form method="post">
2020-10-23 17:15:07 +02:00
<h4 class="mb-3">General</h4>
<div class="form-group">
<label asp-for="Id"></label>
<input asp-for="Id" readonly class="form-control" />
</div>
<div class="form-group">
<label asp-for="StoreName"></label>
<input asp-for="StoreName" class="form-control" />
<span asp-validation-for="StoreName" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="StoreWebsite"></label>
<input asp-for="StoreWebsite" class="form-control" />
<span asp-validation-for="StoreWebsite" class="text-danger"></span>
</div>
2020-10-23 17:15:07 +02:00
<h4 class="mt-5 mb-3">Payment</h4>
<div class="form-group">
<div class="form-check">
<input asp-for="AnyoneCanCreateInvoice" type="checkbox" class="form-check-input" />
<label asp-for="AnyoneCanCreateInvoice" class="form-check-label"></label>
<a href="https://docs.btcpayserver.org/FAQ/FAQ-Stores/#allow-anyone-to-create-invoice" target="_blank">
<span class="fa fa-question-circle-o text-secondary" title="More information..."></span>
</a>
</div>
2020-10-23 17:15:07 +02:00
</div>
<div class="form-group">
<div class="form-check">
<input asp-for="PayJoinEnabled" type="checkbox" class="form-check-input" />
<label asp-for="PayJoinEnabled" class="form-check-label"></label>
<a href="https://docs.btcpayserver.org/Payjoin/" target="_blank">
<span class="fa fa-question-circle-o text-secondary" title="More information..."></span>
</a>
2020-10-23 17:15:07 +02:00
<span asp-validation-for="PayJoinEnabled" class="text-danger"></span>
</div>
2020-10-23 17:15:07 +02:00
</div>
<div class="form-group">
<label asp-for="NetworkFeeMode"></label>
<a href="https://docs.btcpayserver.org/FAQ/FAQ-Stores/#add-network-fee-to-invoice-vary-with-mining-fees" target="_blank">
<span class="fa fa-question-circle-o text-secondary" title="More information..."></span>
</a>
2020-10-23 17:15:07 +02:00
<select asp-for="NetworkFeeMode" class="form-control">
<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">
<div class="mb-2">
<label asp-for="InvoiceExpiration" class="d-inline"></label>
<a href="https://docs.btcpayserver.org/FAQ/FAQ-Stores/#invoice-expires-if-the-full-amount-has-not-been-paid-after-minutes" target="_blank">
<span class="fa fa-question-circle-o text-secondary" title="More information..."></span>
</a>
</div>
2020-10-23 17:15:07 +02:00
<div class="input-group">
<input asp-for="InvoiceExpiration" class="form-control" style="max-width:10ch;" />
<div class="input-group-append">
<span class="input-group-text">minutes</span>
2020-07-22 15:31:09 +02:00
</div>
</div>
2020-10-23 17:15:07 +02:00
<span asp-validation-for="InvoiceExpiration" class="text-danger"></span>
</div>
<div class="form-group">
<div class="mb-2">
<label asp-for="MonitoringExpiration" class="d-inline"></label>
<a href="https://docs.btcpayserver.org/FAQ/FAQ-Stores/#payment-invalid-if-transactions-fails-to-confirm-minutes-after-invoice-expiration" target="_blank">
<span class="fa fa-question-circle-o text-secondary" title="More information..."></span>
</a>
</div>
2020-10-23 17:15:07 +02:00
<div class="input-group">
<input asp-for="MonitoringExpiration" class="form-control" style="max-width:10ch;" />
<div class="input-group-append">
<span class="input-group-text">minutes</span>
</div>
</div>
2020-10-23 17:15:07 +02:00
<span asp-validation-for="MonitoringExpiration" class="text-danger"></span>
</div>
<div class="form-group">
<div class="mb-2">
<label asp-for="PaymentTolerance" class="d-inline"></label>
<a href="https://docs.btcpayserver.org/FAQ/FAQ-Stores/#consider-the-invoice-paid-even-if-the-paid-amount-is-less-than-expected" target="_blank">
<span class="fa fa-question-circle-o text-secondary" title="More information..."></span>
</a>
</div>
2020-10-23 17:15:07 +02:00
<div class="input-group">
<input asp-for="PaymentTolerance" class="form-control" style="max-width:10ch;" />
<div class="input-group-append">
<span class="input-group-text">percent</span>
2020-07-22 15:31:09 +02:00
</div>
</div>
2020-10-23 17:15:07 +02:00
<span asp-validation-for="PaymentTolerance" class="text-danger"></span>
</div>
<div class="form-group">
<div class="mb-2">
<label asp-for="SpeedPolicy" class="d-inline"></label>
<a href="https://docs.btcpayserver.org/FAQ/FAQ-Stores/#consider-the-invoice-confirmed-when-the-payment-transaction" target="_blank">
<span class="fa fa-question-circle-o text-secondary" title="More information..."></span>
2020-10-23 17:15:07 +02:00
</a>
2020-10-21 10:45:24 +02:00
</div>
2020-10-23 17:15:07 +02:00
<script>
function handleSpeedPolicyChange(select) {
document.getElementById('unconfirmed-warning').hidden = select.value !== '0';
}
</script>
<select asp-for="SpeedPolicy" class="form-control w-auto" onchange="handleSpeedPolicyChange(this)">
<option value="0">Is unconfirmed</option>
<option value="1">Has at least 1 confirmation</option>
<option value="3">Has at least 2 confirmations</option>
<option value="2">Has at least 6 confirmations</option>
</select>
<div class="alert alert-warning my-2" hidden="@(Model.SpeedPolicy != 0)" id="unconfirmed-warning" role="alert">
Choosing to accept an unconfirmed invoice can lead to double-spending and is strongly discouraged.
</div>
<span asp-validation-for="SpeedPolicy" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="LightningDescriptionTemplate"></label>
<input asp-for="LightningDescriptionTemplate" class="form-control" />
<span asp-validation-for="LightningDescriptionTemplate" class="text-danger"></span>
<p class="form-text text-muted">
Available placeholders:
<code>{StoreName} {ItemDescription} {OrderId}</code>
</p>
</div>
<button name="command" type="submit" class="btn btn-primary" value="Save" id="Save">Save Store Settings</button>
</form>
2020-10-23 17:15:07 +02:00
<h4 class="mt-5 mb-3">Services</h4>
<div class="table-responsive-md">
<table class="table table-sm mt-1 mb-5">
<thead>
2020-10-23 17:15:07 +02:00
<tr>
<th>Service</th>
<th class="text-right w-100px">Actions</th>
</tr>
</thead>
<tbody>
2020-10-23 17:15:07 +02:00
<tr>
<td>
Email
</td>
<td class="text-right">
<a asp-action="Emails" asp-route-storeId="@Context.GetRouteValue("storeId")">
Setup
</a>
</td>
</tr>
</tbody>
</table>
</div>
2020-10-23 17:15:07 +02:00
@if (Model.CanDelete)
{
<h4 class="mt-5 mb-3">Other actions</h4>
2020-11-06 12:42:26 +01:00
<button id="danger-zone-expander" class="btn btn-link text-secondary mb-3 p-0" type="button" data-toggle="collapse" data-target="#danger-zone">
2020-10-23 17:15:07 +02:00
See more actions
</button>
<div id="danger-zone" class="collapse">
2020-11-06 12:42:26 +01:00
<a id="delete-store" class="btn btn-outline-danger mb-5" asp-action="DeleteStore" asp-route-storeId="@Model.Id">Delete this store</a>
2020-10-23 17:15:07 +02:00
</div>
}
</div>
2017-09-13 16:50:36 +02:00
</div>
@section Scripts {
<partial name="_ValidationScriptsPartial" />
2017-09-13 16:50:36 +02:00
}