aboutsummaryrefslogtreecommitdiff
path: root/src/backend/taler-merchant-httpd_post-orders-ID-pay.c
diff options
context:
space:
mode:
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.c50
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 @@
25 * @author Florian Dold 25 * @author Florian Dold
26 */ 26 */
27#include "platform.h" 27#include "platform.h"
28#include <taler/taler_dbevents.h>
28#include <taler/taler_signatures.h> 29#include <taler/taler_signatures.h>
29#include <taler/taler_json_lib.h> 30#include <taler/taler_json_lib.h>
30#include <taler/taler_exchange_service.h> 31#include <taler/taler_exchange_service.h>
@@ -1290,6 +1291,54 @@ check_payment_sufficient (struct PayContext *pc)
1290 1291
1291 1292
1292/** 1293/**
1294 * Use database to notify other clients about the
1295 * payment being completed.
1296 *
1297 * @param pc context to trigger notification for
1298 */
1299static void
1300trigger_payment_notification (struct PayContext *pc)
1301{
1302 {
1303 struct TMH_OrderPayEvent pay_eh = {
1304 .header.size = htons (sizeof (pay_eh)),
1305 .header.type = htons (TALER_DBEVENT_MERCHANT_ORDER_PAID)
1306 };
1307
1308 GNUNET_CRYPTO_hash (pc->order_id,
1309 strlen (pc->order_id),
1310 &pay_eh.h_order_id);
1311 TMH_db->event_notify (TMH_db->cls,
1312 &pay_eh.header,
1313 NULL,
1314 0);
1315 }
1316 if ( (NULL != pc->session_id) &&
1317 (NULL != pc->fulfillment_url) )
1318 {
1319#ifndef TALER_API_VERSION
1320#define TALER_DBEVENT_MERCHANT_SESSION_CAPTURED 1103
1321#endif
1322 struct TMH_SessionEvent session_eh = {
1323 .header.size = htons (sizeof (session_eh)),
1324 .header.type = htons (TALER_DBEVENT_MERCHANT_SESSION_CAPTURED)
1325 };
1326
1327 GNUNET_CRYPTO_hash (pc->session_id,
1328 strlen (pc->session_id),
1329 &session_eh.h_session_id);
1330 GNUNET_CRYPTO_hash (pc->fulfillment_url,
1331 strlen (pc->fulfillment_url),
1332 &session_eh.h_fulfillment_url);
1333 TMH_db->event_notify (TMH_db->cls,
1334 &session_eh.header,
1335 NULL,
1336 0);
1337 }
1338}
1339
1340
1341/**
1293 * 1342 *
1294 * 1343 *
1295 */ 1344 */
@@ -1445,6 +1494,7 @@ execute_pay_transaction (struct PayContext *pc)
1445 "mark contract paid"); 1494 "mark contract paid");
1446 return; 1495 return;
1447 } 1496 }
1497 trigger_payment_notification (pc);
1448 } 1498 }
1449 1499
1450 { 1500 {