Line data Source code
1 : /* 2 : This file is part of TALER 3 : (C) 2019, 2020, 2021 Taler Systems SA 4 : 5 : TALER is free software; you can redistribute it and/or modify it under the 6 : terms of the GNU Affero General Public License as published by the Free Software 7 : Foundation; either version 3, or (at your option) any later version. 8 : 9 : TALER is distributed in the hope that it will be useful, but WITHOUT ANY 10 : WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 11 : A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 : 13 : You should have received a copy of the GNU General Public License along with 14 : TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> 15 : */ 16 : /** 17 : * @file taler-merchant-httpd_config.c 18 : * @brief implement API for querying configuration data of the backend 19 : * @author Florian Dold 20 : */ 21 : #include "platform.h" 22 : #include <jansson.h> 23 : #include <taler/taler_util.h> 24 : #include <taler/taler_json_lib.h> 25 : #include "taler-merchant-httpd.h" 26 : #include "taler-merchant-httpd_mhd.h" 27 : #include "taler-merchant-httpd_exchanges.h" 28 : 29 : 30 : /** 31 : * Taler protocol version in the format CURRENT:REVISION:AGE 32 : * as used by GNU libtool. See 33 : * https://www.gnu.org/software/libtool/manual/html_node/Libtool-versioning.html 34 : * 35 : * Please be very careful when updating and follow 36 : * https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html#Updating-version-info 37 : * precisely. Note that this version has NOTHING to do with the 38 : * release version, and the format is NOT the same that semantic 39 : * versioning uses either. 40 : * 41 : * When changing this version, you likely want to also update 42 : * #MERCHANT_PROTOCOL_CURRENT and #MERCHANT_PROTOCOL_AGE in 43 : * merchant_api_config.c! 44 : */ 45 : #define MERCHANT_PROTOCOL_VERSION "3:0:1" 46 : 47 : 48 : MHD_RESULT 49 0 : MH_handler_config (struct TMH_RequestHandler *rh, 50 : struct MHD_Connection *connection, 51 : struct TMH_HandlerContext *hc) 52 : { 53 : static struct MHD_Response *response; 54 : 55 : (void) rh; 56 : (void) hc; 57 0 : if (NULL == response) 58 : { 59 0 : response = TALER_MHD_MAKE_JSON_PACK ( 60 : GNUNET_JSON_pack_string ("currency", 61 : TMH_currency), 62 : GNUNET_JSON_pack_string ("name", 63 : "taler-merchant"), 64 : GNUNET_JSON_pack_string ("version", 65 : MERCHANT_PROTOCOL_VERSION)); 66 : } 67 0 : return MHD_queue_response (connection, 68 : MHD_HTTP_OK, 69 : response); 70 : } 71 : 72 : 73 : /* end of taler-merchant-httpd_config.c */