merchant

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

taler-merchant-httpd_fountains.h (2002B)


      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_fountains.h
     22  * @brief shared validation of private fountain grants
     23  */
     24 #ifndef TALER_MERCHANT_HTTPD_FOUNTAINS_H
     25 #define TALER_MERCHANT_HTTPD_FOUNTAINS_H
     26 
     27 #include "taler-merchant-httpd.h"
     28 #include "merchant-database/do_insert_fountain.h"
     29 
     30 
     31 /**
     32  * Maximum number of grants in a private fountain request.
     33  */
     34 #define TMH_MAX_FOUNTAIN_GRANTS 192
     35 
     36 
     37 /**
     38  * Parse and validate the grants for POST or PATCH of a private fountain.
     39  * Checks the grant count, quota bounds, key windows and duplicate slugs.
     40  * An empty array is valid. Handling an omitted PATCH field is the caller's job.
     41  *
     42  * @param connection connection to report errors on
     43  * @param jgrants JSON array, already checked by the request body parser
     44  * @param[out] grants caller-provided storage for #TMH_MAX_FOUNTAIN_GRANTS entries;
     45  *        slug strings borrow their storage from @a jgrants
     46  * @param[out] grants_len number of grants on success, zero on failure
     47  * @return #GNUNET_OK on success, #GNUNET_NO if an error response was queued,
     48  *         #GNUNET_SYSERR if queueing the error failed
     49  */
     50 enum GNUNET_GenericReturnValue
     51 TMH_fountain_grants_parse (
     52   struct MHD_Connection *connection,
     53   const json_t *jgrants,
     54   struct TALER_MERCHANTDB_FountainGrant *grants,
     55   unsigned int *grants_len);
     56 
     57 #endif