do_refund.h (2969B)
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/do_refund.h 18 * @brief implementation of the do_refund function for Postgres 19 * @author Christian Grothoff 20 */ 21 #ifndef EXCHANGE_DATABASE_DO_REFUND_H 22 #define EXCHANGE_DATABASE_DO_REFUND_H 23 24 #include "taler/taler_util.h" 25 #include "exchange-database/free_coin_transaction_list.h" 26 27 /** 28 * @brief Specification for a refund operation. The combination of 29 * the coin's public key, the merchant's public key and the 30 * transaction ID must be unique. While a coin can (theoretically) be 31 * deposited at the same merchant twice (with partial spending), the 32 * merchant must either use a different public key or a different 33 * transaction ID for the two transactions. The same goes for 34 * refunds, hence we also have a "rtransaction" ID which is disjoint 35 * from the transaction ID. The same coin must not be used twice at 36 * the same merchant for the same transaction or rtransaction ID. 37 */ 38 struct TALER_EXCHANGEDB_Refund 39 { 40 /** 41 * Information about the coin that is being refunded. 42 */ 43 struct TALER_CoinPublicInfo coin; 44 45 /** 46 * Details about the refund. 47 */ 48 struct TALER_EXCHANGEDB_RefundListEntry details; 49 50 }; 51 52 53 /** 54 * Perform refund operation, checking for sufficient deposits 55 * of the coin and possibly persisting the refund details. 56 * 57 * @param pg the database context 58 * @param refund refund operation details 59 * @param deposit_fee deposit fee applicable for the coin, possibly refunded 60 * @param known_coin_id row of the coin in the known_coins table 61 * @param[out] not_found set if the deposit was not found 62 * @param[out] refund_ok set if the refund succeeded (below deposit amount) 63 * @param[out] gone if the merchant was already paid 64 * @param[out] conflict set if the refund ID was reused 65 * @return query execution status 66 */ 67 enum GNUNET_DB_QueryStatus 68 TALER_EXCHANGEDB_do_refund (struct TALER_EXCHANGEDB_PostgresContext *pg, 69 const struct TALER_EXCHANGEDB_Refund *refund, 70 const struct TALER_Amount *deposit_fee, 71 uint64_t known_coin_id, 72 bool *not_found, 73 bool *refund_ok, 74 bool *gone, 75 bool *conflict); 76 77 #endif