merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

commit 3cd7996494b9bdc764d7009f47c3382978f7f896
parent 785e5813359cc9ddd1709070a448ed26fd11b51c
Author: Marcello Stanisci <marcello.stanisci@inria.fr>
Date:   Tue,  9 Feb 2016 13:32:07 +0100

blog: cleaning

Diffstat:
Msrc/frontend_blog/cc_payment.php | 2+-
Msrc/frontend_blog/essay_contract.php | 2--
Dsrc/frontend_blog/execute.js | 33---------------------------------
Dsrc/frontend_blog/execute.php | 56--------------------------------------------------------
Dsrc/frontend_blog/execute.tsx | 41-----------------------------------------
Dsrc/frontend_blog/teaser.php | 49-------------------------------------------------
6 files changed, 1 insertion(+), 182 deletions(-)

diff --git a/src/frontend_blog/cc_payment.php b/src/frontend_blog/cc_payment.php @@ -44,7 +44,7 @@ <input type="radio" name="gender">Female</input><br> </form> <?php - echo "<form method=\"post\" action=\"essay_cc_pay.php?article=$article\"><input type=\"submit\"></input></form>"; + echo "<form method=\"post\" action=\"essay_cc_pay-fulfillment.php?article=$article\"><input type=\"submit\"></input></form>"; ?> </article> </section> diff --git a/src/frontend_blog/essay_contract.php b/src/frontend_blog/essay_contract.php @@ -32,8 +32,6 @@ if (!isset($_GET['article'])){ die(); } $article = $_GET['article']; -$_SESSION['article'] = $article; -// 2 to-do // send contract $transaction_id = rand(0, 1001); diff --git a/src/frontend_blog/execute.js b/src/frontend_blog/execute.js @@ -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_blog/execute.php b/src/frontend_blog/execute.php @@ -1,56 +0,0 @@ -<!DOCTYPE html> -<html lang="en"> -<head> - <title>Toy Store - Taler Demo</title> - <link rel="stylesheet" type="text/css" href="style.css"> - <script> /* @licstart The following is the entire license notice for the - JavaScript code in this page. - - Copyright (C) 2015 GNUnet e.V. - - The JavaScript code in this page is free software: you can - redistribute it and/or modify it under the terms of the GNU - Lesser General Public License (GNU LGPL) as published by the Free Software - Foundation, either version 2.1 of the License, or (at your option) - any later version. The code is distributed WITHOUT ANY WARRANTY; - without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. See the GNU LGPL for more details. - - As additional permission under GNU LGPL version 2.1 section 7, you - may distribute non-source (e.g., minimized or compacted) forms of - that code without the copy of the GNU LGPL normally required by - section 4, provided you include this license notice and a URL - through which recipients can access the Corresponding Source. - - @licend The above is the entire license notice - for the JavaScript code in this page. - */ - </script> - <script type="text/javascript"> -<?php -session_start(); -echo "var h_contract=\"$_SESSION[H_contract]\";\n"; -?> - </script> - <script type="text/javascript" src="execute.js"></script> -</head> - -<body> - <header> - <div id="logo"> - <svg height="100" width="100"> - <circle cx="50" cy="50" r="40" stroke="darkcyan" stroke-width="6" fill="white" /> - <text x="19" y="82" font-family="Verdana" font-size="90" fill="darkcyan">S</text> - </svg> - </div> - <h1>Toy Store - Taler Demo</h1> - </header> - - <aside class="sidebar" id="left"> - </aside> - - <section id="main"> - <h1>Executing Payment ...</h1> - <div id="loading">Loading...</div> -</body> -</html> diff --git a/src/frontend_blog/execute.tsx b/src/frontend_blog/execute.tsx @@ -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 = - <div>Payment successful. View your <a href={e.detail.fulfillmentUrl}>product</a>.</div>; - replace(document.getElementById("loading"), msg); -}); diff --git a/src/frontend_blog/teaser.php b/src/frontend_blog/teaser.php @@ -1,49 +0,0 @@ -<html> -<?php -/* - This file is part of GNU TALER. - Copyright (C) 2014, 2015 GNUnet e.V. - - TALER is free software; you can redistribute it and/or modify it under the - terms of the GNU Lesser General Public License as published by the Free Software - Foundation; either version 2.1, or (at your option) any later version. - - TALER is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License along with - TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/> -*/ - -/** - * This file should: - * - * 1. fetch the article teaser and attach a 'read more' link to it - * - */ -$article = (isset($_GET['article']) ? $_GET['article'] : "No article"); -$content = file_get_contents("articles/$article.html"); -$doc = new DOMDocument(); -$doc->loadHTML($content); -$teaser = $doc->getElementById("teaser"); -?> -<head> - <title> - <?php echo $article ?> - </title> -</head> -<body onload="signal_taler_wallet_onload();"> -<?php if ($article == "No article") - echo "Please select some article"; - else { - session_start(); - $_SESSION['article'] = $article; - echo $teaser->nodeValue; - } -?> - <br><a href="cc_payment.html" id="read-more">read more</a> - -</body> - -</html>