blob: 8fd1058e1df56b553bb25571b7b743a88559ba31 (
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
|
<?php
// This file is in the public domain.
include 'error.php';
include 'backend.php';
if (!isset($_GET['tid'])){
build_error(array("body" => "No transaction ID given"),
"tid argument missing",
400);
return;
}
$response = get_to_backend("/track/transaction",
array("id" => intval($_GET['tid'])));
if (!in_array($response["status_code"], array(200, 202))){
echo build_error($response,
"Backend error",
$response["status_code"]);
return;
}
// Render HTML
http_response_code($response["status_code"]);
$decoded = json_decode($response["body"]);
if (202 == $response["status_code"]){
$pretty_date = get_pretty_date($decoded->details->execution_time);
echo "<p>The exchange accepted the transaction.
The estimated time for when the related wire transfer
is to be performed is: $pretty_date</p>";
return;
}
echo "<ul>";
foreach ($decoded as $entry){
$pretty_date = get_pretty_date($entry->execution_time);
echo sprintf("<li>Wire transfer ID: %s, date: %s</li>",
$entry->wtid,
$pretty_date);
}
echo "</ul>";
?>
|