gnunet-svn
[Top][All Lists]
Advanced

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

[taler-merchant] branch master updated (332630ca -> 906e3035)


From: gnunet
Subject: [taler-merchant] branch master updated (332630ca -> 906e3035)
Date: Tue, 11 May 2021 19:19:25 +0200

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

grothoff pushed a change to branch master
in repository merchant.

    from 332630ca add test about transaction inserting
     new 5ab6a385 add instance to query to ensure no cross-instance conflicts; 
still, this does not explain the GNUNET_break()/assert failure in #6854
     new b4697925 Merge branch 'master' of git+ssh://git.taler.net/merchant
     new 5463f26b fix typo
     new 906e3035 fix #6861, maybe #6854

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 ...merchant-httpd_private-patch-orders-ID-forget.c |  43 +++++-
 .../taler-merchant-httpd_private-post-transfers.c  |  25 +++-
 src/backenddb/merchant-0001.sql                    |   2 +-
 src/backenddb/plugin_merchantdb_postgres.c         |  23 ++-
 src/backenddb/test_merchantdb.c                    | 163 +++++++++++----------
 src/include/taler_merchantdb_plugin.h              |   2 +
 src/lib/merchant_api_delete_instance.c             |   4 +-
 src/lib/merchant_api_get_instances.c               |   4 +
 src/lib/merchant_api_patch_order_forget.c          |   4 +
 src/testing/test_merchant_order_creation.sh        |   2 +-
 src/testing/testing_api_cmd_delete_instance.c      |   3 +-
 src/testing/testing_api_cmd_delete_order.c         |   2 +-
 src/testing/testing_api_cmd_delete_product.c       |  11 +-
 src/testing/testing_api_cmd_delete_reserve.c       |   3 +-
 src/testing/testing_api_cmd_get_instance.c         |   7 +-
 src/testing/testing_api_cmd_get_instances.c        |   3 +-
 src/testing/testing_api_cmd_lock_product.c         |  12 +-
 src/testing/testing_api_cmd_merchant_get_order.c   |   3 +-
 src/testing/testing_api_cmd_patch_instance.c       |   9 +-
 src/testing/testing_api_cmd_patch_product.c        |  14 +-
 src/testing/testing_api_cmd_post_instances.c       |   9 +-
 src/testing/testing_api_cmd_post_orders.c          |   1 -
 src/testing/testing_api_cmd_post_products.c        |  10 +-
 src/testing/testing_api_cmd_post_reserves.c        |  11 +-
 src/testing/testing_api_cmd_post_transfers.c       |   8 +-
 src/testing/testing_api_cmd_refund_order.c         |  11 +-
 26 files changed, 268 insertions(+), 121 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_private-patch-orders-ID-forget.c 
b/src/backend/taler-merchant-httpd_private-patch-orders-ID-forget.c
index 2ec8193a..da56cda2 100644
--- a/src/backend/taler-merchant-httpd_private-patch-orders-ID-forget.c
+++ b/src/backend/taler-merchant-httpd_private-patch-orders-ID-forget.c
@@ -46,11 +46,31 @@ forget (void *cls,
         json_t *parent)
 {
   int *res = cls;
+  int ret;
 
-  if (GNUNET_OK !=
-      TALER_JSON_contract_part_forget (parent,
-                                       object_id))
+  ret = TALER_JSON_contract_part_forget (parent,
+                                         object_id);
+  if (GNUNET_SYSERR == ret)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                "Matching path `%s' not forgettable!\n",
+                object_id);
     *res = GNUNET_SYSERR;
+  }
+  if (GNUNET_NO == ret)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                "Matching path `%s' already forgotten!\n",
+                object_id);
+  }
+  else
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                "Forgot `%s'\n",
+                object_id);
+    if (GNUNET_NO == *res)
+      *res = GNUNET_OK;
+  }
 }
 
 
@@ -75,6 +95,7 @@ TMH_private_patch_orders_ID_forget (const struct 
TMH_RequestHandler *rh,
   {
     json_t *fields;
     json_t *contract_terms;
+    bool changed = false;
 
     if (GNUNET_OK !=
         TMH_db->start (TMH_db->cls,
@@ -146,8 +167,9 @@ TMH_private_patch_orders_ID_forget (const struct 
TMH_RequestHandler *rh,
     {
       size_t index;
       json_t *value;
+
       json_array_foreach (fields, index, value) {
-        int forget_status = GNUNET_OK;
+        int forget_status = GNUNET_NO;
         int expand_status;
 
         if (! (json_is_string (value)))
@@ -175,6 +197,8 @@ TMH_private_patch_orders_ID_forget (const struct 
TMH_RequestHandler *rh,
                                              
TALER_EC_MERCHANT_PRIVATE_PATCH_ORDERS_ID_FORGET_PATH_NOT_FORGETTABLE,
                                              json_string_value (value));
         }
+        if (GNUNET_OK == forget_status)
+          changed = true;
         if (GNUNET_SYSERR == expand_status)
         {
           /* One of the paths was malformed and couldn't be expanded */
@@ -189,6 +213,17 @@ TMH_private_patch_orders_ID_forget (const struct 
TMH_RequestHandler *rh,
       }
     }
 
+    if (! changed)
+    {
+      TMH_db->rollback (TMH_db->cls);
+      json_decref (contract_terms);
+      json_decref (fields);
+      return TALER_MHD_reply_static (connection,
+                                     MHD_HTTP_NO_CONTENT,
+                                     NULL,
+                                     NULL,
+                                     0);
+    }
     qs = TMH_db->update_contract_terms (TMH_db->cls,
                                         hc->instance->settings.id,
                                         order_id,
diff --git a/src/backend/taler-merchant-httpd_private-post-transfers.c 
b/src/backend/taler-merchant-httpd_private-post-transfers.c
index 9741a0a5..52f12a16 100644
--- a/src/backend/taler-merchant-httpd_private-post-transfers.c
+++ b/src/backend/taler-merchant-httpd_private-post-transfers.c
@@ -386,7 +386,6 @@ check_wire_fee (struct PostTransfersContext *ptc,
   char *wire_method;
 
   wire_method = TALER_payto_get_method (ptc->payto_uri);
-  TMH_db->preflight (TMH_db->cls);
   qs = TMH_db->lookup_wire_fee (TMH_db->cls,
                                 &ptc->master_pub,
                                 wire_method,
@@ -626,7 +625,6 @@ verify_exchange_claim_cb (void *cls,
   ptc->current_detail = ttd;
   /* Set the coin as "never seen" before. */
   ptc->check_transfer_result = GNUNET_NO;
-  TMH_db->preflight (TMH_db->cls);
   qs = TMH_db->lookup_deposits_by_contract_and_coin (
     TMH_db->cls,
     ptc->hc->instance->settings.id,
@@ -863,7 +861,7 @@ static void
 download (struct PostTransfersContext *ptc)
 {
   ptc->downloaded = true;
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               "Suspending POST /private/transfers handling while working with 
exchange\n");
   MHD_suspend_connection (ptc->connection);
   GNUNET_CONTAINER_DLL_insert (ptc_head,
@@ -952,6 +950,7 @@ TMH_private_post_transfers (const struct TMH_RequestHandler 
*rh,
                                          "transfer");
     }
     qs = TMH_db->lookup_transfer (TMH_db->cls,
+                                  ptc->hc->instance->settings.id,
                                   ptc->exchange_url,
                                   &ptc->wtid,
                                   &total_amount,
@@ -1027,6 +1026,8 @@ TMH_private_post_transfers (const struct 
TMH_RequestHandler *rh,
                                              TALER_EC_GENERIC_DB_STORE_FAILED,
                                              "transfer");
         case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
+          /* insert failed due to UNIQUE violation, after
+             the earlier lookup failed? very strange! */
           GNUNET_break (0);
           break;
         case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
@@ -1175,6 +1176,24 @@ TMH_private_post_transfers (const struct 
TMH_RequestHandler *rh,
           break;
         }
 
+        qs = TMH_db->commit (TMH_db->cls);
+        switch (qs)
+        {
+        case GNUNET_DB_STATUS_SOFT_ERROR:
+          TMH_db->rollback (TMH_db->cls);
+          continue;
+        case GNUNET_DB_STATUS_HARD_ERROR:
+          GNUNET_break (0);
+          TMH_db->rollback (TMH_db->cls);
+          return TALER_MHD_reply_with_error (connection,
+                                             MHD_HTTP_INTERNAL_SERVER_ERROR,
+                                             TALER_EC_GENERIC_DB_COMMIT_FAILED,
+                                             NULL);
+        case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
+        case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
+          break;
+        }
+
         deposit_sums = json_array ();
         GNUNET_assert (NULL != deposit_sums);
         GNUNET_CONTAINER_multihashmap_iterate (map,
diff --git a/src/backenddb/merchant-0001.sql b/src/backenddb/merchant-0001.sql
index ba2129dc..6e79c7ff 100644
--- a/src/backenddb/merchant-0001.sql
+++ b/src/backenddb/merchant-0001.sql
@@ -359,7 +359,7 @@ CREATE TABLE IF NOT EXISTS merchant_transfers
      REFERENCES merchant_accounts (account_serial) ON DELETE CASCADE
   ,verified BOOLEAN NOT NULL DEFAULT FALSE
   ,confirmed BOOLEAN NOT NULL DEFAULT FALSE
-  ,UNIQUE (wtid, exchange_url)
+  ,UNIQUE (wtid, exchange_url, account_serial)
   );
 COMMENT ON TABLE merchant_transfers
   IS 'table represents the information provided by the (trusted) merchant 
about incoming wire transfers';
diff --git a/src/backenddb/plugin_merchantdb_postgres.c 
b/src/backenddb/plugin_merchantdb_postgres.c
index b5a75222..413a863a 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -221,8 +221,9 @@ postgres_start (void *cls,
 
   check_connection (pg);
   postgres_preflight (pg);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Starting merchant DB transaction\n");
+  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+              "Starting merchant DB transaction `%s'\n",
+              name);
   if (GNUNET_OK !=
       GNUNET_PQ_exec_statements (pg->conn,
                                  es))
@@ -256,8 +257,9 @@ postgres_start_read_committed (void *cls,
 
   check_connection (pg);
   postgres_preflight (pg);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Starting merchant DB transaction (READ COMMITTED)\n");
+  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+              "Starting merchant DB transaction %s (READ COMMITTED)\n",
+              name);
   if (GNUNET_OK !=
       GNUNET_PQ_exec_statements (pg->conn,
                                  es))
@@ -308,8 +310,9 @@ postgres_commit (void *cls)
     GNUNET_PQ_query_param_end
   };
 
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Committing merchant DB transaction\n");
+  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+              "Committing merchant DB transaction %s\n",
+              pg->transaction_name);
   pg->transaction_name = NULL;
   return GNUNET_PQ_eval_prepared_non_select (pg->conn,
                                              "end_transaction",
@@ -3839,6 +3842,7 @@ postgres_lookup_deposits_by_contract_and_coin (
 static enum GNUNET_DB_QueryStatus
 postgres_lookup_transfer (
   void *cls,
+  const char *instance_id,
   const char *exchange_url,
   const struct TALER_WireTransferIdentifierRawP *wtid,
   struct TALER_Amount *total_amount,
@@ -3850,6 +3854,7 @@ postgres_lookup_transfer (
   struct GNUNET_PQ_QueryParam params[] = {
     GNUNET_PQ_query_param_string (exchange_url),
     GNUNET_PQ_query_param_auto_from_type (wtid),
+    GNUNET_PQ_query_param_string (instance_id),
     GNUNET_PQ_query_param_end
   };
   uint8_t verified8;
@@ -7816,9 +7821,11 @@ postgres_connect (void *cls)
                             " FROM merchant_transfers"
                             "  JOIN merchant_transfer_signatures USING 
(credit_serial)"
                             "  JOIN merchant_accounts USING (account_serial)"
+                            "  JOIN merchant_instances USING (merchant_serial)"
                             " WHERE wtid=$2"
-                            "   AND exchange_url=$1",
-                            2),
+                            "   AND exchange_url=$1"
+                            "   AND merchant_id=$3;",
+                            3),
     /* for postgres_set_transfer_status_to_verified() */
     GNUNET_PQ_make_prepare ("set_transfer_status_to_verified",
                             "UPDATE merchant_transfers SET"
diff --git a/src/backenddb/test_merchantdb.c b/src/backenddb/test_merchantdb.c
index aabc431a..237bd18e 100644
--- a/src/backenddb/test_merchantdb.c
+++ b/src/backenddb/test_merchantdb.c
@@ -2568,26 +2568,34 @@ lookup_deposits_cb (void *cls,
   cmp->results_length += 1;
   for (unsigned int i = 0; cmp->deposits_to_cmp_length > i; ++i)
   {
-    if ((GNUNET_OK == TALER_amount_cmp_currency (
+    if ((GNUNET_OK ==
+         TALER_amount_cmp_currency (
            &cmp->deposits_to_cmp[i].amount_with_fee,
            amount_with_fee)) &&
-        (0 == TALER_amount_cmp (&cmp->deposits_to_cmp[i].amount_with_fee,
-                                amount_with_fee)) &&
-        (GNUNET_OK == TALER_amount_cmp_currency (
+        (0 ==
+         TALER_amount_cmp (&cmp->deposits_to_cmp[i].amount_with_fee,
+                           amount_with_fee)) &&
+        (GNUNET_OK ==
+         TALER_amount_cmp_currency (
            &cmp->deposits_to_cmp[i].deposit_fee,
            deposit_fee)) &&
-        (0 == TALER_amount_cmp (&cmp->deposits_to_cmp[i].deposit_fee,
-                                deposit_fee)) &&
-        (GNUNET_OK == TALER_amount_cmp_currency (
+        (0 ==
+         TALER_amount_cmp (&cmp->deposits_to_cmp[i].deposit_fee,
+                           deposit_fee)) &&
+        (GNUNET_OK ==
+         TALER_amount_cmp_currency (
            &cmp->deposits_to_cmp[i].refund_fee,
            refund_fee)) &&
-        (0 == TALER_amount_cmp (&cmp->deposits_to_cmp[i].refund_fee,
-                                refund_fee)) &&
-        (GNUNET_OK == TALER_amount_cmp_currency (
+        (0 ==
+         TALER_amount_cmp (&cmp->deposits_to_cmp[i].refund_fee,
+                           refund_fee)) &&
+        (GNUNET_OK ==
+         TALER_amount_cmp_currency (
            &cmp->deposits_to_cmp[i].wire_fee,
            wire_fee)) &&
-        (0 == TALER_amount_cmp (&cmp->deposits_to_cmp[i].wire_fee,
-                                wire_fee)))
+        (0 ==
+         TALER_amount_cmp (&cmp->deposits_to_cmp[i].wire_fee,
+                           wire_fee)))
     {
       cmp->results_matching[i] += 1;
     }
@@ -2664,21 +2672,21 @@ test_lookup_deposits (const struct InstanceData 
*instance,
  * @param exchange_pub public key of the exchange.
  */
 static void
-lookup_deposits_contract_coin_cb (void *cls,
-                                  const char *exchange_url,
-                                  const struct TALER_Amount *amount_with_fee,
-                                  const struct TALER_Amount *deposit_fee,
-                                  const struct TALER_Amount *refund_fee,
-                                  const struct TALER_Amount *wire_fee,
-                                  const struct GNUNET_HashCode *h_wire,
-                                  struct GNUNET_TIME_Absolute 
deposit_timestamp,
-                                  struct GNUNET_TIME_Absolute refund_deadline,
-                                  const struct
-                                  TALER_ExchangeSignatureP *exchange_sig,
-                                  const struct
-                                  TALER_ExchangePublicKeyP *exchange_pub)
+lookup_deposits_contract_coin_cb (
+  void *cls,
+  const char *exchange_url,
+  const struct TALER_Amount *amount_with_fee,
+  const struct TALER_Amount *deposit_fee,
+  const struct TALER_Amount *refund_fee,
+  const struct TALER_Amount *wire_fee,
+  const struct GNUNET_HashCode *h_wire,
+  struct GNUNET_TIME_Absolute deposit_timestamp,
+  struct GNUNET_TIME_Absolute refund_deadline,
+  const struct TALER_ExchangeSignatureP *exchange_sig,
+  const struct TALER_ExchangePublicKeyP *exchange_pub)
 {
   struct TestLookupDeposits_Closure *cmp = cls;
+
   if (NULL == cmp)
     return;
   cmp->results_length += 1;
@@ -2730,13 +2738,12 @@ lookup_deposits_contract_coin_cb (void *cls,
  * @return 0 on success, 1 otherwise.
  */
 static int
-test_lookup_deposits_contract_and_coin (const struct InstanceData *instance,
-                                        const struct
-                                        GNUNET_HashCode *h_contract,
-                                        const struct
-                                        TALER_CoinSpendPublicKeyP *coin_pub,
-                                        unsigned int deposits_length,
-                                        const struct DepositData *deposits)
+test_lookup_deposits_contract_and_coin (
+  const struct InstanceData *instance,
+  const struct GNUNET_HashCode *h_contract,
+  const struct TALER_CoinSpendPublicKeyP *coin_pub,
+  unsigned int deposits_length,
+  const struct DepositData *deposits)
 {
   unsigned int results_matching[deposits_length];
   struct TestLookupDeposits_Closure cmp = {
@@ -2748,17 +2755,16 @@ test_lookup_deposits_contract_and_coin (const struct 
InstanceData *instance,
   memset (results_matching,
           0,
           sizeof (unsigned int) * deposits_length);
-  TEST_COND_RET_ON_FAIL (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT ==
-                         plugin->lookup_deposits_by_contract_and_coin (
-                           plugin->cls,
-                           instance
-                           ->instance.id,
-                           h_contract,
-                           coin_pub,
-                           &
-                           lookup_deposits_contract_coin_cb,
-                           &cmp),
-                         "Lookup deposits by contract and coin failed\n");
+  TEST_COND_RET_ON_FAIL (
+    GNUNET_DB_STATUS_SUCCESS_ONE_RESULT ==
+    plugin->lookup_deposits_by_contract_and_coin (
+      plugin->cls,
+      instance->instance.id,
+      h_contract,
+      coin_pub,
+      &lookup_deposits_contract_coin_cb,
+      &cmp),
+    "Lookup deposits by contract and coin failed\n");
   if (deposits_length != cmp.results_length)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -3273,7 +3279,6 @@ struct TransferData
    */
   struct TALER_WireTransferIdentifierRawP wtid;
 
-
   /**
    * The main data for the transfer.
    */
@@ -3370,14 +3375,18 @@ make_transfer (const struct ExchangeSignkeyData 
*signkey,
  * @return 1 on success, 0 otherwise.
  */
 static int
-test_lookup_transfer (const struct TransferData *transfer)
+test_lookup_transfer (
+  const struct InstanceData *instance,
+  const struct TransferData *transfer)
 {
   struct TALER_Amount total_with_fee;
   struct TALER_Amount total;
   struct TALER_Amount fee;
   struct GNUNET_TIME_Absolute time;
   bool verified;
+
   if (1 != plugin->lookup_transfer (plugin->cls,
+                                    instance->instance.id,
                                     transfer->exchange_url,
                                     &transfer->wtid,
                                     &total,
@@ -3482,12 +3491,12 @@ lookup_transfer_summary_cb (void *cls,
  * @return 1 on success, 0 otherwise.
  */
 static int
-test_lookup_transfer_summary (const char *exchange_url,
-                              const struct
-                              TALER_WireTransferIdentifierRawP *wtid,
-                              const char *expected_order_id,
-                              const struct TALER_Amount 
*expected_deposit_value,
-                              const struct TALER_Amount *expected_deposit_fee)
+test_lookup_transfer_summary (
+  const char *exchange_url,
+  const struct TALER_WireTransferIdentifierRawP *wtid,
+  const char *expected_order_id,
+  const struct TALER_Amount *expected_deposit_value,
+  const struct TALER_Amount *expected_deposit_fee)
 {
   struct TestLookupTransferSummary_Closure cmp = {
     .order_id = expected_order_id,
@@ -3591,11 +3600,11 @@ lookup_transfer_details_cb (void *cls,
  * @return 1 on success, 0 otherwise.
  */
 static int
-test_lookup_transfer_details (const char *exchange_url,
-                              const struct
-                              TALER_WireTransferIdentifierRawP *wtid,
-                              unsigned int details_length,
-                              const struct TALER_TrackTransferDetails *details)
+test_lookup_transfer_details (
+  const char *exchange_url,
+  const struct TALER_WireTransferIdentifierRawP *wtid,
+  unsigned int details_length,
+  const struct TALER_TrackTransferDetails *details)
 {
   unsigned int results_matching[details_length];
   struct TestLookupTransferDetails_Closure cmp = {
@@ -3676,14 +3685,14 @@ struct TestLookupTransferDetailsByOrder_Closure
  * @param transfer_confirmed whether the transfer was confirmed.
  */
 static void
-lookup_transfer_details_order_cb (void *cls,
-                                  const struct
-                                  TALER_WireTransferIdentifierRawP *wtid,
-                                  const char *exchange_url,
-                                  struct GNUNET_TIME_Absolute execution_time,
-                                  const struct TALER_Amount *deposit_value,
-                                  const struct TALER_Amount *deposit_fee,
-                                  bool transfer_confirmed)
+lookup_transfer_details_order_cb (
+  void *cls,
+  const struct TALER_WireTransferIdentifierRawP *wtid,
+  const char *exchange_url,
+  struct GNUNET_TIME_Absolute execution_time,
+  const struct TALER_Amount *deposit_value,
+  const struct TALER_Amount *deposit_fee,
+  bool transfer_confirmed)
 {
   struct TestLookupTransferDetailsByOrder_Closure *cmp = cls;
   if (NULL == cmp)
@@ -3724,10 +3733,10 @@ lookup_transfer_details_order_cb (void *cls,
  * @return 0 on success, 1 otherwise.
  */
 static int
-test_lookup_transfer_details_by_order (uint64_t order_serial,
-                                       unsigned int transfers_length,
-                                       const struct
-                                       TransferData *transfers)
+test_lookup_transfer_details_by_order (
+  uint64_t order_serial,
+  unsigned int transfers_length,
+  const struct TransferData *transfers)
 {
   unsigned int results_matching[transfers_length];
   struct TestLookupTransferDetailsByOrder_Closure cmp = {
@@ -4051,6 +4060,7 @@ test_insert_deposit_to_transfer (const struct 
InstanceData *instance,
   uint64_t deposit_serial = get_deposit_serial (instance,
                                                 order,
                                                 deposit);
+
   TEST_COND_RET_ON_FAIL (expected_result ==
                          plugin->insert_deposit_to_transfer (plugin->cls,
                                                              deposit_serial,
@@ -4070,11 +4080,11 @@ test_insert_deposit_to_transfer (const struct 
InstanceData *instance,
  * @return 0 on success, 1 otherwise.
  */
 static int
-test_insert_transfer_details (const struct InstanceData *instance,
-                              const struct
-                              TALER_MERCHANTDB_AccountDetails *account,
-                              const struct TransferData *transfer,
-                              enum GNUNET_DB_QueryStatus expected_result)
+test_insert_transfer_details (
+  const struct InstanceData *instance,
+  const struct TALER_MERCHANTDB_AccountDetails *account,
+  const struct TransferData *transfer,
+  enum GNUNET_DB_QueryStatus expected_result)
 {
   TEST_COND_RET_ON_FAIL (expected_result ==
                          plugin->insert_transfer_details (plugin->cls,
@@ -4285,7 +4295,8 @@ run_test_transfers (struct TestTransfers_Closure *cls)
                                                 NULL,
                                                 false,
                                                 true));
-  TEST_RET_ON_FAIL (test_lookup_transfer (&cls->transfers[0]));
+  TEST_RET_ON_FAIL (test_lookup_transfer (&cls->instance,
+                                          &cls->transfers[0]));
   TEST_COND_RET_ON_FAIL (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT ==
                          plugin->set_transfer_status_to_verified (plugin->cls,
                                                                   cls->deposit.
@@ -4295,7 +4306,8 @@ run_test_transfers (struct TestTransfers_Closure *cls)
                                                                   wtid),
                          "Set transfer status to verified failed\n");
   cls->transfers[0].verified = true;
-  TEST_RET_ON_FAIL (test_lookup_transfer (&cls->transfers[0]));
+  TEST_RET_ON_FAIL (test_lookup_transfer (&cls->instance,
+                                          &cls->transfers[0]));
   TEST_RET_ON_FAIL (test_lookup_transfer_summary (cls->deposit.exchange_url,
                                                   &cls->transfers[0].wtid,
                                                   cls->order.id,
@@ -4331,6 +4343,7 @@ static int
 test_transfers (void)
 {
   struct TestTransfers_Closure test_cls;
+
   pre_test_transfers (&test_cls);
   int test_result = run_test_transfers (&test_cls);
   post_test_transfers (&test_cls);
diff --git a/src/include/taler_merchantdb_plugin.h 
b/src/include/taler_merchantdb_plugin.h
index 09063897..677e90d4 100644
--- a/src/include/taler_merchantdb_plugin.h
+++ b/src/include/taler_merchantdb_plugin.h
@@ -1643,6 +1643,7 @@ struct TALER_MERCHANTDB_Plugin
    * Lookup transfer status.
    *
    * @param cls closure
+   * @param instance_id the instance to look up details at
    * @param exchange_url the exchange that made the transfer
    * @param payto_uri account that received the transfer
    * @param wtid wire transfer subject
@@ -1657,6 +1658,7 @@ struct TALER_MERCHANTDB_Plugin
   enum GNUNET_DB_QueryStatus
   (*lookup_transfer)(
     void *cls,
+    const char *instance_id,
     const char *exchange_url,
     const struct TALER_WireTransferIdentifierRawP *wtid,
     struct TALER_Amount *total_amount,
diff --git a/src/lib/merchant_api_delete_instance.c 
b/src/lib/merchant_api_delete_instance.c
index d83ea467..b0458a62 100644
--- a/src/lib/merchant_api_delete_instance.c
+++ b/src/lib/merchant_api_delete_instance.c
@@ -96,12 +96,14 @@ handle_delete_instance_finished (void *cls,
     hr.hint = TALER_JSON_get_error_hint (json);
     /* Nothing really to verify, merchant says we need to authenticate. */
     break;
+  case MHD_HTTP_NOT_FOUND:
+    break;
   default:
     /* unexpected response code */
     hr.ec = TALER_JSON_get_error_code (json);
     hr.hint = TALER_JSON_get_error_hint (json);
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Unexpected response code %u/%d\n",
+                "Unexpected response code %u/%d for DELETE /instance/ID\n",
                 (unsigned int) response_code,
                 (int) hr.ec);
     break;
diff --git a/src/lib/merchant_api_get_instances.c 
b/src/lib/merchant_api_get_instances.c
index be8b6e5b..a8eaa608 100644
--- a/src/lib/merchant_api_get_instances.c
+++ b/src/lib/merchant_api_get_instances.c
@@ -205,6 +205,10 @@ handle_instances_finished (void *cls,
       GNUNET_JSON_parse_free (spec);
       break;
     }
+  case MHD_HTTP_UNAUTHORIZED:
+    hr.ec = TALER_JSON_get_error_code (json);
+    hr.hint = TALER_JSON_get_error_hint (json);
+    break;
   default:
     /* unexpected response code */
     hr.ec = TALER_JSON_get_error_code (json);
diff --git a/src/lib/merchant_api_patch_order_forget.c 
b/src/lib/merchant_api_patch_order_forget.c
index ddb26062..69563aaf 100644
--- a/src/lib/merchant_api_patch_order_forget.c
+++ b/src/lib/merchant_api_patch_order_forget.c
@@ -101,6 +101,10 @@ handle_forget_finished (void *cls,
     hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
     break;
   case MHD_HTTP_OK:
+    /* fields were NOW forgotten */
+    break;
+  case MHD_HTTP_NO_CONTENT:
+    /* fields were already forgotten before */
     break;
   case MHD_HTTP_BAD_REQUEST:
     hr.ec = TALER_JSON_get_error_code (json);
diff --git a/src/testing/test_merchant_order_creation.sh 
b/src/testing/test_merchant_order_creation.sh
index 5bc8c649..8c1f599b 100755
--- a/src/testing/test_merchant_order_creation.sh
+++ b/src/testing/test_merchant_order_creation.sh
@@ -301,7 +301,7 @@ then
     exit_fail "Expected response ok. got: $STATUS"
 fi
 
-#this will triger the GNUNET_break at 
taler-merchant-httpd_private-post-transfers.c:1030
+#this will trigger the GNUNET_break at 
taler-merchant-httpd_private-post-transfers.c:1030
 STATUS=$(curl 'http://localhost:9966/instances/default/private/transfers' \
     -d 
'{"credit_amount":"'$CREDIT_AMOUNT'","wtid":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","payto_uri":"'$TARGET_PAYTO'","exchange_url":"'$WURL'"}'
 \
     -w "%{http_code}" -s -o $LAST_RESPONSE)
diff --git a/src/testing/testing_api_cmd_delete_instance.c 
b/src/testing/testing_api_cmd_delete_instance.c
index ca2acb76..9d3bd7d5 100644
--- a/src/testing/testing_api_cmd_delete_instance.c
+++ b/src/testing/testing_api_cmd_delete_instance.c
@@ -100,7 +100,8 @@ delete_instance_cb (void *cls,
     break;
   default:
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "Unhandled HTTP status.\n");
+                "Unhandled HTTP status %d for DELETE instance.\n",
+                hr->http_status);
   }
   TALER_TESTING_interpreter_next (dis->is);
 }
diff --git a/src/testing/testing_api_cmd_delete_order.c 
b/src/testing/testing_api_cmd_delete_order.c
index 6d97b611..d5d8b283 100644
--- a/src/testing/testing_api_cmd_delete_order.c
+++ b/src/testing/testing_api_cmd_delete_order.c
@@ -98,7 +98,7 @@ delete_order_cb (void *cls,
   default:
     GNUNET_break (0);
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "Unhandled HTTP status %d.\n",
+                "Unhandled HTTP status %u for DELETE order.\n",
                 hr->http_status);
   }
   TALER_TESTING_interpreter_next (dos->is);
diff --git a/src/testing/testing_api_cmd_delete_product.c 
b/src/testing/testing_api_cmd_delete_product.c
index d5a724fe..6fed8d46 100644
--- a/src/testing/testing_api_cmd_delete_product.c
+++ b/src/testing/testing_api_cmd_delete_product.c
@@ -87,11 +87,18 @@ delete_product_cb (void *cls,
   }
   switch (hr->http_status)
   {
-  case MHD_HTTP_OK:
+  case MHD_HTTP_NO_CONTENT:
+    break;
+  case MHD_HTTP_UNAUTHORIZED:
+    break;
+  case MHD_HTTP_NOT_FOUND:
+    break;
+  case MHD_HTTP_CONFLICT:
     break;
   default:
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "Unhandled HTTP status.\n");
+                "Unhandled HTTP status %u for DELETE product.\n",
+                hr->http_status);
   }
   TALER_TESTING_interpreter_next (dis->is);
 }
diff --git a/src/testing/testing_api_cmd_delete_reserve.c 
b/src/testing/testing_api_cmd_delete_reserve.c
index fe95277e..d98b688a 100644
--- a/src/testing/testing_api_cmd_delete_reserve.c
+++ b/src/testing/testing_api_cmd_delete_reserve.c
@@ -100,7 +100,8 @@ delete_reserve_cb (void *cls,
     break;
   default:
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "Unhandled HTTP status.\n");
+                "Unhandled HTTP status %u for DELETE reserve.\n",
+                hr->http_status);
   }
   TALER_TESTING_interpreter_next (drs->is);
 }
diff --git a/src/testing/testing_api_cmd_get_instance.c 
b/src/testing/testing_api_cmd_get_instance.c
index 7b4ee094..6622b2ec 100644
--- a/src/testing/testing_api_cmd_get_instance.c
+++ b/src/testing/testing_api_cmd_get_instance.c
@@ -325,9 +325,14 @@ get_instance_cb (void *cls,
       }
     }
     break;
+  case MHD_HTTP_UNAUTHORIZED:
+    break;
+  case MHD_HTTP_NOT_FOUND:
+    break;
   default:
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "Unhandled HTTP status.\n");
+                "Unhandled HTTP status %u for GET instance ID.\n",
+                hr->http_status);
   }
   TALER_TESTING_interpreter_next (gis->is);
 }
diff --git a/src/testing/testing_api_cmd_get_instances.c 
b/src/testing/testing_api_cmd_get_instances.c
index ff900b87..0e3342e6 100644
--- a/src/testing/testing_api_cmd_get_instances.c
+++ b/src/testing/testing_api_cmd_get_instances.c
@@ -161,7 +161,8 @@ get_instances_cb (void *cls,
     break;
   default:
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "Unhandled HTTP status.\n");
+                "Unhandled HTTP status %u for GET /instances.\n",
+                hr->http_status);
   }
   TALER_TESTING_interpreter_next (gis->is);
 }
diff --git a/src/testing/testing_api_cmd_lock_product.c 
b/src/testing/testing_api_cmd_lock_product.c
index a61f1bd4..abb5920c 100644
--- a/src/testing/testing_api_cmd_lock_product.c
+++ b/src/testing/testing_api_cmd_lock_product.c
@@ -102,12 +102,18 @@ lock_product_cb (void *cls,
   }
   switch (hr->http_status)
   {
-  case MHD_HTTP_OK:
+  case MHD_HTTP_NO_CONTENT:
+    break;
+  case MHD_HTTP_FORBIDDEN:
+    break;
+  case MHD_HTTP_NOT_FOUND:
+    break;
+  case MHD_HTTP_GONE:
     break;
-  // FIXME: add other legitimate states here...
   default:
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "Unhandled HTTP status.\n");
+                "Unhandled HTTP status %u for lock product.\n",
+                hr->http_status);
   }
   TALER_TESTING_interpreter_next (pis->is);
 }
diff --git a/src/testing/testing_api_cmd_merchant_get_order.c 
b/src/testing/testing_api_cmd_merchant_get_order.c
index c08dd56e..ed8b966b 100644
--- a/src/testing/testing_api_cmd_merchant_get_order.c
+++ b/src/testing/testing_api_cmd_merchant_get_order.c
@@ -118,7 +118,8 @@ apply_forget (void *cls,
               json_t *parent)
 {
   int *res = cls;
-  if (GNUNET_OK !=
+
+  if (GNUNET_SYSERR ==
       TALER_JSON_contract_part_forget (parent,
                                        object_id))
     *res = GNUNET_SYSERR;
diff --git a/src/testing/testing_api_cmd_patch_instance.c 
b/src/testing/testing_api_cmd_patch_instance.c
index a7a82ef7..3d4b93d1 100644
--- a/src/testing/testing_api_cmd_patch_instance.c
+++ b/src/testing/testing_api_cmd_patch_instance.c
@@ -139,10 +139,15 @@ patch_instance_cb (void *cls,
   {
   case MHD_HTTP_NO_CONTENT:
     break;
-  // FIXME: add other legitimate states here...
+  case MHD_HTTP_UNAUTHORIZED:
+    break;
+  case MHD_HTTP_NOT_FOUND:
+    break;
+  case MHD_HTTP_CONFLICT:
+    break;
   default:
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "Unhandled HTTP status %u.\n",
+                "Unhandled HTTP status %u for PATCH instance.\n",
                 hr->http_status);
   }
   TALER_TESTING_interpreter_next (pis->is);
diff --git a/src/testing/testing_api_cmd_patch_product.c 
b/src/testing/testing_api_cmd_patch_product.c
index 6e4613df..ed64d8f3 100644
--- a/src/testing/testing_api_cmd_patch_product.c
+++ b/src/testing/testing_api_cmd_patch_product.c
@@ -137,12 +137,20 @@ patch_product_cb (void *cls,
   }
   switch (hr->http_status)
   {
-  case MHD_HTTP_OK:
+  case MHD_HTTP_NO_CONTENT:
+    break;
+  case MHD_HTTP_UNAUTHORIZED:
+    break;
+  case MHD_HTTP_FORBIDDEN:
+    break;
+  case MHD_HTTP_NOT_FOUND:
+    break;
+  case MHD_HTTP_CONFLICT:
     break;
-  // FIXME: add other legitimate states here...
   default:
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "Unhandled HTTP status.\n");
+                "Unhandled HTTP status %u for PATCH /products/ID.\n",
+                hr->http_status);
   }
   TALER_TESTING_interpreter_next (pis->is);
 }
diff --git a/src/testing/testing_api_cmd_post_instances.c 
b/src/testing/testing_api_cmd_post_instances.c
index 7eb2e7fa..8961d4e0 100644
--- a/src/testing/testing_api_cmd_post_instances.c
+++ b/src/testing/testing_api_cmd_post_instances.c
@@ -144,13 +144,18 @@ post_instances_cb (void *cls,
   {
   case MHD_HTTP_NO_CONTENT:
     break;
+  case MHD_HTTP_UNAUTHORIZED:
+    break;
+  case MHD_HTTP_FORBIDDEN:
+    break;
+  case MHD_HTTP_NOT_FOUND:
+    break;
   case MHD_HTTP_CONFLICT:
     break;
-  // FIXME: add other legitimate states here...
   default:
     GNUNET_break (0);
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "Unhandled HTTP status %u.\n",
+                "Unhandled HTTP status %u for POST instances.\n",
                 hr->http_status);
   }
   TALER_TESTING_interpreter_next (pis->is);
diff --git a/src/testing/testing_api_cmd_post_orders.c 
b/src/testing/testing_api_cmd_post_orders.c
index 4cbb17b0..5b9e533f 100644
--- a/src/testing/testing_api_cmd_post_orders.c
+++ b/src/testing/testing_api_cmd_post_orders.c
@@ -677,7 +677,6 @@ make_order_json (const char *order_id,
                                          "$.dummy_array[*].item",
                                          &mark_forgettable,
                                          NULL));
-
   *order = json_dumps (contract_terms, 0);
   json_decref (contract_terms);
 }
diff --git a/src/testing/testing_api_cmd_post_products.c 
b/src/testing/testing_api_cmd_post_products.c
index 1a358a7e..5d1abb48 100644
--- a/src/testing/testing_api_cmd_post_products.c
+++ b/src/testing/testing_api_cmd_post_products.c
@@ -134,13 +134,19 @@ post_products_cb (void *cls,
   {
   case MHD_HTTP_NO_CONTENT:
     break;
+  case MHD_HTTP_UNAUTHORIZED:
+    break;
+  case MHD_HTTP_FORBIDDEN:
+    break;
+  case MHD_HTTP_NOT_FOUND:
+    break;
   case MHD_HTTP_CONFLICT:
     break;
-  // FIXME: add other legitimate states here...
   default:
     GNUNET_break (0);
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "Unhandled HTTP status.\n");
+                "Unhandled HTTP status %u for POST /products.\n",
+                hr->http_status);
   }
   TALER_TESTING_interpreter_next (pis->is);
 }
diff --git a/src/testing/testing_api_cmd_post_reserves.c 
b/src/testing/testing_api_cmd_post_reserves.c
index 4f18dbde..31866384 100644
--- a/src/testing/testing_api_cmd_post_reserves.c
+++ b/src/testing/testing_api_cmd_post_reserves.c
@@ -104,17 +104,18 @@ post_reserves_cb (void *cls,
   }
   switch (hr->http_status)
   {
-  case MHD_HTTP_NO_CONTENT:
+  case MHD_HTTP_OK:
     break;
-  case MHD_HTTP_CONFLICT:
+  case MHD_HTTP_ACCEPTED:
     break;
-  case MHD_HTTP_OK:
+  case MHD_HTTP_UNAUTHORIZED:
+    break;
+  case MHD_HTTP_NOT_FOUND:
     break;
-  // FIXME: add other legitimate states here...
   default:
     GNUNET_break (0);
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "Unhandled HTTP status (%d).\n",
+                "Unhandled HTTP status %u for POST /reserves.\n",
                 hr->http_status);
   }
   prs->reserve_pub = *reserve_pub;
diff --git a/src/testing/testing_api_cmd_post_transfers.c 
b/src/testing/testing_api_cmd_post_transfers.c
index 1fa9dfc0..72b6f132 100644
--- a/src/testing/testing_api_cmd_post_transfers.c
+++ b/src/testing/testing_api_cmd_post_transfers.c
@@ -298,10 +298,16 @@ transfers_cb (void *cls,
 #endif
       break;
     }
+  case MHD_HTTP_ACCEPTED:
+    break;
+  case MHD_HTTP_UNAUTHORIZED:
+    break;
+  case MHD_HTTP_NOT_FOUND:
+    break;
   default:
     GNUNET_break (0);
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "Unhandled HTTP status %d.\n",
+                "Unhandled HTTP status %u for POST /transfers.\n",
                 hr->http_status);
   }
   TALER_TESTING_interpreter_next (pts->is);
diff --git a/src/testing/testing_api_cmd_refund_order.c 
b/src/testing/testing_api_cmd_refund_order.c
index 309c33a8..fd06f887 100644
--- a/src/testing/testing_api_cmd_refund_order.c
+++ b/src/testing/testing_api_cmd_refund_order.c
@@ -154,9 +154,18 @@ refund_cb (void *cls,
       TALER_MERCHANT_parse_refund_uri_free (&rud);
     }
     break;
+  case MHD_HTTP_UNAUTHORIZED:
+    break;
+  case MHD_HTTP_FORBIDDEN:
+    break;
+  case MHD_HTTP_NOT_FOUND:
+    break;
+  case MHD_HTTP_CONFLICT:
+    break;
   default:
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "Unhandled HTTP status.\n");
+                "Unhandled HTTP status %u for refund order.\n",
+                hr->http_status);
   }
   TALER_TESTING_interpreter_next (ris->is);
 }

-- 
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]