diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-08-25 07:58:27 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-08-25 07:58:27 +0200 |
commit | 5672080efcaca68ed2d301adf1673d45f7638a16 (patch) | |
tree | 12767bfb5996765f70f6b421c1179c0e56e8bc3c /src/backend/taler-merchant-httpd_post-orders-ID-pay.c | |
parent | 0c78255cba8bc6ed6c8042995292f02d4980e714 (diff) | |
download | merchant-5672080efcaca68ed2d301adf1673d45f7638a16.tar.gz merchant-5672080efcaca68ed2d301adf1673d45f7638a16.tar.bz2 merchant-5672080efcaca68ed2d301adf1673d45f7638a16.zip |
-add more events
Diffstat (limited to 'src/backend/taler-merchant-httpd_post-orders-ID-pay.c')
-rw-r--r-- | src/backend/taler-merchant-httpd_post-orders-ID-pay.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/backend/taler-merchant-httpd_post-orders-ID-pay.c b/src/backend/taler-merchant-httpd_post-orders-ID-pay.c index f4e7f6ee..ea8dd200 100644 --- a/src/backend/taler-merchant-httpd_post-orders-ID-pay.c +++ b/src/backend/taler-merchant-httpd_post-orders-ID-pay.c @@ -25,6 +25,7 @@ * @author Florian Dold */ #include "platform.h" +#include <taler/taler_dbevents.h> #include <taler/taler_signatures.h> #include <taler/taler_json_lib.h> #include <taler/taler_exchange_service.h> @@ -1290,6 +1291,54 @@ check_payment_sufficient (struct PayContext *pc) /** + * Use database to notify other clients about the + * payment being completed. + * + * @param pc context to trigger notification for + */ +static void +trigger_payment_notification (struct PayContext *pc) +{ + { + struct TMH_OrderPayEvent pay_eh = { + .header.size = htons (sizeof (pay_eh)), + .header.type = htons (TALER_DBEVENT_MERCHANT_ORDER_PAID) + }; + + GNUNET_CRYPTO_hash (pc->order_id, + strlen (pc->order_id), + &pay_eh.h_order_id); + TMH_db->event_notify (TMH_db->cls, + &pay_eh.header, + NULL, + 0); + } + if ( (NULL != pc->session_id) && + (NULL != pc->fulfillment_url) ) + { +#ifndef TALER_API_VERSION +#define TALER_DBEVENT_MERCHANT_SESSION_CAPTURED 1103 +#endif + struct TMH_SessionEvent session_eh = { + .header.size = htons (sizeof (session_eh)), + .header.type = htons (TALER_DBEVENT_MERCHANT_SESSION_CAPTURED) + }; + + GNUNET_CRYPTO_hash (pc->session_id, + strlen (pc->session_id), + &session_eh.h_session_id); + GNUNET_CRYPTO_hash (pc->fulfillment_url, + strlen (pc->fulfillment_url), + &session_eh.h_fulfillment_url); + TMH_db->event_notify (TMH_db->cls, + &session_eh.header, + NULL, + 0); + } +} + + +/** * * */ @@ -1445,6 +1494,7 @@ execute_pay_transaction (struct PayContext *pc) "mark contract paid"); return; } + trigger_payment_notification (pc); } { |