[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-donau] branch master updated: donau charity get
From: |
gnunet |
Subject: |
[taler-donau] branch master updated: donau charity get |
Date: |
Fri, 05 Jan 2024 16:35:05 +0100 |
This is an automated email from the git hooks/post-receive script.
johannes-casaburi pushed a commit to branch master
in repository donau.
The following commit(s) were added to refs/heads/master by this push:
new 62b10cf donau charity get
new a4db1d4 Merge remote-tracking branch 'refs/remotes/origin/master'
62b10cf is described below
commit 62b10cfde177ce1fd768c0b6d6e03d2a8ea2f5a0
Author: Casaburi Johannes <johannes.casaburi@students.bfh.ch>
AuthorDate: Fri Jan 5 16:34:11 2024 +0100
donau charity get
---
src/donau/donau-httpd_get-charity.c | 114 ++++++++++++++++++++++++++++++++++++
1 file changed, 114 insertions(+)
diff --git a/src/donau/donau-httpd_get-charity.c
b/src/donau/donau-httpd_get-charity.c
new file mode 100644
index 0000000..bdd3795
--- /dev/null
+++ b/src/donau/donau-httpd_get-charity.c
@@ -0,0 +1,114 @@
+/*
+ This file is part of TALER
+ Copyright (C) 2023 Taler Systems SA
+
+ TALER is free software; you can redistribute it and/or modify it under the
+ terms of the GNU Affero General Public License as published by the Free
Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
details.
+
+ You should have received a copy of the GNU Affero General Public License
along with
+ TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+*/
+/**
+ * @file donau-httpd_charity-get.c
+ * @brief Return summary information about AML decision
+ * @author Johannes Casaburi
+ */
+#include "platform.h"
+#include <gnunet/gnunet_util_lib.h>
+#include <jansson.h>
+#include <microhttpd.h>
+#include <pthread.h>
+#include "taler/taler_json_lib.h"
+#include "taler/taler_mhd_lib.h"
+#include "taler/taler_signatures.h"
+#include "donau-httpd.h"
+#include "donaudb_plugin.h"
+#include "donau-httpd_aml-decision.h"
+#include "donau-httpd_metrics.h"
+
+
+/**
+ * Maximum number of records we return per request.
+ */
+#define MAX_RECORDS 1024
+
+MHD_RESULT
+DH_handler_charity_get (
+ struct DH_RequestContext *rc,
+ const char *const args[])
+{
+ int charity_id;
+
+ if ( (NULL == args[0]) ||
+ (GNUNET_OK !=
+ GNUNET_STRINGS_string_to_data (args[0],
+ strlen (args[0]),
+ &charity_id,
+ sizeof (charity_id))) )
+ {
+ GNUNET_break_op (0);
+ return TALER_MHD_reply_with_error (rc->connection,
+ MHD_HTTP_BAD_REQUEST,
+ TALER_EC_GENERIC_PARAMETER_MALFORMED,
+ "charity_id");
+ }
+
+ if (NULL != args[1])
+ {
+ GNUNET_break_op (0);
+ return TALER_MHD_reply_with_error (rc->connection,
+ MHD_HTTP_BAD_REQUEST,
+ TALER_EC_GENERIC_ENDPOINT_UNKNOWN,
+ args[1]);
+ }
+
+ {
+ json_t *charity_info;
+ enum GNUNET_DB_QueryStatus qs;
+ bool none = false;
+
+ charity_info = json_array ();
+ GNUNET_assert (NULL != charity_info);
+ qs = DH_plugin->select_charity_info (DH_plugin->cls,
+ &charity_id,
+ charity_info);
+ switch (qs)
+ {
+ case GNUNET_DB_STATUS_HARD_ERROR:
+ case GNUNET_DB_STATUS_SOFT_ERROR:
+ json_decref (charity_info);
+ GNUNET_break (0);
+ return TALER_MHD_reply_with_error (rc->connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ NULL);
+ case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
+ if (none)
+ {
+ json_decref (charity_info);
+ return TALER_MHD_reply_static (
+ rc->connection,
+ MHD_HTTP_NO_CONTENT,
+ NULL,
+ NULL,
+ 0);
+ }
+ break;
+ case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
+ break;
+ }
+ return TALER_MHD_REPLY_JSON_PACK (
+ rc->connection,
+ MHD_HTTP_OK,
+ GNUNET_JSON_pack_array_steal ("charity_info",
+ charity_info));
+ }
+}
+
+
+/* end of donau-httpd_aml-decision_get.c */
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-donau] branch master updated: donau charity get,
gnunet <=