gnunet-svn
[Top][All Lists]
Advanced

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

[taler-merchant] branch master updated (9a651aee -> ad966ab4)


From: gnunet
Subject: [taler-merchant] branch master updated (9a651aee -> ad966ab4)
Date: Wed, 01 Feb 2023 13:04:11 +0100

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

priscilla-huang pushed a change to branch master
in repository merchant.

    from 9a651aee -fix non-deterministic failure if no refund deadline given
     new 8b188505 update from the file testing
     new ad966ab4 update webhook header_template and body_template, these two 
can be optional now

The 2 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:
 .../taler-merchant-httpd_private-get-webhooks-ID.c       | 10 ++++++----
 .../taler-merchant-httpd_private-patch-webhooks-ID.c     | 13 ++++++++-----
 src/backend/taler-merchant-webhook.c                     |  7 +++++--
 src/testing/testing_api_cmd_get_webhook.c                | 16 +++++++++++-----
 src/testing/testing_api_cmd_patch_webhook.c              |  4 ++--
 src/testing/testing_api_cmd_post_webhooks.c              |  4 ++--
 src/testing/testing_api_cmd_webhook.c                    |  6 +++---
 7 files changed, 37 insertions(+), 23 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_private-get-webhooks-ID.c 
b/src/backend/taler-merchant-httpd_private-get-webhooks-ID.c
index 94371e9e..e1566efd 100644
--- a/src/backend/taler-merchant-httpd_private-get-webhooks-ID.c
+++ b/src/backend/taler-merchant-httpd_private-get-webhooks-ID.c
@@ -72,10 +72,12 @@ TMH_private_get_webhooks_ID (const struct 
TMH_RequestHandler *rh,
                                wb.url),
       GNUNET_JSON_pack_string ("http_method",
                                wb.http_method),
-      GNUNET_JSON_pack_string ("header_template",
-                               wb.header_template),
-      GNUNET_JSON_pack_string ("body_template",
-                               wb.body_template));
+      GNUNET_JSON_pack_allow_null (
+        GNUNET_JSON_pack_string ("header_template",
+                                 wb.header_template)),
+      GNUNET_JSON_pack_allow_null (
+        GNUNET_JSON_pack_string ("body_template",
+                                 wb.body_template)));
     GNUNET_free (wb.event_type);
     GNUNET_free (wb.url);
     GNUNET_free (wb.http_method);
diff --git a/src/backend/taler-merchant-httpd_private-patch-webhooks-ID.c 
b/src/backend/taler-merchant-httpd_private-patch-webhooks-ID.c
index d84a888c..18f946f0 100644
--- a/src/backend/taler-merchant-httpd_private-patch-webhooks-ID.c
+++ b/src/backend/taler-merchant-httpd_private-patch-webhooks-ID.c
@@ -116,11 +116,14 @@ TMH_private_patch_webhooks_ID (const struct 
TMH_RequestHandler *rh,
                              (const char **) &wb.url),
     GNUNET_JSON_spec_string ("http_method",
                              (const char **) &wb.http_method),
-    GNUNET_JSON_spec_string ("header_template",
-                             (const char **) &wb.header_template),
-    GNUNET_JSON_spec_string ("body_template",
-                             (const char **) &wb.body_template),
-
+    GNUNET_JSON_spec_mark_optional (
+      GNUNET_JSON_spec_string ("header_template",
+                               (const char **) &wb.header_template),
+    NULL),
+    GNUNET_JSON_spec_mark_optional (
+      GNUNET_JSON_spec_string ("body_template",
+                               (const char **) &wb.body_template),
+    NULL),
     GNUNET_JSON_spec_end ()
   };
 
diff --git a/src/backend/taler-merchant-webhook.c 
b/src/backend/taler-merchant-webhook.c
index 1d258a18..ed0e148d 100644
--- a/src/backend/taler-merchant-webhook.c
+++ b/src/backend/taler-merchant-webhook.c
@@ -170,7 +170,8 @@ handle_webhook_response (void *cls,
     qs = db_plugin->delete_pending_webhook (db_plugin->cls,
                                             w->webhook_pending_serial);
 
-    if ((GNUNET_DB_STATUS_HARD_ERROR == qs) 
||(GNUNET_DB_STATUS_SOFT_ERROR==qs))
+    /* GNUNET_DB_STATUS_SOFT_ERROR seems impossible */
+    if ((GNUNET_DB_STATUS_HARD_ERROR == qs) 
||(GNUNET_DB_STATUS_SUCCESS_ONE_RESULT==qs))
       {
         GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                     "Failed!\n");
@@ -203,7 +204,9 @@ handle_webhook_response (void *cls,
     qs = db_plugin->update_pending_webhook (db_plugin->cls,
                                             w->webhook_pending_serial,
                                             GNUNET_TIME_relative_to_absolute 
(next_attempt));
-    if ((GNUNET_DB_STATUS_HARD_ERROR == qs) 
||(GNUNET_DB_STATUS_SOFT_ERROR==qs))
+
+    /* GNUNET_DB_STATUS_SOFT_ERROR seems impossible */
+    if ((GNUNET_DB_STATUS_HARD_ERROR == qs) 
||(GNUNET_DB_STATUS_SUCCESS_ONE_RESULT==qs))
       {
         GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                     "Failed!\n");
diff --git a/src/testing/testing_api_cmd_get_webhook.c 
b/src/testing/testing_api_cmd_get_webhook.c
index 7acc344e..b28a075e 100644
--- a/src/testing/testing_api_cmd_get_webhook.c
+++ b/src/testing/testing_api_cmd_get_webhook.c
@@ -114,7 +114,7 @@ get_webhook_cb (void *cls,
           TALER_TESTING_get_trait_event_type (webhook_cmd,
                                               &expected_event_type))
         TALER_TESTING_interpreter_fail (gis->is);
-      if (0 != strcmp (event_type,         
+      if (0 != strcmp (event_type,
                        *expected_event_type))
       {
         GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -162,8 +162,11 @@ get_webhook_cb (void *cls,
           TALER_TESTING_get_trait_header_template (webhook_cmd,
                                                    &expected_header_template))
         TALER_TESTING_interpreter_fail (gis->is);
-      if (0 != strcmp (header_template,
-                       *expected_header_template))
+      if ( ( (NULL == header_template) && (NULL != *expected_header_template)) 
||
+           ( (NULL != header_template) && (NULL == expected_header_template)) 
||
+           ( (NULL != header_template) &&
+             (0 != strcmp (header_template,
+                           *expected_header_template)) ) )
       {
         GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                     "header template does not match\n");
@@ -178,8 +181,11 @@ get_webhook_cb (void *cls,
           TALER_TESTING_get_trait_body_template (webhook_cmd,
                                                  &expected_body_template))
         TALER_TESTING_interpreter_fail (gis->is);
-      if (0 != strcmp (body_template,
-                       *expected_body_template))
+      if ( ( (NULL == body_template) && (NULL != *expected_body_template)) ||
+           ( (NULL != body_template) && (NULL == expected_body_template)) ||
+           ( (NULL != body_template) &&
+             (0 != strcmp (body_template,
+                           *expected_body_template)) ) )
       {
         GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                     "body template does not match\n");
diff --git a/src/testing/testing_api_cmd_patch_webhook.c 
b/src/testing/testing_api_cmd_patch_webhook.c
index a2fea433..8cbcc6b1 100644
--- a/src/testing/testing_api_cmd_patch_webhook.c
+++ b/src/testing/testing_api_cmd_patch_webhook.c
@@ -239,8 +239,8 @@ TALER_TESTING_cmd_merchant_patch_webhook (
   pis->event_type = event_type;
   pis->url = url;
   pis->http_method = http_method;
-  pis->header_template = header_template;
-  pis->body_template = body_template;
+  pis->header_template = (NULL == header_template) ? NULL : header_template;
+  pis->body_template = (NULL == body_template) ? NULL : body_template;
   {
     struct TALER_TESTING_Command cmd = {
       .cls = pis,
diff --git a/src/testing/testing_api_cmd_post_webhooks.c 
b/src/testing/testing_api_cmd_post_webhooks.c
index d1628429..9f7c36b7 100644
--- a/src/testing/testing_api_cmd_post_webhooks.c
+++ b/src/testing/testing_api_cmd_post_webhooks.c
@@ -240,8 +240,8 @@ TALER_TESTING_cmd_merchant_post_webhooks2 (
   wis->event_type = event_type;
   wis->url = url;
   wis->http_method = http_method;
-  wis->header_template = header_template;
-  wis->body_template = body_template;
+  wis->header_template = (NULL==header_template) ? NULL : header_template;
+  wis->body_template = (NULL==body_template) ? NULL : body_template;
   {
     struct TALER_TESTING_Command cmd = {
       .cls = wis,
diff --git a/src/testing/testing_api_cmd_webhook.c 
b/src/testing/testing_api_cmd_webhook.c
index fa97db71..519e46a6 100644
--- a/src/testing/testing_api_cmd_webhook.c
+++ b/src/testing/testing_api_cmd_webhook.c
@@ -22,10 +22,10 @@
  * @author Priscilla HUANG
  */
 #include "platform.h"
-#include "taler_json_lib.h"
+#include "taler/taler_json_lib.h"
 #include <gnunet/gnunet_curl_lib.h>
-#include "taler_signatures.h"
-#include "taler_testing_lib.h"
+#include "taler/taler_signatures.h"
+#include "taler/taler_testing_lib.h"
 
 
 /**

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