commit d50b423aec3db3a7f6ea1af38637ce0668f42fe8
parent afb5ccc6eb21fe92c788e38ff738195dc4c4ef91
Author: Florian Dold <dold@inria.fr>
Date: Sun, 20 Dec 2015 13:28:34 +0100
Lift URLs outside signed contract.
Diffstat:
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/frontend/generate_taler_contract.php b/src/frontend/generate_taler_contract.php
@@ -102,7 +102,7 @@ $now = new DateTime('now');
// pack the JSON for the contract
// --- FIXME: exact format needs review!
-$json = json_encode (array ('amount' => array ('value' => $amount_value,
+$contract = array ('amount' => array ('value' => $amount_value,
'fraction' => $amount_fraction,
'currency' => $currency),
'max_fee' => array ('value' => 3,
@@ -120,7 +120,6 @@ $json = json_encode (array ('amount' => array ('value' => $amount_value,
'delivery_date' => "Some Date Format",
'delivery_location' => 'LNAME1')),
'timestamp' => "/Date(" . $now->getTimestamp() . ")/",
- 'pay_url' => "/taler/pay",
'expiry' => "/Date(" . $now->add(new DateInterval('P2W'))->getTimestamp() . ")/",
'refund_deadline' => "/Date(" . $now->add(new DateInterval('P3M'))->getTimestamp() . ")/",
'merchant' => array ('address' => 'LNAME2',
@@ -148,7 +147,9 @@ $json = json_encode (array ('amount' => array ('value' => $amount_value,
'state' => 'Test State',
'region' => 'Test Region',
'province' => 'Test Province',
- 'ZIP code' => 4908))), JSON_PRETTY_PRINT);
+ 'ZIP code' => 4908)));
+
+$json = json_encode (array ("contract" => $contract, "pay_url" => "pay.php", "exec_url" => "execute.php"));
if ($cli_debug && !$backend_test)
{
echo $json . "\n";
@@ -180,10 +181,14 @@ http_response_code ($status_code);
// Now generate our body
if ($status_code != 200)
{
- echo "Error while generating the contract";
+ echo "Error while generating the contract:";
+ echo "$resp";
}
else
{
+
+ $json = json_decode($resp->body->toString (), true);
+ $_SESSION["H_contract"] = $json["H_contract"];
// send the contract back to the wallet without touching it
echo $resp->body->toString ();
}