From 253d220ea54d45557f33dd3a7affef0e79593218 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 30 Jun 2015 22:09:15 +0200 Subject: towards implementing #3851: /admin/add/incoming --- src/mint/taler-mint-httpd_db.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/mint/taler-mint-httpd_db.c') diff --git a/src/mint/taler-mint-httpd_db.c b/src/mint/taler-mint-httpd_db.c index 78a8d6f40..512ed9a48 100644 --- a/src/mint/taler-mint-httpd_db.c +++ b/src/mint/taler-mint-httpd_db.c @@ -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 */ -- cgit v1.2.3 From f948a10f712ebd6f52182dc4bf71deee1c45b35f Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 1 Jul 2015 00:01:21 +0200 Subject: implementing #3851 --- src/mint/taler-mint-httpd_db.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'src/mint/taler-mint-httpd_db.c') diff --git a/src/mint/taler-mint-httpd_db.c b/src/mint/taler-mint-httpd_db.c index 512ed9a48..e4e8c59ec 100644 --- a/src/mint/taler-mint-httpd_db.c +++ b/src/mint/taler-mint-httpd_db.c @@ -1393,8 +1393,33 @@ TMH_DB_execute_admin_add_incoming (struct MHD_Connection *connection, struct GNUNET_TIME_Absolute execution_time, json_t *wire) { - GNUNET_break (0); // FIXME: #3851! - return MHD_NO; + struct TALER_MINTDB_Session *session; + int ret; + + if (NULL == (session = TMH_plugin->get_session (TMH_plugin->cls, + TMH_test_mode))) + { + GNUNET_break (0); + return TMH_RESPONSE_reply_internal_db_error (connection); + } + ret = TMH_plugin->reserves_in_insert (TMH_plugin->cls, + session, + reserve_pub, + amount, + execution_time, + wire); + if (GNUNET_SYSERR == ret) + { + GNUNET_break (0); + return TMH_RESPONSE_reply_internal_db_error (connection); + } + return TMH_RESPONSE_reply_json_pack (connection, + MHD_HTTP_OK, + "{s:s}", + "status", + (GNUNET_OK == ret) + ? "NEW" + : "DUP"); } -- cgit v1.2.3