From bf8c5982a2e79f0b5198a0033dd41e9702d093f9 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 5 Apr 2020 22:05:38 +0200 Subject: make exchange API more uniform in how information is returned --- src/testing/testing_api_cmd_recoup.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src/testing/testing_api_cmd_recoup.c') diff --git a/src/testing/testing_api_cmd_recoup.c b/src/testing/testing_api_cmd_recoup.c index 3bbda8e75..7c4204d9e 100644 --- a/src/testing/testing_api_cmd_recoup.c +++ b/src/testing/testing_api_cmd_recoup.c @@ -123,19 +123,15 @@ parse_coin_reference (const char *coin_reference, * was paid back belonged to the right reserve. * * @param cls closure - * @param http_status HTTP response code. - * @param ec taler-specific error code. + * @param hr HTTP response details * @param reserve_pub public key of the reserve receiving the recoup, NULL if refreshed or on error * @param old_coin_pub public key of the dirty coin, NULL if not refreshed or on error - * @param full_response raw response from the exchange. */ static void recoup_cb (void *cls, - unsigned int http_status, - enum TALER_ErrorCode ec, + const struct TALER_EXCHANGE_HttpResponse *hr, const struct TALER_ReservePublicKeyP *reserve_pub, - const struct TALER_CoinSpendPublicKeyP *old_coin_pub, - const json_t *full_response) + const struct TALER_CoinSpendPublicKeyP *old_coin_pub) { struct RecoupState *ps = cls; struct TALER_TESTING_Interpreter *is = ps->is; @@ -145,15 +141,18 @@ recoup_cb (void *cls, unsigned int idx; ps->ph = NULL; - if (ps->expected_response_code != http_status) + if (ps->expected_response_code != hr->http_status) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Unexpected response code %u to command %s in %s:%u\n", - http_status, + "Unexpected response code %u/%d to command %s in %s:%u\n", + hr->http_status, + (int) hr->ec, cmd->label, __FILE__, __LINE__); - json_dumpf (full_response, stderr, 0); + json_dumpf (hr->reply, + stderr, + 0); fprintf (stderr, "\n"); TALER_TESTING_interpreter_fail (is); return; @@ -179,7 +178,7 @@ recoup_cb (void *cls, return; } - switch (http_status) + switch (hr->http_status) { case MHD_HTTP_OK: /* check old_coin_pub or reserve_pub, respectively */ @@ -256,8 +255,9 @@ recoup_cb (void *cls, break; default: GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - "Unmanaged HTTP status code %u.\n", - http_status); + "Unmanaged HTTP status code %u/%d.\n", + hr->http_status, + (int) hr->ec); break; } TALER_TESTING_interpreter_next (is); -- cgit v1.2.3