diff options
author | Marcello Stanisci <marcello.stanisci@inria.fr> | 2016-02-26 09:58:28 +0100 |
---|---|---|
committer | Marcello Stanisci <marcello.stanisci@inria.fr> | 2016-02-26 09:58:28 +0100 |
commit | 69ba9f8107a8bb36989d57c292178b0ab7bb5897 (patch) | |
tree | fb98141141d4726991a135e156b60fb12ab15259 /examples/blog/essay_pay.php | |
parent | 2dd8f39f524af9c7c64538c59fb423549654427d (diff) | |
download | merchant-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.php | 14 |
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']){ |