summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorMarcello Stanisci <stanisci.m@gmail.com>2019-04-08 23:53:52 +0200
committerMarcello Stanisci <stanisci.m@gmail.com>2019-04-08 23:56:46 +0200
commited0da1fdb3e85a0d19148b3ec9eb481e8c06c025 (patch)
tree3006bfea0e7f3de280256896ad4eef57d143fde1 /src/include
parent5ec20870a495cad72e561b154862454844ea57d3 (diff)
downloadexchange-ed0da1fdb3e85a0d19148b3ec9eb481e8c06c025.tar.gz
exchange-ed0da1fdb3e85a0d19148b3ec9eb481e8c06c025.tar.bz2
exchange-ed0da1fdb3e85a0d19148b3ec9eb481e8c06c025.zip
/history-range.
Implementing the "lib" and "testing-lib" functions to use it.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/taler_bank_service.h37
-rw-r--r--src/include/taler_testing_lib.h72
2 files changed, 89 insertions, 20 deletions
diff --git a/src/include/taler_bank_service.h b/src/include/taler_bank_service.h
index 2f4a06023..2cebbe6e7 100644
--- a/src/include/taler_bank_service.h
+++ b/src/include/taler_bank_service.h
@@ -101,6 +101,7 @@ struct TALER_BANK_AdminAddIncomingHandle;
* 0 if the bank's reply is bogus (fails to follow the protocol)
* @param ec detailed error code
* @param serial_id unique ID of the wire transfer in the bank's records; UINT64_MAX on error
+ * @param timestamp time when the transaction was made.
* @param json detailed response from the HTTPD, or NULL if reply was not in JSON
*/
typedef void
@@ -108,6 +109,7 @@ typedef void
unsigned int http_status,
enum TALER_ErrorCode ec,
uint64_t serial_id,
+ struct GNUNET_TIME_Absolute timestamp,
const json_t *json);
@@ -282,6 +284,41 @@ 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_lib.h b/src/include/taler_testing_lib.h
index d0b5f2754..31180c308 100644
--- a/src/include/taler_testing_lib.h
+++ b/src/include/taler_testing_lib.h
@@ -654,8 +654,9 @@ struct TALER_TESTING_SetupContext
* @return #GNUNET_OK if no errors occurred.
*/
int
-TALER_TESTING_setup_with_exchange_cfg (void *cls,
- const struct GNUNET_CONFIGURATION_Handle *cfg);
+TALER_TESTING_setup_with_exchange_cfg
+ (void *cls,
+ const struct GNUNET_CONFIGURATION_Handle *cfg);
/**
@@ -681,22 +682,23 @@ TALER_TESTING_setup_with_exchange (TALER_TESTING_Main main_cb,
/**
* Initialize scheduler loop and curl context for the test case
- * including starting and stopping the auditor and exchange using the
- * given configuration file.
+ * including starting and stopping the auditor and exchange using
+ * the given configuration file.
*
* @param cls must be a `struct TALER_TESTING_SetupContext *`
* @param cfg configuration to use.
* @return #GNUNET_OK if no errors occurred.
*/
int
-TALER_TESTING_setup_with_auditor_and_exchange_cfg (void *cls,
- const struct GNUNET_CONFIGURATION_Handle *cfg);
+TALER_TESTING_setup_with_auditor_and_exchange_cfg
+ (void *cls,
+ const struct GNUNET_CONFIGURATION_Handle *cfg);
/**
* Initialize scheduler loop and curl context for the test case
- * including starting and stopping the auditor and exchange using the
- * given configuration file.
+ * including starting and stopping the auditor and exchange using
+ * the given configuration file.
*
* @param main_cb main method.
* @param main_cb_cls main method closure.
@@ -709,12 +711,10 @@ TALER_TESTING_setup_with_auditor_and_exchange_cfg (void *cls,
* @return #GNUNET_OK if no errors occurred.
*/
int
-TALER_TESTING_setup_with_auditor_and_exchange (TALER_TESTING_Main main_cb,
- void *main_cb_cls,
- const char *config_file);
-
-
-
+TALER_TESTING_setup_with_auditor_and_exchange
+ (TALER_TESTING_Main main_cb,
+ void *main_cb_cls,
+ const char *config_file);
/* ************** Specific interpreter commands ************ */
@@ -872,14 +872,15 @@ TALER_TESTING_cmd_fakebank_transfer_with_instance
/**
* Modify a fakebank transfer command to enable retries when the
- * reserve is not yet full or we get other transient errors from the
- * fakebank.
+ * reserve is not yet full or we get other transient errors from
+ * the fakebank.
*
* @param cmd a fakebank transfer command
* @return the command with retries enabled
*/
struct TALER_TESTING_Command
-TALER_TESTING_cmd_fakebank_transfer_retry (struct TALER_TESTING_Command cmd);
+TALER_TESTING_cmd_fakebank_transfer_retry
+ (struct TALER_TESTING_Command cmd);
/**
@@ -1020,7 +1021,8 @@ TALER_TESTING_cmd_withdraw_denomination
* @return the command with retries enabled
*/
struct TALER_TESTING_Command
-TALER_TESTING_cmd_withdraw_with_retry (struct TALER_TESTING_Command cmd);
+TALER_TESTING_cmd_withdraw_with_retry
+ (struct TALER_TESTING_Command cmd);
/**
@@ -1098,7 +1100,8 @@ TALER_TESTING_cmd_deposit
* @return the command with retries enabled
*/
struct TALER_TESTING_Command
-TALER_TESTING_cmd_deposit_with_retry (struct TALER_TESTING_Command cmd);
+TALER_TESTING_cmd_deposit_with_retry
+ (struct TALER_TESTING_Command cmd);
/**
@@ -1148,7 +1151,8 @@ TALER_TESTING_cmd_refresh_melt_double
* @return modified command.
*/
struct TALER_TESTING_Command
-TALER_TESTING_cmd_refresh_melt_with_retry (struct TALER_TESTING_Command cmd);
+TALER_TESTING_cmd_refresh_melt_with_retry
+ (struct TALER_TESTING_Command cmd);
/**
@@ -2407,4 +2411,32 @@ TALER_TESTING_get_trait_cmd
struct TALER_TESTING_Command **_cmd);
+/**
+ * Obtain a absolute time from @a cmd.
+ *
+ * @param cmd command to extract trait from
+ * @param index which time stamp to pick if
+ * @a cmd has multiple on offer.
+ * @param time[out] set to the wanted WTID.
+ * @return #GNUNET_OK on success
+ */
+int
+TALER_TESTING_get_trait_absolute_time
+ (const struct TALER_TESTING_Command *cmd,
+ unsigned int index,
+ const struct GNUNET_TIME_Absolute **time);
+
+
+/**
+ * Offer a absolute time.
+ *
+ * @param index associate the object with this index
+ * @param time which object should be returned
+ * @return the trait.
+ */
+struct TALER_TESTING_Trait
+TALER_TESTING_make_trait_absolute_time
+ (unsigned int index,
+ const struct GNUNET_TIME_Absolute *time);
+
#endif