gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-merchant] 185/277: headers and empty source files for GET /privat


From: gnunet
Subject: [taler-merchant] 185/277: headers and empty source files for GET /private/tips
Date: Sun, 05 Jul 2020 20:51:38 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository merchant.

commit cb8cb51cbda0eb3255754ea87c0098280a1b4286
Author: Jonathan Buchanan <jonathan.russ.buchanan@gmail.com>
AuthorDate: Mon Jun 8 18:28:36 2020 -0400

    headers and empty source files for GET /private/tips
---
 src/backend/Makefile.am                            |  2 +
 .../taler-merchant-httpd_private-get-tips.c        | 20 +++++
 .../taler-merchant-httpd_private-get-tips.h        | 41 ++++++++++
 src/include/taler_merchant_service.h               | 93 ++++++++++++++++++++++
 src/lib/Makefile.am                                |  1 +
 src/lib/merchant_api_get_tips.c                    | 21 +++++
 6 files changed, 178 insertions(+)

diff --git a/src/backend/Makefile.am b/src/backend/Makefile.am
index e70a188..d37f249 100644
--- a/src/backend/Makefile.am
+++ b/src/backend/Makefile.am
@@ -26,6 +26,8 @@ taler_merchant_httpd_SOURCES = \
     taler-merchant-httpd_get-orders-ID.h \
   taler-merchant-httpd_get-tips-ID.c \
     taler-merchant-httpd_get-tips-ID.h \
+  taler-merchant-httpd_private-get-tips.c \
+    taler-merchant-httpd_private-get-tips.h \
   taler-merchant-httpd_mhd.c taler-merchant-httpd_mhd.h \
   taler-merchant-httpd_private-delete-instances-ID.c \
     taler-merchant-httpd_private-delete-instances-ID.h \
diff --git a/src/backend/taler-merchant-httpd_private-get-tips.c 
b/src/backend/taler-merchant-httpd_private-get-tips.c
new file mode 100644
index 0000000..f874f5b
--- /dev/null
+++ b/src/backend/taler-merchant-httpd_private-get-tips.c
@@ -0,0 +1,20 @@
+/*
+  This file is part of TALER
+  (C) 2020 Taler Systems SA
+
+  TALER is free software; you can redistribute it and/or modify it under the
+  terms of the GNU 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 General Public License for more details.
+
+  You should have received a copy of the GNU General Public License along with
+  TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
+*/
+/**
+ * @file backend/taler-merchant-httpd_private-get-tips.c
+ * @brief implementation of a GET /private/tips handler
+ * @author Jonathan Buchanan
+ */
diff --git a/src/backend/taler-merchant-httpd_private-get-tips.h 
b/src/backend/taler-merchant-httpd_private-get-tips.h
new file mode 100644
index 0000000..a892726
--- /dev/null
+++ b/src/backend/taler-merchant-httpd_private-get-tips.h
@@ -0,0 +1,41 @@
+/*
+  This file is part of TALER
+  (C) 2020 Taler Systems SA
+
+  TALER is free software; you can redistribute it and/or modify it under the
+  terms of the GNU 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 General Public License for more details.
+
+  You should have received a copy of the GNU General Public License along with
+  TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
+*/
+/**
+ * @file backend/taler-merchant-httpd_private-get-tips.h
+ * @brief headers for GET /private/tips handler
+ * @author Jonathan Buchanan
+ */
+#ifndef TALER_MERCHANT_HTTPD_PRIVATE_GET_TIPS_H
+#define TALER_MERCHANT_HTTPD_PRIVATE_GET_TIPS_H
+#include <microhttpd.h>
+#include "taler-merchant-httpd.h"
+
+
+/**
+ * Manages a GET /private/tips call.
+ *
+ * @param rh context of the handler
+ * @param connection the MHD connection to handle
+ * @param[in,out] hc context with further information about the request
+ * @return MHD result code
+ */
+MHD_RESULT
+TMH_private_get_tips (const struct TMH_RequestHandler *rh,
+                      struct MHD_Connection *connection,
+                      struct TMH_HandlerContext *hc);
+
+
+#endif
diff --git a/src/include/taler_merchant_service.h 
b/src/include/taler_merchant_service.h
index 19f059b..4c0fa0c 100644
--- a/src/include/taler_merchant_service.h
+++ b/src/include/taler_merchant_service.h
@@ -2819,6 +2819,99 @@ void
 TALER_MERCHANT_tip_get_cancel (struct TALER_MERCHANT_TipGetHandle *tqh);
 
 
+/**
+ * Handle for a GET /private/tips request.
+ */
+struct TALER_MERCHANT_TipsGetHandle;
+
+
+/**
+ * Database entry information of a tip.
+ */
+struct TALER_MERCHANT_TipEntry
+{
+  /**
+   * Row number of the tip in the database.
+   */
+  unsigned int row_id;
+
+
+  /**
+   * Identifier for the tip.
+   */
+  struct GNUNET_HashCode tip_id;
+
+  /**
+   * Total value of the tip (including fees).
+   */
+  struct TALER_Amount tip_amount;
+
+};
+
+
+/**
+ * Callback to process a GET /private/tips request.
+ *
+ * @param cls closure
+ * @param hr HTTP response details
+ * @param tips_length length of the @a tips array
+ * @param tips the array of tips, NULL on error
+ */
+typedef void
+(*TALER_MERCHANT_TipsGetCallback) (
+  void *cls,
+  const struct TALER_MERCHANT_HttpResponse *hr,
+  unsigned int tips_length,
+  const struct TALER_MERCHANT_TipEntry tips[]);
+
+
+/**
+ * Issue a GET /private/tips request to the backend.
+ *
+ * @param ctx execution context
+ * @param backend_url base URL of the merchant backend
+ * @param cb function to call with the result
+ * @param cb_cls closure for @a cb
+ * @return handle for this operation, NULL upon errors
+ */
+struct TALER_MERCHANT_TipsGetHandle *
+TALER_MERCHANT_tips_get (struct GNUNET_CURL_Context *ctx,
+                         const char *backend_url,
+                         TALER_MERCHANT_TipsGetCallback cb,
+                         void *cb_cls);
+
+
+/**
+ * Issue a GET /private/tips request with filters to the backend.
+ *
+ * @param ctx execution context
+ * @param backend_url base URL of the merchant backend
+ * @param include_expired whether to return all tips or only unexpired tips
+ * @param limit number of results to return, negative for descending row id, 
positive for ascending
+ * @param offset row id to start returning results from
+ * @param cb function to call with the result
+ * @param cb_cls closure for @a cb
+ * @return handle for this operation, NULL upon errors
+ */
+struct TALER_MERCHANT_TipsGetHandle *
+TALER_MERCHANT_tips_get2 (struct GNUNET_CURL_Context *ctx,
+                          const char *backend_url,
+                          bool include_expired,
+                          int limit,
+                          unsigned int offset,
+                          TALER_MERCHANT_TipsGetCallback cb,
+                          void *cb_cls);
+
+
+/**
+ * Cancel a GET /private/tips request.
+ *
+ * @param
+ */
+void
+TALER_MERCHANT_tips_get_cancel (struct TALER_MERCHANT_TipsGetHandle *);
+
+
 /**
  * Handle for a POST /tips/$TIP_ID/pickup operation.
  */
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index 50b7a6d..5e9eaa3 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -39,6 +39,7 @@ libtalermerchant_la_SOURCES = \
   merchant_api_post_products.c \
   merchant_api_post_reserves.c \
   merchant_api_post_transfers.c \
+       merchant_api_get_tips.c \
  \
   merchant_api_tip_authorize.c \
   merchant_api_tip_pickup.c \
diff --git a/src/lib/merchant_api_get_tips.c b/src/lib/merchant_api_get_tips.c
new file mode 100644
index 0000000..05f8e7b
--- /dev/null
+++ b/src/lib/merchant_api_get_tips.c
@@ -0,0 +1,21 @@
+/*
+  This file is part of TALER
+  Copyright (C) 2020 Taler Systems SA
+
+  TALER 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 2.1, 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 Lesser General Public License for more 
details.
+
+  You should have received a copy of the GNU Lesser General Public License 
along with
+  TALER; see the file COPYING.LGPL.  If not, see
+  <http://www.gnu.org/licenses/>
+*/
+/**
+ * @file lib/merchant_api_get_tips.c
+ * @brief Implementation of the GET /private/tips request of the merchant's 
HTTP API
+ * @author Jonathan Buchanan
+ */

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]