merchant-frontend-examples

ZZZ: Inactive/Deprecated
Log | Files | Refs

commit 3b93f180cbee7ed5010735eaa7b60a953bac5edf
parent b534ea2375604fae8688b230e6207b05d88da622
Author: Marcello Stanisci <marcello.stanisci@inria.fr>
Date:   Mon,  5 Dec 2016 16:17:43 +0100

Final fixes for track-* conflict pages

Diffstat:
Mphp/track-transaction.php | 13++++++++++++-
Mphp/track-transfer.php | 12+++++++-----
2 files changed, 19 insertions(+), 6 deletions(-)

diff --git 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 @@ -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"]);