start with new history API implementation

This commit is contained in:
Christian Grothoff 2020-02-11 15:39:39 +01:00
parent 26c9563ef0
commit de0d987e34
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
5 changed files with 26 additions and 8 deletions

@ -1 +1 @@
Subproject commit 934a6a18301e81c4fd1b3a8cda2dc13dca4741cc Subproject commit ca53235ccfa0458ebf11c204888ca370e20ec3f5

View File

@ -776,7 +776,7 @@ handle_transfer (struct TALER_FAKEBANK_Handle *h,
/** /**
* Handle incoming HTTP request for /history * Handle incoming HTTP request for /
* *
* @param h the fakebank handle * @param h the fakebank handle
* @param connection the connection * @param connection the connection
@ -925,8 +925,13 @@ handle_debit_history (struct TALER_FAKEBANK_Handle *h,
const char *account) const char *account)
{ {
struct HistoryArgs ha; struct HistoryArgs ha;
struct Transaction *pos; const struct Transaction *pos;
json_t *history; json_t *history;
struct TALER_Amount total_incoming;
struct TALER_Amount start_outgoing;
struct TALER_Amount end_outgoing;
const struct Transaction *start_pos;
const struct Transaction *end_pos;
if (GNUNET_OK != if (GNUNET_OK !=
parse_history_common_args (connection, parse_history_common_args (connection,
@ -967,6 +972,11 @@ handle_debit_history (struct TALER_FAKEBANK_Handle *h,
/* list is empty */ /* list is empty */
pos = NULL; pos = NULL;
} }
if (0 > ha.delta)
end_pos = pos;
else
start_pos = pos;
history = json_array (); history = json_array ();
while ( (0 != ha.delta) && while ( (0 != ha.delta) &&
(NULL != pos) ) (NULL != pos) )
@ -1018,6 +1028,14 @@ handle_debit_history (struct TALER_FAKEBANK_Handle *h,
if (0 < ha.delta) if (0 < ha.delta)
pos = pos->next; pos = pos->next;
} }
if (0 > ha.delta)
start_pos = pos;
else
end_pos = pos;
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (fb->currency,
&));
return TALER_MHD_reply_json_pack (connection, return TALER_MHD_reply_json_pack (connection,
MHD_HTTP_OK, MHD_HTTP_OK,
"{s:o}", "{s:o}",