merchant

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

get_external_refunds_total.h (2163B)


      1 /*
      2    This file is part of TALER
      3    Copyright (C) 2026 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/get_external_refunds_total.h
     18  * @brief implementation of the get_external_refunds_total function for Postgres
     19  * @author Bohdan Potuzhnyi
     20  * @author Volodymyr Potuzhnyi
     21  */
     22 #ifndef MERCHANT_DATABASE_GET_EXTERNAL_REFUNDS_TOTAL_H
     23 #define MERCHANT_DATABASE_GET_EXTERNAL_REFUNDS_TOTAL_H
     24 
     25 #include <taler/taler_util.h>
     26 #include <taler/taler_json_lib.h>
     27 #include "merchantdb_lib.h"
     28 
     29 
     30 struct TALER_MERCHANTDB_PostgresContext;
     31 
     32 
     33 /**
     34  * Sum up the external refunds recorded for the given @a order_id.
     35  *
     36  * The summation happens in the database, so that a single row is
     37  * returned no matter how many external refunds were recorded.
     38  *
     39  * @param pg database context
     40  * @param instance_id instance's identifier
     41  * @param order_id order to sum the external refunds of
     42  * @param[out] total set to the total externally refunded amount,
     43  *        only set if #GNUNET_DB_STATUS_SUCCESS_ONE_RESULT is returned
     44  * @param[out] currency_mismatch set to true if the recorded refunds
     45  *        are not all in the same currency, in which case @a total is
     46  *        not set
     47  * @return transaction status, #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS if
     48  *         no external refund was recorded for @a order_id
     49  */
     50 enum GNUNET_DB_QueryStatus
     51 TALER_MERCHANTDB_get_external_refunds_total (
     52   struct TALER_MERCHANTDB_PostgresContext *pg,
     53   const char *instance_id,
     54   const char *order_id,
     55   struct TALER_Amount *total,
     56   bool *currency_mismatch);
     57 
     58 #endif