commit 7d0b3fdd257773866e29978453f9ebc89c099c51
parent 28918aebfae40ae3bebf7eb05ddfb732caa785f5
Author: Marcello Stanisci <marcello.stanisci@inria.fr>
Date: Tue, 28 Mar 2017 16:51:00 +0200
fix /track scripts for php backoffice
Diffstat:
3 files changed, 7 insertions(+), 15 deletions(-)
diff --git a/php/backoffice.html b/php/backoffice.html
@@ -14,6 +14,7 @@
<form action='/track-transfer.php' method='GET'>
<input type='text' name='wtid' placeholder='Wire transfer ID'></input>
<input type='text' name='exchange' placeholder='Exchange URL'></input>
+ <input type='text' name='instance' value="tutorial" hidden></input>
<input type='submit' value='Track transfer'></input>
</form>
<form id="history_form" action="" method="GET">
diff --git a/php/doc/tutorial.texi b/php/doc/tutorial.texi
@@ -495,8 +495,8 @@ can be shown to the user.
@section Tracking a wire transfer
-To track a wire transfer, we first check if the user submitted all the
-required parameters, and then we forward the request to the backend.
+To track a wire transfer, the frontend just needs to forward the request
+it got from the Web form, to the backend.
Again, the backend may request missing information from the exchange,
verify signatures, persist the result and complain if there are
inconsistencies.
diff --git a/php/track-transfer.php b/php/track-transfer.php
@@ -5,17 +5,8 @@
include 'backend.php';
- if (!isset($_GET['wtid']) or !isset($_GET['exchange'])){
- build_error(array("body" => "Missing parameter"),
- "'wtid' or 'exchange' has not been submitted",
- 400);
- return;
- }
+ $response = get_to_backend("/track/transfer", $_GET);
- $wtid = $_GET['wtid'];
- $response = get_to_backend("/track/transfer",
- array("wtid" => $wtid,
- "exchange" => $_GET['exchange']));
if (!in_array($response["status_code"], array(200, 424))){
echo build_error($response,
"Backend error",
@@ -33,16 +24,16 @@
$body->coin_pub);
return;
}
- $json_response = json_decode($response["body"]);
+ $json_response = json_decode($response["body"]);
$pretty_date = get_pretty_date($json_response->execution_time);
$amount = get_amount($json_response->total);
echo "<p>$wtid: $amount transferred on $pretty_date.
The list of involved transactions is shown below:</p>";
echo "<ul>";
- foreach ($json_response->deposits as $entry){
- echo sprintf("<li>Transaction id: %s", $entry->transaction_id);
+ foreach ($json_response->deposits_sums as $entry){
+ echo sprintf("<li>Order id: %s", $entry->order_id);
}
echo "</ul>";
?>