summaryrefslogtreecommitdiff
path: root/examples/blog/essay_pay.php
diff options
context:
space:
mode:
authorMarcello Stanisci <marcello.stanisci@inria.fr>2016-02-26 09:58:28 +0100
committerMarcello Stanisci <marcello.stanisci@inria.fr>2016-02-26 09:58:28 +0100
commit69ba9f8107a8bb36989d57c292178b0ab7bb5897 (patch)
treefb98141141d4726991a135e156b60fb12ab15259 /examples/blog/essay_pay.php
parent2dd8f39f524af9c7c64538c59fb423549654427d (diff)
downloadmerchant-69ba9f8107a8bb36989d57c292178b0ab7bb5897.tar.gz
merchant-69ba9f8107a8bb36989d57c292178b0ab7bb5897.tar.bz2
merchant-69ba9f8107a8bb36989d57c292178b0ab7bb5897.zip
contract/pay events triggered regardless of wallet being installed
Diffstat (limited to 'examples/blog/essay_pay.php')
-rw-r--r--examples/blog/essay_pay.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/examples/blog/essay_pay.php b/examples/blog/essay_pay.php
index 502be9c6..e5aecb1c 100644
--- a/examples/blog/essay_pay.php
+++ b/examples/blog/essay_pay.php
@@ -18,6 +18,9 @@
include("../../copylib/merchants.php");
include("../../copylib/util.php");
include("./blog_lib.php");
+
+ log_string("paying");
+
$article = get($_GET["article"]);
if (empty($article)){
http_response_code(400);
@@ -30,6 +33,17 @@
$deposit_permission = file_get_contents('php://input');
// FIXME check here if the deposit permission is associated
session_start();
+ if (!isset($_SESSION["payments"])) {
+ $json = json_encode(
+ array(
+ "error" => "no payments ongoing",
+ "status" => 500,
+ "detail" => "the shop has no state for any article"
+ )
+ );
+ echo $json;
+ die();
+ }
$payments = &pull($_SESSION, "payments", array());
$dec_dep_perm = json_decode($deposit_permission, true);
if ($dec_dep_perm['H_contract'] != $payments[$article]['hc']){