gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-blog] branch master updated: check status via API


From: gnunet
Subject: [GNUnet-SVN] [taler-blog] branch master updated: check status via API
Date: Tue, 27 Aug 2019 01:05:20 +0200

This is an automated email from the git hooks/post-receive script.

dold pushed a commit to branch master
in repository blog.

The following commit(s) were added to refs/heads/master by this push:
     new c0657b7  check status via API
c0657b7 is described below

commit c0657b7fc92ce330b3cbda249114f37fb995c915
Author: Florian Dold <address@hidden>
AuthorDate: Tue Aug 27 01:05:15 2019 +0200

    check status via API
---
 talerblog/blog/blog.py                        |  2 ++
 talerblog/blog/templates/request_payment.html | 37 ++++++++++++++++++++++++++-
 2 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/talerblog/blog/blog.py b/talerblog/blog/blog.py
index 7162119..9c4f8ad 100644
--- a/talerblog/blog/blog.py
+++ b/talerblog/blog/blog.py
@@ -337,6 +337,8 @@ def article(article_name, data=None):
         # run the payment protocol.
         taler_pay_uri = pay_status["taler_pay_uri"]
         qrcode_svg = get_qrcode_svg(taler_pay_uri)
+        check_status_url = flask.url_for(
+                "check_status", order_id=order_id, session_id=session_id)
         content = flask.render_template("templates/request_payment.html",
                                          article_name=article_name,
                                          taler_pay_uri=taler_pay_uri,
diff --git a/talerblog/blog/templates/request_payment.html 
b/talerblog/blog/templates/request_payment.html
index c30b847..6c14456 100644
--- a/talerblog/blog/templates/request_payment.html
+++ b/talerblog/blog/templates/request_payment.html
@@ -1,7 +1,42 @@
 {% extends "templates/base.html" %}
+
+
 {% block meta %}
-<meta http-equiv="refresh" content="1">
+<noscript>
+  <meta http-equiv="refresh" content="1">
+</noscript>
 {% endblock meta %}
+
+
+{% block scripts %}
+<script>
+  let checkUrl = decodeURIComponent("{{ check_status_url_enc }}");
+  let delayMs = 500;
+  function check() {
+    let req = new XMLHttpRequest();
+    req.onreadystatechange = function () {
+      if (req.readyState === XMLHttpRequest.DONE && req.status === 200) {
+        if (req.status === 200) {
+          let resp = JSON.parse(req.responseText);
+          if (resp.paid) {
+            document.location.reload(true);
+          }
+        }
+        setTimeout(check, delayMs);
+      }
+    };
+    req.onerror = function () {
+      setTimeout(check, delayMs);
+    }
+    req.open("GET", checkUrl);
+    req.send();
+  }
+
+  setTimeout(check, delayMs);
+</script>
+{% endblock scripts %}
+
+
 {% block main %}
 
 <h1>Payment Required</h1>

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]