/*
   This file is part of TALER
   Copyright (C) 2023 Taler Systems SA

   TALER is free software; you can redistribute it and/or modify it under the
   terms of the GNU General Public License as published by the Free Software
   Foundation; either version 3, or (at your option) any later version.

   TALER is distributed in the hope that it will be useful, but WITHOUT ANY
   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
   A PARTICULAR PURPOSE.  See the GNU General Public License for more details.

   You should have received a copy of the GNU General Public License along with
   TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
 */
/**
 * @file src/include/donau-database/do_do_insert_receipt_issued.h
 * @brief implementation of the do_insert_receipt_issued function for Postgres
 * @author Johannes Casaburi
 */
#ifndef DONAU_DATABASE_DO_INSERT_RECEIPT_ISSUED_H
#define DONAU_DATABASE_DO_INSERT_RECEIPT_ISSUED_H

#include "donaudb_lib.h"


/**
 * Insert issued blinded donation receipt to the charity.
 *
 * @param ctx closure
 * @param year the current year
 * @param num_blinded_sig
 * @param signatures blinded signatures
 * @param charity_id identifier of the charity
 * @param h_receipt hash of the donation receipt
 * @param amount_receipts_request donation amount
 * @param[out] smaller_than_max_per_year new receipts to day smaller than the max?
 * @param[out] charity_unknown set to true if there is no charity with
 *             @a charity_id; in that case nothing was written and
 *             @a smaller_than_max_per_year is meaningless
 * @return transaction status code
 */
enum GNUNET_DB_QueryStatus
DONAUDB_do_insert_receipt_issued (
  struct DONAUDB_PostgresContext *ctx,
  uint32_t year,
  size_t num_blinded_sig,
  const struct DONAU_BlindedDonationUnitSignature signatures[num_blinded_sig],
  uint64_t charity_id,
  const struct DONAU_DonationReceiptHashP *h_receipt,
  const struct TALER_Amount *amount_receipts_request,
  bool *smaller_than_max_per_year,
  bool *charity_unknown);

#endif
