[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis] branch master updated: added /terms rest api
From: |
gnunet |
Subject: |
[taler-anastasis] branch master updated: added /terms rest api |
Date: |
Sun, 17 May 2020 17:02:43 +0200 |
This is an automated email from the git hooks/post-receive script.
dennis-neufeld pushed a commit to branch master
in repository anastasis.
The following commit(s) were added to refs/heads/master by this push:
new b727c2f added /terms rest api
b727c2f is described below
commit b727c2fe6fa6d84e6975f9e0b1293d8b6b028e67
Author: Dennis Neufeld <address@hidden>
AuthorDate: Sun May 17 15:02:38 2020 +0000
added /terms rest api
---
src/backend/Makefile.am | 1 +
src/backend/anastasis-httpd.c | 5 ++++
src/backend/anastasis-httpd_terms.c | 56 +++++++++++++++++++++++++++++++++++++
src/backend/anastasis-httpd_terms.h | 47 +++++++++++++++++++++++++++++++
4 files changed, 109 insertions(+)
diff --git a/src/backend/Makefile.am b/src/backend/Makefile.am
index d913acd..28b892a 100644
--- a/src/backend/Makefile.am
+++ b/src/backend/Makefile.am
@@ -18,6 +18,7 @@ anastasis_httpd_SOURCES = \
anastasis-httpd_policy_upload.c \
anastasis-httpd_salt.c anastasis-httpd_salt.h \
anastasis-httpd_truth.c anastasis-httpd_truth.h \
+ anastasis-httpd_terms.c anastasis-httpd_terms.h \
anastasis-httpd_truth_upload.c
anastasis_httpd_LDADD = \
diff --git a/src/backend/anastasis-httpd.c b/src/backend/anastasis-httpd.c
index 8c0ca14..52a0201 100644
--- a/src/backend/anastasis-httpd.c
+++ b/src/backend/anastasis-httpd.c
@@ -29,6 +29,8 @@
#include "anastasis-httpd_policy.h"
#include "anastasis-httpd_truth.h"
#include "anastasis-httpd_salt.h"
+#include "anastasis-httpd_terms.h"
+
/**
* Backlog for listen operation on unix-domain sockets.
@@ -220,6 +222,9 @@ url_handler (void *cls,
{ "/agpl", MHD_HTTP_METHOD_GET, "text/plain",
NULL, 0,
&TMH_MHD_handler_agpl_redirect, MHD_HTTP_FOUND },
+ { "/terms", MHD_HTTP_METHOD_GET, "text/plain",
+ NULL, 0,
+ &AH_handler_terms, MHD_HTTP_OK },
{NULL, NULL, NULL, NULL, 0, 0 }
};
static struct TMH_RequestHandler h404 = {
diff --git a/src/backend/anastasis-httpd_terms.c
b/src/backend/anastasis-httpd_terms.c
new file mode 100644
index 0000000..ede38c6
--- /dev/null
+++ b/src/backend/anastasis-httpd_terms.c
@@ -0,0 +1,56 @@
+/*
+ This file is part of Anastasis
+ Copyright (C) 2020 Taler Systems SA
+
+ Anastasis is free software; you can redistribute it and/or modify it under
the
+ terms of the GNU Lesser General Public License as published by the Free
Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ Anastasis 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ Anastasis; see the file COPYING.GPL. If not, see
<http://www.gnu.org/licenses/>
+*/
+/**
+ * @file backend/anastasis-httpd_terms.c
+ * @brief headers for /terms handler
+ * @author Christian Grothoff
+ * @author Dennis Neufeld
+ * @author Dominik Meister
+ */
+#include "platform.h"
+#include "anastasis-httpd_terms.h"
+#include <taler/taler_json_lib.h>
+
+/**
+ * Manages a /terms call.
+ *
+ * @param rh context of the handler
+ * @param connection the MHD connection to handle
+ * @param[in,out] connection_cls the connection's closure (can be updated)
+ * @param upload_data upload data
+ * @param[in,out] upload_data_size number of bytes (left) in @a upload_data
+ * @param mi merchant backend instance, never NULL
+ * @return MHD result code
+ */
+int
+AH_handler_terms (struct TMH_RequestHandler *rh,
+ struct MHD_Connection *connection,
+ void **connection_cls,
+ const char *upload_data,
+ size_t *upload_data_size)
+{
+ return TALER_MHD_reply_json_pack (connection,
+ MHD_HTTP_OK,
+ "{s:I, s:o, s:s}",
+ "storage_limit_in_megabytes",
+ (json_int_t) AH_upload_limit_mb,
+ "annual_fee",
+ TALER_JSON_from_amount (&AH_annual_fee),
+ "version",
+ "0.0");
+}
+
+/* end of anastasis-httpd_terms.c */
\ No newline at end of file
diff --git a/src/backend/anastasis-httpd_terms.h
b/src/backend/anastasis-httpd_terms.h
new file mode 100644
index 0000000..7d61cbf
--- /dev/null
+++ b/src/backend/anastasis-httpd_terms.h
@@ -0,0 +1,47 @@
+/*
+ This file is part of Anastasis
+ Copyright (C) 2020 Taler Systems SA
+
+ Anastasis is free software; you can redistribute it and/or modify it under
the
+ terms of the GNU Lesser General Public License as published by the Free
Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ Anastasis 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ Anastasis; see the file COPYING.GPL. If not, see
<http://www.gnu.org/licenses/>
+*/
+/**
+ * @file backend/anastasis-httpd_terms.h
+ * @brief headers for /terms handler
+ * @author Christian Grothoff
+ * @author Dennis Neufeld
+ * @author Dominik Meister
+ */
+#ifndef ANASTASIS_HTTPD_TERMS_H
+#define ANASTASIS_HTTPD_TERMS_H
+#include <microhttpd.h>
+#include "anastasis-httpd.h"
+
+/**
+ * Manages a /terms call.
+ *
+ * @param rh context of the handler
+ * @param connection the MHD connection to handle
+ * @param[in,out] connection_cls the connection's closure (can be updated)
+ * @param upload_data upload data
+ * @param[in,out] upload_data_size number of bytes (left) in @a upload_data
+ * @return MHD result code
+ */
+int
+AH_handler_terms (struct TMH_RequestHandler *rh,
+ struct MHD_Connection *connection,
+ void **connection_cls,
+ const char *upload_data,
+ size_t *upload_data_size);
+
+#endif
+
+/* end of anastasis-httpd_terms.h */
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
address@hidden.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-anastasis] branch master updated: added /terms rest api,
gnunet <=