merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

lookup_expected_transfers.h (3855B)


      1 /*
      2    This file is part of TALER
      3    Copyright (C) 2025 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/lookup_expected_transfers.h
     18  * @brief implementation of the lookup_expected_transfers function for Postgres
     19  * @author Christian Grothoff
     20  */
     21 #ifndef MERCHANT_DATABASE_LOOKUP_EXPECTED_TRANSFERS_H
     22 #define MERCHANT_DATABASE_LOOKUP_EXPECTED_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 expected incoming wire transfers.
     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_url base URL of the exchange that made the wire transfer
     37  * @param expected_transfer_serial_id serial number identifying the expected transfer in the backend
     38  * @param execution_time when did the exchange claim to have made the transfer
     39  * @param confirmed true if the merchant confirmed this wire transfer
     40  *                 false if it is so far only claimed to have been made by the exchange
     41  * @param validated true if the reconciliation succeeded
     42  * @param last_http_status HTTP status of our last request to the exchange for this transfer
     43  * @param last_ec last error code we got back (otherwise #TALER_EC_NONE)
     44  * @param last_error_detail last detail we got back (or NULL for none)
     45  */
     46 typedef void
     47 (*TALER_MERCHANTDB_IncomingCallback)(
     48   void *cls,
     49   const struct TALER_Amount *expected_credit_amount,
     50   const struct TALER_WireTransferIdentifierRawP *wtid,
     51   struct TALER_FullPayto payto_uri,
     52   const char *exchange_url,
     53   uint64_t expected_transfer_serial_id,
     54   struct GNUNET_TIME_Timestamp execution_time,
     55   bool confirmed,
     56   bool validated,
     57   unsigned int last_http_status,
     58   enum TALER_ErrorCode last_ec,
     59   const char *last_error_detail);
     60 
     61 /**
     62  * Lookup expected incoming transfers.
     63  *
     64  * @param pg database context
     65  * @param instance_id instance to lookup payments for
     66  * @param payto_uri account that we are interested in transfers to
     67  * @param before timestamp for the earliest transfer we care about
     68  * @param after timestamp for the last transfer we care about
     69  * @param limit number of entries to return, negative for descending in execution time,
     70  *                positive for ascending in execution time
     71  * @param offset expected_transfer_serial number of the transfer we want to offset from
     72  * @param confirmed filter by confirmation status
     73  * @param verified filter by verification status
     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_lookup_expected_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 confirmed,
     88   enum TALER_EXCHANGE_YesNoAll verified,
     89   TALER_MERCHANTDB_IncomingCallback cb,
     90   void *cb_cls);
     91 
     92 
     93 #endif