From b31d803c167ada7ab33a1fc59be9ba5bb5dc5981 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 15 Jan 2018 15:19:31 +0100 Subject: [PATCH] add timestamp for /reserve/status deposit events --- src/exchange-lib/exchange_api_reserve.c | 4 ++++ src/exchange/taler-exchange-httpd_responses.c | 7 +++++-- src/include/taler_exchange_service.h | 5 +++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/exchange-lib/exchange_api_reserve.c b/src/exchange-lib/exchange_api_reserve.c index 35fd0e018..ab857f28f 100644 --- a/src/exchange-lib/exchange_api_reserve.c +++ b/src/exchange-lib/exchange_api_reserve.c @@ -142,11 +142,14 @@ parse_reserve_history (struct TALER_EXCHANGE_Handle *exchange, json_t *wire_account; void *wire_reference; size_t wire_reference_size; + struct GNUNET_TIME_Absolute timestamp; struct GNUNET_JSON_Specification withdraw_spec[] = { GNUNET_JSON_spec_varsize ("wire_reference", &wire_reference, &wire_reference_size), + GNUNET_JSON_spec_absolute_time ("timestamp", + ×tamp), GNUNET_JSON_spec_json ("sender_account_details", &wire_account), GNUNET_JSON_spec_end() @@ -173,6 +176,7 @@ parse_reserve_history (struct TALER_EXCHANGE_Handle *exchange, rhistory[off].details.in_details.sender_account_details = wire_account; rhistory[off].details.in_details.wire_reference = wire_reference; rhistory[off].details.in_details.wire_reference_size = wire_reference_size; + rhistory[off].details.in_details.timestamp = timestamp; /* end type==DEPOSIT */ } else if (0 == strcasecmp (type, diff --git a/src/exchange/taler-exchange-httpd_responses.c b/src/exchange/taler-exchange-httpd_responses.c index 8965e2aaf..c7874ed15 100644 --- a/src/exchange/taler-exchange-httpd_responses.c +++ b/src/exchange/taler-exchange-httpd_responses.c @@ -711,7 +711,9 @@ TEH_RESPONSE_compile_reserve_history (const struct TALER_EXCHANGEDB_ReserveHisto json_history = json_array (); ret = 0; - for (const struct TALER_EXCHANGEDB_ReserveHistory *pos = rh; NULL != pos; pos = pos->next) + for (const struct TALER_EXCHANGEDB_ReserveHistory *pos = rh; + NULL != pos; + pos = pos->next) { switch (pos->type) { @@ -731,8 +733,9 @@ TEH_RESPONSE_compile_reserve_history (const struct TALER_EXCHANGEDB_ReserveHisto ret |= 1; GNUNET_assert (0 == json_array_append_new (json_history, - json_pack ("{s:s, s:O, s:o, s:o}", + json_pack ("{s:s, s:o, s:O, s:o, s:o}", "type", "DEPOSIT", + "timestamp", GNUNET_JSON_from_time_abs (pos->details.bank->execution_date), "sender_account_details", pos->details.bank->sender_account_details, "wire_reference", GNUNET_JSON_from_data (pos->details.bank->wire_reference, pos->details.bank->wire_reference_size), diff --git a/src/include/taler_exchange_service.h b/src/include/taler_exchange_service.h index f1af114cb..2d9460e22 100644 --- a/src/include/taler_exchange_service.h +++ b/src/include/taler_exchange_service.h @@ -845,6 +845,11 @@ struct TALER_EXCHANGE_ReserveHistory */ void *wire_reference; + /** + * When did the wire transfer happen? + */ + struct GNUNET_TIME_Absolute timestamp; + /** * Number of bytes stored in @e wire_reference. */