exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

commit bba46ca85a0b9871d8c635b63acdc3051d3f37f9
parent d5e581b5e61a706c83778fa493bf4c9e80f228b0
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sun, 21 Jun 2015 18:47:42 +0200

compile mint_api_deposit.c

Diffstat:
Msrc/mint-lib/Makefile.am | 3++-
Msrc/mint-lib/mint_api_deposit.c | 25+++++++++++++++++++------
2 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/src/mint-lib/Makefile.am b/src/mint-lib/Makefile.am @@ -16,7 +16,8 @@ libtalermint_la_LDFLAGS = \ libtalermint_la_SOURCES = \ mint_api_context.c mint_api_context.h \ mint_api_json.c mint_api_json.h \ - mint_api_handle.c mint_api_handle.h + mint_api_handle.c mint_api_handle.h \ + mint_api_deposit.c libtalermint_la_LIBADD = \ -lgnunetutil \ diff --git a/src/mint-lib/mint_api_deposit.c b/src/mint-lib/mint_api_deposit.c @@ -25,10 +25,21 @@ #include <jansson.h> #include <gnunet/gnunet_util_lib.h> #include "taler_mint_service.h" +#include "mint_api_context.h" +#include "mint_api_handle.h" #include "taler_signatures.h" /** + * Print JSON parsing related error information + */ +#define JSON_WARN(error) \ + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, \ + "JSON parsing failed at %s:%u: %s (%s)", \ + __FILE__, __LINE__, error.text, error.source) + + +/** * @brief A Deposit Handle */ struct TALER_MINT_DepositHandle @@ -241,7 +252,9 @@ TALER_MINT_deposit (struct TALER_MINT_Handle *mint, } GNUNET_break (0); /* FIXME: verify all sigs! */ - deposit_obj = json_new (); /* FIXME: actually build JSON request */ + /* FIXME: actually build JSON request */ + deposit_obj = json_pack ("{s:s}", + "hello", "world"); dh = GNUNET_new (struct TALER_MINT_DepositHandle); dh->mint = mint; @@ -266,13 +279,13 @@ TALER_MINT_deposit (struct TALER_MINT_Handle *mint, CURLOPT_POSTFIELDSIZE, strlen (dh->json_enc))); GNUNET_assert (CURLE_OK == - curl_easy_setopt (c, + curl_easy_setopt (eh, CURLOPT_WRITEFUNCTION, - &keys_download_cb)); + &deposit_download_cb)); GNUNET_assert (CURLE_OK == - curl_easy_setopt (c, + curl_easy_setopt (eh, CURLOPT_WRITEDATA, - kr)); + dh)); GNUNET_assert (NULL != (dh->headers = curl_slist_append (dh->headers, "Content-Type: application/json"))); @@ -283,7 +296,7 @@ TALER_MINT_deposit (struct TALER_MINT_Handle *mint, ctx = MAH_handle_to_context (mint); dh->job = MAC_job_add (ctx, eh, - &handle_deposit_reply, + &handle_deposit_finished, dh); return dh; }