aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcello Stanisci <marcello.stanisci@inria.fr>2016-04-22 20:52:40 +0200
committerMarcello Stanisci <marcello.stanisci@inria.fr>2016-04-22 20:52:40 +0200
commit04dcab347402c1aca1029e80bd05556e2f1641fb (patch)
tree9d31025fa275a47c66b5eda35dd89c8bdd8adc48
parentd0b8cc5ad517c445f591c7f1cb7ca43212fa169e (diff)
wallet-less testing #4452
-rw-r--r--copylib/util.php2
m---------examples/blog/web-common0
-rw-r--r--examples/shop/fulfillment.php2
-rw-r--r--examples/shop/generate_taler_contract.php2
-rw-r--r--examples/shop/index.php1
-rw-r--r--examples/shop/nginx_example.conf40
-rw-r--r--examples/shop/pay.php16
m---------examples/shop/web-common0
8 files changed, 12 insertions, 51 deletions
diff --git a/copylib/util.php b/copylib/util.php
index 83caa2c5..2cfbe851 100644
--- a/copylib/util.php
+++ b/copylib/util.php
@@ -42,7 +42,7 @@ function article_state_to_str($article_state){
}
function log_string($str){
- file_put_contents("/tmp/blog.dbg", $str . "\n", FILE_APPEND);
+ file_put_contents("/tmp/frontend.dbg", $str . "\n", FILE_APPEND);
}
function get_full_uri(){
diff --git a/examples/blog/web-common b/examples/blog/web-common
-Subproject 026ef2476676ef00b6c2a0cec135a8e64024ee5
+Subproject eb164f4a0ba56bb1232052b5cde19014fca70ed
diff --git a/examples/shop/fulfillment.php b/examples/shop/fulfillment.php
index c2481029..60de9a3b 100644
--- a/examples/shop/fulfillment.php
+++ b/examples/shop/fulfillment.php
@@ -98,7 +98,7 @@ if (array() === $my_payment || true !== get($my_payment["is_payed"], false)) {
}
$hc = json_decode($resp->body->toString(), true)['H_contract'];
- $my_payment['ispayed'] = false;
+ $my_payment['is_payed'] = false;
$my_payment['hc'] = $hc;
echo "<p>you have not payed for this contract: " . $hc . "</p>";
echo "<p>Asking the wallet to re-execute it ... </p>";
diff --git a/examples/shop/generate_taler_contract.php b/examples/shop/generate_taler_contract.php
index 439ea248..183ca242 100644
--- a/examples/shop/generate_taler_contract.php
+++ b/examples/shop/generate_taler_contract.php
@@ -69,6 +69,8 @@ $contract = generate_contract(array(
"fulfillment_url" => $fulfillment_url)
);
+file_put_contents("/tmp/ff.link", $fulfillment_url . "\r\n");
+
$resp = give_to_backend("backend/contract", $contract);
// Our response code is the same we got from the backend:
diff --git a/examples/shop/index.php b/examples/shop/index.php
index 9df9877b..c78f9c66 100644
--- a/examples/shop/index.php
+++ b/examples/shop/index.php
@@ -16,6 +16,7 @@
-->
<?php
require_once "../../copylib/config.php";
+session_destroy();
?>
<html lang="en">
<head>
diff --git a/examples/shop/nginx_example.conf b/examples/shop/nginx_example.conf
deleted file mode 100644
index 2b417eb4..00000000
--- a/examples/shop/nginx_example.conf
+++ /dev/null
@@ -1,40 +0,0 @@
-server {
- listen 80; ## listen for ipv4; this line is default and implied
- # listen [::]:80 default_server ipv6only=on; ## listen for ipv6
- server_name example.com;
-
- # WARNING the 'shop' directory can't be freely moved in your filesystem
- # because it includes some PHP files via relative path (../../copylib)
- root /path/to/merchant/examples/shop;
- index index.php;
-
- # Make site accessible from http://localhost/
-
- location / {
- try_files $uri $uri/ =404;
- rewrite /taler/pay /pay.php;
- rewrite /taler/contract /generate_taler_contract.php;
-
- }
-
- location /fullfillment {
- rewrite /(.*) /$1.php;
-
- }
-
- location ~ \.php$ {
-
- fastcgi_pass unix:/var/run/php5-fpm.sock;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- include fastcgi_params;
-
- }
-
- location /backend {
- rewrite /backend/(.*) /$1 break;
- proxy_pass http://127.0.0.1:19966;
- proxy_redirect off;
- proxy_set_header Host $host;
- }
-
-}
diff --git a/examples/shop/pay.php b/examples/shop/pay.php
index fbab6f3f..4973db59 100644
--- a/examples/shop/pay.php
+++ b/examples/shop/pay.php
@@ -30,10 +30,10 @@ if (empty($receiver))
return;
}
+session_start();
$payments = &pull($_SESSION, "payments", array());
-$my_payment = get($payments[$receiver]);
-if (null === $my_payment)
+if (!isset($payments[$receiver]))
{
http_response_code(400);
echo json_encode(array(
@@ -42,12 +42,15 @@ if (null === $my_payment)
return;
}
+echo 'recognized session';
+echo 'with hash ' . $payments[$receiver]['hc'];
+die();
$post_body = file_get_contents('php://input');
$deposit_permission = json_decode ($post_body, true);
// Check if the receiver is actually *mentioned* in the contract
-if ($my_payment['hc'] != $deposit_permission['H_contract']) {
+if ($payments[$receiver]['hc'] != $deposit_permission['H_contract']) {
$json = json_encode(
array(
@@ -96,12 +99,7 @@ if ($status_code != 200)
die();
}
-session_start();
-
$payments = &pull($_SESSION, "payments", array());
-$payments[$hc] = array(
- 'receiver' => $receiver,
- 'is_payed' => true
-);
+$payments[$receiver]['is_payed'] = true;
?>
diff --git a/examples/shop/web-common b/examples/shop/web-common
-Subproject 026ef2476676ef00b6c2a0cec135a8e64024ee5
+Subproject eb164f4a0ba56bb1232052b5cde19014fca70ed