summaryrefslogtreecommitdiff
path: root/src/frontend_blog/essay_offer.php
diff options
context:
space:
mode:
authorMarcello Stanisci <marcello.stanisci@inria.fr>2016-02-12 20:14:43 +0100
committerMarcello Stanisci <marcello.stanisci@inria.fr>2016-02-12 20:14:43 +0100
commit30554a39dab12478a2832e3d1990904d773c7445 (patch)
tree9e3b8e7ca3148f219116b2737210131c1366fe23 /src/frontend_blog/essay_offer.php
parent3cd7996494b9bdc764d7009f47c3382978f7f896 (diff)
downloadmerchant-30554a39dab12478a2832e3d1990904d773c7445.tar.gz
merchant-30554a39dab12478a2832e3d1990904d773c7445.tar.bz2
merchant-30554a39dab12478a2832e3d1990904d773c7445.zip
fixing the blog up to the point of forwarding the payment to
the backend
Diffstat (limited to 'src/frontend_blog/essay_offer.php')
-rw-r--r--src/frontend_blog/essay_offer.php53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/frontend_blog/essay_offer.php b/src/frontend_blog/essay_offer.php
new file mode 100644
index 00000000..7377a4b3
--- /dev/null
+++ b/src/frontend_blog/essay_offer.php
@@ -0,0 +1,53 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script type="text/javascript">
+
+ function handle_contract(json_contract) {
+ var cEvent = new CustomEvent('taler-contract',
+ {detail: json_contract});
+ document.dispatchEvent(cEvent);
+ };
+ function get_contract(article) {
+ var contract_request = new XMLHttpRequest();
+
+ contract_request.open("GET",
+ "essay_contract.php?article=" + article,
+ true);
+ contract_request.onload = function (e) {
+ if (contract_request.readyState == 4) {
+ if (contract_request.status == 200) {
+ console.log("response text:",
+ contract_request.responseText);
+ handle_contract(contract_request.responseText);
+ } else {
+ alert("Failure to download contract from merchant " +
+ "(" + contract_request.status + "):\n" +
+ contract_request.responseText);
+ }
+ }
+ };
+ contract_request.onerror = function (e) {
+ alert("Failure requesting the contract:\n"
+ + contract_request.statusText);
+ };
+ contract_request.send();
+}
+</script>
+</head>
+<body>
+<?php
+
+ include("../frontend_lib/merchants.php");
+ include("../frontend_lib/util.php");
+ include("./blog_lib.php");
+ session_start();
+ $article = get($_GET['article']);
+ if (null == $article){
+ echo "Please land here just to buy articles";
+ die();
+ }
+ echo "<script>get_contract('$article');</script>"
+?>
+</body>
+</html>