blob: 0b913b065a53f33f7427a9ca14332f20c52775aa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
<?php
// This file is in the public domain.
include 'error.php';
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;
}
$wtid = $_GET['wtid'];
$response = get_to_backend("/track/transfer",
array("wtid" => $wtid,
"exchange" => $_GET['exchange']));
if (!in_array($response["status_code"], array(200, 402))){
echo build_error($response,
"Backend error",
$response["status_code"]);
return;
}
// Render HTML
http_response_code($response["status_code"]);
if (402 == $response["status_code"]){
echo "<p>The backend detected that exchange provided
conflicting information about WTID $wtid.
Refer to exchange's operator.</p>";
return;
}
$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 Taler transactions involved in $wtid is shown below:</p>";
echo "<ul>";
foreach ($json_response->deposits as $entry){
echo sprintf("<li>Transaction id: %s", $entry->transaction_id);
}
echo "</ul>";
?>
|