summaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2018-01-04 18:01:47 +0100
committerFlorian Dold <florian.dold@gmail.com>2018-01-04 18:01:47 +0100
commit0db5194eefeb3aa2d89e7073cf31793af1bca504 (patch)
tree8412f0b9b0875e4b7e2aed085ca8b111de736df8 /src/backend
parent10cd6a5c9ceaa52f0c74f6992bc41cfe114c94dc (diff)
downloadmerchant-0db5194eefeb3aa2d89e7073cf31793af1bca504.tar.gz
merchant-0db5194eefeb3aa2d89e7073cf31793af1bca504.tar.bz2
merchant-0db5194eefeb3aa2d89e7073cf31793af1bca504.zip
add /trigger-pay skeleton
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/Makefile.am3
-rw-r--r--src/backend/taler-merchant-httpd_check-payment.c2
-rw-r--r--src/backend/taler-merchant-httpd_trigger-pay.c55
-rw-r--r--src/backend/taler-merchant-httpd_trigger-pay.h45
4 files changed, 103 insertions, 2 deletions
diff --git a/src/backend/Makefile.am b/src/backend/Makefile.am
index 0f305eb5..648f2afe 100644
--- a/src/backend/Makefile.am
+++ b/src/backend/Makefile.am
@@ -29,7 +29,8 @@ taler_merchant_httpd_SOURCES = \
taler-merchant-httpd_track-transaction.c taler-merchant-httpd_track-transaction.h \
taler-merchant-httpd_track-transfer.c taler-merchant-httpd_track-transfer.h \
taler-merchant-httpd_refund.c taler-merchant-httpd_refund.h \
- taler-merchant-httpd_check-payment.c taler-merchant-httpd_check-payment.h
+ taler-merchant-httpd_check-payment.c taler-merchant-httpd_check-payment.h \
+ taler-merchant-httpd_trigger-pay.c taler-merchant-httpd_trigger-pay.h
taler_merchant_httpd_LDADD = \
diff --git a/src/backend/taler-merchant-httpd_check-payment.c b/src/backend/taler-merchant-httpd_check-payment.c
index af5eee1e..129f7bce 100644
--- a/src/backend/taler-merchant-httpd_check-payment.c
+++ b/src/backend/taler-merchant-httpd_check-payment.c
@@ -297,7 +297,7 @@ MH_handler_check_payment (struct TMH_RequestHandler *rh,
do_pay:
{
- char *url = make_absolute_backend_url (connection, "show-contract", "contract_url", contract_url, "session_id", session_id, NULL);
+ char *url = make_absolute_backend_url (connection, "trigger-pay", "contract_url", contract_url, "session_id", session_id, NULL);
int ret = TMH_RESPONSE_reply_json_pack (connection,
MHD_HTTP_OK,
"{s:s}",
diff --git a/src/backend/taler-merchant-httpd_trigger-pay.c b/src/backend/taler-merchant-httpd_trigger-pay.c
new file mode 100644
index 00000000..971fc50a
--- /dev/null
+++ b/src/backend/taler-merchant-httpd_trigger-pay.c
@@ -0,0 +1,55 @@
+/*
+ This file is part of TALER
+ (C) 2017 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_check-payment.c
+ * @brief implementation of /check-payment handler
+ * @author Florian Dold
+ */
+#include "platform.h"
+#include <string.h>
+#include <microhttpd.h>
+#include <jansson.h>
+#include <taler/taler_json_lib.h>
+#include <taler/taler_signatures.h>
+#include "taler-merchant-httpd.h"
+#include "taler-merchant-httpd_mhd.h"
+#include "taler-merchant-httpd_parsing.h"
+#include "taler-merchant-httpd_exchanges.h"
+#include "taler-merchant-httpd_responses.h"
+#include "taler-merchant-httpd_trigger-pay.h"
+
+
+/**
+ * Serves a request to browsers to trigger a payment.
+ * Contains all the logic to handle different platforms, so that the frontend
+ * does not have to handle that.
+ *
+ * @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
+MH_handler_trigger_pay (struct TMH_RequestHandler *rh,
+ struct MHD_Connection *connection,
+ void **connection_cls,
+ const char *upload_data,
+ size_t *upload_data_size)
+{
+ return 0;
+}
diff --git a/src/backend/taler-merchant-httpd_trigger-pay.h b/src/backend/taler-merchant-httpd_trigger-pay.h
new file mode 100644
index 00000000..b3957725
--- /dev/null
+++ b/src/backend/taler-merchant-httpd_trigger-pay.h
@@ -0,0 +1,45 @@
+/*
+ This file is part of TALER
+ (C) 2018 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_trigger-pay.h
+ * @brief headers for /trigger-pay handler
+ * @author Florian Dold
+ */
+#ifndef TALER_MERCHANT_HTTPD_TRIGGER_PAY_H
+#define TALER_MERCHANT_HTTPD_TRIGGER_PAY_H
+#include <microhttpd.h>
+#include "taler-merchant-httpd.h"
+
+/**
+ * Serves a request to browsers to trigger a payment.
+ * Contains all the logic to handle different platforms, so that the frontend
+ * does not have to handle that.
+ *
+ * @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
+MH_handler_trigger_pay (struct TMH_RequestHandler *rh,
+ struct MHD_Connection *connection,
+ void **connection_cls,
+ const char *upload_data,
+ size_t *upload_data_size);
+
+#endif