From dee45bf02284716d5dea18e94193d74e64f7e5bf Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 20 Mar 2022 09:44:42 +0100 Subject: return new global fees from /keys --- src/include/taler_exchange_service.h | 59 +++++++++++++++++++++++++++++++++++ src/include/taler_exchangedb_plugin.h | 2 +- src/include/taler_json_lib.h | 24 ++++++++++++++ 3 files changed, 84 insertions(+), 1 deletion(-) (limited to 'src/include') diff --git a/src/include/taler_exchange_service.h b/src/include/taler_exchange_service.h index 48272a6b..56940669 100644 --- a/src/include/taler_exchange_service.h +++ b/src/include/taler_exchange_service.h @@ -203,6 +203,55 @@ struct TALER_EXCHANGE_AuditorInformation }; +/** + * Global fees and options of an exchange for a given time period. + */ +struct TALER_EXCHANGE_GlobalFee +{ + + /** + * Signature affirming all of the data. + */ + struct TALER_MasterSignatureP master_sig; + + /** + * Starting time of the validity period (inclusive). + */ + struct GNUNET_TIME_Timestamp start_date; + + /** + * End time of the validity period (exclusive). + */ + struct GNUNET_TIME_Timestamp end_date; + + /** + * Unmerged purses will be timed out after at most this time. + */ + struct GNUNET_TIME_Relative purse_timeout; + + /** + * Accounts without KYC will be closed after this time. + */ + struct GNUNET_TIME_Relative kyc_timeout; + + /** + * Account history is limited to this timeframe. + */ + struct GNUNET_TIME_Relative history_expiration; + + /** + * Fees that apply globally, independent of denomination + * and wire method. + */ + struct TALER_GlobalFeeSet fees; + + /** + * Number of free purses per account. + */ + uint32_t purse_account_limit; +}; + + /** * @brief Information about keys from the exchange. */ @@ -229,6 +278,11 @@ struct TALER_EXCHANGE_Keys */ struct TALER_EXCHANGE_AuditorInformation *auditors; + /** + * Array with the global fees of the exchange. + */ + struct TALER_EXCHANGE_GlobalFee *global_fees; + /** * Supported Taler protocol version by the exchange. * String in the format current:revision:age using the @@ -272,6 +326,11 @@ struct TALER_EXCHANGE_Keys */ struct TALER_AgeMask age_mask; + /** + * Length of the @e global_fees array. + */ + unsigned int num_global_fees; + /** * Length of the @e sign_keys array (number of valid entries). */ diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h index 7696b607..fc909a1b 100644 --- a/src/include/taler_exchangedb_plugin.h +++ b/src/include/taler_exchangedb_plugin.h @@ -3968,7 +3968,7 @@ struct TALER_EXCHANGEDB_Plugin * Obtain information about the global fee structure of the exchange. * * @param cls closure - * @param cb function to call on each account + * @param cb function to call on each fee entry * @param cb_cls closure for @a cb * @return transaction status code */ diff --git a/src/include/taler_json_lib.h b/src/include/taler_json_lib.h index 6238c07d..b4f99900 100644 --- a/src/include/taler_json_lib.h +++ b/src/include/taler_json_lib.h @@ -279,6 +279,30 @@ TALER_JSON_spec_amount_any_nbo (const char *name, TALER_JSON_pack_amount (pfx "_refund", &(dfs)->refund) +/** + * Generate specification to parse all global fees. + * + * @param currency which currency to expect + * @param[out] gfs a `struct TALER_GlobalFeeSet` to initialize + */ +#define TALER_JSON_SPEC_GLOBAL_FEES(currency,gfs) \ + TALER_JSON_spec_amount ("kyc_fee", (currency), &(gfs)->kyc), \ + TALER_JSON_spec_amount ("history_fee", (currency), &(gfs)->history), \ + TALER_JSON_spec_amount ("account_fee", (currency), &(gfs)->account), \ + TALER_JSON_spec_amount ("purse_fee", (currency), &(gfs)->purse) + +/** + * Macro to pack all of the global fees. + * + * @param gfs a `struct TALER_GlobalFeeSet` to pack + */ +#define TALER_JSON_PACK_GLOBAL_FEES(gfs) \ + TALER_JSON_pack_amount ("kyc_fee", &(gfs)->kyc), \ + TALER_JSON_pack_amount ("history_fee", &(gfs)->history), \ + TALER_JSON_pack_amount ("account_fee", &(gfs)->account), \ + TALER_JSON_pack_amount ("purse_fee", &(gfs)->purse) + + /** * Generate line in parser specification for denomination public key. * -- cgit v1.2.3