exchange

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

select_refunds_above_serial_id.h (4521B)


      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 src/include/exchange-database/select_refunds_above_serial_id.h
     18  * @brief implementation of the select_refunds_above_serial_id function for Postgres
     19  * @author Christian Grothoff
     20  */
     21 #ifndef EXCHANGE_DATABASE_SELECT_REFUNDS_ABOVE_SERIAL_ID_H
     22 #define EXCHANGE_DATABASE_SELECT_REFUNDS_ABOVE_SERIAL_ID_H
     23 
     24 #include "taler/taler_util.h"
     25 #include "exchangedb_lib.h"
     26 #include "exchange-database/do_refund.h"
     27 
     28 
     29 /**
     30  * Function called with details about coins that were refunding,
     31  * with the goal of auditing the refund's execution.
     32  *
     33  * @param cls closure
     34  * @param rowid unique serial ID for the refund in our DB
     35  * @param denom_pub denomination public key of @a coin_pub
     36  * @param coin_pub public key of the coin
     37  * @param merchant_pub public key of the merchant
     38  * @param merchant_sig signature of the merchant
     39  * @param h_contract_terms hash of the proposal data known to merchant and customer
     40  * @param rtransaction_id refund transaction ID chosen by the merchant
     41  * @param full_refund true if the refunds total up to the entire value of the deposit
     42  * @param amount_with_fee amount that was deposited including fee
     43  * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop
     44  */
     45 typedef enum GNUNET_GenericReturnValue
     46 (*TALER_EXCHANGEDB_RefundCallback)(
     47   void *cls,
     48   uint64_t rowid,
     49   const struct TALER_DenominationPublicKey *denom_pub,
     50   const struct TALER_CoinSpendPublicKeyP *coin_pub,
     51   const struct TALER_MerchantPublicKeyP *merchant_pub,
     52   const struct TALER_MerchantSignatureP *merchant_sig,
     53   const struct TALER_PrivateContractHashP *h_contract_terms,
     54   uint64_t rtransaction_id,
     55   bool full_refund,
     56   const struct TALER_Amount *amount_with_fee);
     57 
     58 
     59 /* Callback typedefs */
     60 /**
     61  * Function called with details about coins that were refunding,
     62  * with the goal of auditing the refund's execution.
     63  *
     64  * @param cls closure
     65  * @param rowid unique serial ID for the refund in our DB
     66  * @param denom_pub denomination public key of @a coin_pub
     67  * @param coin_pub public key of the coin
     68  * @param merchant_pub public key of the merchant
     69  * @param merchant_sig signature of the merchant
     70  * @param h_contract_terms hash of the proposal data known to merchant and customer
     71  * @param rtransaction_id refund transaction ID chosen by the merchant
     72  * @param full_refund true if the refunds total up to the entire value of the deposit
     73  * @param amount_with_fee amount that was deposited including fee
     74  * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop
     75  */
     76 typedef enum GNUNET_GenericReturnValue
     77 (*TALER_EXCHANGEDB_RefundCallback)(
     78   void *cls,
     79   uint64_t rowid,
     80   const struct TALER_DenominationPublicKey *denom_pub,
     81   const struct TALER_CoinSpendPublicKeyP *coin_pub,
     82   const struct TALER_MerchantPublicKeyP *merchant_pub,
     83   const struct TALER_MerchantSignatureP *merchant_sig,
     84   const struct TALER_PrivateContractHashP *h_contract_terms,
     85   uint64_t rtransaction_id,
     86   bool full_refund,
     87   const struct TALER_Amount *amount_with_fee);
     88 
     89 /**
     90  * Select refunds above @a serial_id in monotonically increasing
     91  * order.
     92  *
     93  * @param pg the database context
     94  * @param serial_id highest serial ID to exclude (select strictly larger)
     95  * @param cb function to call on each result
     96  * @param cb_cls closure for @a cb
     97  * @return transaction status code
     98  */
     99 enum GNUNET_DB_QueryStatus
    100 TALER_EXCHANGEDB_select_refunds_above_serial_id (struct
    101                                                  TALER_EXCHANGEDB_PostgresContext
    102                                                  *
    103                                                  pg,
    104                                                  uint64_t serial_id,
    105                                                  TALER_EXCHANGEDB_RefundCallback
    106                                                  cb,
    107                                                  void *cb_cls);
    108 
    109 #endif