status => history
This commit is contained in:
parent
7993c9b2fd
commit
bddd7986d7
@ -31,15 +31,15 @@
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send reserve status information to client.
|
* Send reserve history to client.
|
||||||
*
|
*
|
||||||
* @param connection connection to the client
|
* @param connection connection to the client
|
||||||
* @param rh reserve history to return
|
* @param rh reserve history to return
|
||||||
* @return MHD result code
|
* @return MHD result code
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
reply_reserve_status_success (struct MHD_Connection *connection,
|
reply_reserve_history_success (struct MHD_Connection *connection,
|
||||||
const struct TALER_EXCHANGEDB_ReserveHistory *rh)
|
const struct TALER_EXCHANGEDB_ReserveHistory *rh)
|
||||||
{
|
{
|
||||||
json_t *json_balance;
|
json_t *json_balance;
|
||||||
json_t *json_history;
|
json_t *json_history;
|
||||||
@ -62,9 +62,9 @@ reply_reserve_status_success (struct MHD_Connection *connection,
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Closure for #reserve_status_transaction.
|
* Closure for #reserve_history_transaction.
|
||||||
*/
|
*/
|
||||||
struct ReserveStatusContext
|
struct ReserveHistoryContext
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Public key of the reserve the inquiry is about.
|
* Public key of the reserve the inquiry is about.
|
||||||
@ -80,8 +80,8 @@ struct ReserveStatusContext
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function implementing /reserve/status transaction.
|
* Function implementing /reserves/ GET transaction.
|
||||||
* Execute a /reserve/status. Given the public key of a reserve,
|
* Execute a /reserves/ GET. Given the public key of a reserve,
|
||||||
* return the associated transaction history. Runs the
|
* return the associated transaction history. Runs the
|
||||||
* transaction logic; IF it returns a non-error code, the transaction
|
* transaction logic; IF it returns a non-error code, the transaction
|
||||||
* logic MUST NOT queue a MHD response. IF it returns an hard error,
|
* logic MUST NOT queue a MHD response. IF it returns an hard error,
|
||||||
@ -89,7 +89,7 @@ struct ReserveStatusContext
|
|||||||
* IF it returns the soft error code, the function MAY be called again
|
* IF it returns the soft error code, the function MAY be called again
|
||||||
* to retry and MUST not queue a MHD response.
|
* to retry and MUST not queue a MHD response.
|
||||||
*
|
*
|
||||||
* @param cls a `struct ReserveStatusContext *`
|
* @param cls a `struct ReserveHistoryContext *`
|
||||||
* @param connection MHD request which triggered the transaction
|
* @param connection MHD request which triggered the transaction
|
||||||
* @param session database session to use
|
* @param session database session to use
|
||||||
* @param[out] mhd_ret set to MHD response status for @a connection,
|
* @param[out] mhd_ret set to MHD response status for @a connection,
|
||||||
@ -97,12 +97,12 @@ struct ReserveStatusContext
|
|||||||
* @return transaction status
|
* @return transaction status
|
||||||
*/
|
*/
|
||||||
static enum GNUNET_DB_QueryStatus
|
static enum GNUNET_DB_QueryStatus
|
||||||
reserve_status_transaction (void *cls,
|
reserve_history_transaction (void *cls,
|
||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
struct TALER_EXCHANGEDB_Session *session,
|
struct TALER_EXCHANGEDB_Session *session,
|
||||||
int *mhd_ret)
|
int *mhd_ret)
|
||||||
{
|
{
|
||||||
struct ReserveStatusContext *rsc = cls;
|
struct ReserveHistoryContext *rsc = cls;
|
||||||
|
|
||||||
(void) connection;
|
(void) connection;
|
||||||
(void) mhd_ret;
|
(void) mhd_ret;
|
||||||
@ -117,7 +117,7 @@ reserve_status_transaction (void *cls,
|
|||||||
* Handle a GET "/reserves/" request. Parses the
|
* Handle a GET "/reserves/" request. Parses the
|
||||||
* given "reserve_pub" in @a args (which should contain the
|
* given "reserve_pub" in @a args (which should contain the
|
||||||
* EdDSA public key of a reserve) and then respond with the
|
* EdDSA public key of a reserve) and then respond with the
|
||||||
* status of the reserve.
|
* history of the reserve.
|
||||||
*
|
*
|
||||||
* @param rh context of the handler
|
* @param rh context of the handler
|
||||||
* @param connection the MHD connection to handle
|
* @param connection the MHD connection to handle
|
||||||
@ -129,7 +129,7 @@ TEH_handler_reserves_get (const struct TEH_RequestHandler *rh,
|
|||||||
struct MHD_Connection *connection,
|
struct MHD_Connection *connection,
|
||||||
const char *const args[1])
|
const char *const args[1])
|
||||||
{
|
{
|
||||||
struct ReserveStatusContext rsc;
|
struct ReserveHistoryContext rsc;
|
||||||
int mhd_ret;
|
int mhd_ret;
|
||||||
|
|
||||||
(void) rh;
|
(void) rh;
|
||||||
@ -148,9 +148,9 @@ TEH_handler_reserves_get (const struct TEH_RequestHandler *rh,
|
|||||||
rsc.rh = NULL;
|
rsc.rh = NULL;
|
||||||
if (GNUNET_OK !=
|
if (GNUNET_OK !=
|
||||||
TEH_DB_run_transaction (connection,
|
TEH_DB_run_transaction (connection,
|
||||||
"get reserve status",
|
"get reserve history",
|
||||||
&mhd_ret,
|
&mhd_ret,
|
||||||
&reserve_status_transaction,
|
&reserve_history_transaction,
|
||||||
&rsc))
|
&rsc))
|
||||||
return mhd_ret;
|
return mhd_ret;
|
||||||
|
|
||||||
@ -164,8 +164,8 @@ TEH_handler_reserves_get (const struct TEH_RequestHandler *rh,
|
|||||||
"code",
|
"code",
|
||||||
(json_int_t)
|
(json_int_t)
|
||||||
TALER_EC_RESERVE_STATUS_UNKNOWN);
|
TALER_EC_RESERVE_STATUS_UNKNOWN);
|
||||||
mhd_ret = reply_reserve_status_success (connection,
|
mhd_ret = reply_reserve_history_success (connection,
|
||||||
rsc.rh);
|
rsc.rh);
|
||||||
TEH_plugin->free_reserve_history (TEH_plugin->cls,
|
TEH_plugin->free_reserve_history (TEH_plugin->cls,
|
||||||
rsc.rh);
|
rsc.rh);
|
||||||
return mhd_ret;
|
return mhd_ret;
|
||||||
|
Loading…
Reference in New Issue
Block a user