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:
Rockstar Developer
2018-10-07 17:19:55 -05:00
committed by Nicolas Dorier
parent 657cfe1b23
commit d459839bf7
6 changed files with 104 additions and 15 deletions

View File

@@ -20,6 +20,17 @@ function resetTabsSlider() {
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) {
// extender properties used
jsonData.shapeshiftUrl = "https://shapeshift.io/shifty.html?destination=" + jsonData.btcAddress + "&output=" + jsonData.paymentMethodId + "&amount=" + jsonData.btcDue;
@@ -66,20 +77,26 @@ function onDataCallback(jsonData) {
$(".payment__spinner").hide();
}
if (checkoutCtrl.scanDisplayQr === "") {
checkoutCtrl.scanDisplayQr = jsonData.invoiceBitcoinUrlQR;
}
if (jsonData.isLightning && checkoutCtrl.lndModel === null) {
var lndModel = {
toggle: 0
};
checkoutCtrl.lndModel = lndModel;
}
if (!jsonData.isLightning) {
checkoutCtrl.lndModel = null;
}
// updating ui
checkoutCtrl.srvModel = jsonData;
}
function changeCurrency(currency) {
if (currency !== null && srvModel.paymentMethodId !== currency) {
$(".payment__currencies").hide();
$(".payment__spinner").show();
srvModel.paymentMethodId = currency;
fetchStatus();
}
return false;
}
function fetchStatus() {
var path = srvModel.serverUrl + "/i/" + srvModel.invoiceId + "/" + srvModel.paymentMethodId + "/status";
$.ajax({
@@ -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
$(document).ready(function () {
// initialize