summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcello Stanisci <marcello.stanisci@inria.fr>2015-08-10 11:06:12 +0200
committerMarcello Stanisci <marcello.stanisci@inria.fr>2015-08-10 11:06:12 +0200
commit32ddce4e3f346f5c7dad9a51180e11489124d93e (patch)
treea328df163d66ad632ddff7acac6ce6c596bd37a1
parent426fe6eebca9a1e03ccd124fc1131f5529ae4048 (diff)
parent69efb4bae614e62b8f2a465c525be35a3f1a71c5 (diff)
downloadmerchant-32ddce4e3f346f5c7dad9a51180e11489124d93e.tar.gz
merchant-32ddce4e3f346f5c7dad9a51180e11489124d93e.tar.bz2
merchant-32ddce4e3f346f5c7dad9a51180e11489124d93e.zip
configure minor fix
Merge branch 'master' of ssh://taler.net/var/git/merchant
-rw-r--r--src/frontend/Gala.jpgbin0 -> 33855 bytes
-rw-r--r--src/frontend/README21
-rw-r--r--src/frontend/cert.php41
-rw-r--r--src/frontend/checkout.php11
-rw-r--r--src/frontend/style.css3
-rw-r--r--src/frontend/toys2.jpgbin41373 -> 0 bytes
6 files changed, 38 insertions, 38 deletions
diff --git a/src/frontend/Gala.jpg b/src/frontend/Gala.jpg
new file mode 100644
index 00000000..795e726f
--- /dev/null
+++ b/src/frontend/Gala.jpg
Binary files differ
diff --git a/src/frontend/README b/src/frontend/README
index a89b9d36..fe8f44ab 100644
--- a/src/frontend/README
+++ b/src/frontend/README
@@ -1,24 +1,23 @@
This directory contains the files implementing the frontend of the new merchant architecture.
-Only tested on nginx. To run the website, it suffices to have all the files in the same
-directory, then having PHP enabled, and setting the following two redirections:
-
-1. your_site/certal/ => your_site/cert.php
-2. your_site/payler/ => your_site/pay.php
+Only tested on nginx. To run the website, it suffices to have all the .php and .html files
+in the same directory, and having PHP (with the extension 'pecl_http' enabled) enabled.
File |What implements
--------------------------------
-o index.html | The "negotiation" view, that is the form
- that allows the user to choose the product to buy.
+o index.html | The homepage. Here it is possible to decide how much donate
+ to whom you would like.
o checkout.php | The "payment selection" that is the form
that allows the user to choose the payment method he wishes to use.
- It also implements the request of certificate and its showing as a
- popup window (by JavaScript in it). For debugging purposes, it has a
- certificate hardcoded in it.
+ It also implements the request of certificate and trigger the certificate
+ viewer in the extension when it arrives in the customer's machine.
+
-o cert.php | Replies with a JSON certificate that is held in a 'session' variable.
+o cert.php | Replies with a JSON certificate gotten from the backend.
o pay.php | Actual receiving of money, plus it gives back a "fullfillment" page
that informs the user of his well ended deal.
+o toy | the nginx configuration file skeleton for this virtual server. To be tuned
+ as needed.
diff --git a/src/frontend/cert.php b/src/frontend/cert.php
index a330d76e..9f0af350 100644
--- a/src/frontend/cert.php
+++ b/src/frontend/cert.php
@@ -60,27 +60,30 @@ else{
'currency' => $currency)));
// test
// echo $json;
- // send to backend
- /* // _very_ problematic
- $http_obj = new HttpRequest;
- $http_obj.setMethod (METH_GET);
- //$http_obj.setBody ($json);
- $http_obj.send ();
- $http_obj.setUrl ("http://" . $SERVER["SERVER_NAME"] . "/backend" . "/hello");
- $status = $http_obj.getResponseHeader ('status');
- */
- $client = new http\Client;
- $certificate = http_post_data ("http://" . $SERVER["SERVER_NAME"] . "/backend" . "/hello",
- null, $response);
- $status_code = $response['response_code'];
-
- set_response_code ($status_code);
+
+ //echo phpinfo ();
+
+ // crafting the request
+ $req = new http\Client\Request ("POST",
+ "http://" . $SERVER["SERVER_NAME"] . "/backend" . "/contract",
+ //"http://localhost:9898/",
+ array ("Content-Type" => "application/json"));
+ $req->getBody()->append ($json);
- if ($status != 200)
- echo "Some error occurred during this operation";
+ $client = new http\Client;
+ $client->enqueue($req)->send ();
+ $resp = $client->getResponse ();
+ $status_code = $resp->getResponseCode ();
+ http_response_code ($status_code);
+
+
+ if ($status_code != 200){
+ echo "Error while generating the certificate, response code : " . $status_code;
+ }
// send the contract back to the wallet without touching it
- else echo $http_obj.getResponseBody ();
-
+ else{
+ echo $resp->body->toString ();
+ }
}
diff --git a/src/frontend/checkout.php b/src/frontend/checkout.php
index fc11b35a..b7b028fb 100644
--- a/src/frontend/checkout.php
+++ b/src/frontend/checkout.php
@@ -41,8 +41,6 @@
<?php
-// ID generation
-$transId = rand(1, 15);
// getting the donation receiver's name
$got_donation = $_POST['group0'];
// create session
@@ -54,13 +52,14 @@ $_SESSION['maydonate'] = true;
?>
-<form name="tform" action="" method="POST">
+<form name="tform" action="cert.php" method="POST">
<div id="opt-form" align="left"><br>
<input type="radio" name="group1" value="Lisa">Lisa<br>
<input type="radio" name="group1" value="You Card" checked>You Card<br>
<input type="radio" name="group1" value="Card Me">Card Me<br>
<input id="t-button-id" type="radio" name="group1" value="Taler" disabled="true">Taler<br>
-<input type="button" onclick="ok(this.form)" value="Ok"-->
+<input type="submit" value="Ok"-->
+<!--input type="button" onclick="ok(this.form)" value="Ok"-->
</div>
</form>
@@ -81,9 +80,7 @@ function ok(form){
to the (XUL) extension) */
sendContract(cert.responseText);
}
- else alert("Certificate ready state: "
- + cert.readyState + ", cert status: "
- + cert.status);
+ else alert("No certificate gotten, status " + cert.status);
}
};
diff --git a/src/frontend/style.css b/src/frontend/style.css
index a06d4c27..6d7c5efc 100644
--- a/src/frontend/style.css
+++ b/src/frontend/style.css
@@ -37,7 +37,8 @@ header {
header h1 {
height: 190px;
margin: 0px;
- background-image: url(toysX.jpg);
+ background-color: black;
+ background-image: url(Gala.jpg);
background-repeat: no-repeat;
}
header h1, header h2 {
diff --git a/src/frontend/toys2.jpg b/src/frontend/toys2.jpg
deleted file mode 100644
index 9b3d2d29..00000000
--- a/src/frontend/toys2.jpg
+++ /dev/null
Binary files differ