summaryrefslogtreecommitdiff
path: root/php
diff options
context:
space:
mode:
authorMarcello Stanisci <marcello.stanisci@inria.fr>2016-12-05 16:17:43 +0100
committerMarcello Stanisci <marcello.stanisci@inria.fr>2016-12-05 16:17:43 +0100
commit3b93f180cbee7ed5010735eaa7b60a953bac5edf (patch)
treebe370aa735484c2f89186d879bf930fc663819b5 /php
parentb534ea2375604fae8688b230e6207b05d88da622 (diff)
downloadmerchant-frontend-examples-3b93f180cbee7ed5010735eaa7b60a953bac5edf.tar.gz
merchant-frontend-examples-3b93f180cbee7ed5010735eaa7b60a953bac5edf.tar.bz2
merchant-frontend-examples-3b93f180cbee7ed5010735eaa7b60a953bac5edf.zip
Final fixes for track-* conflict pages
Diffstat (limited to 'php')
-rw-r--r--php/track-transaction.php13
-rw-r--r--php/track-transfer.php12
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"]);