diff options
author | bohdan-potuzhnyi <bohdan.potuzhnyi@gmail.com> | 2024-11-06 11:37:49 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2024-11-15 13:50:49 +0100 |
commit | fdbabd1a9bfdd84d35717569509ebfc28e9942ba (patch) | |
tree | 963b0cfe112a43d09b8295791211e988d98f3abd /src | |
parent | 666c318e87cfe0b34c946c7fa90d1c49ce6739c6 (diff) |
paid webhook
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/taler-merchant-httpd_post-orders-ID-paid.c | 28 |
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; |