switch to wid to comply with spec

This commit is contained in:
Christian Grothoff 2016-03-23 11:34:24 +01:00
parent 7f7ac5d92c
commit ac950fbe61
4 changed files with 20 additions and 5 deletions

View File

@ -43,4 +43,5 @@ test_bank_api_SOURCES = \
test_bank_api_LDADD = \ test_bank_api_LDADD = \
libtalerbank.la \ libtalerbank.la \
$(top_builddir)/src/util/libtalerutil.la \ $(top_builddir)/src/util/libtalerutil.la \
-lgnunetutil -lgnunetutil \
-ljansson

View File

@ -135,7 +135,8 @@ handle_admin_add_incoming_finished (void *cls,
break; break;
} }
aai->cb (aai->cb_cls, aai->cb (aai->cb_cls,
response_code); response_code,
json);
json_decref (json); json_decref (json);
TALER_BANK_admin_add_incoming_cancel (aai); TALER_BANK_admin_add_incoming_cancel (aai);
} }
@ -174,7 +175,7 @@ TALER_BANK_admin_add_incoming (struct TALER_BANK_Context *bank,
admin_obj = json_pack ("{s:o, s:o," admin_obj = json_pack ("{s:o, s:o,"
" s:I, s:I}", " s:I, s:I}",
"wtid", GNUNET_JSON_from_data (wtid, "wid", GNUNET_JSON_from_data (wtid,
sizeof (*wtid)), sizeof (*wtid)),
"amount", TALER_JSON_from_amount (amount), "amount", TALER_JSON_from_amount (amount),
"debit_account", (json_int_t) debit_account_no, "debit_account", (json_int_t) debit_account_no,

View File

@ -246,10 +246,12 @@ interpreter_run (void *cls,
* @param cls closure with the interpreter state * @param cls closure with the interpreter state
* @param http_status HTTP response code, #MHD_HTTP_OK (200) for successful status request * @param http_status HTTP response code, #MHD_HTTP_OK (200) for successful status request
* 0 if the bank's reply is bogus (fails to follow the protocol) * 0 if the bank's reply is bogus (fails to follow the protocol)
* @param json detailed response from the HTTPD, or NULL if reply was not in JSON
*/ */
static void static void
add_incoming_cb (void *cls, add_incoming_cb (void *cls,
unsigned int http_status) unsigned int http_status,
json_t *json)
{ {
struct InterpreterState *is = cls; struct InterpreterState *is = cls;
struct Command *cmd = &is->commands[is->ip]; struct Command *cmd = &is->commands[is->ip];
@ -258,6 +260,14 @@ add_incoming_cb (void *cls,
if (cmd->expected_response_code != http_status) if (cmd->expected_response_code != http_status)
{ {
GNUNET_break (0); GNUNET_break (0);
if (NULL != json)
{
fprintf (stderr,
"Unexpected response code %u:\n",
http_status);
json_dumpf (json, stderr, 0);
fprintf (stderr, "\n");
}
fail (is); fail (is);
return; return;
} }

View File

@ -22,6 +22,7 @@
#ifndef _TALER_BANK_SERVICE_H #ifndef _TALER_BANK_SERVICE_H
#define _TALER_BANK_SERVICE_H #define _TALER_BANK_SERVICE_H
#include <jansson.h>
#include "taler_util.h" #include "taler_util.h"
/* ********************* event loop *********************** */ /* ********************* event loop *********************** */
@ -117,10 +118,12 @@ struct TALER_BANK_AdminAddIncomingHandle;
* @param cls closure * @param cls closure
* @param http_status HTTP response code, #MHD_HTTP_OK (200) for successful status request * @param http_status HTTP response code, #MHD_HTTP_OK (200) for successful status request
* 0 if the bank's reply is bogus (fails to follow the protocol) * 0 if the bank's reply is bogus (fails to follow the protocol)
* @param json detailed response from the HTTPD, or NULL if reply was not in JSON
*/ */
typedef void typedef void
(*TALER_BANK_AdminAddIncomingResultCallback) (void *cls, (*TALER_BANK_AdminAddIncomingResultCallback) (void *cls,
unsigned int http_status); unsigned int http_status,
json_t *json);
/** /**