diff options
author | Christian Grothoff <christian@grothoff.org> | 2024-01-10 14:50:13 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2024-01-10 14:50:23 +0100 |
commit | fcce372afa485be2fc6e5abbbdfb1b6202d5f208 (patch) | |
tree | 36094e0bf7a01222d850a0c7ddc876b4bfd7580f /src/include | |
parent | 68ced6e31a9d247bf18f22754c0bd3619ca9f726 (diff) |
remove GET /exchanges endpoint as we are making the auditor single-exchange only; also fixes #8054
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/taler_auditor_service.h | 104 | ||||
-rw-r--r-- | src/include/taler_testing_lib.h | 406 |
2 files changed, 184 insertions, 326 deletions
diff --git a/src/include/taler_auditor_service.h b/src/include/taler_auditor_service.h index 409faca7d..75c3d0e25 100644 --- a/src/include/taler_auditor_service.h +++ b/src/include/taler_auditor_service.h @@ -338,108 +338,4 @@ TALER_AUDITOR_deposit_confirmation_cancel ( struct TALER_AUDITOR_DepositConfirmationHandle *deposit_confirmation); -/** - * Handle for /exchanges API returned by - * #TALER_AUDITOR_list_exchanges() so that the operation can be - * cancelled with #TALER_AUDITOR_list_exchanges_cancel() - */ -struct TALER_AUDITOR_ListExchangesHandle; - - -/** - * Information about an exchange kept by the auditor. - */ -struct TALER_AUDITOR_ExchangeInfo -{ - /** - * Master public key of the exchange. - */ - struct TALER_MasterPublicKeyP master_pub; - - /** - * Base URL of the exchange's API. - */ - const char *exchange_url; -}; - - -/** - * Response to GET /exchanges request. - */ -struct TALER_AUDITOR_ListExchangesResponse -{ - /** - * HTTP response. - */ - struct TALER_AUDITOR_HttpResponse hr; - - /** - * Details depending on HTTP status. - */ - union - { - - /** - * Details for #MHD_HTTP_OK. - */ - struct - { - - /** - * Length of the @e ei array. - */ - unsigned int num_exchanges; - - /** - * Array with information about exchanges - * audited by this auditor. - */ - const struct TALER_AUDITOR_ExchangeInfo *ei; - } ok; - } details; -}; - - -/** - * Function called with the result from /exchanges. - * - * @param cls closure - * @param ler response data - */ -typedef void -(*TALER_AUDITOR_ListExchangesResultCallback)( - void *cls, - const struct TALER_AUDITOR_ListExchangesResponse *ler); - - -/** - * Submit an /exchanges request to the auditor and get the - * auditor's response. If the auditor's reply is not - * well-formed, we return an HTTP status code of zero to @a cb. - * - * @param ctx the context for CURL requests - * @param url HTTP base URL for the auditor - * @param cb the callback to call when a reply for this request is available - * @param cb_cls closure for the above callback - * @return a handle for this request; NULL if the inputs are invalid (i.e. - * signatures fail to verify). In this case, the callback is not called. - */ -struct TALER_AUDITOR_ListExchangesHandle * -TALER_AUDITOR_list_exchanges (struct GNUNET_CURL_Context *ctx, - const char *url, - TALER_AUDITOR_ListExchangesResultCallback cb, - void *cb_cls); - - -/** - * Cancel a list exchanges request. This function cannot be used - * on a request handle if a response is already served for it. - * - * @param leh the list exchanges request handle - */ -void -TALER_AUDITOR_list_exchanges_cancel ( - struct TALER_AUDITOR_ListExchangesHandle *leh); - - #endif /* _TALER_AUDITOR_SERVICE_H */ diff --git a/src/include/taler_testing_lib.h b/src/include/taler_testing_lib.h index 1e8ae9d8f..43923fea7 100644 --- a/src/include/taler_testing_lib.h +++ b/src/include/taler_testing_lib.h @@ -43,12 +43,12 @@ * quite any time after the command "run" method has been called. */ #define TALER_TESTING_FAIL(is) \ - do \ - { \ - GNUNET_break (0); \ - TALER_TESTING_interpreter_fail (is); \ - return; \ - } while (0) + do \ + { \ + GNUNET_break (0); \ + TALER_TESTING_interpreter_fail (is); \ + return; \ + } while (0) /** @@ -60,16 +60,16 @@ * @param expected expected HTTP status code */ #define TALER_TESTING_unexpected_status(is,status,expected) \ - do { \ - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \ - "Unexpected response code %u (expected: %u) to command %s in %s:%u\n", \ - status, \ - expected, \ - TALER_TESTING_interpreter_get_current_label (is), \ - __FILE__, \ - __LINE__); \ - TALER_TESTING_interpreter_fail (is); \ - } while (0) + do { \ + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \ + "Unexpected response code %u (expected: %u) to command %s in %s:%u\n", \ + status, \ + expected, \ + TALER_TESTING_interpreter_get_current_label (is), \ + __FILE__, \ + __LINE__); \ + TALER_TESTING_interpreter_fail (is); \ + } while (0) /** * Log an error message about us receiving an unexpected HTTP @@ -82,18 +82,18 @@ * @param body received JSON-reply */ #define TALER_TESTING_unexpected_status_with_body(is,status,expected,body) \ - do { \ - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \ - "Unexpected response code %u (expected: %u) to " \ - "command %s in %s:%u\nwith body:\n>>%s<<\n", \ - status, \ - expected, \ - TALER_TESTING_interpreter_get_current_label (is), \ - __FILE__, \ - __LINE__, \ - json_dumps (body, JSON_INDENT (2))); \ - TALER_TESTING_interpreter_fail (is); \ - } while (0) + do { \ + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \ + "Unexpected response code %u (expected: %u) to " \ + "command %s in %s:%u\nwith body:\n>>%s<<\n", \ + status, \ + expected, \ + TALER_TESTING_interpreter_get_current_label (is), \ + __FILE__, \ + __LINE__, \ + json_dumps (body, JSON_INDENT (2))); \ + TALER_TESTING_interpreter_fail (is); \ + } while (0) /** @@ -104,14 +104,14 @@ * @param label command label of the incomplete command */ #define TALER_TESTING_command_incomplete(is,label) \ - do { \ - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \ - "Command %s (%s:%u) did not complete (at %s)\n", \ - label, \ - __FILE__, \ - __LINE__, \ - TALER_TESTING_interpreter_get_current_label (is)); \ - } while (0) + do { \ + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \ + "Command %s (%s:%u) did not complete (at %s)\n", \ + label, \ + __FILE__, \ + __LINE__, \ + TALER_TESTING_interpreter_get_current_label (is)); \ + } while (0) /** @@ -311,10 +311,10 @@ struct TALER_TESTING_Command * @return #GNUNET_OK on success */ enum GNUNET_GenericReturnValue - (*traits)(void *cls, - const void **ret, - const char *trait, - unsigned int index); + (*traits)(void *cls, + const void **ret, + const char *trait, + unsigned int index); /** * When did the execution of this command start? @@ -831,44 +831,6 @@ TALER_TESTING_cmd_deposit_confirmation_with_retry ( /** - * Create a "list exchanges" command. - * - * @param label command label. - * @param expected_response_code expected HTTP response code. - * @return the command. - */ -struct TALER_TESTING_Command -TALER_TESTING_cmd_exchanges (const char *label, - unsigned int expected_response_code); - - -/** - * Create a "list exchanges" command and check whether - * a particular exchange belongs to the returned bundle. - * - * @param label command label. - * @param expected_response_code expected HTTP response code. - * @param exchange_url URL of the exchange supposed to - * be included in the response. - * @return the command. - */ -struct TALER_TESTING_Command -TALER_TESTING_cmd_exchanges_with_url (const char *label, - unsigned int expected_response_code, - const char *exchange_url); - -/** - * Modify an exchanges command to enable retries when we get - * transient errors from the auditor. - * - * @param cmd a deposit confirmation command - * @return the command with retries enabled - */ -struct TALER_TESTING_Command -TALER_TESTING_cmd_exchanges_with_retry (struct TALER_TESTING_Command cmd); - - -/** * Create /admin/add-incoming command. * * @param label command label. @@ -1130,14 +1092,14 @@ TALER_TESTING_cmd_batch_withdraw_with_conflict ( expected_response_code, \ amount, \ ...) \ - TALER_TESTING_cmd_batch_withdraw_with_conflict ( \ - (label), \ - (reserve_reference), \ - false, \ - (age), \ - (expected_response_code), \ - (amount), \ - __VA_ARGS__) + TALER_TESTING_cmd_batch_withdraw_with_conflict ( \ + (label), \ + (reserve_reference), \ + false, \ + (age), \ + (expected_response_code), \ + (amount), \ + __VA_ARGS__) /** * Create an age-withdraw command, letting the caller specify @@ -2267,7 +2229,7 @@ TALER_TESTING_cmd_oauth_with_birthdate (const char *label, * @param port the TCP port to listen on */ #define TALER_TESTING_cmd_oauth(label, port) \ - TALER_TESTING_cmd_oauth_with_birthdate ((label), NULL, (port)) + TALER_TESTING_cmd_oauth_with_birthdate ((label), NULL, (port)) /* ****************** P2P payment commands ****************** */ @@ -2596,13 +2558,13 @@ TALER_TESTING_get_trait (const struct TALER_TESTING_Trait *traits, * statically allocated data of type @a type. */ #define TALER_TESTING_MAKE_DECL_SIMPLE_TRAIT(name,type) \ - enum GNUNET_GenericReturnValue \ - TALER_TESTING_get_trait_ ## name ( \ - const struct TALER_TESTING_Command *cmd, \ - type **ret); \ - struct TALER_TESTING_Trait \ - TALER_TESTING_make_trait_ ## name ( \ - type * value); + enum GNUNET_GenericReturnValue \ + TALER_TESTING_get_trait_ ## name ( \ + const struct TALER_TESTING_Command *cmd, \ + type **ret); \ + struct TALER_TESTING_Trait \ + TALER_TESTING_make_trait_ ## name ( \ + type * value); /** @@ -2610,27 +2572,27 @@ TALER_TESTING_get_trait (const struct TALER_TESTING_Trait *traits, * allocated data of type @a type. */ #define TALER_TESTING_MAKE_IMPL_SIMPLE_TRAIT(name,type) \ - enum GNUNET_GenericReturnValue \ - TALER_TESTING_get_trait_ ## name ( \ - const struct TALER_TESTING_Command *cmd, \ - type * *ret) \ - { \ - if (NULL == cmd->traits) return GNUNET_SYSERR; \ - return cmd->traits (cmd->cls, \ - (const void **) ret, \ - TALER_S (name), \ - 0); \ - } \ - struct TALER_TESTING_Trait \ - TALER_TESTING_make_trait_ ## name ( \ - type * value) \ - { \ - struct TALER_TESTING_Trait ret = { \ - .trait_name = TALER_S (name), \ - .ptr = (const void *) value \ - }; \ - return ret; \ - } + enum GNUNET_GenericReturnValue \ + TALER_TESTING_get_trait_ ## name ( \ + const struct TALER_TESTING_Command *cmd, \ + type **ret) \ + { \ + if (NULL == cmd->traits) return GNUNET_SYSERR; \ + return cmd->traits (cmd->cls, \ + (const void **) ret, \ + TALER_S (name), \ + 0); \ + } \ + struct TALER_TESTING_Trait \ + TALER_TESTING_make_trait_ ## name ( \ + type * value) \ + { \ + struct TALER_TESTING_Trait ret = { \ + .trait_name = TALER_S (name), \ + .ptr = (const void *) value \ + }; \ + return ret; \ + } /** @@ -2638,15 +2600,15 @@ TALER_TESTING_get_trait (const struct TALER_TESTING_Trait *traits, * statically allocated data of type @a type. */ #define TALER_TESTING_MAKE_DECL_INDEXED_TRAIT(name,type) \ - enum GNUNET_GenericReturnValue \ - TALER_TESTING_get_trait_ ## name ( \ - const struct TALER_TESTING_Command *cmd, \ - unsigned int index, \ - type **ret); \ - struct TALER_TESTING_Trait \ - TALER_TESTING_make_trait_ ## name ( \ - unsigned int index, \ - type *value); + enum GNUNET_GenericReturnValue \ + TALER_TESTING_get_trait_ ## name ( \ + const struct TALER_TESTING_Command *cmd, \ + unsigned int index, \ + type **ret); \ + struct TALER_TESTING_Trait \ + TALER_TESTING_make_trait_ ## name ( \ + unsigned int index, \ + type * value); /** @@ -2654,116 +2616,116 @@ TALER_TESTING_get_trait (const struct TALER_TESTING_Trait *traits, * allocated data of type @a type. */ #define TALER_TESTING_MAKE_IMPL_INDEXED_TRAIT(name,type) \ - enum GNUNET_GenericReturnValue \ - TALER_TESTING_get_trait_ ## name ( \ - const struct TALER_TESTING_Command *cmd, \ - unsigned int index, \ - type * *ret) \ - { \ - if (NULL == cmd->traits) return GNUNET_SYSERR; \ - return cmd->traits (cmd->cls, \ - (const void **) ret, \ - TALER_S (name), \ - index); \ - } \ - struct TALER_TESTING_Trait \ - TALER_TESTING_make_trait_ ## name ( \ - unsigned int index, \ - type * value) \ - { \ - struct TALER_TESTING_Trait ret = { \ - .index = index, \ - .trait_name = TALER_S (name), \ - .ptr = (const void *) value \ - }; \ - return ret; \ - } + enum GNUNET_GenericReturnValue \ + TALER_TESTING_get_trait_ ## name ( \ + const struct TALER_TESTING_Command *cmd, \ + unsigned int index, \ + type **ret) \ + { \ + if (NULL == cmd->traits) return GNUNET_SYSERR; \ + return cmd->traits (cmd->cls, \ + (const void **) ret, \ + TALER_S (name), \ + index); \ + } \ + struct TALER_TESTING_Trait \ + TALER_TESTING_make_trait_ ## name ( \ + unsigned int index, \ + type * value) \ + { \ + struct TALER_TESTING_Trait ret = { \ + .index = index, \ + .trait_name = TALER_S (name), \ + .ptr = (const void *) value \ + }; \ + return ret; \ + } /** * Call #op on all simple traits. */ #define TALER_TESTING_SIMPLE_TRAITS(op) \ - op (bank_row, const uint64_t) \ - op (officer_pub, const struct TALER_AmlOfficerPublicKeyP) \ - op (officer_priv, const struct TALER_AmlOfficerPrivateKeyP) \ - op (officer_name, const char) \ - op (aml_decision, enum TALER_AmlDecisionState) \ - op (aml_justification, const char) \ - op (auditor_priv, const struct TALER_AuditorPrivateKeyP) \ - op (auditor_pub, const struct TALER_AuditorPublicKeyP) \ - op (master_priv, const struct TALER_MasterPrivateKeyP) \ - op (master_pub, const struct TALER_MasterPublicKeyP) \ - op (purse_priv, const struct TALER_PurseContractPrivateKeyP) \ - op (purse_pub, const struct TALER_PurseContractPublicKeyP) \ - op (merge_priv, const struct TALER_PurseMergePrivateKeyP) \ - op (merge_pub, const struct TALER_PurseMergePublicKeyP) \ - op (contract_priv, const struct TALER_ContractDiffiePrivateP) \ - op (reserve_priv, const struct TALER_ReservePrivateKeyP) \ - op (reserve_sig, const struct TALER_ReserveSignatureP) \ - op (h_payto, const struct TALER_PaytoHashP) \ - op (planchet_secret, const struct TALER_PlanchetMasterSecretP) \ - op (refresh_secret, const struct TALER_RefreshMasterSecretP) \ - op (reserve_pub, const struct TALER_ReservePublicKeyP) \ - op (merchant_priv, const struct TALER_MerchantPrivateKeyP) \ - op (merchant_pub, const struct TALER_MerchantPublicKeyP) \ - op (merchant_sig, const struct TALER_MerchantSignatureP) \ - op (wtid, const struct TALER_WireTransferIdentifierRawP) \ - op (bank_auth_data, const struct TALER_BANK_AuthenticationData) \ - op (contract_terms, const json_t) \ - op (wire_details, const json_t) \ - op (exchange_url, const char) \ - op (auditor_url, const char) \ - op (exchange_bank_account_url, const char) \ - op (taler_uri, const char) \ - op (payto_uri, const char) \ - op (kyc_url, const char) \ - op (web_url, const char) \ - op (row, const uint64_t) \ - op (legi_requirement_row, const uint64_t) \ - op (array_length, const unsigned int) \ - op (credit_payto_uri, const char) \ - op (debit_payto_uri, const char) \ - op (order_id, const char) \ - op (amount, const struct TALER_Amount) \ - op (amount_with_fee, const struct TALER_Amount) \ - op (batch_cmds, struct TALER_TESTING_Command) \ - op (uuid, const struct GNUNET_Uuid) \ - op (fresh_coins, const struct TALER_TESTING_FreshCoinData *) \ - op (claim_token, const struct TALER_ClaimTokenP) \ - op (relative_time, const struct GNUNET_TIME_Relative) \ - op (fakebank, struct TALER_FAKEBANK_Handle) \ - op (keys, struct TALER_EXCHANGE_Keys) \ - op (process, struct GNUNET_OS_Process *) + op (bank_row, const uint64_t) \ + op (officer_pub, const struct TALER_AmlOfficerPublicKeyP) \ + op (officer_priv, const struct TALER_AmlOfficerPrivateKeyP) \ + op (officer_name, const char) \ + op (aml_decision, enum TALER_AmlDecisionState) \ + op (aml_justification, const char) \ + op (auditor_priv, const struct TALER_AuditorPrivateKeyP) \ + op (auditor_pub, const struct TALER_AuditorPublicKeyP) \ + op (master_priv, const struct TALER_MasterPrivateKeyP) \ + op (master_pub, const struct TALER_MasterPublicKeyP) \ + op (purse_priv, const struct TALER_PurseContractPrivateKeyP) \ + op (purse_pub, const struct TALER_PurseContractPublicKeyP) \ + op (merge_priv, const struct TALER_PurseMergePrivateKeyP) \ + op (merge_pub, const struct TALER_PurseMergePublicKeyP) \ + op (contract_priv, const struct TALER_ContractDiffiePrivateP) \ + op (reserve_priv, const struct TALER_ReservePrivateKeyP) \ + op (reserve_sig, const struct TALER_ReserveSignatureP) \ + op (h_payto, const struct TALER_PaytoHashP) \ + op (planchet_secret, const struct TALER_PlanchetMasterSecretP) \ + op (refresh_secret, const struct TALER_RefreshMasterSecretP) \ + op (reserve_pub, const struct TALER_ReservePublicKeyP) \ + op (merchant_priv, const struct TALER_MerchantPrivateKeyP) \ + op (merchant_pub, const struct TALER_MerchantPublicKeyP) \ + op (merchant_sig, const struct TALER_MerchantSignatureP) \ + op (wtid, const struct TALER_WireTransferIdentifierRawP) \ + op (bank_auth_data, const struct TALER_BANK_AuthenticationData) \ + op (contract_terms, const json_t) \ + op (wire_details, const json_t) \ + op (exchange_url, const char) \ + op (auditor_url, const char) \ + op (exchange_bank_account_url, const char) \ + op (taler_uri, const char) \ + op (payto_uri, const char) \ + op (kyc_url, const char) \ + op (web_url, const char) \ + op (row, const uint64_t) \ + op (legi_requirement_row, const uint64_t) \ + op (array_length, const unsigned int) \ + op (credit_payto_uri, const char) \ + op (debit_payto_uri, const char) \ + op (order_id, const char) \ + op (amount, const struct TALER_Amount) \ + op (amount_with_fee, const struct TALER_Amount) \ + op (batch_cmds, struct TALER_TESTING_Command) \ + op (uuid, const struct GNUNET_Uuid) \ + op (fresh_coins, const struct TALER_TESTING_FreshCoinData *) \ + op (claim_token, const struct TALER_ClaimTokenP) \ + op (relative_time, const struct GNUNET_TIME_Relative) \ + op (fakebank, struct TALER_FAKEBANK_Handle) \ + op (keys, struct TALER_EXCHANGE_Keys) \ + op (process, struct GNUNET_OS_Process *) /** * Call #op on all indexed traits. */ #define TALER_TESTING_INDEXED_TRAITS(op) \ - op (denom_pub, const struct TALER_EXCHANGE_DenomPublicKey) \ - op (denom_sig, const struct TALER_DenominationSignature) \ - op (amounts, const struct TALER_Amount) \ - op (deposit_amount, const struct TALER_Amount) \ - op (deposit_fee_amount, const struct TALER_Amount) \ - op (age_commitment, const struct TALER_AgeCommitment) \ - op (age_commitment_proof, const struct TALER_AgeCommitmentProof) \ - op (h_age_commitment, const struct TALER_AgeCommitmentHash) \ - op (reserve_history, const struct TALER_EXCHANGE_ReserveHistoryEntry) \ - op (coin_history, const struct TALER_EXCHANGE_CoinHistoryEntry) \ - op (planchet_secrets, const struct TALER_PlanchetMasterSecretP) \ - op (exchange_wd_value, const struct TALER_ExchangeWithdrawValues) \ - op (coin_priv, const struct TALER_CoinSpendPrivateKeyP) \ - op (coin_pub, const struct TALER_CoinSpendPublicKeyP) \ - op (coin_sig, const struct TALER_CoinSpendSignatureP) \ - op (absolute_time, const struct GNUNET_TIME_Absolute) \ - op (timestamp, const struct GNUNET_TIME_Timestamp) \ - op (wire_deadline, const struct GNUNET_TIME_Timestamp) \ - op (refund_deadline, const struct GNUNET_TIME_Timestamp) \ - op (exchange_pub, const struct TALER_ExchangePublicKeyP) \ - op (exchange_sig, const struct TALER_ExchangeSignatureP) \ - op (blinding_key, const union GNUNET_CRYPTO_BlindingSecretP) \ - op (h_blinded_coin, const struct TALER_BlindedCoinHashP) + op (denom_pub, const struct TALER_EXCHANGE_DenomPublicKey) \ + op (denom_sig, const struct TALER_DenominationSignature) \ + op (amounts, const struct TALER_Amount) \ + op (deposit_amount, const struct TALER_Amount) \ + op (deposit_fee_amount, const struct TALER_Amount) \ + op (age_commitment, const struct TALER_AgeCommitment) \ + op (age_commitment_proof, const struct TALER_AgeCommitmentProof) \ + op (h_age_commitment, const struct TALER_AgeCommitmentHash) \ + op (reserve_history, const struct TALER_EXCHANGE_ReserveHistoryEntry) \ + op (coin_history, const struct TALER_EXCHANGE_CoinHistoryEntry) \ + op (planchet_secrets, const struct TALER_PlanchetMasterSecretP) \ + op (exchange_wd_value, const struct TALER_ExchangeWithdrawValues) \ + op (coin_priv, const struct TALER_CoinSpendPrivateKeyP) \ + op (coin_pub, const struct TALER_CoinSpendPublicKeyP) \ + op (coin_sig, const struct TALER_CoinSpendSignatureP) \ + op (absolute_time, const struct GNUNET_TIME_Absolute) \ + op (timestamp, const struct GNUNET_TIME_Timestamp) \ + op (wire_deadline, const struct GNUNET_TIME_Timestamp) \ + op (refund_deadline, const struct GNUNET_TIME_Timestamp) \ + op (exchange_pub, const struct TALER_ExchangePublicKeyP) \ + op (exchange_sig, const struct TALER_ExchangeSignatureP) \ + op (blinding_key, const union GNUNET_CRYPTO_BlindingSecretP) \ + op (h_blinded_coin, const struct TALER_BlindedCoinHashP) TALER_TESTING_SIMPLE_TRAITS (TALER_TESTING_MAKE_DECL_SIMPLE_TRAIT) |