diff options
Diffstat (limited to 'php')
-rw-r--r-- | php/track-transaction.php | 13 | ||||
-rw-r--r-- | php/track-transfer.php | 12 |
2 files changed, 19 insertions, 6 deletions
diff --git a/php/track-transaction.php b/php/track-transaction.php index 8fd1058..e51d1a1 100644 --- a/php/track-transaction.php +++ b/php/track-transaction.php @@ -14,13 +14,24 @@ $response = get_to_backend("/track/transaction", array("id" => intval($_GET['tid']))); - if (!in_array($response["status_code"], array(200, 202))){ + if (!in_array($response["status_code"], array(200, 202, 424))){ echo build_error($response, "Backend error", $response["status_code"]); return; } + // Report conflict + if (424 == $response["status_code"]){ + $body = json_decode($response["body"]); + echo sprintf("<p>Coin '%s', related to transaction '%s', + is conflicting: what claimed by the exchange does + not match what stored in our DB.</p>", + $body->coin_pub, + $_GET['tid']); + return; + } + // Render HTML http_response_code($response["status_code"]); $decoded = json_decode($response["body"]); diff --git a/php/track-transfer.php b/php/track-transfer.php index 0b913b0..05a7f6e 100644 --- a/php/track-transfer.php +++ b/php/track-transfer.php @@ -16,7 +16,7 @@ $response = get_to_backend("/track/transfer", array("wtid" => $wtid, "exchange" => $_GET['exchange'])); - if (!in_array($response["status_code"], array(200, 402))){ + if (!in_array($response["status_code"], array(200, 424))){ echo build_error($response, "Backend error", $response["status_code"]); @@ -25,10 +25,12 @@ // 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>"; + if (424 == $response["status_code"]){ + $body = json_decode($response["body"]); + echo sprintf("<p>The backend detected that the amount wire + transferred by the exchange for coin '%s', differs + from the coin's original amount.</p>", + $body->coin_pub); return; } $json_response = json_decode($response["body"]); |