taler-merchant-httpd_delete-private-fountains-FOUNTAIN_ID.c (2662B)
1 /* 2 This file is part of TALER 3 (C) 2026 Taler Systems SA 4 5 TALER is free software; you can redistribute it and/or modify 6 it under the terms of the GNU Affero General Public License as 7 published by the Free Software Foundation; either version 3, 8 or (at your option) any later version. 9 10 TALER is distributed in the hope that it will be useful, but 11 WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public 16 License along with TALER; see the file COPYING. If not, 17 see <http://www.gnu.org/licenses/> 18 */ 19 20 /** 21 * @file src/backend/taler-merchant-httpd_delete-private-fountains-FOUNTAIN_ID.c 22 * @brief implementing DELETE /private/fountains/$FOUNTAIN_ID request handling 23 * @author Bohdan Potuzhnyi 24 */ 25 #include "platform.h" 26 #include "taler-merchant-httpd_delete-private-fountains-FOUNTAIN_ID.h" 27 #include <taler/taler_json_lib.h> 28 #include "merchant-database/delete_fountain.h" 29 30 31 enum MHD_Result 32 TMH_private_delete_fountains_FOUNTAIN_ID (const struct TMH_RequestHandler *rh, 33 struct MHD_Connection *connection, 34 struct TMH_HandlerContext *hc) 35 { 36 struct TMH_MerchantInstance *mi = hc->instance; 37 enum GNUNET_DB_QueryStatus qs; 38 39 GNUNET_assert (NULL != mi); 40 GNUNET_assert (NULL != hc->infix); 41 qs = TALER_MERCHANTDB_delete_fountain (TMH_db, 42 mi->settings.id, 43 hc->infix); 44 switch (qs) 45 { 46 case GNUNET_DB_STATUS_HARD_ERROR: 47 case GNUNET_DB_STATUS_SOFT_ERROR: 48 GNUNET_break (0); 49 return TALER_MHD_reply_with_error (connection, 50 MHD_HTTP_INTERNAL_SERVER_ERROR, 51 TALER_EC_GENERIC_DB_STORE_FAILED, 52 "delete_fountain"); 53 case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: 54 return TALER_MHD_reply_with_error (connection, 55 MHD_HTTP_NOT_FOUND, 56 TALER_EC_MERCHANT_GENERIC_FOUNTAIN_UNKNOWN, 57 hc->infix); 58 case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: 59 return TALER_MHD_reply_static (connection, 60 MHD_HTTP_NO_CONTENT, 61 NULL, 62 NULL, 63 0); 64 } 65 GNUNET_assert (0); 66 return MHD_NO; 67 } 68 69 70 /* end of taler-merchant-httpd_delete-private-fountains-FOUNTAIN_ID.c */