summaryrefslogtreecommitdiff
path: root/src/frontend
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2016-01-25 16:11:28 +0100
committerFlorian Dold <florian.dold@gmail.com>2016-01-25 16:11:28 +0100
commit52d4248097904e30d43036202b5feba167d7cfca (patch)
treee06b5c6a4ccab70457efab92a0ae040b5b0c4cfb /src/frontend
parenta55410cdedb18f2cbd6682865f89d4ccbaf9481c (diff)
downloadmerchant-52d4248097904e30d43036202b5feba167d7cfca.tar.gz
merchant-52d4248097904e30d43036202b5feba167d7cfca.tar.bz2
merchant-52d4248097904e30d43036202b5feba167d7cfca.zip
merge execution page into fulfillment
Diffstat (limited to 'src/frontend')
-rw-r--r--src/frontend/execute.js33
-rw-r--r--src/frontend/fulfillment.php3
2 files changed, 2 insertions, 34 deletions
diff --git a/src/frontend/execute.js b/src/frontend/execute.js
deleted file mode 100644
index a9045cb5..00000000
--- a/src/frontend/execute.js
+++ /dev/null
@@ -1,33 +0,0 @@
-"use strict";
-// JSX literals are compiled to calls to React.createElement calls.
-let React = {
- createElement: function (tag, props, ...children) {
- let e = document.createElement(tag);
- for (let k in props) {
- e.setAttribute(k, props[k]);
- }
- for (let child of children) {
- if ("string" === typeof child || "number" == typeof child) {
- child = document.createTextNode(child);
- }
- e.appendChild(child);
- }
- return e;
- }
-};
-document.addEventListener("DOMContentLoaded", function (e) {
- var eve = new CustomEvent('taler-execute-payment', { detail: { H_contract: h_contract } });
- document.dispatchEvent(eve);
-});
-function replace(el, r) {
- el.parentNode.replaceChild(r, el);
-}
-document.addEventListener("taler-payment-result", function (e) {
- if (!e.detail.success) {
- alert("Payment failed\n" + JSON.stringify(e.detail));
- return;
- }
- console.log("finished payment");
- let msg = React.createElement("div", null, "Payment successful. View your ", React.createElement("a", {"href": e.detail.fulfillmentUrl}, "product"), ".");
- replace(document.getElementById("loading"), msg);
-});
diff --git a/src/frontend/fulfillment.php b/src/frontend/fulfillment.php
index 06760121..11c019c3 100644
--- a/src/frontend/fulfillment.php
+++ b/src/frontend/fulfillment.php
@@ -3,6 +3,7 @@
<head>
<title>Taler's "Demo" Shop</title>
<link rel="stylesheet" type="text/css" href="style.css">
+ <script type="application/javascript" src="taler-presence.js">
<script type="application/javascript">
function executePayment(H_contract, pay_url) {
var detail = {
@@ -81,7 +82,7 @@ if (null === $my_payment)
if (true !== get($my_payment["is_payed"], false))
{
- $pay_url = url_rel("pay");
+ $pay_url = url_rel("pay", true);
echo "<p>you have not payed for this contract: " . $hc . "</p>";
echo "<p>Asking the wallet to re-execute it ... </p>";
echo "<script>executePayment('$hc', '$pay_url');</script?";