From fdbabd1a9bfdd84d35717569509ebfc28e9942ba Mon Sep 17 00:00:00 2001 From: bohdan-potuzhnyi Date: Wed, 6 Nov 2024 11:37:49 +0100 Subject: paid webhook --- .../taler-merchant-httpd_post-orders-ID-paid.c | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) 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 #include #include +#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; -- cgit v1.2.3