exchange

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

pg_do_purse_deposit.h (2547B)


      1 /*
      2    This file is part of TALER
      3    Copyright (C) 2022 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 exchangedb/pg_do_purse_deposit.h
     18  * @brief implementation of the do_purse_deposit function for Postgres
     19  * @author Christian Grothoff
     20  */
     21 #ifndef PG_DO_PURSE_DEPOSIT_H
     22 #define PG_DO_PURSE_DEPOSIT_H
     23 
     24 #include "taler/taler_util.h"
     25 #include "taler/taler_json_lib.h"
     26 #include "taler/taler_exchangedb_plugin.h"
     27 
     28 /**
     29  * Function called to execute a transaction crediting
     30  * a purse with @a amount from @a coin_pub. Reduces the
     31  * value of @a coin_pub and increase the balance of
     32  * the @a purse_pub purse. If the balance reaches the
     33  * target amount and the purse has been merged, triggers
     34  * the updates of the reserve/account balance.
     35  *
     36  * @param cls the @e cls of this struct with the plugin-specific state
     37  * @param purse_pub purse to credit
     38  * @param coin_pub coin to deposit (debit)
     39  * @param amount fraction of the coin's value to deposit
     40  * @param coin_sig signature affirming the operation
     41  * @param amount_minus_fee amount to add to the purse
     42  * @param[out] balance_ok set to false if the coin's
     43  *        remaining balance is below @a amount;
     44  *             in this case, the return value will be
     45  *             #GNUNET_DB_STATUS_SUCCESS_ONE_RESULT despite the failure
     46  * @param[out] too_late set to true if it is too late to deposit into the purse
     47  * @param[out] conflict set to true if the deposit failed due to a conflict (coin already spent,
     48  *             or deposited into this purse with a different amount)
     49  * @return transaction status code
     50  */
     51 enum GNUNET_DB_QueryStatus
     52 TEH_PG_do_purse_deposit (
     53   void *cls,
     54   const struct TALER_PurseContractPublicKeyP *purse_pub,
     55   const struct TALER_CoinSpendPublicKeyP *coin_pub,
     56   const struct TALER_Amount *amount,
     57   const struct TALER_CoinSpendSignatureP *coin_sig,
     58   const struct TALER_Amount *amount_minus_fee,
     59   bool *balance_ok,
     60   bool *too_late,
     61   bool *conflict);
     62 
     63 #endif