exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

get_pending_aggregation.h (2722B)


      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/exchange-database/get_pending_aggregation.h
     18  * @brief implementation of the get_pending_aggregation function
     19  * @author Christian Grothoff
     20  */
     21 #ifndef EXCHANGE_DATABASE_GET_PENDING_AGGREGATION_H
     22 #define EXCHANGE_DATABASE_GET_PENDING_AGGREGATION_H
     23 
     24 #include "taler/taler_util.h"
     25 #include "exchangedb_lib.h"
     26 
     27 
     28 /**
     29  * Obtain the deposits that were aggregated into the wire transfer @a wtid but
     30  * that the exchange has not (yet) executed, that is: for which there is no
     31  * `wire_out` row.
     32  *
     33  * The three totals are returned separately rather than netted out because the
     34  * exchange nets them out itself in `exchange_do_aggregate`, and the caller has
     35  * to be able to reproduce that arithmetic exactly: the amount the exchange
     36  * still owes is @a total_deposited - @a total_refunded - @a total_deposit_fee,
     37  * where the deposit fee is *not* charged for coins that were refunded in full.
     38  *
     39  * @param pg the database context
     40  * @param wtid wire transfer identifier to look up
     41  * @param[out] wire_target_h_payto set to the account the transfer should go to
     42  * @param[out] payto_uri set to the URI of that account, to be freed by the
     43  *        caller; needed because the normalized form of the account is not
     44  *        replicated to an external auditor
     45  * @param[out] total_deposited set to the sum of the deposited amounts
     46  * @param[out] total_refunded set to the sum of the refunded amounts
     47  * @param[out] total_deposit_fee set to the sum of the deposit fees charged
     48  * @return #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS if the transfer was executed,
     49  *         or if no deposit was aggregated into @a wtid at all
     50  */
     51 enum GNUNET_DB_QueryStatus
     52 TALER_EXCHANGEDB_get_pending_aggregation (
     53   struct TALER_EXCHANGEDB_PostgresContext *pg,
     54   const struct TALER_WireTransferIdentifierRawP *wtid,
     55   struct TALER_FullPaytoHashP *wire_target_h_payto,
     56   struct TALER_FullPayto *payto_uri,
     57   struct TALER_Amount *total_deposited,
     58   struct TALER_Amount *total_refunded,
     59   struct TALER_Amount *total_deposit_fee);
     60 
     61 #endif