From 3a4e0743d9891683fbf035f18742d8b65d07e232 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 25 Jan 2016 15:59:16 +0100 Subject: execute contract from fulfillment page --- src/frontend/execute.php | 56 -------------------------------------------- src/frontend/execute.tsx | 41 -------------------------------- src/frontend/fulfillment.php | 16 ++++++++++++- 3 files changed, 15 insertions(+), 98 deletions(-) delete mode 100644 src/frontend/execute.php delete mode 100644 src/frontend/execute.tsx diff --git a/src/frontend/execute.php b/src/frontend/execute.php deleted file mode 100644 index 33021fd3..00000000 --- a/src/frontend/execute.php +++ /dev/null @@ -1,56 +0,0 @@ - - - - Toy Store - Taler Demo - - - - - - - -
- -

Toy Store - Taler Demo

-
- - - -
-

Executing Payment ...

-
Loading...
- - diff --git a/src/frontend/execute.tsx b/src/frontend/execute.tsx deleted file mode 100644 index 67cf8e06..00000000 --- a/src/frontend/execute.tsx +++ /dev/null @@ -1,41 +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; - } -}; - -declare var h_contract: string; - -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: CustomEvent) { - if (!e.detail.success) { - alert("Payment failed\n" + JSON.stringify(e.detail)); - return; - } - console.log("finished payment"); - let msg = -
Payment successful. View your product.
; - replace(document.getElementById("loading"), msg); -}); diff --git a/src/frontend/fulfillment.php b/src/frontend/fulfillment.php index 43517709..595ccc60 100644 --- a/src/frontend/fulfillment.php +++ b/src/frontend/fulfillment.php @@ -3,6 +3,16 @@ Taler's "Demo" Shop + @@ -41,7 +51,8 @@ include '../frontend_lib/util.php'; -function generate_msg ($link){ +function generate_msg ($link) +{ $msg = "

Thanks for donating to " . $_SESSION['receiver'] . ".

"; if (false != $link) $msg .= "

Check our latest news!

"; @@ -64,7 +75,10 @@ $my_payment = get($payments[$hc]); if (null === $my_payment) { + $pay_url = url_rel("pay"); echo "

you do not have the session state for this contract: " . $hc . "

"; + echo "

Asking the wallet to re-execute it ...

"; + echo "