merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

commit 0d945e7432a67c7c90378b9a9962a94212b52798
parent d50b423aec3db3a7f6ea1af38637ce0668f42fe8
Author: Florian Dold <dold@inria.fr>
Date:   Sun, 20 Dec 2015 13:29:23 +0100

Relative URLs.

Diffstat:
Msrc/frontend/pay.php | 17++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/frontend/pay.php b/src/frontend/pay.php @@ -23,7 +23,9 @@ NOTE: 'max_fee' must be consistent with the same value indicated within the contract; thus, a "real" merchant must implement such a mapping -*/ + */ + +session_start(); $cli_debug = false; $backend_test = true; @@ -39,15 +41,15 @@ if (isset($_GET['backend_test']) && $_GET['backend_test'] == 'no') $backend_test = false; } -if (!isset($_SESSION['receiver'])) + + +if (!isset($_SESSION['H_contract'])) { echo "No session active."; http_response_code (301); return; } -session_start(); - $post_body = file_get_contents('php://input'); $now = new DateTime('now'); @@ -80,8 +82,13 @@ if ($cli_debug && !$backend_test) exit; } + +// Backend is relative to the shop site. +$url = (new http\URL("http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]")) + ->mod(array ("path" => "backend/pay"), http\Url::JOIN_PATH); + $req = new http\Client\Request("POST", - "http://" . $_SERVER["SERVER_NAME"] . "/backend/pay", + $url, array ("Content-Type" => "application/json")); $req->getBody()->append (json_encode ($new_deposit_permission));