summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-02-04 21:59:43 +0100
committerChristian Grothoff <christian@grothoff.org>2020-02-04 21:59:43 +0100
commit42bc31744b9810509aef344c54bfee2f4e2a7ccb (patch)
tree92ece6674b23f5e985755992a2ddb840cdd2de7f /src/include
parente6d6987e5685b35f6c3137f59894a02a63d09766 (diff)
downloadexchange-42bc31744b9810509aef344c54bfee2f4e2a7ccb.tar.gz
exchange-42bc31744b9810509aef344c54bfee2f4e2a7ccb.tar.bz2
exchange-42bc31744b9810509aef344c54bfee2f4e2a7ccb.zip
implement /config in fakebank and taler_bank_lib.h (#6066)
Diffstat (limited to 'src/include')
-rw-r--r--src/include/taler_bank_service.h73
-rw-r--r--src/include/taler_fakebank_lib.h4
-rw-r--r--src/include/taler_testing_lib.h8
3 files changed, 78 insertions, 7 deletions
diff --git a/src/include/taler_bank_service.h b/src/include/taler_bank_service.h
index 98a1017c2..c9c93fac5 100644
--- a/src/include/taler_bank_service.h
+++ b/src/include/taler_bank_service.h
@@ -89,6 +89,73 @@ struct TALER_BANK_AuthenticationData
};
+/* ********************* /config *********************** */
+
+/**
+ * @brief A /config Handle
+ */
+struct TALER_BANK_ConfigHandle;
+
+/**
+ * Configuration data provided by the bank.
+ */
+struct TALER_BANK_Configuration
+{
+ /**
+ * Current protocol version. Libtool style.
+ */
+ const char *version;
+
+ /**
+ * Currency used by the bank.
+ */
+ const char *currency;
+};
+
+
+/**
+ * Function called with configuration details from the bank.
+ *
+ * @param cls closure
+ * @param http status code
+ * @param ec taler error code
+ * @param config the configuration, NULL on error
+ */
+typedef void
+(*TALER_BANK_ConfigCallback)(void *cls,
+ unsigned int http_status,
+ enum TALER_ErrorCode ec,
+ const struct TALER_BANK_Configuration *config);
+
+/**
+ * Request the configuration of the bank.
+ *
+ * @param ctx curl context for the event loop
+ * @param auth authentication data to use
+ * @param hres_cb the callback to call with the
+ * configuration
+ * @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_ConfigHandle *
+TALER_BANK_configuration (struct GNUNET_CURL_Context *ctx,
+ const struct TALER_BANK_AuthenticationData *auth,
+ TALER_BANK_ConfigCallback hres_cb,
+ void *hres_cb_cls);
+
+
+/**
+ * Cancel a configuration request. This function cannot be
+ * used on a request handle if a response is already
+ * served for it.
+ *
+ * @param ch the configuration request handle
+ */
+void
+TALER_BANK_configuration_cancel (struct TALER_BANK_ConfigHandle *ch);
+
/* ********************* /admin/add/incoming *********************** */
@@ -160,7 +227,7 @@ TALER_BANK_admin_add_incoming_cancel (struct
TALER_BANK_AdminAddIncomingHandle *aai);
-/* ********************* /taler/transfer *********************** */
+/* ********************* /transfer *********************** */
/**
* Prepare for exeuction of a wire transfer.
@@ -243,7 +310,7 @@ TALER_BANK_execute_wire_transfer_cancel (struct
TALER_BANK_WireExecuteHandle *weh);
-/* ********************* /taler/credits *********************** */
+/* ********************* /history/incoming *********************** */
/**
* Handle for querying the bank for transactions
@@ -347,7 +414,7 @@ void
TALER_BANK_credit_history_cancel (struct TALER_BANK_CreditHistoryHandle *hh);
-/* ********************* /taler/debits *********************** */
+/* ********************* /history/outgoing *********************** */
/**
* Handle for querying the bank for transactions
diff --git a/src/include/taler_fakebank_lib.h b/src/include/taler_fakebank_lib.h
index 9324bdce1..8601a8d8d 100644
--- a/src/include/taler_fakebank_lib.h
+++ b/src/include/taler_fakebank_lib.h
@@ -44,10 +44,12 @@ struct TALER_FAKEBANK_Handle;
* would have issued the correct wire transfer orders.
*
* @param port port to listen to
+ * @param currency which currency should the bank offer
* @return NULL on error
*/
struct TALER_FAKEBANK_Handle *
-TALER_FAKEBANK_start (uint16_t port);
+TALER_FAKEBANK_start (uint16_t port,
+ const char *currency);
/**
diff --git a/src/include/taler_testing_lib.h b/src/include/taler_testing_lib.h
index 0b3d19999..5aa50155c 100644
--- a/src/include/taler_testing_lib.h
+++ b/src/include/taler_testing_lib.h
@@ -635,7 +635,7 @@ typedef void
* @param main_cb the "run" method which coontains all the
* commands.
* @param main_cb_cls a closure for "run", typically NULL.
- * @param config_filename configuration filename.
+ * @param cfg configuration to use
* @param exchanged exchange process handle: will be put in the
* state as some commands - e.g. revoke - need to send
* signal to it, for example to let it know to reload the
@@ -650,7 +650,7 @@ typedef void
int
TALER_TESTING_setup (TALER_TESTING_Main main_cb,
void *main_cb_cls,
- const char *config_filename,
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
struct GNUNET_OS_Process *exchanged,
int exchange_connect);
@@ -789,11 +789,13 @@ TALER_TESTING_run_bank (const char *config_filename,
* from the base URL.
*
* @param bank_url bank's base URL.
+ * @param currency currency the bank uses
* @return the fakebank process handle, or NULL if any
* error occurs.
*/
struct TALER_FAKEBANK_Handle *
-TALER_TESTING_run_fakebank (const char *bank_url);
+TALER_TESTING_run_fakebank (const char *bank_url,
+ const char *currency);
/**