summaryrefslogtreecommitdiff
path: root/src/backend/taler-merchant-httpd_private-post-webhooks.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/taler-merchant-httpd_private-post-webhooks.c')
-rw-r--r--src/backend/taler-merchant-httpd_private-post-webhooks.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/src/backend/taler-merchant-httpd_private-post-webhooks.c b/src/backend/taler-merchant-httpd_private-post-webhooks.c
index 48f6e7fb..391c7ea9 100644
--- a/src/backend/taler-merchant-httpd_private-post-webhooks.c
+++ b/src/backend/taler-merchant-httpd_private-post-webhooks.c
@@ -51,10 +51,18 @@ webhooks_equal (const struct TALER_MERCHANTDB_WebhookDetails *w1,
w2->url)) &&
(0 == strcmp (w1->http_method,
w2->http_method)) &&
- (0 == strcmp (w1->header_template,
- w2->header_template)) &&
- (0 == strcmp (w1->body_template,
- w2->body_template)));
+ ( ( (NULL == w1->header_template) &&
+ (NULL == w2->header_template) ) ||
+ ( (NULL != w1->header_template) &&
+ (NULL != w2->header_template) &&
+ (0 == strcmp (w1->header_template,
+ w2->header_template)) ) ) &&
+ ( ( (NULL == w1->body_template) &&
+ (NULL == w2->body_template) ) ||
+ ( (NULL != w1->body_template) &&
+ (NULL != w2->body_template) &&
+ (0 == strcmp (w1->body_template,
+ w2->body_template)) ) ) );
}
@@ -72,14 +80,18 @@ TMH_private_post_webhooks (const struct TMH_RequestHandler *rh,
&webhook_id),
GNUNET_JSON_spec_string ("event_type",
(const char **) &wb.event_type),
- GNUNET_JSON_spec_string ("url",
+ TALER_JSON_spec_web_url ("url",
(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 ()
};
@@ -100,7 +112,6 @@ TMH_private_post_webhooks (const struct TMH_RequestHandler *rh,
}
-
/* finally, interact with DB until no serialization error */
for (unsigned int i = 0; i<MAX_RETRIES; i++)
{