diff --git a/configs/bank-landing/shop-pay.js b/configs/bank-landing/shop-pay.js new file mode 100644 index 0000000..197ce98 --- /dev/null +++ b/configs/bank-landing/shop-pay.js @@ -0,0 +1,158 @@ +/** + * GOA shop pay popup — public pay-template + payto (no merchant secrets). + * QR: white modules, centered official qr-logo (DD 90). + */ +(function () { + var MERCHANT_HOST = "taler.hacktivism.ch"; + var INSTANCE = "goa-demo-cp4zqk"; + var SHOP_PAYTO = + "payto://x-taler-bank/bank.hacktivism.ch/goa-demo-cp4zqk?receiver-name=GOA%20Demo%20Shop%20cp4zqk"; + var SHOP_PAYTO_HTTPS = + "https://bank.hacktivism.ch/webui/"; + + function payTemplateUri(productId) { + return ( + "taler://pay-template/" + + MERCHANT_HOST + + "/instances/" + + INSTANCE + + "/" + + encodeURIComponent(productId) + ); + } + + function payTemplateHttps(productId) { + return ( + "https://" + + MERCHANT_HOST + + "/instances/" + + INSTANCE + + "/templates/" + + encodeURIComponent(productId) + ); + } + + function introBase() { + var b = document.querySelector("base"); + return b && b.href ? b.href : "/intro/"; + } + + function ensureModal() { + var m = document.getElementById("goa-pay-modal"); + if (m) return m; + m = document.createElement("div"); + m.id = "goa-pay-modal"; + m.className = "goa-pay-modal"; + m.setAttribute("role", "dialog"); + m.setAttribute("aria-modal", "true"); + m.setAttribute("aria-labelledby", "goa-pay-title"); + m.hidden = true; + m.innerHTML = + '
Scan with GNU Taler Wallet
' + + ' Open payment link →' + + 'Payment URI (wallet)
' + + ' ' +
+ ' (https)
Merchant payto (settlement)
' + + ' ' +
+ ' (https)
QR library missing
'; + } else { + new QRCode(qrHost, { + text: uri, + width: 220, + height: 220, + colorDark: "#000000", + colorLight: "#ffffff", + correctLevel: QRCode.CorrectLevel.M, + }); + } + + m.hidden = false; + m.classList.add("open"); + } + + function bind() { + document.querySelectorAll("[data-product]").forEach(function (el) { + el.addEventListener("click", function (e) { + e.preventDefault(); + var id = el.getAttribute("data-product"); + var nameEl = el.querySelector(".name"); + var priceEl = el.querySelector(".price"); + showPay( + id, + nameEl ? nameEl.textContent.trim() : id, + priceEl ? priceEl.textContent.trim() : "" + ); + }); + }); + } + + if (document.readyState === "loading") { + document.addEventListener("DOMContentLoaded", bind); + } else { + bind(); + } +})();