summaryrefslogtreecommitdiff
path: root/contrib/request_payment.en.mcpp
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-08-20 21:25:24 +0200
committerChristian Grothoff <christian@grothoff.org>2021-08-20 21:25:24 +0200
commit5335c44f98fb17d5349850219ddd3d3d6695caaa (patch)
treed9164dba7b3ac4cb1e1a8fc206eb8c5f90f2ebc0 /contrib/request_payment.en.mcpp
parent5e5e4fbf006f120e15e9cd6b393c9d259398911d (diff)
downloadmerchant-5335c44f98fb17d5349850219ddd3d3d6695caaa.tar.gz
merchant-5335c44f98fb17d5349850219ddd3d3d6695caaa.tar.bz2
merchant-5335c44f98fb17d5349850219ddd3d3d6695caaa.zip
address #6995 in terms of enabling sharing across Mustach template files by using cpp during the build process
Diffstat (limited to 'contrib/request_payment.en.mcpp')
-rw-r--r--contrib/request_payment.en.mcpp103
1 files changed, 103 insertions, 0 deletions
diff --git a/contrib/request_payment.en.mcpp b/contrib/request_payment.en.mcpp
new file mode 100644
index 00000000..e0507af3
--- /dev/null
+++ b/contrib/request_payment.en.mcpp
@@ -0,0 +1,103 @@
+<!DOCTYPE html>
+#include "copyright.html"
+<html>
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <noscript>
+ <meta http-equiv="refresh" content="1">
+ </noscript>
+ <title>Payment requested for {{order_summary}}</title>
+#include "css.html"
+</head>
+<body>
+<script>
+ let longpollDelayMs = 60000;
+ let checkUrl = new URL("{{& order_status_url }}");
+ checkUrl.searchParams.set("timeout_ms", longpollDelayMs.toString());
+ function check() {
+ let retried = false;
+ function retryOnce() {
+ if (!retried) {
+ retried = true;
+ check();
+ }
+ }
+ let req = new XMLHttpRequest();
+ req.onreadystatechange = function () {
+ if (req.readyState === XMLHttpRequest.DONE) {
+ if (req.status === 200) {
+ try {
+ let resp = JSON.parse(req.responseText);
+ if (resp.fulfillment_url) {
+ window.location.replace(resp.fulfillment_url);
+ }
+ } catch (e) {
+ console.error("could not parse response:", e);
+ }
+ }
+ if (req.status === 202) {
+ try {
+ let resp = JSON.parse(req.responseText);
+ if (resp.fulfillment_url) {
+ window.location.replace(resp.fulfillment_url);
+ }
+ } catch (e) {
+ console.error("could not parse response:", e);
+ }
+ }
+ if (req.status === 402) {
+ try {
+ let resp = JSON.parse(req.responseText);
+ if (resp.already_paid_order_id && resp.fulfillment_url) {
+ window.location.replace(resp.fulfillment_url);
+ }
+ } catch (e) {
+ console.error("could not parse response:", e);
+ }
+ }
+ setTimeout(retryOnce, 500);
+ }
+ };
+ req.onerror = function () {
+ setTimeout(retryOnce, 500);
+ }
+ req.ontimeout = function () {
+ setTimeout(retryOnce, 500);
+ }
+ req.timeout = longpollDelayMs;
+ req.open("GET", checkUrl.href);
+ req.send();
+ }
+ setTimeout(check, 500);
+</script>
+
+<section id="main" class="content">
+
+
+<h1>Taler payment requested</h1>
+
+<div class="taler-installed-hide">
+ <p>
+ Please select your Taler wallet to pay. If you do not have one, GNU Taler
+ offers a
+ <a href="https://wallet.taler.net/">wallet browser extensions</a> for
+ many platforms.
+ </p>
+</div>
+
+<div>
+ <p>
+ Alternatively, you can scan this QR code to pay with your mobile wallet:
+ </p>
+ <div class="qr">
+ {{{taler_pay_qrcode_svg}}}
+ </div>
+ <p>
+ Finally, you could click <a href="{{taler_pay_uri}}">this link</a> to
+ try to open your system's Taler wallet if it exists.
+ </p>
+</div>
+<hr />
+</section>
+#include "footer.html"