summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bank-lib/bank_api_history.c61
-rw-r--r--src/bank-lib/fakebank.c75
-rw-r--r--src/bank-lib/fakebank_history.c41
-rw-r--r--src/bank-lib/testing_api_cmd_history.c188
-rw-r--r--src/include/taler_bank_service.h35
-rw-r--r--src/include/taler_testing_bank_lib.h57
6 files changed, 1 insertions, 456 deletions
diff --git a/src/bank-lib/bank_api_history.c b/src/bank-lib/bank_api_history.c
index fcb68009..f5013b85 100644
--- a/src/bank-lib/bank_api_history.c
+++ b/src/bank-lib/bank_api_history.c
@@ -346,67 +346,6 @@ conv_cancel (enum TALER_BANK_Direction direction)
/**
- * Request the wire transfer history of a bank account,
- * using time stamps to narrow the results.
- *
- * @param ctx curl context for the event loop
- * @param bank_base_url URL of the bank (used to execute this
- * request)
- * @param auth authentication data to use
- * @param account_number which account number should we query
- * @param direction what kinds of wire transfers should be
- * returned
- * @param ascending if GNUNET_YES, history elements will
- * be returned in chronological order.
- * @param start_date threshold for oldest result.
- * @param end_date threshold for youngest result.
- * @param hres_cb the callback to call with the transaction
- * history
- * @param hres_cb_cls closure for the above callback
- * @return NULL if the inputs are invalid (i.e. zero value for
- * @e num_results). In this case, the callback is not
- * called.
- */
-struct TALER_BANK_HistoryHandle *
-TALER_BANK_history_range (struct GNUNET_CURL_Context *ctx,
- const char *bank_base_url,
- const struct TALER_BANK_AuthenticationData *auth,
- uint64_t account_number,
- enum TALER_BANK_Direction direction,
- unsigned int ascending,
- struct GNUNET_TIME_Absolute start_date,
- struct GNUNET_TIME_Absolute end_date,
- TALER_BANK_HistoryResultCallback hres_cb,
- void *hres_cb_cls)
-{
- struct TALER_BANK_HistoryHandle *hh;
- char *url;
-
- GNUNET_TIME_round_abs (&start_date);
- GNUNET_TIME_round_abs (&end_date);
-
- GNUNET_asprintf (&url,
- "/history-range?auth=basic&account_number=%llu&start=%llu&end=%llu&direction=%s&cancelled=%s&ordering=%s",
- (unsigned long long) account_number,
- start_date.abs_value_us / 1000LL / 1000LL,
- end_date.abs_value_us / 1000LL / 1000LL,
- conv_direction (direction),
- conv_cancel (direction),
- (GNUNET_YES == ascending) ? "ascending" : "descending");
-
- hh = put_history_job (ctx,
- bank_base_url,
- url,
- auth,
- hres_cb,
- hres_cb_cls);
-
- GNUNET_free (url);
- return hh;
-}
-
-
-/**
* Request the wire transfer history of a bank account.
*
* @param ctx curl context for the event loop
diff --git a/src/bank-lib/fakebank.c b/src/bank-lib/fakebank.c
index e1a5c9bb..5b388f66 100644
--- a/src/bank-lib/fakebank.c
+++ b/src/bank-lib/fakebank.c
@@ -715,74 +715,6 @@ handle_history (struct TALER_FAKEBANK_Handle *h,
/**
- * Handle incoming HTTP request for /history-range.
- *
- * @param h the fakebank handle
- * @param connection the connection
- * @param con_cls place to store state, not used
- * @return MHD result code
- */
-static int
-handle_history_range (struct TALER_FAKEBANK_Handle *h,
- struct MHD_Connection *connection,
- void **con_cls)
-{
- struct HistoryArgs ha;
- struct HistoryRangeDates hrd;
- const char *start;
- const char *end;
- long long unsigned int start_stamp;
- long long unsigned int end_stamp;
- struct Transaction *pos;
-
- (void) con_cls;
- if (GNUNET_OK !=
- TFH_parse_history_common_args (connection,
- &ha))
- {
- GNUNET_break (0);
- return MHD_NO;
- }
- start = MHD_lookup_connection_value (connection,
- MHD_GET_ARGUMENT_KIND,
- "start");
- end = MHD_lookup_connection_value (connection,
- MHD_GET_ARGUMENT_KIND,
- "end");
-
- if ( (NULL == start) || (1 != sscanf (start,
- "%llu",
- &start_stamp)) ||
- (NULL == end) || (1 != sscanf (end,
- "%lld",
- &end_stamp)) )
- {
- GNUNET_break (0);
- return MHD_NO;
- }
-
- hrd.start.abs_value_us = start_stamp * 1000LL * 1000LL;
- hrd.end.abs_value_us = end_stamp * 1000LL * 1000LL;
- ha.range = &hrd;
-
- /* hunt for 'pos' in the Transaction(s) LL. */
- for (pos = h->transactions_head;
- NULL != pos;
- pos = pos->next)
- {
- if (hrd.start.abs_value_us <= pos->date.abs_value_us)
- break;
- }
- return TFH_build_history_response (connection,
- pos,
- &ha,
- &TFH_handle_history_range_skip,
- &TFH_handle_history_range_skip,
- &TFH_handle_history_range_advance);
-}
-
-
-/**
* Handle incoming HTTP request.
*
* @param cls a `struct TALER_FAKEBANK_Handle`
@@ -837,13 +769,6 @@ handle_mhd_request (void *cls,
upload_data_size,
con_cls);
if ( (0 == strcasecmp (url,
- "/history-range")) &&
- (0 == strcasecmp (method,
- MHD_HTTP_METHOD_GET)) )
- return handle_history_range (h,
- connection,
- con_cls);
- if ( (0 == strcasecmp (url,
"/history")) &&
(0 == strcasecmp (method,
MHD_HTTP_METHOD_GET)) )
diff --git a/src/bank-lib/fakebank_history.c b/src/bank-lib/fakebank_history.c
index 17057452..f4c615c5 100644
--- a/src/bank-lib/fakebank_history.c
+++ b/src/bank-lib/fakebank_history.c
@@ -97,47 +97,6 @@ TFH_handle_history_step (const struct HistoryArgs *ha,
/**
- * Decides whether the history builder will advance or not
- * to the next element.
- *
- * @param ha history args
- * @return GNUNET_YES/NO to advance/not-advance.
- */
-int
-TFH_handle_history_range_advance (const struct HistoryArgs *ha,
- const struct Transaction *pos)
-{
- const struct HistoryRangeDates *hrd = ha->range;
-
- if ( (NULL != pos) &&
- (pos->date.abs_value_us <= hrd->end.abs_value_us) )
- return GNUNET_YES;
-
- return GNUNET_NO;
-}
-
-
-/**
- * Iterates towards the "next" element to be processed. To
- * be used when the current element does not get inserted in
- * the result.
- *
- * @param ha history arguments.
- * @param pos current element being processed.
- * @return the next element to be processed.
- */
-struct Transaction *
-TFH_handle_history_range_skip (const struct HistoryArgs *ha,
- const struct Transaction *pos)
-{
- (void) ha;
- /* Transactions
- * are stored from "head"/older to "tail"/younger. */
- return pos->next;
-}
-
-
-/**
* Actual history response builder.
*
* @param pos first (included) element in the result set, NULL if history is empty
diff --git a/src/bank-lib/testing_api_cmd_history.c b/src/bank-lib/testing_api_cmd_history.c
index 0b5184ad..dc5cd2d9 100644
--- a/src/bank-lib/testing_api_cmd_history.c
+++ b/src/bank-lib/testing_api_cmd_history.c
@@ -61,9 +61,7 @@ struct HistoryState
const char *start_row_reference;
/**
- * How many rows we want in the result, _at most_. In
- * the case of /history-range, we fake this value with
- * UINT64_MAX.
+ * How many rows we want in the result, _at most_.
*/
unsigned long long num_results;
@@ -930,85 +928,6 @@ history_run (void *cls,
/**
- * Run the command.
- *
- * @param cls closure.
- * @param cmd the command to execute.
- * @param is the interpreter state.
- */
-static void
-history_range_run (void *cls,
- const struct TALER_TESTING_Command *cmd,
- struct TALER_TESTING_Interpreter *is)
-{
- struct HistoryState *hs = cls;
- const struct GNUNET_TIME_Absolute *start_date;
- const struct GNUNET_TIME_Absolute *end_date;
- struct TALER_BANK_AuthenticationData *auth;
-
- (void) cmd;
- if (NULL != hs->start_row_reference)
- {
- const struct TALER_TESTING_Command *history_cmd;
-
- history_cmd = TALER_TESTING_interpreter_lookup_command
- (is, hs->start_row_reference);
-
- if (NULL == history_cmd)
- TALER_TESTING_FAIL (is);
-
- if (GNUNET_OK != TALER_TESTING_get_trait_absolute_time
- (history_cmd, 0, &start_date))
- TALER_TESTING_FAIL (is);
- hs->start_date = *start_date;
- }
- else
- {
- /* no trait wanted. */
- GNUNET_assert (GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us !=
- hs->start_date.abs_value_us);
- start_date = &hs->start_date;
- }
-
- if (NULL != hs->end_row_reference)
- {
- const struct TALER_TESTING_Command *history_cmd;
-
- history_cmd = TALER_TESTING_interpreter_lookup_command
- (is, hs->end_row_reference);
-
- if (NULL == history_cmd)
- TALER_TESTING_FAIL (is);
-
- if (GNUNET_OK != TALER_TESTING_get_trait_absolute_time
- (history_cmd, 0, &end_date))
- TALER_TESTING_FAIL (is);
- hs->end_date = *end_date;
- }
- else
- {
- /* no trait wanted. */
- GNUNET_assert (GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us !=
- hs->end_date.abs_value_us);
- end_date = &hs->end_date;
- }
-
- auth = &AUTHS[hs->account_no - 1];
- hs->hh = TALER_BANK_history_range (is->ctx,
- hs->bank_url,
- auth,
- hs->account_no,
- hs->direction,
- hs->ascending,
- *start_date,
- *end_date,
- &history_cb,
- is);
- GNUNET_assert (NULL != hs->hh);
-}
-
-
-/**
* Free the state from a "history" CMD, and possibly cancel
* a pending operation thereof.
*
@@ -1082,109 +1001,4 @@ TALER_TESTING_cmd_bank_history (const char *label,
}
-/**
- * Make a "history-range" CMD, picking dates from traits.
- *
- * @param label command label.
- * @param bank_url base URL of the bank offering the "history"
- * operation.
- * @param account_no bank account number to ask the history for.
- * @param direction which direction this operation is interested.
- * @param ascending if GNUNET_YES, the bank will return the rows
- * in ascending (= chronological) order.
- * @param start_row_reference reference to a command that can
- * offer a absolute time to use as the 'start' argument
- * for "/history-range".
- * @param end_row_reference reference to a command that can
- * offer a absolute time to use as the 'end' argument
- * for "/history-range".
- * @return the command.
- */
-struct TALER_TESTING_Command
-TALER_TESTING_cmd_bank_history_range
- (const char *label,
- const char *bank_url,
- uint64_t account_no,
- enum TALER_BANK_Direction direction,
- unsigned int ascending,
- const char *start_row_reference,
- const char *end_row_reference)
-{
- struct HistoryState *hs;
-
- hs = GNUNET_new (struct HistoryState);
- hs->bank_url = bank_url;
- hs->account_no = account_no;
- hs->direction = direction;
- hs->start_row_reference = start_row_reference;
- hs->end_row_reference = end_row_reference;
- hs->ascending = ascending;
- hs->start_date = GNUNET_TIME_UNIT_FOREVER_ABS;
- hs->end_date = GNUNET_TIME_UNIT_FOREVER_ABS;
-
- {
- struct TALER_TESTING_Command cmd = {
- .label = label,
- .cls = hs,
- .run = &history_range_run,
- .cleanup = &history_cleanup,
- .traits = &history_traits
- };
-
- return cmd;
- }
-}
-
-
-/**
- * Make a "history-range" CMD, picking dates from the arguments.
- *
- * @param label command label.
- * @param bank_url base URL of the bank offering the "history"
- * operation.
- * @param account_no bank account number to ask the history for.
- * @param direction which direction this operation is interested.
- * @param ascending if GNUNET_YES, the bank will return the rows
- * in ascending (= chronological) order.
- * @param start_date value for the 'start' argument
- * of "/history-range".
- * @param end_date value for the 'end' argument
- * of "/history-range".
- * @return the command.
- */
-struct TALER_TESTING_Command
-TALER_TESTING_cmd_bank_history_range_with_dates
- (const char *label,
- const char *bank_url,
- uint64_t account_no,
- enum TALER_BANK_Direction direction,
- unsigned int ascending,
- struct GNUNET_TIME_Absolute start_date,
- struct GNUNET_TIME_Absolute end_date)
-{
- struct HistoryState *hs;
-
- hs = GNUNET_new (struct HistoryState);
- hs->bank_url = bank_url;
- hs->account_no = account_no;
- hs->direction = direction;
- hs->ascending = ascending;
- hs->start_row_reference = NULL;
- hs->start_date = start_date;
- hs->end_date = end_date;
-
- {
- struct TALER_TESTING_Command cmd = {
- .label = label,
- .cls = hs,
- .run = &history_range_run,
- .cleanup = &history_cleanup,
- .traits = &history_traits
- };
-
- return cmd;
- }
-}
-
-
/* end of testing_api_cmd_history.c */
diff --git a/src/include/taler_bank_service.h b/src/include/taler_bank_service.h
index b2a02f74..a7246ad2 100644
--- a/src/include/taler_bank_service.h
+++ b/src/include/taler_bank_service.h
@@ -290,41 +290,6 @@ TALER_BANK_history (struct GNUNET_CURL_Context *ctx,
/**
- * Request the wire transfer history of a bank account,
- * using time stamps to narrow the results.
- *
- * @param ctx curl context for the event loop
- * @param bank_base_url URL of the bank (used to execute this
- * request)
- * @param auth authentication data to use
- * @param account_number which account number should we query
- * @param direction what kinds of wire transfers should be
- * returned
- * @param ascending if GNUNET_YES, history elements will
- * be returned in chronological order.
- * @param start_date threshold for oldest result.
- * @param end_date threshold for youngest result.
- * @param hres_cb the callback to call with the transaction
- * history
- * @param hres_cb_cls closure for the above callback
- * @return NULL if the inputs are invalid (i.e. zero value for
- * @e num_results). In this case, the callback is not
- * called.
- */
-struct TALER_BANK_HistoryHandle *
-TALER_BANK_history_range (struct GNUNET_CURL_Context *ctx,
- const char *bank_base_url,
- const struct TALER_BANK_AuthenticationData *auth,
- uint64_t account_number,
- enum TALER_BANK_Direction direction,
- unsigned int ascending,
- struct GNUNET_TIME_Absolute start_date,
- struct GNUNET_TIME_Absolute end_date,
- TALER_BANK_HistoryResultCallback hres_cb,
- void *hres_cb_cls);
-
-
-/**
* Cancel an history request. This function cannot be used on a request
* handle if the last response (anything with a status code other than
* 200) is already served for it.
diff --git a/src/include/taler_testing_bank_lib.h b/src/include/taler_testing_bank_lib.h
index 27db9d59..6b407197 100644
--- a/src/include/taler_testing_bank_lib.h
+++ b/src/include/taler_testing_bank_lib.h
@@ -127,63 +127,6 @@ TALER_TESTING_cmd_bank_history (const char *label,
/**
- * Make a "history-range" CMD, picking dates from the arguments.
- *
- * @param label command label.
- * @param bank_url base URL of the bank offering the "history"
- * operation.
- * @param account_no bank account number to ask the history for.
- * @param direction which direction this operation is interested.
- * @param ascending if GNUNET_YES, the bank will return the rows
- * in ascending (= chronological) order.
- * @param start_date value for the 'start' argument
- * of "/history-range".
- * @param end_date value for the 'end' argument
- * of "/history-range".
- * @return the command.
- */
-struct TALER_TESTING_Command
-TALER_TESTING_cmd_bank_history_range_with_dates (const char *label,
- const char *bank_url,
- uint64_t account_no,
- enum TALER_BANK_Direction
- direction,
- unsigned int ascending,
- struct GNUNET_TIME_Absolute
- start_date,
- struct GNUNET_TIME_Absolute
- end_date);
-
-
-/**
- * Make a "history-range" CMD, picking dates from traits.
- *
- * @param label command label.
- * @param bank_url base URL of the bank offering the "history"
- * operation.
- * @param account_no bank account number to ask the history for.
- * @param direction which direction this operation is interested.
- * @param ascending if GNUNET_YES, the bank will return the rows
- * in ascending (= chronological) order.
- * @param start_row_reference reference to a command that can
- * offer a absolute time to use as the 'start' argument
- * for "/history-range".
- * @param end_row_reference reference to a command that can
- * offer a absolute time to use as the 'end' argument
- * for "/history-range".
- * @return the command.
- */
-struct TALER_TESTING_Command
-TALER_TESTING_cmd_bank_history_range (const char *label,
- const char *bank_url,
- uint64_t account_no,
- enum TALER_BANK_Direction direction,
- unsigned int ascending,
- const char *start_row_reference,
- const char *end_row_reference);
-
-
-/**
* Create a "reject" CMD.
*
* @param label command label.