compile mint_api_deposit.c
This commit is contained in:
parent
d5e581b5e6
commit
bba46ca85a
@ -16,7 +16,8 @@ libtalermint_la_LDFLAGS = \
|
|||||||
libtalermint_la_SOURCES = \
|
libtalermint_la_SOURCES = \
|
||||||
mint_api_context.c mint_api_context.h \
|
mint_api_context.c mint_api_context.h \
|
||||||
mint_api_json.c mint_api_json.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 = \
|
libtalermint_la_LIBADD = \
|
||||||
-lgnunetutil \
|
-lgnunetutil \
|
||||||
|
@ -25,9 +25,20 @@
|
|||||||
#include <jansson.h>
|
#include <jansson.h>
|
||||||
#include <gnunet/gnunet_util_lib.h>
|
#include <gnunet/gnunet_util_lib.h>
|
||||||
#include "taler_mint_service.h"
|
#include "taler_mint_service.h"
|
||||||
|
#include "mint_api_context.h"
|
||||||
|
#include "mint_api_handle.h"
|
||||||
#include "taler_signatures.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
|
* @brief A Deposit Handle
|
||||||
*/
|
*/
|
||||||
@ -241,7 +252,9 @@ TALER_MINT_deposit (struct TALER_MINT_Handle *mint,
|
|||||||
}
|
}
|
||||||
GNUNET_break (0); /* FIXME: verify all sigs! */
|
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 = GNUNET_new (struct TALER_MINT_DepositHandle);
|
||||||
dh->mint = mint;
|
dh->mint = mint;
|
||||||
@ -266,13 +279,13 @@ TALER_MINT_deposit (struct TALER_MINT_Handle *mint,
|
|||||||
CURLOPT_POSTFIELDSIZE,
|
CURLOPT_POSTFIELDSIZE,
|
||||||
strlen (dh->json_enc)));
|
strlen (dh->json_enc)));
|
||||||
GNUNET_assert (CURLE_OK ==
|
GNUNET_assert (CURLE_OK ==
|
||||||
curl_easy_setopt (c,
|
curl_easy_setopt (eh,
|
||||||
CURLOPT_WRITEFUNCTION,
|
CURLOPT_WRITEFUNCTION,
|
||||||
&keys_download_cb));
|
&deposit_download_cb));
|
||||||
GNUNET_assert (CURLE_OK ==
|
GNUNET_assert (CURLE_OK ==
|
||||||
curl_easy_setopt (c,
|
curl_easy_setopt (eh,
|
||||||
CURLOPT_WRITEDATA,
|
CURLOPT_WRITEDATA,
|
||||||
kr));
|
dh));
|
||||||
GNUNET_assert (NULL != (dh->headers =
|
GNUNET_assert (NULL != (dh->headers =
|
||||||
curl_slist_append (dh->headers,
|
curl_slist_append (dh->headers,
|
||||||
"Content-Type: application/json")));
|
"Content-Type: application/json")));
|
||||||
@ -283,7 +296,7 @@ TALER_MINT_deposit (struct TALER_MINT_Handle *mint,
|
|||||||
ctx = MAH_handle_to_context (mint);
|
ctx = MAH_handle_to_context (mint);
|
||||||
dh->job = MAC_job_add (ctx,
|
dh->job = MAC_job_add (ctx,
|
||||||
eh,
|
eh,
|
||||||
&handle_deposit_reply,
|
&handle_deposit_finished,
|
||||||
dh);
|
dh);
|
||||||
return dh;
|
return dh;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user