iterate_transfers.h (3857B)
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/merchant-database/iterate_transfers.h 18 * @brief implementation of the iterate_transfers function for Postgres 19 * @author Christian Grothoff 20 */ 21 #ifndef MERCHANT_DATABASE_ITERATE_TRANSFERS_H 22 #define MERCHANT_DATABASE_ITERATE_TRANSFERS_H 23 24 #include <taler/taler_util.h> 25 #include <taler/taler_json_lib.h> 26 #include "merchantdb_lib.h" 27 28 29 /** 30 * Function called with information about a wire transfer. 31 * 32 * @param cls closure with a `json_t *` array to build up the response 33 * @param expected_credit_amount how we expect to see wired to the merchant (minus fees), NULL if unknown 34 * @param wtid wire transfer identifier 35 * @param payto_uri target account that received the wire transfer 36 * @param exchange_payto_uri account of the exchange that was debited; 37 * `full_payto` is NULL if the exchange did not tell us 38 * @param exchange_url base URL of the exchange that made the wire transfer 39 * @param transfer_serial_id serial number identifying the transfer in the backend 40 * @param expected_transfer_serial_id serial number identifying the expected transfer in the backend, 0 if not @a expected 41 * @param execution_time when did the exchange make the transfer, #GNUNET_TIME_UNIT_FOREVER_ABS 42 * if it did not yet happen 43 * @param expected true if the merchant acknowledged the wire transfer reception 44 */ 45 typedef void 46 (*TALER_MERCHANTDB_TransferCallback)( 47 void *cls, 48 const struct TALER_Amount *expected_credit_amount, 49 const struct TALER_WireTransferIdentifierRawP *wtid, 50 struct TALER_FullPayto payto_uri, 51 struct TALER_FullPayto exchange_payto_uri, 52 const char *exchange_url, 53 uint64_t transfer_serial_id, 54 uint64_t expected_transfer_serial_id, 55 struct GNUNET_TIME_Absolute execution_time, 56 bool expected); 57 58 /** 59 * Lookup transfers. Note that filtering by @a verified status is done 60 * outside of SQL, as we already have 8 prepared statements and adding 61 * a filter on verified would further double the number of statements for 62 * a likely rather ineffective filter. So we apply that filter in 63 * #lookup_transfers_cb(). 64 * 65 * @param pg database context 66 * @param instance_id instance to lookup payments for 67 * @param payto_uri account that we are interested in transfers to 68 * @param before timestamp for the earliest transfer we care about 69 * @param after timestamp for the last transfer we care about 70 * @param limit number of entries to return, negative for descending in execution time, 71 * positive for ascending in execution time 72 * @param offset transfer_serial number of the transfer we want to offset from 73 * @param expected filter for transfers that were expected 74 * @param cb function to call with detailed transfer data 75 * @param cb_cls closure for @a cb 76 * @return transaction status 77 */ 78 enum GNUNET_DB_QueryStatus 79 TALER_MERCHANTDB_iterate_transfers ( 80 struct TALER_MERCHANTDB_PostgresContext *pg, 81 const char *instance_id, 82 struct TALER_FullPayto payto_uri, 83 struct GNUNET_TIME_Timestamp before, 84 struct GNUNET_TIME_Timestamp after, 85 int64_t limit, 86 uint64_t offset, 87 enum TALER_EXCHANGE_YesNoAll expected, 88 TALER_MERCHANTDB_TransferCallback cb, 89 void *cb_cls); 90 91 #endif