[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-exchange] branch master updated: -add notifications for purse eve
From: |
gnunet |
Subject: |
[taler-exchange] branch master updated: -add notifications for purse events |
Date: |
Sat, 30 Apr 2022 13:46:37 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository exchange.
The following commit(s) were added to refs/heads/master by this push:
new fb8349a7 -add notifications for purse events
fb8349a7 is described below
commit fb8349a7e3088f1ca0215ecebcfef553098d7ab9
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sat Apr 30 13:46:35 2022 +0200
-add notifications for purse events
---
src/exchange/taler-exchange-httpd_purses_deposit.c | 15 +++++++++++++++
src/exchange/taler-exchange-httpd_purses_get.c | 8 +++++---
src/exchange/taler-exchange-httpd_purses_merge.c | 17 +++++++++++++++++
3 files changed, 37 insertions(+), 3 deletions(-)
diff --git a/src/exchange/taler-exchange-httpd_purses_deposit.c
b/src/exchange/taler-exchange-httpd_purses_deposit.c
index d29487af..95c5d52f 100644
--- a/src/exchange/taler-exchange-httpd_purses_deposit.c
+++ b/src/exchange/taler-exchange-httpd_purses_deposit.c
@@ -26,6 +26,7 @@
#include <jansson.h>
#include <microhttpd.h>
#include <pthread.h>
+#include "taler_dbevents.h"
#include "taler_json_lib.h"
#include "taler_mhd_lib.h"
#include "taler-exchange-httpd_purses_deposit.h"
@@ -276,6 +277,20 @@ deposit_transaction (void *cls,
return GNUNET_DB_STATUS_HARD_ERROR;
}
}
+ {
+ struct TALER_PurseEventP rep = {
+ .header.size = htons (sizeof (rep)),
+ .header.type = htons (TALER_DBEVENT_EXCHANGE_PURSE_DEPOSITED),
+ .purse_pub = *pcc->purse_pub
+ };
+
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Notifying about purse deposit\n");
+ TEH_plugin->event_notify (TEH_plugin->cls,
+ &rep.header,
+ NULL,
+ 0);
+ }
return qs;
}
diff --git a/src/exchange/taler-exchange-httpd_purses_get.c
b/src/exchange/taler-exchange-httpd_purses_get.c
index ca24adbe..b9cd9c43 100644
--- a/src/exchange/taler-exchange-httpd_purses_get.c
+++ b/src/exchange/taler-exchange-httpd_purses_get.c
@@ -332,9 +332,6 @@ TEH_handler_purses_get (struct TEH_RequestContext *rc,
gc->purse_expiration));
}
- // FIXME: compare amount to deposited amount;
- // if below, set 'deposit_timestamp' to zero!
-
if (GNUNET_TIME_absolute_is_future (gc->timeout) &&
( ((gc->wait_for_merge) &&
GNUNET_TIME_absolute_is_never (gc->merge_timestamp.abs_time)) ||
@@ -358,6 +355,11 @@ TEH_handler_purses_get (struct TEH_RequestContext *rc,
>,
gc->purse_expiration))
dt = gc->purse_expiration;
+ if (0 <
+ TALER_amount_cmp (&gc->amount,
+ &gc->deposited))
+ dt = GNUNET_TIME_UNIT_ZERO_TS;
+
// FIXME: add exchange signature!?
// FIXME: return amount?
res = TALER_MHD_REPLY_JSON_PACK (
diff --git a/src/exchange/taler-exchange-httpd_purses_merge.c
b/src/exchange/taler-exchange-httpd_purses_merge.c
index eb264f48..12a2008f 100644
--- a/src/exchange/taler-exchange-httpd_purses_merge.c
+++ b/src/exchange/taler-exchange-httpd_purses_merge.c
@@ -26,6 +26,7 @@
#include <jansson.h>
#include <microhttpd.h>
#include <pthread.h>
+#include "taler_dbevents.h"
#include "taler_json_lib.h"
#include "taler_mhd_lib.h"
#include "taler-exchange-httpd_purses_merge.h"
@@ -307,6 +308,22 @@ merge_transaction (void *cls,
GNUNET_free (partner_url);
return GNUNET_DB_STATUS_HARD_ERROR;
}
+
+ {
+ struct TALER_PurseEventP rep = {
+ .header.size = htons (sizeof (rep)),
+ .header.type = htons (TALER_DBEVENT_EXCHANGE_PURSE_MERGED),
+ .purse_pub = *pcc->purse_pub
+ };
+
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Notifying about purse merge\n");
+ TEH_plugin->event_notify (TEH_plugin->cls,
+ &rep.header,
+ NULL,
+ 0);
+ }
+
return qs;
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-exchange] branch master updated: -add notifications for purse events,
gnunet <=