aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/taler-merchant-httpd_post-orders-ID-paid.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/backend/taler-merchant-httpd_post-orders-ID-paid.c b/src/backend/taler-merchant-httpd_post-orders-ID-paid.c
index 4eb7280f..39b2ae8f 100644
--- a/src/backend/taler-merchant-httpd_post-orders-ID-paid.c
+++ b/src/backend/taler-merchant-httpd_post-orders-ID-paid.c
@@ -27,6 +27,7 @@
#include <taler/taler_signatures.h>
#include <taler/taler_json_lib.h>
#include <taler/taler_exchange_service.h>
+#include "taler-merchant-httpd_helper.h"
#include "taler-merchant-httpd_post-orders-ID-paid.h"
@@ -219,6 +220,33 @@ TMH_post_orders_ID_paid (const struct TMH_RequestHandler *rh,
trigger_session_notification (hc,
session_id,
fulfillment_url);
+
+ /*Trigger webhook */
+ {
+ enum GNUNET_DB_QueryStatus qs;
+ json_t *jhook;
+
+ jhook = GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_object_incref ("contract_terms",
+ contract_terms),
+ GNUNET_JSON_pack_string ("order_id",
+ order_id)
+ );
+ GNUNET_assert (NULL != jhook);
+ qs = TMH_trigger_webhook (hc->instance->settings.id,
+ "paid",
+ jhook);
+ json_decref (jhook);
+ if (qs < 0)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Failed to init the webhook for contract %s with %s/%s as paid\n",
+ order_id,
+ session_id,
+ fulfillment_url);
+ }
+ }
+
/* fulfillment_url is part of the contract_terms */
{
bool refunded = false;