-add notifications for purse events
This commit is contained in:
parent
8e4969eb66
commit
fb8349a7e3
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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 (
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user