towards implementing #3851: /admin/add/incoming
This commit is contained in:
parent
68bf92de2c
commit
253d220ea5
@ -11,6 +11,7 @@ taler_mint_httpd_SOURCES = \
|
||||
taler-mint-httpd_parsing.c taler-mint-httpd_parsing.h \
|
||||
taler-mint-httpd_responses.c taler-mint-httpd_responses.h \
|
||||
taler-mint-httpd_mhd.c taler-mint-httpd_mhd.h \
|
||||
taler-mint-httpd_admin.c taler-mint-httpd_admin.h \
|
||||
taler-mint-httpd_deposit.c taler-mint-httpd_deposit.h \
|
||||
taler-mint-httpd_withdraw.c taler-mint-httpd_withdraw.h \
|
||||
taler-mint-httpd_refresh.c taler-mint-httpd_refresh.h
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include <pthread.h>
|
||||
#include "taler-mint-httpd_parsing.h"
|
||||
#include "taler-mint-httpd_mhd.h"
|
||||
#include "taler-mint-httpd_admin.h"
|
||||
#include "taler-mint-httpd_deposit.h"
|
||||
#include "taler-mint-httpd_withdraw.h"
|
||||
#include "taler-mint-httpd_refresh.h"
|
||||
@ -199,6 +200,15 @@ handle_mhd_request (void *cls,
|
||||
"Only GET is allowed", 0,
|
||||
&TMH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
|
||||
|
||||
/* FIXME: maybe conditionally compile these? */
|
||||
{ "/admin/add/incoming", MHD_HTTP_METHOD_POST, "application/json",
|
||||
NULL, 0,
|
||||
&TMH_ADMIN_handler_admin_add_incoming, MHD_HTTP_OK },
|
||||
{ "/admin/add/incoming", NULL, "text/plain",
|
||||
"Only POST is allowed", 0,
|
||||
&TMH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
|
||||
|
||||
|
||||
#if HAVE_DEVELOPER
|
||||
{ "/test", MHD_HTTP_METHOD_POST, "application/json",
|
||||
NULL, 0,
|
||||
|
@ -1374,4 +1374,28 @@ TMH_DB_execute_refresh_link (struct MHD_Connection *connection,
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add an incoming transaction to the database. Checks if the
|
||||
* transaction is fresh (not a duplicate) and if so adds it to
|
||||
* the database.
|
||||
*
|
||||
* @param connection the MHD connection to handle
|
||||
* @param reserve_pub public key of the reserve
|
||||
* @param amount amount to add to the reserve
|
||||
* @param execution_time when did we receive the wire transfer
|
||||
* @param wire details about the wire transfer
|
||||
* @return MHD result code
|
||||
*/
|
||||
int
|
||||
TMH_DB_execute_admin_add_incoming (struct MHD_Connection *connection,
|
||||
const struct TALER_ReservePublicKeyP *reserve_pub,
|
||||
const struct TALER_Amount *amount,
|
||||
struct GNUNET_TIME_Absolute execution_time,
|
||||
json_t *wire)
|
||||
{
|
||||
GNUNET_break (0); // FIXME: #3851!
|
||||
return MHD_NO;
|
||||
}
|
||||
|
||||
|
||||
/* end of taler-mint-httpd_db.c */
|
||||
|
@ -167,5 +167,24 @@ TMH_DB_execute_refresh_link (struct MHD_Connection *connection,
|
||||
const struct TALER_CoinSpendPublicKeyP *coin_pub);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Add an incoming transaction to the database.
|
||||
*
|
||||
* @param connection the MHD connection to handle
|
||||
* @param reserve_pub public key of the reserve
|
||||
* @param amount amount to add to the reserve
|
||||
* @param execution_time when did we receive the wire transfer
|
||||
* @param wire details about the wire transfer
|
||||
* @return MHD result code
|
||||
*/
|
||||
int
|
||||
TMH_DB_execute_admin_add_incoming (struct MHD_Connection *connection,
|
||||
const struct TALER_ReservePublicKeyP *reserve_pub,
|
||||
const struct TALER_Amount *amount,
|
||||
struct GNUNET_TIME_Absolute execution_time,
|
||||
json_t *wire);
|
||||
|
||||
|
||||
#endif
|
||||
/* TALER_MINT_HTTPD_DB_H */
|
||||
|
@ -134,6 +134,7 @@ enum TMH_PARSE_JsonNavigationCommand
|
||||
* Param: struct GNUNET_TIME_Absolute *
|
||||
*/
|
||||
TMH_PARSE_JNC_RET_TIME_ABSOLUTE
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -299,6 +300,7 @@ TMH_PARSE_release_data (struct TMH_PARSE_FieldSpecification *spec);
|
||||
*/
|
||||
#define TMH_PARSE_MEMBER_TIME_ABS(field,atime) { field, atime, sizeof(*atime), 0, TMH_PARSE_JNC_RET_TIME_ABSOLUTE, 0 }
|
||||
|
||||
|
||||
/**
|
||||
* Generate line in parser specification indicating the end of the spec.
|
||||
*/
|
||||
|
@ -171,6 +171,25 @@ TMH_RESPONSE_reply_arg_missing (struct MHD_Connection *connection,
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send a response indicating permission denied.
|
||||
*
|
||||
* @param connection the MHD connection to use
|
||||
* @param hint hint about why access was denied
|
||||
* @return a MHD result code
|
||||
*/
|
||||
int
|
||||
TMH_RESPONSE_reply_permission_denied (struct MHD_Connection *connection,
|
||||
const char *hint)
|
||||
{
|
||||
return TMH_RESPONSE_reply_json_pack (connection,
|
||||
MHD_HTTP_FORBIDDEN,
|
||||
"{s:s, s:s}",
|
||||
"error", "permission denied",
|
||||
"hint", hint);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send a response indicating an internal error.
|
||||
*
|
||||
|
@ -114,6 +114,18 @@ TMH_RESPONSE_reply_arg_missing (struct MHD_Connection *connection,
|
||||
const char *param_name);
|
||||
|
||||
|
||||
/**
|
||||
* Send a response indicating permission denied.
|
||||
*
|
||||
* @param connection the MHD connection to use
|
||||
* @param hint hint about why access was denied
|
||||
* @return a MHD result code
|
||||
*/
|
||||
int
|
||||
TMH_RESPONSE_reply_permission_denied (struct MHD_Connection *connection,
|
||||
const char *hint);
|
||||
|
||||
|
||||
/**
|
||||
* Send a response indicating an internal error.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user