gnunet-svn
[Top][All Lists]
Advanced

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

[taler-merchant] 22/24: -misc fixes wrt long polling


From: gnunet
Subject: [taler-merchant] 22/24: -misc fixes wrt long polling
Date: Wed, 17 Nov 2021 12:44:45 +0100

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

grothoff pushed a commit to branch master
in repository merchant.

commit cd1270a53dfbd503ce8b5ab8b52d29c84a443339
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Wed Nov 17 08:39:18 2021 +0100

    -misc fixes wrt long polling
---
 src/backend/taler-merchant-httpd.h                 |  1 +
 src/backend/taler-merchant-httpd_get-orders-ID.c   | 16 ++++----
 .../taler-merchant-httpd_post-orders-ID-claim.c    | 25 +++++++-----
 .../taler-merchant-httpd_post-orders-ID-pay.c      |  5 +++
 .../taler-merchant-httpd_private-get-orders-ID.c   |  9 +++++
 .../taler-merchant-httpd_private-get-orders.c      | 45 ++++++++++++++++++++--
 ...-merchant-httpd_private-post-orders-ID-refund.c |  5 ++-
 .../taler-merchant-httpd_private-post-orders.c     |  4 ++
 src/lib/merchant_api_get_kyc.c                     |  5 ++-
 src/lib/merchant_api_get_orders.c                  |  4 +-
 src/testing/test_merchant_api.c                    | 37 ++++++++++++------
 src/testing/testing_api_cmd_get_orders.c           |  2 +-
 src/testing/testing_api_cmd_kyc_get.c              | 18 +++++----
 src/testing/testing_api_cmd_pay_order.c            |  2 +-
 src/testing/testing_api_cmd_wallet_get_order.c     |  4 +-
 15 files changed, 131 insertions(+), 51 deletions(-)

diff --git a/src/backend/taler-merchant-httpd.h 
b/src/backend/taler-merchant-httpd.h
index 91d83c53..7fbc8bb5 100644
--- a/src/backend/taler-merchant-httpd.h
+++ b/src/backend/taler-merchant-httpd.h
@@ -284,6 +284,7 @@ enum TMH_OrderStateFlags
 
   /**
    * Merchant received the payment from the exchange.
+   * FIXME: not triggered yet!
    */
   TMH_OSF_WIRED = 8
 };
diff --git a/src/backend/taler-merchant-httpd_get-orders-ID.c 
b/src/backend/taler-merchant-httpd_get-orders-ID.c
index cc385e4a..ddc1c1c7 100644
--- a/src/backend/taler-merchant-httpd_get-orders-ID.c
+++ b/src/backend/taler-merchant-httpd_get-orders-ID.c
@@ -209,7 +209,7 @@ resume_by_event (void *cls,
 
   GNUNET_async_scope_enter (&god->hc->async_scope_id,
                             &old);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               "Received event for %s with argument `%.*s`\n",
               god->order_id,
               (int) extra_size,
@@ -261,7 +261,7 @@ resume_by_event (void *cls,
       return; /* refund too small */
     }
   }
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               "Resuming (%d/%d) by event with argument `%.*s`\n",
               (int) GNUNET_TIME_absolute_is_future (god->sc.long_poll_timeout),
               god->sc.awaiting_refund,
@@ -285,7 +285,7 @@ resume_by_event (void *cls,
 static void
 suspend_god (struct GetOrderData *god)
 {
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               "Suspending GET /orders/%s\n",
               god->order_id);
   if (NULL != god->contract_terms)
@@ -956,9 +956,6 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
             if (god->sc.awaiting_refund ||
                 god->sc.awaiting_refund_obtained)
             {
-#ifndef TALER_API_VERSION
-#define TALER_DBEVENT_MERCHANT_REFUND_OBTAINED 1104
-#endif
               struct TMH_OrderPayEventP refund_eh = {
                 .header.size = htons (sizeof (refund_eh)),
                 .header.type = htons (god->sc.awaiting_refund_obtained
@@ -970,8 +967,9 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
               GNUNET_CRYPTO_hash (god->order_id,
                                   strlen (god->order_id),
                                   &refund_eh.h_order_id);
-              GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                          "Subscribing to refunds on %s\n",
+              GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                          "Subscribing %p to refunds on %s\n",
+                          god,
                           god->order_id);
               god->refund_eh = TMH_db->event_listen (TMH_db->cls,
                                                      &refund_eh.header,
@@ -986,7 +984,7 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
                 .merchant_pub = hc->instance->merchant_pub
               };
 
-              GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              GNUNET_log (GNUNET_ERROR_TYPE_INFO,
                           "Subscribing to payments on %s\n",
                           god->order_id);
               GNUNET_CRYPTO_hash (god->order_id,
diff --git a/src/backend/taler-merchant-httpd_post-orders-ID-claim.c 
b/src/backend/taler-merchant-httpd_post-orders-ID-claim.c
index e9551e3a..17475c9a 100644
--- a/src/backend/taler-merchant-httpd_post-orders-ID-claim.c
+++ b/src/backend/taler-merchant-httpd_post-orders-ID-claim.c
@@ -27,6 +27,7 @@
 #include <jansson.h>
 #include <taler/taler_signatures.h>
 #include <taler/taler_json_lib.h>
+#include "taler-merchant-httpd_private-get-orders.h"
 #include "taler-merchant-httpd_post-orders-ID-claim.h"
 
 
@@ -60,6 +61,8 @@ claim_order (const char *instance_id,
 {
   struct TALER_ClaimTokenP order_ct;
   enum GNUNET_DB_QueryStatus qs;
+  uint64_t order_serial;
+  struct GNUNET_TIME_Absolute timestamp;
 
   if (GNUNET_OK !=
       TMH_db->start (TMH_db->cls,
@@ -68,16 +71,12 @@ claim_order (const char *instance_id,
     GNUNET_break (0);
     return GNUNET_DB_STATUS_HARD_ERROR;
   }
-  {
-    uint64_t order_serial;
-
-    qs = TMH_db->lookup_contract_terms (TMH_db->cls,
-                                        instance_id,
-                                        order_id,
-                                        contract_terms,
-                                        &order_serial,
-                                        NULL);
-  }
+  qs = TMH_db->lookup_contract_terms (TMH_db->cls,
+                                      instance_id,
+                                      order_id,
+                                      contract_terms,
+                                      &order_serial,
+                                      NULL);
   if (0 > qs)
   {
     TMH_db->rollback (TMH_db->cls);
@@ -91,6 +90,8 @@ claim_order (const char *instance_id,
     struct GNUNET_JSON_Specification spec[] = {
       GNUNET_JSON_spec_string ("nonce",
                                &stored_nonce),
+      TALER_JSON_spec_absolute_time ("timestamp",
+                                     &timestamp),
       GNUNET_JSON_spec_end ()
     };
 
@@ -162,6 +163,10 @@ claim_order (const char *instance_id,
       *contract_terms = NULL;
       return qs;
     }
+    TMH_notify_order_change (TMH_lookup_instance (instance_id),
+                             TMH_OSF_CLAIMED,
+                             timestamp,
+                             order_serial);
     qs = TMH_db->commit (TMH_db->cls);
     if (0 > qs)
       return qs;
diff --git a/src/backend/taler-merchant-httpd_post-orders-ID-pay.c 
b/src/backend/taler-merchant-httpd_post-orders-ID-pay.c
index 064b0be5..fcdb9821 100644
--- a/src/backend/taler-merchant-httpd_post-orders-ID-pay.c
+++ b/src/backend/taler-merchant-httpd_post-orders-ID-pay.c
@@ -1493,6 +1493,11 @@ execute_pay_transaction (struct PayContext *pc)
     }
   }
 
+  TMH_notify_order_change (hc->instance,
+                           TMH_OSF_CLAIMED | TMH_OSF_PAID,
+                           pc->timestamp,
+                           pc->order_serial);
+
   {
     enum GNUNET_DB_QueryStatus qs;
 
diff --git a/src/backend/taler-merchant-httpd_private-get-orders-ID.c 
b/src/backend/taler-merchant-httpd_private-get-orders-ID.c
index 394fe936..bb576ab9 100644
--- a/src/backend/taler-merchant-httpd_private-get-orders-ID.c
+++ b/src/backend/taler-merchant-httpd_private-get-orders-ID.c
@@ -357,6 +357,9 @@ resume_by_event (void *cls,
 
   (void) extra;
   (void) extra_size;
+  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+              "Resuming request %p by trigger\n",
+              gorc);
   if (! gorc->suspended)
     return; /* duplicate event is possible */
   gorc->suspended = false;
@@ -925,6 +928,9 @@ TMH_private_get_orders_ID (const struct TMH_RequestHandler 
*rh,
           GNUNET_CRYPTO_hash (hc->infix,
                               strlen (hc->infix),
                               &pay_eh.h_order_id);
+          GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                      "Subscribing to payment triggers for %p\n",
+                      gorc);
           gorc->eh = TMH_db->event_listen (TMH_db->cls,
                                            &pay_eh.header,
                                            timeout,
@@ -939,6 +945,9 @@ TMH_private_get_orders_ID (const struct TMH_RequestHandler 
*rh,
               .merchant_pub = hc->instance->merchant_pub
             };
 
+            GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                        "Subscribing to session triggers for %p\n",
+                        gorc);
             GNUNET_CRYPTO_hash (gorc->session_id,
                                 strlen (gorc->session_id),
                                 &session_eh.h_session_id);
diff --git a/src/backend/taler-merchant-httpd_private-get-orders.c 
b/src/backend/taler-merchant-httpd_private-get-orders.c
index 8c6b12ff..85660812 100644
--- a/src/backend/taler-merchant-httpd_private-get-orders.c
+++ b/src/backend/taler-merchant-httpd_private-get-orders.c
@@ -444,6 +444,9 @@ resume_by_event (void *cls,
   osf = (enum TMH_OrderStateFlags) ntohl (oce->order_state);
   order_serial_id = GNUNET_ntohll (oce->order_serial_id);
   date = GNUNET_TIME_absolute_ntoh (oce->execution_date);
+  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+              "Received notification about new order %llu\n",
+              (unsigned long long) order_serial_id);
   for (struct TMH_PendingOrder *po = mi->po_head;
        NULL != po;
        po = pn)
@@ -458,23 +461,51 @@ resume_by_event (void *cls,
             ( ((TALER_EXCHANGE_YNA_YES == po->of.wired) ==
                (0 != (osf & TMH_OSF_WIRED))) ||
               (TALER_EXCHANGE_YNA_ALL == po->of.wired) ) ) )
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                  "Client %p waits on different order type\n",
+                  po);
       continue;
+    }
     if (po->of.delta > 0)
     {
       if (order_serial_id < po->of.start_row)
+      {
+        GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                    "Client %p waits on different order row\n",
+                    po);
         continue;
+      }
       if (date.abs_value_us < po->of.date.abs_value_us)
+      {
+        GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                    "Client %p waits on different order date\n",
+                    po);
         continue;
+      }
       po->of.delta--;
     }
     else
     {
       if (order_serial_id > po->of.start_row)
+      {
+        GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                    "Client %p waits on different order row\n",
+                    po);
         continue;
+      }
       if (date.abs_value_us > po->of.date.abs_value_us)
+      {
+        GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                    "Client %p waits on different order date\n",
+                    po);
         continue;
+      }
       po->of.delta++;
     }
+    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                "Waking up client %p!\n",
+                po);
     add_order (po,
                NULL,
                order_serial_id,
@@ -486,6 +517,7 @@ resume_by_event (void *cls,
     po->in_dll = false;
     GNUNET_assert (po ==
                    GNUNET_CONTAINER_heap_remove_node (po->hn));
+    po->hn = NULL;
     MHD_resume_connection (po->con);
     TALER_MHD_daemon_trigger ();   /* we resumed, kick MHD */
   }
@@ -523,6 +555,10 @@ TMH_notify_order_change (struct TMH_MerchantInstance *mi,
     .merchant_pub = mi->merchant_pub
   };
 
+  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+              "Notifying clients of new order %llu at %s\n",
+              (unsigned long long) order_serial_id,
+              TALER_B2S (&mi->merchant_pub));
   TMH_db->event_notify (TMH_db->cls,
                         &eh.header,
                         &oce,
@@ -799,13 +835,14 @@ TMH_private_get_orders (const struct TMH_RequestHandler 
*rh,
     po->in_dll = true;
     if (NULL == mi->po_eh)
     {
-      struct GNUNET_DB_EventHeaderP change_eh = {
-        .type = htons (TALER_DBEVENT_MERCHANT_ORDERS_CHANGE),
-        .size = htons (sizeof (change_eh))
+      struct TMH_OrderChangeEventP change_eh = {
+        .header.type = htons (TALER_DBEVENT_MERCHANT_ORDERS_CHANGE),
+        .header.size = htons (sizeof (change_eh)),
+        .merchant_pub = mi->merchant_pub
       };
 
       mi->po_eh = TMH_db->event_listen (TMH_db->cls,
-                                        &change_eh,
+                                        &change_eh.header,
                                         GNUNET_TIME_UNIT_FOREVER_REL,
                                         &resume_by_event,
                                         mi);
diff --git a/src/backend/taler-merchant-httpd_private-post-orders-ID-refund.c 
b/src/backend/taler-merchant-httpd_private-post-orders-ID-refund.c
index 20645b30..2f98be98 100644
--- a/src/backend/taler-merchant-httpd_private-post-orders-ID-refund.c
+++ b/src/backend/taler-merchant-httpd_private-post-orders-ID-refund.c
@@ -55,7 +55,7 @@ trigger_refund_notification (struct TMH_HandlerContext *hc,
 
   /* Resume clients that may wait for this refund */
   as = TALER_amount2s (amount);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               "Awakening clients on %s waiting for refund of no more than 
%s\n",
               hc->infix,
               as);
@@ -353,7 +353,8 @@ TMH_private_post_orders_ID_refund (const struct 
TMH_RequestHandler *rh,
                                          NULL);
     }
     TMH_notify_order_change (hc->instance,
-                             TMH_OSF_PAID
+                             TMH_OSF_CLAIMED
+                             | TMH_OSF_PAID
                              | TMH_OSF_REFUNDED,
                              timestamp,
                              order_serial);
diff --git a/src/backend/taler-merchant-httpd_private-post-orders.c 
b/src/backend/taler-merchant-httpd_private-post-orders.c
index c244966f..17131d3b 100644
--- a/src/backend/taler-merchant-httpd_private-post-orders.c
+++ b/src/backend/taler-merchant-httpd_private-post-orders.c
@@ -286,6 +286,10 @@ execute_transaction (struct TMH_HandlerContext *hc,
     TMH_db->rollback (TMH_db->cls);
     return qs;
   }
+  TMH_notify_order_change (hc->instance,
+                           TMH_OSF_NONE,
+                           timestamp,
+                           order_serial);
   /* finally, commit transaction (note: if it fails, we ALSO re-acquire
      the UUID locks, which is exactly what we want) */
   qs = TMH_db->commit (TMH_db->cls);
diff --git a/src/lib/merchant_api_get_kyc.c b/src/lib/merchant_api_get_kyc.c
index 8beee99b..302eb718 100644
--- a/src/lib/merchant_api_get_kyc.c
+++ b/src/lib/merchant_api_get_kyc.c
@@ -269,6 +269,7 @@ kyc_get (struct GNUNET_CURL_Context *ctx,
                                          / GNUNET_TIME_UNIT_MILLISECONDS.
                                          rel_value_us));
   kyc->url = TALER_url_join (url,
+                             "kyc",
                              "h_wire",
                              NULL == h_wire
                              ? NULL
@@ -318,7 +319,7 @@ TALER_MERCHANT_kyc_get (struct GNUNET_CURL_Context *ctx,
   char *url;
 
   GNUNET_asprintf (&url,
-                   "%sprivate/kyc",
+                   "%sprivate/",
                    backend_url);
   return kyc_get (ctx,
                   url,
@@ -343,7 +344,7 @@ TALER_MERCHANT_management_kyc_get (struct 
GNUNET_CURL_Context *ctx,
   char *url;
 
   GNUNET_asprintf (&url,
-                   "%smanagement/instances/%s/kyc",
+                   "%smanagement/instances/%s/",
                    backend_url,
                    instance_id);
   return kyc_get (ctx,
diff --git a/src/lib/merchant_api_get_orders.c 
b/src/lib/merchant_api_get_orders.c
index 441b5ff8..27e5bd1b 100644
--- a/src/lib/merchant_api_get_orders.c
+++ b/src/lib/merchant_api_get_orders.c
@@ -70,7 +70,7 @@ struct TALER_MERCHANT_OrdersGetHandle
  * @param ogh operation handle
  * @return #GNUNET_OK on success
  */
-static int
+static enum GNUNET_GenericReturnValue
 parse_orders (const json_t *ia,
               struct TALER_MERCHANT_OrdersGetHandle *ogh)
 {
@@ -91,7 +91,7 @@ parse_orders (const json_t *ia,
       GNUNET_JSON_spec_uint64 ("row_id",
                                &ie->order_serial),
       TALER_JSON_spec_amount_any ("amount",
-                              &ie->amount),
+                                  &ie->amount),
       GNUNET_JSON_spec_string ("summary",
                                &ie->summary),
       GNUNET_JSON_spec_bool ("refundable",
diff --git a/src/testing/test_merchant_api.c b/src/testing/test_merchant_api.c
index 93c3af55..67dea30f 100644
--- a/src/testing/test_merchant_api.c
+++ b/src/testing/test_merchant_api.c
@@ -36,6 +36,22 @@
 #include <taler/taler_error_codes.h>
 #include "taler_merchant_testing_lib.h"
 
+
+/**
+ * The 'poll-orders-conclude-1' and other 'conclude'
+ * commands should NOT wait for this timeout!
+ */
+#define POLL_ORDER_TIMEOUT \
+  GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60)
+
+/**
+ * The 'poll-orders-conclude-1x' and other 'conclude'
+ * commands that should (!) wait for this timeout! Hence,
+ * here we use a short value!
+ */
+#define POLL_ORDER_SHORT_TIMEOUT \
+  GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 2)
+
 /**
  * Configuration file we use.  One (big) configuration is used
  * for the various components for this test.
@@ -206,14 +222,12 @@ run (void *cls,
                                                PAYTO_I1,
                                                "EUR",
                                                MHD_HTTP_NO_CONTENT),
-#if FIXME
     TALER_TESTING_cmd_merchant_kyc_get ("instance-create-kyc-0",
                                         merchant_url,
                                         NULL,
                                         NULL,
                                         EXCHANGE_URL,
-                                        MHD_HTTP_OK),
-#endif
+                                        MHD_HTTP_NO_CONTENT),
     TALER_TESTING_cmd_merchant_post_orders_no_claim ("create-proposal-4",
                                                      merchant_url,
                                                      MHD_HTTP_OK,
@@ -280,7 +294,7 @@ run (void *cls,
                                              MHD_HTTP_NOT_FOUND),
     TALER_TESTING_cmd_poll_orders_start ("poll-orders-1-start",
                                          merchant_url,
-                                         GNUNET_TIME_UNIT_MINUTES),
+                                         POLL_ORDER_TIMEOUT),
     TALER_TESTING_cmd_merchant_claim_order ("claim-order-nx",
                                             merchant_url,
                                             MHD_HTTP_NOT_FOUND,
@@ -369,18 +383,18 @@ run (void *cls,
     TALER_TESTING_cmd_wallet_poll_order_start ("poll-order-wallet-start-1",
                                                merchant_url,
                                                "create-proposal-1",
-                                               GNUNET_TIME_UNIT_MINUTES,
+                                               POLL_ORDER_TIMEOUT,
                                                NULL),
     TALER_TESTING_cmd_wallet_poll_order_start2 ("poll-order-wallet-start-1x",
                                                 merchant_url,
                                                 "create-proposal-1x",
-                                                GNUNET_TIME_UNIT_MINUTES,
-                                                NULL,
+                                                POLL_ORDER_SHORT_TIMEOUT,
+                                                NULL, /* no refund */
                                                 "session-0"),
     TALER_TESTING_cmd_poll_order_start ("poll-order-merchant-1-start",
                                         merchant_url,
                                         "1",
-                                        GNUNET_TIME_UNIT_MINUTES),
+                                        POLL_ORDER_TIMEOUT),
     TALER_TESTING_cmd_merchant_pay_order ("deposit-simple",
                                           merchant_url,
                                           MHD_HTTP_OK,
@@ -396,6 +410,7 @@ run (void *cls,
                                                   MHD_HTTP_OK,
                                                   NULL,
                                                   "poll-order-wallet-start-1"),
+    /* Here we expect to run into a timeout, as we do not pay this one */
     TALER_TESTING_cmd_wallet_poll_order_conclude2 ("poll-order-1x-conclude",
                                                    MHD_HTTP_OK,
                                                    NULL,
@@ -708,13 +723,13 @@ run (void *cls,
     TALER_TESTING_cmd_wallet_poll_order_start 
("poll-order-wallet-refund-1-low",
                                                merchant_url,
                                                "create-proposal-1r",
-                                               GNUNET_TIME_UNIT_MINUTES,
+                                               POLL_ORDER_TIMEOUT,
                                                "EUR:0.01"),
     TALER_TESTING_cmd_wallet_poll_order_start (
       "poll-order-wallet-refund-1-high",
       merchant_url,
       "create-proposal-1r",
-      GNUNET_TIME_UNIT_MINUTES,
+      POLL_ORDER_TIMEOUT,
       "EUR:0.2"),
     TALER_TESTING_cmd_merchant_pay_order ("pay-for-refund-1r",
                                           merchant_url,
@@ -727,7 +742,7 @@ run (void *cls,
     TALER_TESTING_cmd_poll_order_start ("poll-payment-refund-1",
                                         merchant_url,
                                         "1r", /* proposal name, not cmd ref! */
-                                        GNUNET_TIME_UNIT_MINUTES),
+                                        POLL_ORDER_TIMEOUT),
     TALER_TESTING_cmd_merchant_order_refund ("refund-increase-1r",
                                              merchant_url,
                                              "refund test",
diff --git a/src/testing/testing_api_cmd_get_orders.c 
b/src/testing/testing_api_cmd_get_orders.c
index 479faac9..6e1ca622 100644
--- a/src/testing/testing_api_cmd_get_orders.c
+++ b/src/testing/testing_api_cmd_get_orders.c
@@ -525,7 +525,7 @@ TALER_TESTING_cmd_poll_orders_start (const char *label,
 
 
 /**
- * Run the "GET orders" CMD.
+ * Wait for the "GET orders" CMD to complete.
  *
  * @param cls closure.
  * @param cmd command being run now.
diff --git a/src/testing/testing_api_cmd_kyc_get.c 
b/src/testing/testing_api_cmd_kyc_get.c
index 32378177..0d7a405e 100644
--- a/src/testing/testing_api_cmd_kyc_get.c
+++ b/src/testing/testing_api_cmd_kyc_get.c
@@ -83,7 +83,7 @@ struct KycGetState
  */
 static void
 kyc_get_cleanup (void *cls,
-                const struct TALER_TESTING_Command *cmd)
+                 const struct TALER_TESTING_Command *cmd)
 {
   struct KycGetState *cs = cls;
 
@@ -109,8 +109,12 @@ kyc_get_cb (void *cls,
   struct KycGetState *cs = cls;
 
   cs->kgh = NULL;
-  if (kr->hr.exchange_http_status != cs->expected_http_status)
+  if (kr->hr.http_status != cs->expected_http_status)
   {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Expected status %u, got %u\n",
+                cs->expected_http_status,
+                kr->hr.http_status);
     TALER_TESTING_FAIL (cs->is);
   }
   TALER_TESTING_interpreter_next (cs->is);
@@ -126,8 +130,8 @@ kyc_get_cb (void *cls,
  */
 static void
 kyc_get_run (void *cls,
-            const struct TALER_TESTING_Command *cmd,
-            struct TALER_TESTING_Interpreter *is)
+             const struct TALER_TESTING_Command *cmd,
+             struct TALER_TESTING_Interpreter *is)
 {
   struct KycGetState *cs = cls;
   const struct TALER_MerchantWireHash *h_wire = NULL;
@@ -138,9 +142,9 @@ kyc_get_run (void *cls,
     const struct TALER_TESTING_Command *wire_cmd;
 
     if (NULL ==
-      (wire_cmd =
-       TALER_TESTING_interpreter_lookup_command (cs->is,
-                                                 cs->h_wire_ref)))
+        (wire_cmd =
+           TALER_TESTING_interpreter_lookup_command (cs->is,
+                                                     cs->h_wire_ref)))
     {
       GNUNET_break (0);
       TALER_TESTING_FAIL (cs->is);
diff --git a/src/testing/testing_api_cmd_pay_order.c 
b/src/testing/testing_api_cmd_pay_order.c
index 697f0694..6087ef2b 100644
--- a/src/testing/testing_api_cmd_pay_order.c
+++ b/src/testing/testing_api_cmd_pay_order.c
@@ -416,7 +416,7 @@ pay_cleanup (void *cls,
  * @param index index number of the object to extract.
  * @return #GNUNET_OK on success
  */
-static int
+static enum GNUNET_GenericReturnValue
 pay_traits (void *cls,
             const void **ret,
             const char *trait,
diff --git a/src/testing/testing_api_cmd_wallet_get_order.c 
b/src/testing/testing_api_cmd_wallet_get_order.c
index 1d43c20e..faa0a77d 100644
--- a/src/testing/testing_api_cmd_wallet_get_order.c
+++ b/src/testing/testing_api_cmd_wallet_get_order.c
@@ -106,7 +106,6 @@ wallet_get_order_cb (
   const char *taler_pay_uri,
   const char *already_paid_order_id)
 {
-  /* FIXME, deeper checks should be implemented here. */
   struct WalletGetOrderState *gos = cls;
   bool paid_b = (paid == GNUNET_YES);
   bool refunded_b = (refunded == GNUNET_YES);
@@ -616,7 +615,8 @@ wallet_poll_order_cb (
                 "Unhandled HTTP status.\n");
     break;
   }
-  if (NULL != pos->cs)
+  if ( (NULL != pos->cs) &&
+       (NULL != pos->cs->task) )
   {
     GNUNET_SCHEDULER_cancel (pos->cs->task);
     pos->cs->task = GNUNET_SCHEDULER_add_now (&conclude_task,

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