diff --git a/internal/api/userpage/static/webapp.html b/internal/api/userpage/static/webapp.html
index 8a24f31..f0cd961 100644
--- a/internal/api/userpage/static/webapp.html
+++ b/internal/api/userpage/static/webapp.html
@@ -245,7 +245,7 @@
@@ -260,6 +260,10 @@
// render the LNURL pay QR code
var s = "{{.LNURLPay}}";
+ const currencies = ["sat", "USD", "EUR"];
+ var currency_idx = 0;
+ document.getElementById("inputCurrency").innerHTML = currencies[0];
+
renderQr(s);
// data passed form telegram server
@@ -292,6 +296,12 @@
$('#requestInvoice').removeClass('btn-danger').addClass('btn-primary');
});
+ var el = document.getElementById("inputCurrency");
+ el.addEventListener("click", function(event) {
+ currency_idx += 1;
+ $(this).html(currencies[currency_idx%(currencies.length)]);
+ });
+
// ------------------ functions ------------------
function invoiceButtonClick() {
@@ -339,8 +349,14 @@
invoiceButtonDisplayError("Invalid")
return false;
}
- console.log("requesting invoice with amount " + invoiceAmount);
- fetch(r.callback + '?amount='+ invoiceAmount * 1000).then(data => {
+ var amountQueryParam;
+ if (currencies[currency_idx] == "sat") {
+ amountQueryParam = invoiceAmount * 1000 // sat to msat
+ } else {
+ amountQueryParam = invoiceAmount + currencies[currency_idx]
+ }
+ console.log("requesting invoice with amount " + amountQueryParam);
+ fetch(r.callback + '?amount='+ amountQueryParam).then(data => {
return data.json();
})
.then(r => {
@@ -348,7 +364,7 @@
if (r.status == "OK"){
// update qr code
renderQr(r.pr);
- document.querySelector('#greeting').innerHTML = "Pay " + invoiceAmount + " sat";
+ document.querySelector('#greeting').innerHTML = "Pay " + invoiceAmount + " " + currencies[currency_idx];
} else {
invoiceButtonDisplayError("Error")
return false;