template for /refresh/payback

This commit is contained in:
Christian Grothoff 2019-06-26 19:14:02 +02:00
parent 0be3dd4711
commit 35fe98a165
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
5 changed files with 133 additions and 18 deletions

View File

@ -51,6 +51,7 @@ taler_exchange_httpd_SOURCES = \
taler-exchange-httpd_payback.c taler-exchange-httpd_payback.h \ taler-exchange-httpd_payback.c taler-exchange-httpd_payback.h \
taler-exchange-httpd_refresh_link.c taler-exchange-httpd_refresh_link.h \ taler-exchange-httpd_refresh_link.c taler-exchange-httpd_refresh_link.h \
taler-exchange-httpd_refresh_melt.c taler-exchange-httpd_refresh_melt.h \ taler-exchange-httpd_refresh_melt.c taler-exchange-httpd_refresh_melt.h \
taler-exchange-httpd_refresh_payback.c taler-exchange-httpd_refresh_payback.h \
taler-exchange-httpd_refresh_reveal.c taler-exchange-httpd_refresh_reveal.h \ taler-exchange-httpd_refresh_reveal.c taler-exchange-httpd_refresh_reveal.h \
taler-exchange-httpd_refund.c taler-exchange-httpd_refund.h \ taler-exchange-httpd_refund.c taler-exchange-httpd_refund.h \
taler-exchange-httpd_reserve_status.c taler-exchange-httpd_reserve_status.h \ taler-exchange-httpd_reserve_status.c taler-exchange-httpd_reserve_status.h \

View File

@ -36,6 +36,7 @@
#include "taler-exchange-httpd_payback.h" #include "taler-exchange-httpd_payback.h"
#include "taler-exchange-httpd_refresh_link.h" #include "taler-exchange-httpd_refresh_link.h"
#include "taler-exchange-httpd_refresh_melt.h" #include "taler-exchange-httpd_refresh_melt.h"
#include "taler-exchange-httpd_refresh_payback.h"
#include "taler-exchange-httpd_refresh_reveal.h" #include "taler-exchange-httpd_refresh_reveal.h"
#include "taler-exchange-httpd_track_transfer.h" #include "taler-exchange-httpd_track_transfer.h"
#include "taler-exchange-httpd_track_transaction.h" #include "taler-exchange-httpd_track_transaction.h"
@ -317,6 +318,13 @@ handle_mhd_request (void *cls,
"Only GET is allowed", 0, "Only GET is allowed", 0,
&TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, &TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
{ "/refresh/payback", MHD_HTTP_METHOD_POST, "application/json",
NULL, 0,
&TEH_REFRESH_handler_refresh_payback, MHD_HTTP_OK },
{ "/refresh/payback", NULL, "text/plain",
"Only POST is allowed", 0,
&TEH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED },
{ "/track/transfer", MHD_HTTP_METHOD_GET, "application/json", { "/track/transfer", MHD_HTTP_METHOD_GET, "application/json",
NULL, 0, NULL, 0,
&TEH_TRACKING_handler_track_transfer, MHD_HTTP_OK }, &TEH_TRACKING_handler_track_transfer, MHD_HTTP_OK },

View File

@ -1,6 +1,6 @@
/* /*
This file is part of TALER This file is part of TALER
Copyright (C) 2014-2017 Inria & GNUnet e.V. Copyright (C) 2014-2019 Inria & GNUnet e.V.
TALER is free software; you can redistribute it and/or modify it under the 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 terms of the GNU Affero General Public License as published by the Free Software

View File

@ -0,0 +1,57 @@
/*
This file is part of TALER
Copyright (C) 2014-2019 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 taler-exchange-httpd_refresh_link.c
* @brief Handle /refresh/link requests
* @author Florian Dold
* @author Benedikt Mueller
* @author Christian Grothoff
*/
#include "platform.h"
#include <gnunet/gnunet_util_lib.h>
#include <jansson.h>
#include <microhttpd.h>
#include "taler-exchange-httpd_parsing.h"
#include "taler-exchange-httpd_mhd.h"
#include "taler-exchange-httpd_refresh_payback.h"
#include "taler-exchange-httpd_responses.h"
#include "taler-exchange-httpd_keystate.h"
/**
* Handle a "/refresh/payback" request. Parses the request into the JSON
* components and then processes the request.
*
* @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
TEH_REFRESH_handler_refresh_payback (struct TEH_RequestHandler *rh,
struct MHD_Connection *connection,
void **connection_cls,
const char *upload_data,
size_t *upload_data_size)
{
GNUNET_break (0);
return MHD_NO;
}
/* end of taler-exchange-httpd_refresh_payback.c */

View File

@ -0,0 +1,49 @@
/*
This file is part of TALER
Copyright (C) 2014-2019 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 taler-exchange-httpd_refresh_payback.h
* @brief Handle /refresh/payback requests
* @author Florian Dold
* @author Christian Grothoff
*/
#ifndef TALER_EXCHANGE_HTTPD_REFRESH_PAYBACK_H
#define TALER_EXCHANGE_HTTPD_REFRESH_PAYBACK_H
#include <gnunet/gnunet_util_lib.h>
#include <microhttpd.h>
#include "taler-exchange-httpd.h"
/**
* Handle a "/refresh/payback" request. Parses the request into the JSON
* components and then processes the request.
*
* @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
TEH_REFRESH_handler_refresh_payback (struct TEH_RequestHandler *rh,
struct MHD_Connection *connection,
void **connection_cls,
const char *upload_data,
size_t *upload_data_size);
#endif