aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorÖzgür Kesim <oec-taler@kesim.org>2023-07-24 20:23:42 +0200
committerÖzgür Kesim <oec-taler@kesim.org>2023-07-24 20:29:38 +0200
commit3e29bdfb8bfda133b7c25a36160a3533e836e0b8 (patch)
tree5d2271678e7b0e3175c340c8a033e3950050a11f /src/include
parente9f7ad3742bc16e1f0afa2162564c6faa4f3036f (diff)
downloadexchange-3e29bdfb8bfda133b7c25a36160a3533e836e0b8.tar.xz
[age-withdraw] first tests pass
age-withdraw successfully tested (no reveal yet): 1. reserve filled with amount large enough to trigger kyc 2. kyc oauth2 test daemon sets birthday to 2015-00-00 3. usual withdraw fails with CONFLICT and AGE_RESTRICTION_REQUIRED 4. age-withdraw with loo large of an maximum age fails 5. age-withdraw with appropriate maximum age succeeds
Diffstat (limited to 'src/include')
-rw-r--r--src/include/taler_exchange_service.h2
-rw-r--r--src/include/taler_exchangedb_plugin.h2
-rw-r--r--src/include/taler_testing_lib.h36
3 files changed, 40 insertions, 0 deletions
diff --git a/src/include/taler_exchange_service.h b/src/include/taler_exchange_service.h
index 7bd1b3248..e8d789162 100644
--- a/src/include/taler_exchange_service.h
+++ b/src/include/taler_exchange_service.h
@@ -2966,6 +2966,7 @@ struct TALER_EXCHANGE_AgeWithdrawBlindedHandle;
* @param curl_ctx The curl context to use
* @param exchange_url The base-URL of the exchange
* @param keys The /keys material from the exchange
+ * @param max_age The maximum age that the coins are committed to.
* @param num_input number of entries in the @a blinded_input array
* @param blinded_input array of planchet details of the planchet to withdraw
* @param reserve_priv private key of the reserve to withdraw from
@@ -2981,6 +2982,7 @@ TALER_EXCHANGE_age_withdraw_blinded (
struct TALER_EXCHANGE_Keys *keys,
const char *exchange_url,
const struct TALER_ReservePrivateKeyP *reserve_priv,
+ uint8_t max_age,
unsigned int num_input,
const struct TALER_EXCHANGE_AgeWithdrawBlindedInput blinded_input[static
num_input],
diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h
index c4b894e20..f5fdd7f11 100644
--- a/src/include/taler_exchangedb_plugin.h
+++ b/src/include/taler_exchangedb_plugin.h
@@ -3863,6 +3863,7 @@ struct TALER_EXCHANGEDB_Plugin
* @param[out] balance_ok set to true if the balance was sufficient
* @param[out] age_ok set to true if age requirements were met
* @param[out] allowed_maximum_age if @e age_ok is FALSE, this is set to the allowed maximum age
+ * @param[out] reserve_birthday if @e age_ok is FALSE, this is set to the reserve's birthday
* @return query execution status
*/
enum GNUNET_DB_QueryStatus
@@ -3874,6 +3875,7 @@ struct TALER_EXCHANGEDB_Plugin
bool *balance_ok,
bool *age_ok,
uint16_t *allowed_maximum_age,
+ uint32_t *reserve_birthday,
bool *conflict);
/**
diff --git a/src/include/taler_testing_lib.h b/src/include/taler_testing_lib.h
index c28937695..a514ad2dd 100644
--- a/src/include/taler_testing_lib.h
+++ b/src/include/taler_testing_lib.h
@@ -1130,6 +1130,42 @@ TALER_TESTING_cmd_batch_withdraw (const char *label,
const char *amount,
...);
+/**
+ * Create an age-withdraw command, letting the caller specify
+ * the maximum agend and desired amounts as string. Takes a variable,
+ * non-empty list of the denomination amounts via VARARGS, similar to
+ * #TALER_TESTING_cmd_withdraw_amount(), just using a batch withdraw.
+ *
+ * @param label command label.
+ * @param reserve_reference command providing us with a reserve to withdraw from
+ * @param max_age maximum allowed age, same for each coin
+ * @param expected_response_code which HTTP response code
+ * we expect from the exchange.
+ * @param amount how much we withdraw for the first coin
+ * @param ... NULL-terminated list of additional amounts to withdraw (one per coin)
+ * @return the withdraw command to be executed by the interpreter.
+ */
+struct TALER_TESTING_Command
+TALER_TESTING_cmd_age_withdraw (const char *label,
+ const char *reserve_reference,
+ uint8_t max_age,
+ unsigned int expected_response_code,
+ const char *amount,
+ ...);
+
+/**
+ * Create a "age-withdraw reveal" command.
+ *
+ * @param label command label.
+ * @param age_withdraw_reference reference to a "age-withdraw" command.
+ * @param expected_response_code expected HTTP response code.
+ * @return the command.
+ */
+struct TALER_TESTING_Command
+TALER_TESTING_cmd_age_withdraw_reveal (
+ const char *label,
+ const char *age_withdraw_reference,
+ unsigned int expected_response_code);
/**
* Create a withdraw command, letting the caller specify