mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 14:34:23 +01:00
Displaying Node Info as QR code for Lightning payments (#318)
* Styling elements required for Node info * Allowing switching QR between bolt11 and node info for lightning * Equal width for Bolt11 and Node info buttons * Certain languages were too verbose for display of "Pay with" Fixes: #317
This commit is contained in:
committed by
Nicolas Dorier
parent
657cfe1b23
commit
d459839bf7
@@ -307,7 +307,7 @@ namespace BTCPayServer.Controllers
|
|||||||
private string GetDisplayName(PaymentMethodId paymentMethodId, BTCPayNetwork network)
|
private string GetDisplayName(PaymentMethodId paymentMethodId, BTCPayNetwork network)
|
||||||
{
|
{
|
||||||
return paymentMethodId.PaymentType == PaymentTypes.BTCLike ?
|
return paymentMethodId.PaymentType == PaymentTypes.BTCLike ?
|
||||||
network.DisplayName : network.DisplayName + " (via Lightning)";
|
network.DisplayName : network.DisplayName + " (Lightning)";
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetImage(PaymentMethodId paymentMethodId, BTCPayNetwork network)
|
private string GetImage(PaymentMethodId paymentMethodId, BTCPayNetwork network)
|
||||||
|
|||||||
@@ -188,9 +188,15 @@
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="bp-view payment scan" id="scan">
|
<div class="bp-view payment scan" id="scan">
|
||||||
|
<div class="wrapBtnGroup" v-bind:class="{ invisible: lndModel === null }">
|
||||||
|
<div class="btnGroupLnd">
|
||||||
|
<button onclick="lndToggleBolt11()" v-bind:class="{ active: lndModel != null && lndModel.toggle === 0 }">{{$t("BOLT 11 Invoice")}}</button>
|
||||||
|
<button onclick="lndToggleNode()" v-bind:class="{ active: lndModel != null && lndModel.toggle === 1 }">{{$t("Node Info")}}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="payment__scan">
|
<div class="payment__scan">
|
||||||
<img v-bind:src="srvModel.cryptoImage" class="qr_currency_icon" />
|
<img v-bind:src="srvModel.cryptoImage" class="qr_currency_icon" />
|
||||||
<qrcode v-bind:val="srvModel.invoiceBitcoinUrlQR" v-bind:size="256" bg-color="#f5f5f7" fg-color="#000">
|
<qrcode v-bind:val="scanDisplayQr" v-bind:size="256" bg-color="#f5f5f7" fg-color="#000">
|
||||||
</qrcode>
|
</qrcode>
|
||||||
</div>
|
</div>
|
||||||
<div class="payment__details__instruction__open-wallet">
|
<div class="payment__details__instruction__open-wallet">
|
||||||
|
|||||||
@@ -151,6 +151,8 @@
|
|||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
srvModel: srvModel,
|
srvModel: srvModel,
|
||||||
|
lndModel: null,
|
||||||
|
scanDisplayQr: "",
|
||||||
expiringSoon: false
|
expiringSoon: false
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -9236,7 +9236,7 @@ strong {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.bp-view.scan {
|
.bp-view.scan {
|
||||||
padding-top: .9em !important;
|
padding-top: 0em !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bp-view:not(.active) {
|
.bp-view:not(.active) {
|
||||||
@@ -9376,11 +9376,64 @@ strong {
|
|||||||
border-bottom: 1px dotted;
|
border-bottom: 1px dotted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.wrapBtnGroup {
|
||||||
|
text-align: center;
|
||||||
|
margin: -2px 0px 12px;
|
||||||
|
padding: 0 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btnGroupLnd {
|
||||||
|
margin: 0 auto;
|
||||||
|
text-align: center;
|
||||||
|
width: inherit;
|
||||||
|
display: table;
|
||||||
|
background-color: #fff;
|
||||||
|
color: #000;
|
||||||
|
font-size: 0px;
|
||||||
|
width:100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btnGroupLnd button:first-child {
|
||||||
|
border-top-left-radius: 5px;
|
||||||
|
border-bottom-left-radius: 5px;
|
||||||
|
border-right: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btnGroupLnd button:last-child {
|
||||||
|
border-top-right-radius: 5px;
|
||||||
|
border-bottom-right-radius: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btnGroupLnd button {
|
||||||
|
display: table-cell;
|
||||||
|
border: solid 1px #24725B;
|
||||||
|
padding: 6px 9px;
|
||||||
|
margin: 0px;
|
||||||
|
font-size: 12px;
|
||||||
|
width: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btnGroupLnd button:hover {
|
||||||
|
background-color: #eeffee;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btnGroupLnd button.active {
|
||||||
|
background-color: #329F80;
|
||||||
|
border-color: #329F80;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btnGroupLnd button.active:hover {
|
||||||
|
background-color: #24725B;
|
||||||
|
border-color: #24725B;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
.payment__details__instruction__open-wallet {
|
.payment__details__instruction__open-wallet {
|
||||||
display: block;
|
display: block;
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
margin: 15px 15px 18px;
|
margin: 0px 15px 18px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,6 +54,7 @@
|
|||||||
|
|
||||||
.clickable_underline {
|
.clickable_underline {
|
||||||
border-bottom: 1px dotted #ccc;
|
border-bottom: 1px dotted #ccc;
|
||||||
|
font-size: 13px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.payment__currencies:hover .clickable_underline {
|
.payment__currencies:hover .clickable_underline {
|
||||||
|
|||||||
@@ -20,6 +20,17 @@ function resetTabsSlider() {
|
|||||||
closePaymentMethodDialog(null);
|
closePaymentMethodDialog(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function changeCurrency(currency) {
|
||||||
|
if (currency !== null && srvModel.paymentMethodId !== currency) {
|
||||||
|
$(".payment__currencies").hide();
|
||||||
|
$(".payment__spinner").show();
|
||||||
|
checkoutCtrl.scanDisplayQr = "";
|
||||||
|
srvModel.paymentMethodId = currency;
|
||||||
|
fetchStatus();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
function onDataCallback(jsonData) {
|
function onDataCallback(jsonData) {
|
||||||
// extender properties used
|
// extender properties used
|
||||||
jsonData.shapeshiftUrl = "https://shapeshift.io/shifty.html?destination=" + jsonData.btcAddress + "&output=" + jsonData.paymentMethodId + "&amount=" + jsonData.btcDue;
|
jsonData.shapeshiftUrl = "https://shapeshift.io/shifty.html?destination=" + jsonData.btcAddress + "&output=" + jsonData.paymentMethodId + "&amount=" + jsonData.btcDue;
|
||||||
@@ -66,18 +77,24 @@ function onDataCallback(jsonData) {
|
|||||||
$(".payment__spinner").hide();
|
$(".payment__spinner").hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
// updating ui
|
if (checkoutCtrl.scanDisplayQr === "") {
|
||||||
checkoutCtrl.srvModel = jsonData;
|
checkoutCtrl.scanDisplayQr = jsonData.invoiceBitcoinUrlQR;
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeCurrency(currency) {
|
if (jsonData.isLightning && checkoutCtrl.lndModel === null) {
|
||||||
if (currency !== null && srvModel.paymentMethodId !== currency) {
|
var lndModel = {
|
||||||
$(".payment__currencies").hide();
|
toggle: 0
|
||||||
$(".payment__spinner").show();
|
};
|
||||||
srvModel.paymentMethodId = currency;
|
|
||||||
fetchStatus();
|
checkoutCtrl.lndModel = lndModel;
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
|
if (!jsonData.isLightning) {
|
||||||
|
checkoutCtrl.lndModel = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// updating ui
|
||||||
|
checkoutCtrl.srvModel = jsonData;
|
||||||
}
|
}
|
||||||
|
|
||||||
function fetchStatus() {
|
function fetchStatus() {
|
||||||
@@ -93,6 +110,16 @@ function fetchStatus() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function lndToggleBolt11() {
|
||||||
|
checkoutCtrl.lndModel.toggle = 0;
|
||||||
|
checkoutCtrl.scanDisplayQr = checkoutCtrl.srvModel.invoiceBitcoinUrlQR;
|
||||||
|
}
|
||||||
|
|
||||||
|
function lndToggleNode() {
|
||||||
|
checkoutCtrl.lndModel.toggle = 1;
|
||||||
|
checkoutCtrl.scanDisplayQr = checkoutCtrl.srvModel.peerInfo;
|
||||||
|
}
|
||||||
|
|
||||||
// private methods
|
// private methods
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
// initialize
|
// initialize
|
||||||
|
|||||||
Reference in New Issue
Block a user