merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

commit 0db5194eefeb3aa2d89e7073cf31793af1bca504
parent 10cd6a5c9ceaa52f0c74f6992bc41cfe114c94dc
Author: Florian Dold <florian.dold@gmail.com>
Date:   Thu,  4 Jan 2018 18:01:47 +0100

add /trigger-pay skeleton

Diffstat:
Msrc/backend/Makefile.am | 3++-
Msrc/backend/taler-merchant-httpd_check-payment.c | 2+-
Asrc/backend/taler-merchant-httpd_trigger-pay.c | 55+++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/backend/taler-merchant-httpd_trigger-pay.h | 45+++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 103 insertions(+), 2 deletions(-)

diff --git 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 @@ -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 @@ -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 @@ -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