gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-merchant] 02/02: Calling the function (still a stub)


From: gnunet
Subject: [GNUnet-SVN] [taler-merchant] 02/02: Calling the function (still a stub) that works out wire transfers tracks before returning that to the frontend.
Date: Fri, 10 Mar 2017 18:07:43 +0100

This is an automated email from the git hooks/post-receive script.

marcello pushed a commit to branch master
in repository merchant.

commit d0ffaaf87216959b28f90f242ee60843eb3c4f10
Author: Marcello Stanisci <address@hidden>
AuthorDate: Fri Mar 10 18:07:00 2017 +0100

    Calling the function (still a stub) that works out wire transfers
    tracks before returning that to the frontend.
---
 src/backend/taler-merchant-httpd_track-transfer.c | 35 ++++++++++++++++++++---
 1 file changed, 31 insertions(+), 4 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_track-transfer.c 
b/src/backend/taler-merchant-httpd_track-transfer.c
index 3635c1d..b273e99 100644
--- a/src/backend/taler-merchant-httpd_track-transfer.c
+++ b/src/backend/taler-merchant-httpd_track-transfer.c
@@ -157,6 +157,21 @@ free_transfer_track_context (struct TrackTransferContext 
*rctx)
   GNUNET_free (rctx);
 }
 
+/**
+ * Transform /track/transfer result as gotten from the exchange
+ * and transforms it in a format liked by the backoffice Web interface.
+ *
+ * @param result response from exchange's /track/transfer
+ * @result pointer to new JSON, or NULL upon errors.
+ */
+json_t *
+transform_response (const json_t *result)
+{
+  json_t *response;
+
+  response = json_object ();
+  return response;
+}
 
 /**
  * Resume the given /track/transfer operation and send the given response.
@@ -287,6 +302,7 @@ wire_transfer_cb (void *cls,
   struct TrackTransferContext *rctx = cls;
   unsigned int i;
   int ret;
+  json_t *jresponse;
 
   rctx->wdh = NULL;
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@@ -403,10 +419,21 @@ wire_transfer_cb (void *cls,
     }
   }
   rctx->original_response = NULL;
-  resume_track_transfer_with_response
-    (rctx,
-     MHD_HTTP_OK,
-     TMH_RESPONSE_make_json (json));
+  /* FIXME, implement response transformator. Handle error as well. */
+  if (NULL == (jresponse = transform_response (json)))
+  {
+    resume_track_transfer_with_response
+      (rctx,
+       MHD_HTTP_INTERNAL_SERVER_ERROR,
+       TMH_RESPONSE_make_internal_error 
(TALER_EC_TRACK_TRANSFER_JSON_RESPONSE_ERROR,
+                                         "Fail to elaborate the response."));
+    return;
+  }
+
+  resume_track_transfer_with_response (rctx,
+                                       MHD_HTTP_OK,
+                                       TMH_RESPONSE_make_json (jresponse));
+  json_decref (jresponse);
 }
 
 

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]