merchant

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

select_donau_instances.h (3221B)


      1 /*
      2    This file is part of TALER
      3    Copyright (C) 2024 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/select_donau_instances.h
     18  * @brief implementation of the select_donau_instance function for Postgres
     19  * @author Bohdan Potuzhnyi
     20  * @author Vlada Svirsh
     21  */
     22 #ifndef MERCHANT_DATABASE_SELECT_DONAU_INSTANCES_H
     23 #define MERCHANT_DATABASE_SELECT_DONAU_INSTANCES_H
     24 
     25 #include <taler/taler_util.h>
     26 #include <taler/taler_json_lib.h>
     27 #include "merchantdb_lib.h"
     28 
     29 
     30 struct TALER_MERCHANTDB_PostgresContext;
     31 /* Callback typedefs */
     32 /**
     33  * Callback function typically used by `select_donau_instances` to handle
     34  * the details of each Donau instance retrieved from the database.
     35  *
     36  * @param cls Closure to pass additional context or data to the callback function.
     37  * @param donau_instance_serial Serial number of the Donau instance in the merchant database.
     38  * @param donau_url The URL of the Donau instance.
     39  * @param charity_name The name of the charity associated with the Donau instance.
     40  * @param charity_pub_key Pointer to the charity's public key used for cryptographic operations.
     41  * @param charity_id The unique identifier for the charity within the Donau instance.
     42  * @param charity_max_per_year Maximum allowed donations to the charity for the current year.
     43  * @param charity_receipts_to_date Total donations received by the charity so far in the current year.
     44  * @param current_year The year for which the donation data is being tracked.
     45  * @param donau_keys_json JSON object containing additional key-related information for the Donau instance, NULL if not (yet) available.
     46  */
     47 typedef void
     48 (*TALER_MERCHANTDB_DonauInstanceCallback)(
     49   void *cls,
     50   uint64_t donau_instance_serial,
     51   const char *donau_url,
     52   const char *charity_name,
     53   const struct DONAU_CharityPublicKeyP *charity_pub_key,
     54   uint64_t charity_id,
     55   const struct TALER_Amount *charity_max_per_year,
     56   const struct TALER_Amount *charity_receipts_to_date,
     57   int64_t current_year,
     58   const json_t *donau_keys_json
     59   );
     60 
     61 /**
     62  * Select Donau instances from the database.
     63  *
     64  * @param pg database context
     65  * @param id the ID of the merchant instance, NULL for all instances
     66  * @param cb callback function to call with each result
     67  * @param cb_cls closure for the callback
     68  * @return status of the PG
     69  */
     70 enum GNUNET_DB_QueryStatus
     71 TALER_MERCHANTDB_select_donau_instances (struct TALER_MERCHANTDB_PostgresContext *pg,
     72                                          const char *id,
     73                                          TALER_MERCHANTDB_DonauInstanceCallback cb,
     74                                          void *cb_cls);
     75 
     76 #endif