gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-merchant] 157/277: fix DB use


From: gnunet
Subject: [taler-merchant] 157/277: fix DB use
Date: Sun, 05 Jul 2020 20:51:10 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository merchant.

commit 059797b86a96e95ca4d61ccbcec690620957aaf9
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sat May 30 18:53:06 2020 +0200

    fix DB use
---
 .../taler-merchant-httpd_private-post-transfers.c  |  12 -
 src/backenddb/merchant-0001.sql                    |   2 +-
 src/backenddb/plugin_merchantdb_postgres.c         | 953 +--------------------
 src/include/taler_merchantdb_plugin.h              | 361 +-------
 4 files changed, 29 insertions(+), 1299 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_private-post-transfers.c 
b/src/backend/taler-merchant-httpd_private-post-transfers.c
index 3687f6d..23bb08e 100644
--- a/src/backend/taler-merchant-httpd_private-post-transfers.c
+++ b/src/backend/taler-merchant-httpd_private-post-transfers.c
@@ -470,18 +470,6 @@ wire_transfer_cb (void *cls,
                                   "could not start transaction");
       return;
     }
-    for (unsigned int i = 0; i < td->details_length; i++)
-    {
-      const struct TALER_TrackTransferDetails *ttd = &td->details[i];
-
-      qs = TMH_db->store_coin_to_transfer (TMH_db->cls,
-                                           &ttd->h_contract_terms,
-                                           &ttd->coin_pub,
-                                           &ptc->wtid);
-      if (0 > qs)
-        goto retry;
-    }
-
     /* Ok, exchange answer is acceptable, store it */
     qs = TMH_db->insert_transfer_details (TMH_db->cls,
                                           instance_id,
diff --git a/src/backenddb/merchant-0001.sql b/src/backenddb/merchant-0001.sql
index beef2cd..d74b852 100644
--- a/src/backenddb/merchant-0001.sql
+++ b/src/backenddb/merchant-0001.sql
@@ -415,7 +415,7 @@ CREATE TABLE IF NOT EXISTS merchant_deposit_to_transfer
   ,UNIQUE(deposit_serial,credit_serial)
 );
 COMMENT ON TABLE merchant_deposit_to_transfer
-  IS 'Mapping of deposits to (possibly unconfirmed) wire transfers';
+  IS 'Mapping of deposits to (possibly unconfirmed) wire transfers; NOTE: not 
used yet';
 COMMENT ON COLUMN merchant_deposit_to_transfer.execution_time
   IS 'Execution time as claimed by the exchange, roughly matches time seen by 
merchant';
 
diff --git a/src/backenddb/plugin_merchantdb_postgres.c 
b/src/backenddb/plugin_merchantdb_postgres.c
index a0490c5..42d5f33 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -5066,724 +5066,6 @@ postgres_insert_pickup_blind_signature (
 }
 
 
-/* ********************* OLD API ************************** */
-
-/**
- * Insert mapping of @a coin_pub and @a h_contract_terms to
- * corresponding @a wtid.
- *
- * @param cls closure
- * @param h_contract_terms hashcode of the proposal data paid by @a coin_pub
- * @param coin_pub public key of the coin
- * @param wtid identifier of the wire transfer in which the exchange
- *             send us the money for the coin deposit
- * @return transaction status
- */
-static enum GNUNET_DB_QueryStatus
-postgres_store_coin_to_transfer (void *cls,
-                                 const struct GNUNET_HashCode 
*h_contract_terms,
-                                 const struct
-                                 TALER_CoinSpendPublicKeyP *coin_pub,
-                                 const struct
-                                 TALER_WireTransferIdentifierRawP *wtid)
-{
-  struct PostgresClosure *pg = cls;
-  struct GNUNET_PQ_QueryParam params[] = {
-    GNUNET_PQ_query_param_auto_from_type (h_contract_terms),
-    GNUNET_PQ_query_param_auto_from_type (coin_pub),
-    GNUNET_PQ_query_param_auto_from_type (wtid),
-    GNUNET_PQ_query_param_end
-  };
-
-  check_connection (pg);
-  return GNUNET_PQ_eval_prepared_non_select (pg->conn,
-                                             "insert_transfer",
-                                             params);
-}
-
-
-/**
- * Insert wire transfer confirmation from the exchange into the database.
- *
- * @param cls closure
- * @param exchange_url URL of the exchange
- * @param wtid identifier of the wire transfer
- * @param execution_time when was @a wtid executed
- * @param signkey_pub public key used by the exchange for @a exchange_proof
- * @param exchange_proof proof from exchange about what the deposit was for
- * @return transaction status
- */
-static enum GNUNET_DB_QueryStatus
-postgres_store_transfer_to_proof (void *cls,
-                                  const char *exchange_url,
-                                  const struct
-                                  TALER_WireTransferIdentifierRawP *wtid,
-                                  struct GNUNET_TIME_Absolute execution_time,
-                                  const struct
-                                  TALER_ExchangePublicKeyP *signkey_pub,
-                                  const json_t *exchange_proof)
-{
-  struct PostgresClosure *pg = cls;
-  struct GNUNET_PQ_QueryParam params[] = {
-    GNUNET_PQ_query_param_string (exchange_url),
-    GNUNET_PQ_query_param_auto_from_type (wtid),
-    GNUNET_PQ_query_param_absolute_time (&execution_time),
-    GNUNET_PQ_query_param_auto_from_type (signkey_pub),
-    TALER_PQ_query_param_json (exchange_proof),
-    GNUNET_PQ_query_param_end
-  };
-
-  check_connection (pg);
-  return GNUNET_PQ_eval_prepared_non_select (pg->conn,
-                                             "insert_proof",
-                                             params);
-}
-
-
-/**
- * Closure for #find_tip_authorizations_cb().
- */
-struct GetAuthorizedTipAmountContext
-{
-  /**
-   * Total authorized amount.
-   */
-  struct TALER_Amount authorized_amount;
-
-  /**
-   * Transaction status code to set.
-   */
-  enum GNUNET_DB_QueryStatus qs;
-
-  /**
-   * Plugin context.
-   */
-  struct PostgresClosure *pg;
-
-};
-
-
-/**
- * Function to be called with the results of a SELECT statement
- * that has returned @a num_results results.
- *
- * @param cls of type `struct GetAuthorizedTipAmountContext *`
- * @param result the postgres result
- * @param num_result the number of results in @a result
- */
-static void
-find_tip_authorizations_cb (void *cls,
-                            PGresult *result,
-                            unsigned int num_results)
-{
-  struct GetAuthorizedTipAmountContext *ctx = cls;
-  struct PostgresClosure *pg = ctx->pg;
-  unsigned int i;
-
-  for (i = 0; i < num_results; i++)
-  {
-    struct TALER_Amount amount;
-    char *just;
-    json_t *extra;
-    struct GNUNET_HashCode h;
-    struct GNUNET_PQ_ResultSpec rs[] = {
-      GNUNET_PQ_result_spec_string ("justification",
-                                    &just),
-      GNUNET_PQ_result_spec_auto_from_type ("tip_id",
-                                            &h),
-      TALER_PQ_RESULT_SPEC_AMOUNT ("amount",
-                                   &amount),
-      TALER_PQ_result_spec_json ("extra",
-                                 &extra),
-      GNUNET_PQ_result_spec_end
-    };
-
-    if (GNUNET_OK !=
-        GNUNET_PQ_extract_result (result,
-                                  rs,
-                                  i))
-    {
-      GNUNET_break (0);
-      ctx->qs = GNUNET_DB_STATUS_HARD_ERROR;
-      return;
-    }
-
-    if (0 == i)
-    {
-      ctx->authorized_amount = amount;
-    }
-    else
-    {
-      if (0 >
-          TALER_amount_add (&ctx->authorized_amount,
-                            &ctx->authorized_amount,
-                            &amount))
-      {
-        GNUNET_break (0);
-        GNUNET_PQ_cleanup_result (rs);
-        ctx->qs = GNUNET_DB_STATUS_HARD_ERROR;
-        return;
-      }
-    }
-    GNUNET_PQ_cleanup_result (rs);
-  }
-
-  if (0 == i)
-  {
-    ctx->qs = GNUNET_DB_STATUS_SUCCESS_NO_RESULTS;
-  }
-  else
-  {
-    /* one aggregated result */
-    ctx->qs = GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
-  }
-}
-
-
-/**
- * Get the total amount of authorized tips for a tipping reserve.
- *
- * @param cls closure, typically a connection to the db
- * @param reserve_priv which reserve to check
- * @param[out] authorzed_amount amount we've authorized so far for tips
- * @return transaction status, usually
- *      #GNUNET_DB_STATUS_SUCCESS_ONE_RESULT for success
- *      #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS if the reserve_priv
- *      does not identify a known tipping reserve
- */
-static enum GNUNET_DB_QueryStatus
-postgres_get_authorized_tip_amount (void *cls,
-                                    const struct
-                                    TALER_ReservePrivateKeyP *reserve_priv,
-                                    struct TALER_Amount *authorized_amount)
-{
-  struct PostgresClosure *pg = cls;
-  struct GNUNET_PQ_QueryParam params[] = {
-    GNUNET_PQ_query_param_auto_from_type (reserve_priv),
-    GNUNET_PQ_query_param_end
-  };
-  enum GNUNET_DB_QueryStatus qs;
-  struct GetAuthorizedTipAmountContext ctx = {
-    .pg = pg
-  };
-
-  check_connection (pg);
-  qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn,
-                                             "find_tip_authorizations",
-                                             params,
-                                             &find_tip_authorizations_cb,
-                                             &ctx);
-  if (0 >= qs)
-    return qs;
-  *authorized_amount = ctx.authorized_amount;
-  return ctx.qs;
-}
-
-
-/**
- * Lookup proof information about a wire transfer.
- *
- * @param cls closure
- * @param exchange_url from which exchange are we looking for proof
- * @param wtid wire transfer identifier for the search
- * @param cb function to call with proof data
- * @param cb_cls closure for @a cb
- * @return transaction status
- */
-static enum GNUNET_DB_QueryStatus
-postgres_find_proof_by_wtid (void *cls,
-                             const char *exchange_url,
-                             const struct
-                             TALER_WireTransferIdentifierRawP *wtid,
-                             TALER_MERCHANTDB_ProofCallback cb,
-                             void *cb_cls)
-{
-  struct PostgresClosure *pg = cls;
-  struct GNUNET_PQ_QueryParam params[] = {
-    GNUNET_PQ_query_param_auto_from_type (wtid),
-    GNUNET_PQ_query_param_string (exchange_url),
-    GNUNET_PQ_query_param_end
-  };
-  json_t *proof;
-  struct GNUNET_PQ_ResultSpec rs[] = {
-    TALER_PQ_result_spec_json ("proof",
-                               &proof),
-    GNUNET_PQ_result_spec_end
-  };
-  enum GNUNET_DB_QueryStatus qs;
-
-  check_connection (pg);
-  qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
-                                                 "find_proof_by_wtid",
-                                                 params,
-                                                 rs);
-  if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs)
-  {
-    cb (cb_cls,
-        proof);
-    GNUNET_PQ_cleanup_result (rs);
-  }
-  return qs;
-}
-
-
-/**
- * Add @a credit to a reserve to be used for tipping.  Note that
- * this function does not actually perform any wire transfers to
- * credit the reserve, it merely tells the merchant backend that
- * a reserve was topped up.  This has to happen before tips can be
- * authorized.
- *
- * @param cls closure, typically a connection to the db
- * @param reserve_priv which reserve is topped up or created
- * @param credit_uuid unique identifier for the credit operation
- * @param credit how much money was added to the reserve
- * @param expiration when does the reserve expire?
- * @return transaction status, usually
- *      #GNUNET_DB_STATUS_SUCCESS_ONE_RESULT for success
- *      #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS if @a credit_uuid already known
- */
-static enum GNUNET_DB_QueryStatus
-postgres_enable_tip_reserve_TR (void *cls,
-                                const struct
-                                TALER_ReservePrivateKeyP *reserve_priv,
-                                const struct GNUNET_HashCode *credit_uuid,
-                                const struct TALER_Amount *credit,
-                                struct GNUNET_TIME_Absolute expiration)
-{
-  struct PostgresClosure *pg = cls;
-  struct GNUNET_TIME_Absolute old_expiration;
-  struct TALER_Amount old_balance;
-  enum GNUNET_DB_QueryStatus qs;
-  struct GNUNET_TIME_Absolute new_expiration;
-  struct TALER_Amount new_balance;
-  unsigned int retries = 0;
-
-  check_connection (pg);
-RETRY:
-  if (MAX_RETRIES < ++retries)
-    return GNUNET_DB_STATUS_SOFT_ERROR;
-  if (GNUNET_OK !=
-      postgres_start (pg,
-                      "enable tip reserve"))
-  {
-    GNUNET_break (0);
-    return GNUNET_DB_STATUS_HARD_ERROR;
-  }
-
-  /* ensure that credit_uuid is new/unique */
-  {
-    struct GNUNET_PQ_QueryParam params[] = {
-      GNUNET_PQ_query_param_auto_from_type (credit_uuid),
-      GNUNET_PQ_query_param_auto_from_type (reserve_priv),
-      GNUNET_PQ_query_param_end
-    };
-
-    struct GNUNET_PQ_ResultSpec rs[] = {
-      GNUNET_PQ_result_spec_end
-    };
-    qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
-                                                   "lookup_tip_credit_uuid",
-                                                   params,
-                                                   rs);
-    if (0 > qs)
-    {
-      GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
-      postgres_rollback (pg);
-      if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
-        goto RETRY;
-      return qs;
-    }
-    if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS != qs)
-    {
-      /* UUID already exists, we are done! */
-      postgres_rollback (pg);
-      return GNUNET_DB_STATUS_SUCCESS_NO_RESULTS;
-    }
-  }
-
-  {
-    struct GNUNET_TIME_Absolute now;
-    struct GNUNET_PQ_QueryParam params[] = {
-      GNUNET_PQ_query_param_auto_from_type (reserve_priv),
-      GNUNET_PQ_query_param_auto_from_type (credit_uuid),
-      GNUNET_PQ_query_param_absolute_time (&now),
-      TALER_PQ_query_param_amount (credit),
-      GNUNET_PQ_query_param_end
-    };
-
-    now = GNUNET_TIME_absolute_get ();
-    (void) GNUNET_TIME_round_abs (&now);
-    qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,
-                                             "insert_tip_credit_uuid",
-                                             params);
-    if (0 > qs)
-    {
-      GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
-      postgres_rollback (pg);
-      if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
-        goto RETRY;
-      return qs;
-    }
-  }
-
-  /* Obtain existing reserve balance */
-  {
-    struct GNUNET_PQ_QueryParam params[] = {
-      GNUNET_PQ_query_param_auto_from_type (reserve_priv),
-      GNUNET_PQ_query_param_end
-    };
-    struct GNUNET_PQ_ResultSpec rs[] = {
-      GNUNET_PQ_result_spec_absolute_time ("expiration",
-                                           &old_expiration),
-      TALER_PQ_RESULT_SPEC_AMOUNT ("balance",
-                                   &old_balance),
-      GNUNET_PQ_result_spec_end
-    };
-
-    qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
-                                                   
"lookup_tip_reserve_balance",
-                                                   params,
-                                                   rs);
-  }
-  if (0 > qs)
-  {
-    GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
-    postgres_rollback (pg);
-    if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
-      goto RETRY;
-    return qs;
-  }
-  if ( (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs) &&
-       (GNUNET_TIME_absolute_get_remaining (old_expiration).rel_value_us > 0) )
-  {
-    new_expiration = GNUNET_TIME_absolute_max (old_expiration,
-                                               expiration);
-    if (0 >
-        TALER_amount_add (&new_balance,
-                          credit,
-                          &old_balance))
-    {
-      GNUNET_break (0);
-      postgres_rollback (pg);
-      return GNUNET_DB_STATUS_HARD_ERROR;
-    }
-  }
-  else
-  {
-    if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                  "Old reserve balance of %s had expired at %s, not carrying 
it over!\n",
-                  TALER_amount2s (&old_balance),
-                  GNUNET_STRINGS_absolute_time_to_string (old_expiration));
-    }
-    new_expiration = expiration;
-    new_balance = *credit;
-  }
-
-  {
-    struct GNUNET_PQ_QueryParam params[] = {
-      GNUNET_PQ_query_param_auto_from_type (reserve_priv),
-      GNUNET_PQ_query_param_absolute_time (&new_expiration),
-      TALER_PQ_query_param_amount (&new_balance),
-      GNUNET_PQ_query_param_end
-    };
-    const char *stmt;
-
-    stmt = (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs)
-           ? "update_tip_reserve_balance"
-           : "insert_tip_reserve_balance";
-    qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,
-                                             stmt,
-                                             params);
-    if (0 > qs)
-    {
-      GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
-      postgres_rollback (pg);
-      if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
-        goto RETRY;
-      return qs;
-    }
-  }
-  qs = postgres_commit (pg);
-  if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
-    return GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
-  GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
-  if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
-    goto RETRY;
-  return qs;
-}
-
-
-/**
- * Find out tip authorization details associated with @a tip_id
- *
- * @param cls closure, typically a connection to the d
- * @param tip_id the unique ID for the tip
- * @param[out] exchange_url set to the URL of the exchange (unless NULL)
- * @param[out] extra extra data to pass to the wallet (unless NULL)
- * @param[out] amount set to the authorized amount (unless NULL)
- * @param[out] amount_left set to the amount left (unless NULL)
- * @param[out] timestamp set to the timestamp of the tip authorization (unless 
NULL)
- * @return transaction status, usually
- *      #GNUNET_DB_STATUS_SUCCESS_ONE_RESULT for success
- *      #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS if @a credit_uuid already known
- */
-static enum GNUNET_DB_QueryStatus
-postgres_lookup_tip_by_id (void *cls,
-                           const struct GNUNET_HashCode *tip_id,
-                           char **exchange_url,
-                           json_t **extra,
-                           struct TALER_Amount *amount,
-                           struct TALER_Amount *amount_left,
-                           struct GNUNET_TIME_Absolute *timestamp)
-{
-  struct PostgresClosure *pg = cls;
-  char *res_exchange_url;
-  json_t *res_extra;
-  struct TALER_Amount res_amount;
-  struct TALER_Amount res_amount_left;
-  struct GNUNET_TIME_Absolute res_timestamp;
-  struct GNUNET_PQ_QueryParam params[] = {
-    GNUNET_PQ_query_param_auto_from_type (tip_id),
-    GNUNET_PQ_query_param_end
-  };
-  struct GNUNET_PQ_ResultSpec rs[] = {
-    GNUNET_PQ_result_spec_string ("exchange_url",
-                                  &res_exchange_url),
-    GNUNET_PQ_result_spec_absolute_time ("timestamp",
-                                         &res_timestamp),
-    TALER_PQ_result_spec_json ("extra",
-                               &res_extra),
-    TALER_PQ_RESULT_SPEC_AMOUNT ("amount",
-                                 &res_amount),
-    TALER_PQ_RESULT_SPEC_AMOUNT ("left",
-                                 &res_amount_left),
-    GNUNET_PQ_result_spec_end
-  };
-  enum GNUNET_DB_QueryStatus qs;
-
-  qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
-                                                 "find_tip_by_id",
-                                                 params,
-                                                 rs);
-  if (0 >= qs)
-  {
-    if (NULL != exchange_url)
-      *exchange_url = NULL;
-    return qs;
-  }
-  if (NULL != exchange_url)
-    *exchange_url = strdup (res_exchange_url);
-  if (NULL != amount)
-    *amount = res_amount;
-  if (NULL != amount_left)
-    *amount_left = res_amount_left;
-  if (NULL != timestamp)
-    *timestamp = res_timestamp;
-  if (NULL != extra)
-  {
-    json_incref (res_extra);
-    *extra = res_extra;
-  }
-  GNUNET_PQ_cleanup_result (rs);
-  return qs;
-}
-
-
-/**
- * Pickup a tip over @a amount using pickup id @a pickup_id.
- *
- * @param cls closure, typically a connection to the db
- * @param amount how high is the amount picked up (with fees)
- * @param tip_id the unique ID from the tip authorization
- * @param pickup_id the unique ID identifying the pick up operation
- *        (to allow replays, hash over the coin envelope and denomination key)
- * @param[out] reserve_priv which reserve key to use to sign
- * @return taler error code
- *      #TALER_EC_TIP_PICKUP_ID_UNKNOWN if @a tip_id is unknown
- *      #TALER_EC_TIP_PICKUP_NO_FUNDS if @a tip_id has insufficient funds left
- *      #TALER_EC_TIP_PICKUP_DB_ERROR_HARD on hard database errors
- *      #TALER_EC_TIP_PICKUP_AMOUNT_CHANGED if @a amount is different for 
known @a pickup_id
- *      #TALER_EC_TIP_PICKUP_DB_ERROR_SOFT on soft database errors (client 
should retry)
- *      #TALER_EC_NONE upon success (@a reserve_priv was set)
- */
-static enum TALER_ErrorCode
-postgres_pickup_tip_TR (void *cls,
-                        const struct TALER_Amount *amount,
-                        const struct GNUNET_HashCode *tip_id,
-                        const struct GNUNET_HashCode *pickup_id,
-                        struct TALER_ReservePrivateKeyP *reserve_priv)
-{
-  struct PostgresClosure *pg = cls;
-  struct TALER_Amount left_amount;
-  struct GNUNET_PQ_QueryParam params[] = {
-    GNUNET_PQ_query_param_auto_from_type (tip_id),
-    GNUNET_PQ_query_param_end
-  };
-  struct GNUNET_PQ_ResultSpec rs[] = {
-    GNUNET_PQ_result_spec_auto_from_type ("reserve_priv",
-                                          reserve_priv),
-    TALER_PQ_RESULT_SPEC_AMOUNT ("left",
-                                 &left_amount),
-    GNUNET_PQ_result_spec_end
-  };
-  enum GNUNET_DB_QueryStatus qs;
-  unsigned int retries;
-
-  retries = 0;
-  check_connection (pg);
-RETRY:
-  if (MAX_RETRIES < ++retries)
-    return TALER_EC_TIP_PICKUP_DB_ERROR_SOFT;
-  if (GNUNET_OK !=
-      postgres_start (pg,
-                      "pickup tip"))
-  {
-    GNUNET_break (0);
-    return TALER_EC_TIP_PICKUP_DB_ERROR_HARD;
-  }
-  qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
-                                                 "lookup_reserve_by_tip_id",
-                                                 params,
-                                                 rs);
-  if (0 >= qs)
-  {
-    /* tip ID unknown */
-    memset (reserve_priv,
-            0,
-            sizeof (*reserve_priv));
-    postgres_rollback (pg);
-    if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
-      return TALER_EC_TIP_PICKUP_TIP_ID_UNKNOWN;
-    if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
-      goto RETRY;
-    return TALER_EC_TIP_PICKUP_DB_ERROR_HARD;
-  }
-
-  /* Check if pickup_id already exists */
-  {
-    struct TALER_Amount existing_amount;
-    struct GNUNET_PQ_QueryParam params[] = {
-      GNUNET_PQ_query_param_auto_from_type (pickup_id),
-      GNUNET_PQ_query_param_auto_from_type (tip_id),
-      GNUNET_PQ_query_param_end
-    };
-    struct GNUNET_PQ_ResultSpec rs[] = {
-      TALER_PQ_RESULT_SPEC_AMOUNT ("amount",
-                                   &existing_amount),
-      GNUNET_PQ_result_spec_end
-    };
-
-    qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
-                                                   "lookup_amount_by_pickup",
-                                                   params,
-                                                   rs);
-    if (0 > qs)
-    {
-      /* DB error */
-      memset (reserve_priv,
-              0,
-              sizeof (*reserve_priv));
-      postgres_rollback (pg);
-      if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
-        goto RETRY;
-      return TALER_EC_TIP_PICKUP_DB_ERROR_HARD;
-    }
-    if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs)
-    {
-      if (0 !=
-          TALER_amount_cmp (&existing_amount,
-                            amount))
-      {
-        GNUNET_break_op (0);
-        postgres_rollback (pg);
-        return TALER_EC_TIP_PICKUP_AMOUNT_CHANGED;
-      }
-      qs = postgres_commit (pg);
-      if (qs < 0)
-        return (GNUNET_DB_STATUS_SOFT_ERROR == qs)
-               ? TALER_EC_TIP_PICKUP_DB_ERROR_SOFT
-               : TALER_EC_TIP_PICKUP_DB_ERROR_HARD;
-      return TALER_EC_NONE; /* we are done! */
-    }
-  }
-
-  /* Calculate new balance */
-  {
-    struct TALER_Amount new_left;
-
-    if (0 >
-        TALER_amount_subtract (&new_left,
-                               &left_amount,
-                               amount))
-    {
-      /* attempt to take more tips than the tipping amount */
-      GNUNET_break_op (0);
-      memset (reserve_priv,
-              0,
-              sizeof (*reserve_priv));
-      postgres_rollback (pg);
-      return TALER_EC_TIP_PICKUP_NO_FUNDS;
-    }
-
-    /* Update DB: update balance */
-    {
-      struct GNUNET_PQ_QueryParam params[] = {
-        GNUNET_PQ_query_param_auto_from_type (tip_id),
-        TALER_PQ_query_param_amount (&new_left),
-        GNUNET_PQ_query_param_end
-      };
-
-      qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,
-                                               "update_tip_balance",
-                                               params);
-      if (0 > qs)
-      {
-        postgres_rollback (pg);
-        memset (reserve_priv,
-                0,
-                sizeof (*reserve_priv));
-        if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
-          goto RETRY;
-        return TALER_EC_TIP_PICKUP_DB_ERROR_HARD;
-      }
-    }
-
-    /* Update DB: remember pickup_id */
-    {
-      struct GNUNET_PQ_QueryParam params[] = {
-        GNUNET_PQ_query_param_auto_from_type (tip_id),
-        GNUNET_PQ_query_param_auto_from_type (pickup_id),
-        TALER_PQ_query_param_amount (amount),
-        GNUNET_PQ_query_param_end
-      };
-
-      qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,
-                                               "insert_pickup_id",
-                                               params);
-      if (0 > qs)
-      {
-        postgres_rollback (pg);
-        memset (reserve_priv,
-                0,
-                sizeof (*reserve_priv));
-        if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
-          goto RETRY;
-        return TALER_EC_TIP_PICKUP_DB_ERROR_HARD;
-      }
-    }
-  }
-  qs = postgres_commit (pg);
-  if (0 <= qs)
-    return TALER_EC_NONE; /* success  */
-  if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
-    goto RETRY;
-  return TALER_EC_TIP_PICKUP_DB_ERROR_HARD;
-}
-
-
 /**
  * Initialize Postgres database subsystem.
  *
@@ -7827,229 +7109,6 @@ libtaler_plugin_merchantdb_postgres_init (void *cls)
                             " FROM merchant_tip_pickups"
                             " WHERE pickup_id=$1",
                             3),
-
-    /* OLD API: */
-#if 0
-    GNUNET_PQ_make_prepare ("insert_contract_terms",
-                            "INSERT INTO merchant_contract_terms"
-                            "(order_id"
-                            ",merchant_pub"
-                            ",timestamp"
-                            ",contract_terms"
-                            ",h_contract_terms)"
-                            " VALUES "
-                            "($1, $2, $3, $4, $5)",
-                            5),
-    GNUNET_PQ_make_prepare ("insert_session_info",
-                            "INSERT INTO merchant_session_info"
-                            "(session_id"
-                            ",fulfillment_url"
-                            ",order_id"
-                            ",merchant_pub"
-                            ",timestamp)"
-                            " VALUES "
-                            "($1, $2, $3, $4, $5)",
-                            5),
-    GNUNET_PQ_make_prepare ("find_contract_terms_from_hash",
-                            "SELECT"
-                            " contract_terms"
-                            " FROM merchant_contract_terms"
-                            " WHERE h_contract_terms=$1"
-                            "   AND merchant_pub=$2",
-                            2),
-    GNUNET_PQ_make_prepare ("find_paid_contract_terms_from_hash",
-                            "SELECT"
-                            " contract_terms"
-                            " FROM merchant_contract_terms"
-                            " WHERE h_contract_terms=$1"
-                            "   AND merchant_pub=$2"
-                            "   AND paid=TRUE",
-                            2),
-    GNUNET_PQ_make_prepare ("find_refunds",
-                            "SELECT"
-                            " refund_amount_val"
-                            ",refund_amount_frac"
-                            " FROM merchant_refunds"
-                            " WHERE coin_pub=$1",
-                            1),
-    GNUNET_PQ_make_prepare ("find_deposits",
-                            "SELECT"
-                            " coin_pub"
-                            ",exchange_url"
-                            ",amount_with_fee_val"
-                            ",amount_with_fee_frac"
-                            ",deposit_fee_val"
-                            ",deposit_fee_frac"
-                            ",refund_fee_val"
-                            ",refund_fee_frac"
-                            ",wire_fee_val"
-                            ",wire_fee_frac"
-                            ",exchange_proof"
-                            " FROM merchant_deposits"
-                            " WHERE h_contract_terms=$1"
-                            " AND merchant_pub=$2",
-                            2),
-    GNUNET_PQ_make_prepare ("find_deposits_by_hash_and_coin",
-                            "SELECT"
-                            " amount_with_fee_val"
-                            ",amount_with_fee_frac"
-                            ",deposit_fee_val"
-                            ",deposit_fee_frac"
-                            ",refund_fee_val"
-                            ",refund_fee_frac"
-                            ",wire_fee_val"
-                            ",wire_fee_frac"
-                            ",exchange_url"
-                            ",exchange_proof"
-                            " FROM merchant_deposits"
-                            " WHERE h_contract_terms=$1"
-                            " AND merchant_pub=$2"
-                            " AND coin_pub=$3",
-                            3),
-    GNUNET_PQ_make_prepare ("find_transfers_by_hash",
-                            "SELECT"
-                            " coin_pub"
-                            ",wtid"
-                            ",merchant_proofs.execution_time"
-                            ",merchant_proofs.proof"
-                            " FROM merchant_transfers"
-                            "   JOIN merchant_proofs USING (wtid)"
-                            " WHERE h_contract_terms=$1",
-                            1),
-    GNUNET_PQ_make_prepare ("find_deposits_by_wtid",
-                            "SELECT"
-                            " merchant_transfers.h_contract_terms"
-                            ",merchant_transfers.coin_pub"
-                            ",merchant_deposits.amount_with_fee_val"
-                            ",merchant_deposits.amount_with_fee_frac"
-                            ",merchant_deposits.deposit_fee_val"
-                            ",merchant_deposits.deposit_fee_frac"
-                            ",merchant_deposits.refund_fee_val"
-                            ",merchant_deposits.refund_fee_frac"
-                            ",merchant_deposits.wire_fee_val"
-                            ",merchant_deposits.wire_fee_frac"
-                            ",merchant_deposits.exchange_url"
-                            ",merchant_deposits.exchange_proof"
-                            " FROM merchant_transfers"
-                            "   JOIN merchant_deposits"
-                            "     USING (h_contract_terms,coin_pub)"
-                            " WHERE wtid=$1",
-                            1),
-    GNUNET_PQ_make_prepare ("find_proof_by_wtid",
-                            "SELECT"
-                            " proof"
-                            " FROM merchant_proofs"
-                            " WHERE wtid=$1"
-                            "  AND exchange_url=$2",
-                            2),
-    GNUNET_PQ_make_prepare ("lookup_tip_reserve_balance",
-                            "SELECT"
-                            " expiration"
-                            ",balance_val"
-                            ",balance_frac"
-                            " FROM merchant_tip_reserves"
-                            " WHERE reserve_priv=$1",
-                            1),
-    GNUNET_PQ_make_prepare ("find_tip_authorizations",
-                            "SELECT"
-                            " amount_val"
-                            ",amount_frac"
-                            ",justification"
-                            ",extra"
-                            ",tip_id"
-                            " FROM merchant_tips"
-                            " WHERE reserve_priv=$1",
-                            1),
-    GNUNET_PQ_make_prepare ("update_tip_reserve_balance",
-                            "UPDATE merchant_tip_reserves SET"
-                            " expiration=$2"
-                            ",balance_val=$3"
-                            ",balance_frac=$4"
-                            " WHERE reserve_priv=$1",
-                            4),
-    GNUNET_PQ_make_prepare ("insert_tip_reserve_balance",
-                            "INSERT INTO merchant_tip_reserves"
-                            "(reserve_priv"
-                            ",expiration"
-                            ",balance_val"
-                            ",balance_frac"
-                            ") VALUES "
-                            "($1, $2, $3, $4)",
-                            4),
-    GNUNET_PQ_make_prepare ("insert_tip_justification",
-                            "INSERT INTO merchant_tips"
-                            "(reserve_priv"
-                            ",tip_id"
-                            ",exchange_url"
-                            ",justification"
-                            ",extra"
-                            ",timestamp"
-                            ",amount_val"
-                            ",amount_frac"
-                            ",left_val"
-                            ",left_frac"
-                            ") VALUES "
-                            "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)",
-                            10),
-    GNUNET_PQ_make_prepare ("lookup_reserve_by_tip_id",
-                            "SELECT"
-                            " reserve_priv"
-                            ",left_val"
-                            ",left_frac"
-                            " FROM merchant_tips"
-                            " WHERE tip_id=$1",
-                            1),
-    GNUNET_PQ_make_prepare ("lookup_amount_by_pickup",
-                            "SELECT"
-                            " amount_val"
-                            ",amount_frac"
-                            " FROM merchant_tip_pickups"
-                            " WHERE pickup_id=$1"
-                            " AND tip_id=$2",
-                            2),
-    GNUNET_PQ_make_prepare ("find_tip_by_id",
-                            "SELECT"
-                            " exchange_url"
-                            ",extra"
-                            ",timestamp"
-                            ",amount_val"
-                            ",amount_frac"
-                            ",left_val"
-                            ",left_frac"
-                            " FROM merchant_tips"
-                            " WHERE tip_id=$1",
-                            1),
-    GNUNET_PQ_make_prepare ("update_tip_balance",
-                            "UPDATE merchant_tips SET"
-                            " left_val=$2"
-                            ",left_frac=$3"
-                            " WHERE tip_id=$1",
-                            3),
-    GNUNET_PQ_make_prepare ("insert_pickup_id",
-                            "INSERT INTO merchant_tip_pickups"
-                            "(tip_id"
-                            ",pickup_id"
-                            ",amount_val"
-                            ",amount_frac"
-                            ") VALUES "
-                            "($1, $2, $3, $4)",
-                            4),
-    GNUNET_PQ_make_prepare ("insert_tip_credit_uuid",
-                            "INSERT INTO merchant_tip_reserve_credits"
-                            "(reserve_priv"
-                            ",credit_uuid"
-                            ",timestamp"
-                            ",amount_val"
-                            ",amount_frac"
-                            ") VALUES "
-                            "($1, $2, $3, $4, $5)",
-                            5),
-    GNUNET_PQ_make_prepare ("lookup_tip_credit_uuid",
-                            "SELECT 1 "
-                            "FROM merchant_tip_reserve_credits "
-                            "WHERE credit_uuid=$1 AND reserve_priv=$2",
-                            2),
-#endif
     GNUNET_PQ_PREPARED_STATEMENT_END
   };
 
@@ -8140,6 +7199,7 @@ libtaler_plugin_merchantdb_postgres_init (void *cls)
   plugin->lookup_transfer_summary = &postgres_lookup_transfer_summary;
   plugin->lookup_transfer_details = &postgres_lookup_transfer_details;
   plugin->lookup_transfers = &postgres_lookup_transfers;
+  plugin->store_wire_fee_by_exchange = &postgres_store_wire_fee_by_exchange;
   plugin->insert_reserve = &postgres_insert_reserve;
   plugin->lookup_reserves = &postgres_lookup_reserves;
   plugin->lookup_reserve = &postgres_lookup_reserve;
@@ -8152,17 +7212,6 @@ libtaler_plugin_merchantdb_postgres_init (void *cls)
   plugin->insert_pickup = &postgres_insert_pickup;
   plugin->insert_pickup_blind_signature =
     &postgres_insert_pickup_blind_signature;
-  /* OLD API: */
-
-  plugin->store_coin_to_transfer = &postgres_store_coin_to_transfer;
-  plugin->store_transfer_to_proof = &postgres_store_transfer_to_proof;
-  plugin->store_wire_fee_by_exchange = &postgres_store_wire_fee_by_exchange;
-  plugin->find_proof_by_wtid = &postgres_find_proof_by_wtid;
-  plugin->get_authorized_tip_amount = &postgres_get_authorized_tip_amount;
-  plugin->enable_tip_reserve_TR = &postgres_enable_tip_reserve_TR;
-  plugin->lookup_tip_by_id = &postgres_lookup_tip_by_id;
-  plugin->pickup_tip_TR = &postgres_pickup_tip_TR;
-
   return plugin;
 }
 
diff --git a/src/include/taler_merchantdb_plugin.h 
b/src/include/taler_merchantdb_plugin.h
index fe306b7..ef55729 100644
--- a/src/include/taler_merchantdb_plugin.h
+++ b/src/include/taler_merchantdb_plugin.h
@@ -1559,6 +1559,33 @@ struct TALER_MERCHANTDB_Plugin
                       void *cb_cls);
 
 
+  /**
+   * Store information about wire fees charged by an exchange,
+   * including signature (so we have proof).
+   *
+   * @param cls closure
+   * @param exchange_pub public key of the exchange
+   * @param h_wire_method hash of wire method
+   * @param wire_fee wire fee charged
+   * @param closing_fee closing fee charged (irrelevant for us,
+   *              but needed to check signature)
+   * @param start_date start of fee being used
+   * @param end_date end of fee being used
+   * @param exchange_sig signature of exchange over fee structure
+   * @return transaction status code
+   */
+  enum GNUNET_DB_QueryStatus
+  (*store_wire_fee_by_exchange)(
+    void *cls,
+    const struct TALER_MasterPublicKeyP *exchange_pub,
+    const struct GNUNET_HashCode *h_wire_method,
+    const struct TALER_Amount *wire_fee,
+    const struct TALER_Amount *closing_fee,
+    struct GNUNET_TIME_Absolute start_date,
+    struct GNUNET_TIME_Absolute end_date,
+    const struct TALER_MasterSignatureP *exchange_sig);
+
+
   /**
    * Add @a credit to a reserve to be used for tipping.  Note that
    * this function does not actually perform any wire transfers to
@@ -1812,340 +1839,6 @@ struct TALER_MERCHANTDB_Plugin
     uint32_t offset,
     const struct GNUNET_CRYPTO_RsaSignature *blind_sig);
 
-
-  /* ****************** OLD API ******************** */
-
-
-  /**
-   * Retrieve proposal data given its hashcode
-   *
-   * @param cls closure
-   * @param[out] contract_terms where to store the result
-   * @param h_contract_terms hashcode used to lookup.
-   * @param merchant_pub instance's public key.
-   * @return transaction status
-   */
-  enum GNUNET_DB_QueryStatus
-  (*find_contract_terms_from_hash)(
-    void *cls,
-    json_t **contract_terms,
-    const struct GNUNET_HashCode *h_contract_terms,
-    const struct TALER_MerchantPublicKeyP *merchant_pub);
-
-
-  /**
-   * Retrieve paid contract terms data given its hashcode.
-   *
-   * @param cls closure
-   * @param[out] contract_terms where to store the result
-   * @param h_contract_terms hashcode used to lookup.
-   * @param merchant_pub instance's public key.
-   * @return transaction status
-   */
-  enum GNUNET_DB_QueryStatus
-  (*find_paid_contract_terms_from_hash)(
-    void *cls,
-    json_t **contract_terms,
-    const struct GNUNET_HashCode *h_contract_terms,
-    const struct TALER_MerchantPublicKeyP *merchant_pub);
-
-
-  /**
-   * Return proposals whose timestamps are younger than `date`.
-   * Among those proposals, only those ones being between the
-   * start-th and (start-nrows)-th record are returned.  The rows
-   * are sorted having the youngest first.
-   *
-   * @param cls our plugin handle.
-   * @param date only results younger than this date are returned.
-   * @param merchant_pub instance's public key; only rows related to this
-   * instance are returned.
-   * @param start only rows with serial id less than start are returned.
-   * @param nrows only nrows rows are returned.
-   * @param past if set to #GNUNET_YES, retrieves rows older than `date`.
-   * @param ascending if GNUNET_YES, then results will be sorted with youngest 
first.
-   * This is typically used to show live updates on the merchant's backoffice
-   * @param cb function to call with transaction data, can be NULL.
-   * @param cb_cls closure for @a cb
-   * @return transaction status
-   */
-  enum GNUNET_DB_QueryStatus
-  (*find_contract_terms_by_date_and_range)(
-    void *cls,
-    struct GNUNET_TIME_Absolute date,
-    const struct TALER_MerchantPublicKeyP *merchant_pub,
-    uint64_t start,
-    uint64_t nrows,
-    int past,
-    unsigned int ascending,
-    TALER_MERCHANTDB_ProposalDataCallback cb,
-    void *cb_cls);
-
-  /**
-   * Lookup for a proposal, respecting the signature used by the
-   * /history's db methods.
-   *
-   * @param cls db plugin handle
-   * @param order_id order id used to search for the proposal data
-   * @param merchant_pub public key of the merchant using this method
-   * @param cb the callback
-   * @param cb_cls closure to pass to @a cb
-   * @return transaction status
-   */
-  enum GNUNET_DB_QueryStatus
-  (*find_contract_terms_history)(
-    void *cls,
-    const char *order_id,
-    const struct TALER_MerchantPublicKeyP *merchant_pub,
-    TALER_MERCHANTDB_ProposalDataCallback cb,
-    void *cb_cls);
-
-
-  /**
-   * Return proposals whose timestamp are older than `date`.
-   * The rows are sorted having the youngest first.*
-   *
-   * @param cls our plugin handle.
-   * @param date only results older than this date are returned.
-   * @param merchant_pub instance's public key; only rows related to this
-   * instance are returned.
-   * @param nrows only nrows rows are returned.
-   * @param cb function to call with transaction data, can be NULL.
-   * @param cb_cls closure for @a cb
-   * @return transaction status
-   */
-  enum GNUNET_DB_QueryStatus
-  (*find_contract_terms_by_date)(
-    void *cls,
-    struct GNUNET_TIME_Absolute date,
-    const struct TALER_MerchantPublicKeyP *merchant_pub,
-    uint64_t nrows,
-    TALER_MERCHANTDB_ProposalDataCallback cb,
-    void *cb_cls);
-
-
-  /**
-   * Insert mapping of @a coin_pub and @a h_contract_terms to
-   * corresponding @a wtid.
-   *
-   * @param cls closure
-   * @param h_contract_terms proposal data's hashcode
-   * @param coin_pub public key of the coin
-   * @param wtid identifier of the wire transfer in which the exchange
-   *             send us the money for the coin deposit
-   * @return transaction status
-   */
-  enum GNUNET_DB_QueryStatus
-  (*store_coin_to_transfer)(
-    void *cls,
-    const struct GNUNET_HashCode *h_contract_terms,
-    const struct TALER_CoinSpendPublicKeyP *coin_pub,
-    const struct TALER_WireTransferIdentifierRawP *wtid);
-
-
-  /**
-   * Insert wire transfer confirmation from the exchange into the database.
-   *
-   * @param cls closure
-   * @param exchange_url from which exchange did we get the @a exchange_proof
-   * @param wtid identifier of the wire transfer
-   * @param execution_time when was @a wtid executed
-   * @param signkey_pub public key used by the exchange for @a exchange_proof
-   * @param exchange_proof proof from exchange about what the deposit was for
-   * @return transaction status
-   */
-  enum GNUNET_DB_QueryStatus
-  (*store_transfer_to_proof)(
-    void *cls,
-    const char *exchange_url,
-    const struct TALER_WireTransferIdentifierRawP *wtid,
-    struct GNUNET_TIME_Absolute execution_time,
-    const struct TALER_ExchangePublicKeyP *signkey_pub,
-    const json_t *exchange_proof);
-
-
-  /**
-   * Store information about wire fees charged by an exchange,
-   * including signature (so we have proof).
-   *
-   * @param cls closure
-   * @param exchange_pub public key of the exchange
-   * @param h_wire_method hash of wire method
-   * @param wire_fee wire fee charged
-   * @param closing_fee closing fee charged (irrelevant for us,
-   *              but needed to check signature)
-   * @param start_date start of fee being used
-   * @param end_date end of fee being used
-   * @param exchange_sig signature of exchange over fee structure
-   * @return transaction status code
-   */
-  enum GNUNET_DB_QueryStatus
-  (*store_wire_fee_by_exchange)(
-    void *cls,
-    const struct TALER_MasterPublicKeyP *exchange_pub,
-    const struct GNUNET_HashCode *h_wire_method,
-    const struct TALER_Amount *wire_fee,
-    const struct TALER_Amount *closing_fee,
-    struct GNUNET_TIME_Absolute start_date,
-    struct GNUNET_TIME_Absolute end_date,
-    const struct TALER_MasterSignatureP *exchange_sig);
-
-
-  /**
-   * Lookup proof information about a wire transfer.
-   *
-   * @param cls closure
-   * @param exchange_url from which exchange are we looking for proof
-   * @param wtid wire transfer identifier for the search
-   * @param cb function to call with proof data
-   * @param cb_cls closure for @a cb
-   * @return transaction status
-   */
-  enum GNUNET_DB_QueryStatus
-  (*find_proof_by_wtid)(void *cls,
-                        const char *exchange_url,
-                        const struct TALER_WireTransferIdentifierRawP *wtid,
-                        TALER_MERCHANTDB_ProofCallback cb,
-                        void *cb_cls);
-
-
-  /**
-   * Obtain refund proofs associated with a refund operation on a
-   * coin.
-   *
-   * @param cls closure, typically a connection to the db
-   * @param merchant_pub public key of the merchant instance
-   * @param h_contract_terms hash code of the contract
-   * @param coin_pub public key of the coin
-   * @param rtransaction_id identificator of the refund
-   * @param[out] exchange_pub public key of the exchange affirming the refund
-   * @param[out] exchange_sig signature of the exchange affirming the refund
-   * @return transaction status
-   */
-  enum GNUNET_DB_QueryStatus
-  (*get_refund_proof)(
-    void *cls,
-    const struct TALER_MerchantPublicKeyP *merchant_pub,
-    const struct GNUNET_HashCode *h_contract_terms,
-    const struct TALER_CoinSpendPublicKeyP *coin_pub,
-    uint64_t rtransaction_id,
-    struct TALER_ExchangePublicKeyP *exchange_pub,
-    struct TALER_ExchangeSignatureP *exchange_sig);
-
-
-  /**
-   * Store refund proofs associated with a refund operation on a
-   * coin.
-   *
-   * @param cls closure, typically a connection to the db
-   * @param merchant_pub public key of the merchant instance
-   * @param h_contract_terms hash code of the contract
-   * @param coin_pub public key of the coin
-   * @param rtransaction_id identificator of the refund
-   * @param exchange_pub public key of the exchange affirming the refund
-   * @param exchange_sig signature of the exchange affirming the refund
-   * @return transaction status
-   */
-  enum GNUNET_DB_QueryStatus
-  (*put_refund_proof)(
-    void *cls,
-    const struct TALER_MerchantPublicKeyP *merchant_pub,
-    const struct GNUNET_HashCode *h_contract_terms,
-    const struct TALER_CoinSpendPublicKeyP *coin_pub,
-    uint64_t rtransaction_id,
-    const struct TALER_ExchangePublicKeyP *exchange_pub,
-    const struct TALER_ExchangeSignatureP *exchange_sig);
-
-
-  /**
-   * Add @a credit to a reserve to be used for tipping.  Note that
-   * this function does not actually perform any wire transfers to
-   * credit the reserve, it merely tells the merchant backend that
-   * a reserve was topped up.  This has to happen before tips can be
-   * authorized.
-   *
-   * @param cls closure, typically a connection to the db
-   * @param reserve_priv which reserve is topped up or created
-   * @param credit_uuid unique identifier for the credit operation
-   * @param credit how much money was added to the reserve
-   * @param expiration when does the reserve expire?
-   * @return transaction status, usually
-   *      #GNUNET_DB_STATUS_SUCCESS_ONE_RESULT for success
-   *      #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS if @a credit_uuid already known
-   */
-  enum GNUNET_DB_QueryStatus
-  (*enable_tip_reserve_TR)(void *cls,
-                           const struct TALER_ReservePrivateKeyP *reserve_priv,
-                           const struct GNUNET_HashCode *credit_uuid,
-                           const struct TALER_Amount *credit,
-                           struct GNUNET_TIME_Absolute expiration);
-
-
-  /**
-   * Get the total amount of authorized tips for a tipping reserve.
-   *
-   * @param cls closure, typically a connection to the db
-   * @param reserve_priv which reserve to check
-   * @param[out] authorzed_amount amount we've authorized so far for tips
-   * @return transaction status, usually
-   *      #GNUNET_DB_STATUS_SUCCESS_ONE_RESULT for success
-   *      #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS if the reserve_priv
-   *      does not identify a known tipping reserve
-   */
-  enum GNUNET_DB_QueryStatus
-  (*get_authorized_tip_amount)(void *cls,
-                               const struct
-                               TALER_ReservePrivateKeyP *reserve_priv,
-                               struct TALER_Amount *authorized_amount);
-
-
-  /**
-   * Find out tip authorization details associated with @a tip_id
-   *
-   * @param cls closure, typically a connection to the d
-   * @param tip_id the unique ID for the tip
-   * @param[out] exchange_url set to the URL of the exchange (unless NULL)
-   * @param[out] extra extra data to pass to the wallet
-   * @param[out] amount set to the authorized amount (unless NULL)
-   * @param[out] amount_left set to the amount left (unless NULL)
-   * @param[out] timestamp set to the timestamp of the tip authorization 
(unless NULL)
-   * @return transaction status, usually
-   *      #GNUNET_DB_STATUS_SUCCESS_ONE_RESULT for success
-   *      #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS if @a credit_uuid already known
-   */
-  enum GNUNET_DB_QueryStatus
-  (*lookup_tip_by_id)(void *cls,
-                      const struct GNUNET_HashCode *tip_id,
-                      char **exchange_url,
-                      json_t **extra,
-                      struct TALER_Amount *amount,
-                      struct TALER_Amount *amount_left,
-                      struct GNUNET_TIME_Absolute *timestamp);
-
-
-  /**
-   * Pickup a tip over @a amount using pickup id @a pickup_id.
-   *
-   * @param cls closure, typically a connection to the db
-   * @param amount how high is the amount picked up (with fees)
-   * @param tip_id the unique ID from the tip authorization
-   * @param pickup_id the unique ID identifying the pick up operation
-   *        (to allow replays, hash over the coin envelope and denomination 
key)
-   * @param[out] reserve_priv which reserve key to use to sign
-   * @return taler error code
-   *      #TALER_EC_TIP_PICKUP_ID_UNKNOWN if @a tip_id is unknown
-   *      #TALER_EC_TIP_PICKUP_NO_FUNDS if @a tip_id has insufficient funds 
left
-   *      #TALER_EC_TIP_PICKUP_DB_ERROR on database errors
-   *      #TALER_EC_NONE upon success (@a reserve_priv was set)
-   */
-  enum TALER_ErrorCode
-  (*pickup_tip_TR)(void *cls,
-                   const struct TALER_Amount *amount,
-                   const struct GNUNET_HashCode *tip_id,
-                   const struct GNUNET_HashCode *pickup_id,
-                   struct TALER_ReservePrivateKeyP *reserve_priv);
-
-
 };
 
 #endif

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]