diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-02-11 15:39:39 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-02-11 15:39:39 +0100 |
commit | de0d987e34d426f6ed3593840078442191255587 (patch) | |
tree | 829357c095652c13c7ea693e6f385ddc0bb38f5d /src/bank-lib | |
parent | 26c9563ef0719601dfd5ac33c70b277dde7e5326 (diff) |
start with new history API implementation
Diffstat (limited to 'src/bank-lib')
-rw-r--r-- | src/bank-lib/fakebank.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/bank-lib/fakebank.c b/src/bank-lib/fakebank.c index abf486876..c7e324dec 100644 --- a/src/bank-lib/fakebank.c +++ b/src/bank-lib/fakebank.c @@ -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 connection the connection @@ -925,8 +925,13 @@ handle_debit_history (struct TALER_FAKEBANK_Handle *h, const char *account) { struct HistoryArgs ha; - struct Transaction *pos; + const struct Transaction *pos; 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 != parse_history_common_args (connection, @@ -967,6 +972,11 @@ handle_debit_history (struct TALER_FAKEBANK_Handle *h, /* list is empty */ pos = NULL; } + if (0 > ha.delta) + end_pos = pos; + else + start_pos = pos; + history = json_array (); while ( (0 != ha.delta) && (NULL != pos) ) @@ -1018,6 +1028,14 @@ handle_debit_history (struct TALER_FAKEBANK_Handle *h, if (0 < ha.delta) 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, MHD_HTTP_OK, "{s:o}", |