aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/exchange/taler-exchange-httpd_purses_deposit.c15
-rw-r--r--src/exchange/taler-exchange-httpd_purses_get.c8
-rw-r--r--src/exchange/taler-exchange-httpd_purses_merge.c17
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 d29487af5..95c5d52f6 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 ca24adbe9..b9cd9c43f 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 eb264f486..12a2008f5 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;
}