merchant

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

iterate_fountain_grants.h (2382B)


      1 /*
      2    This file is part of TALER
      3    Copyright (C) 2026 Taler Systems SA
      4 
      5    TALER is free software; you can redistribute it and/or modify it under the
      6    terms of the GNU 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 src/include/merchant-database/iterate_fountain_grants.h
     18  * @brief implementation of the iterate_fountain_grants function for Postgres
     19  * @author Bohdan Potuzhnyi
     20  */
     21 #ifndef MERCHANT_DATABASE_ITERATE_FOUNTAIN_GRANTS_H
     22 #define MERCHANT_DATABASE_ITERATE_FOUNTAIN_GRANTS_H
     23 
     24 #include <taler/taler_util.h>
     25 #include "merchantdb_lib.h"
     26 
     27 
     28 struct TALER_MERCHANTDB_PostgresContext;
     29 
     30 /**
     31  * Typically called by `iterate_fountain_grants`.
     32  *
     33  * @param cls closure
     34  * @param token_family_slug slug of the granted token family
     35  * @param token_family_serial serial of the granted token family
     36  * @param tokens_per_period_limit maximum withdrawals per issue-key
     37  *        validity period
     38  * @param tokens_per_period_stash suggested number of tokens to hold
     39  *        per period
     40  * @param key_window_size number of issue-key slots ahead the wallet
     41  *        may withdraw tokens for
     42  */
     43 typedef void
     44 (*TALER_MERCHANTDB_FountainGrantsCallback)(
     45   void *cls,
     46   const char *token_family_slug,
     47   uint64_t token_family_serial,
     48   uint64_t tokens_per_period_limit,
     49   uint64_t tokens_per_period_stash,
     50   uint32_t key_window_size);
     51 
     52 
     53 /**
     54  * Iterate over all grants of a fountain.
     55  *
     56  * @param pg database context
     57  * @param instance_id instance the fountain belongs to
     58  * @param fountain_serial serial of the fountain to iterate grants of
     59  * @param cb function to call with each grant
     60  * @param cb_cls closure for @a cb
     61  * @return database result code
     62  */
     63 enum GNUNET_DB_QueryStatus
     64 TALER_MERCHANTDB_iterate_fountain_grants (
     65   struct TALER_MERCHANTDB_PostgresContext *pg,
     66   const char *instance_id,
     67   uint64_t fountain_serial,
     68   TALER_MERCHANTDB_FountainGrantsCallback cb,
     69   void *cb_cls);
     70 
     71 #endif