diff options
author | Christian Grothoff <christian@grothoff.org> | 2024-11-03 08:16:09 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2024-11-05 10:37:38 +0100 |
commit | 29706047056038f153c7d62d8d3257b194a0dfc7 (patch) | |
tree | f1f2d629ba96e48d6ab993361fb569a86d704768 | |
parent | 7786dc9a6df5cb01c2913f6d3c2171f0b9e9eb85 (diff) |
more work on testing
-rw-r--r-- | src/testing/testing_api_cmd_take_aml_decision.c | 54 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_transfer_get.c | 21 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_wire_add.c | 6 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_wire_del.c | 4 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_withdraw.c | 16 | ||||
-rw-r--r-- | src/testing/testing_api_misc.c | 27 |
6 files changed, 67 insertions, 61 deletions
diff --git a/src/testing/testing_api_cmd_take_aml_decision.c b/src/testing/testing_api_cmd_take_aml_decision.c index bfe741869..3273b5161 100644 --- a/src/testing/testing_api_cmd_take_aml_decision.c +++ b/src/testing/testing_api_cmd_take_aml_decision.c @@ -60,7 +60,7 @@ struct AmlDecisionState /** * Payto hash of the account we are manipulating the AML settings for. */ - struct TALER_PaytoHashP h_payto; + struct TALER_NormalizedPaytoHashP h_payto; /** * Justification given. @@ -141,7 +141,7 @@ take_aml_decision_run (void *cls, { struct AmlDecisionState *ds = cls; struct GNUNET_TIME_Timestamp now; - const struct TALER_PaytoHashP *h_payto; + const struct TALER_NormalizedPaytoHashP *h_payto; const struct TALER_AmlOfficerPrivateKeyP *officer_priv; const struct TALER_TESTING_Command *ref; const char *exchange_url; @@ -203,8 +203,8 @@ take_aml_decision_run (void *cls, return; } if (GNUNET_OK != - TALER_TESTING_get_trait_h_payto (ref, - &h_payto)) + TALER_TESTING_get_trait_h_normalized_payto (ref, + &h_payto)) { GNUNET_break (0); TALER_TESTING_interpreter_fail (is); @@ -350,25 +350,31 @@ take_aml_decision_run (void *cls, } GNUNET_assert (off == num_measures); - ds->dh = TALER_EXCHANGE_post_aml_decision ( - TALER_TESTING_interpreter_get_context (is), - exchange_url, - h_payto, - NULL, /* payto_uri */ - now, - ds->successor_measure, - new_measures, - expiration_time, - num_rules, - rules, - num_measures, - measures, - ds->properties, - ds->keep_investigating, - ds->justification, - officer_priv, - &take_aml_decision_cb, - ds); + { + struct TALER_FullPayto null_payto = { + .full_payto = NULL + }; + + ds->dh = TALER_EXCHANGE_post_aml_decision ( + TALER_TESTING_interpreter_get_context (is), + exchange_url, + h_payto, + null_payto, + now, + ds->successor_measure, + new_measures, + expiration_time, + num_rules, + rules, + num_measures, + measures, + ds->properties, + ds->keep_investigating, + ds->justification, + officer_priv, + &take_aml_decision_cb, + ds); + } for (unsigned int j = 0; j<num_rules; j++) { struct TALER_EXCHANGE_AccountRule *rule = &rules[j]; @@ -429,7 +435,7 @@ take_aml_decision_traits (void *cls, { struct AmlDecisionState *ws = cls; struct TALER_TESTING_Trait traits[] = { - TALER_TESTING_make_trait_h_payto (&ws->h_payto), + TALER_TESTING_make_trait_h_normalized_payto (&ws->h_payto), TALER_TESTING_make_trait_aml_justification (ws->justification), TALER_TESTING_trait_end () }; diff --git a/src/testing/testing_api_cmd_transfer_get.c b/src/testing/testing_api_cmd_transfer_get.c index a5940db85..8fdd9745e 100644 --- a/src/testing/testing_api_cmd_transfer_get.c +++ b/src/testing/testing_api_cmd_transfer_get.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2014-2020 Taler Systems SA + Copyright (C) 2014-2020, 2024 Taler Systems SA TALER is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -99,7 +99,6 @@ track_transfer_cleanup ( void *cls, const struct TALER_TESTING_Command *cmd) { - struct TrackTransferState *tts = cls; if (NULL != tts->tth) @@ -217,13 +216,13 @@ track_transfer_cb ( if (NULL != tts->wire_details_reference) { const struct TALER_TESTING_Command *wire_details_cmd; - const char *payto_uri; - struct TALER_PaytoHashP h_payto; + const struct TALER_FullPayto *payto_uri; + struct TALER_FullPaytoHashP h_payto; wire_details_cmd - = TALER_TESTING_interpreter_lookup_command (is, - tts-> - wire_details_reference); + = TALER_TESTING_interpreter_lookup_command ( + is, + tts->wire_details_reference); if (NULL == wire_details_cmd) { GNUNET_break (0); @@ -231,15 +230,15 @@ track_transfer_cb ( return; } if (GNUNET_OK != - TALER_TESTING_get_trait_payto_uri (wire_details_cmd, - &payto_uri)) + TALER_TESTING_get_trait_full_payto_uri (wire_details_cmd, + &payto_uri)) { GNUNET_break (0); TALER_TESTING_interpreter_fail (is); return; } - TALER_payto_hash (payto_uri, - &h_payto); + TALER_full_payto_hash (*payto_uri, + &h_payto); if (0 != GNUNET_memcmp (&h_payto, &ta->h_payto)) { diff --git a/src/testing/testing_api_cmd_wire_add.c b/src/testing/testing_api_cmd_wire_add.c index d2a15894a..5e3abc332 100644 --- a/src/testing/testing_api_cmd_wire_add.c +++ b/src/testing/testing_api_cmd_wire_add.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2020-2023 Taler Systems SA + Copyright (C) 2020-2024 Taler Systems SA TALER is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -48,7 +48,7 @@ struct WireAddState /** * Account to add. */ - const char *payto_uri; + struct TALER_FullPayto payto_uri; /** * Expected HTTP response code. @@ -218,7 +218,7 @@ wire_add_cleanup (void *cls, struct TALER_TESTING_Command TALER_TESTING_cmd_wire_add (const char *label, - const char *payto_uri, + struct TALER_FullPayto payto_uri, unsigned int expected_http_status, bool bad_sig) { diff --git a/src/testing/testing_api_cmd_wire_del.c b/src/testing/testing_api_cmd_wire_del.c index 50ebfc7cb..421bb5911 100644 --- a/src/testing/testing_api_cmd_wire_del.c +++ b/src/testing/testing_api_cmd_wire_del.c @@ -48,7 +48,7 @@ struct WireDelState /** * Account to del. */ - const char *payto_uri; + struct TALER_FullPayto payto_uri; /** * Expected HTTP response code. @@ -194,7 +194,7 @@ wire_del_cleanup (void *cls, struct TALER_TESTING_Command TALER_TESTING_cmd_wire_del (const char *label, - const char *payto_uri, + struct TALER_FullPayto payto_uri, unsigned int expected_http_status, bool bad_sig) { diff --git a/src/testing/testing_api_cmd_withdraw.c b/src/testing/testing_api_cmd_withdraw.c index f8ff0205b..e3a985669 100644 --- a/src/testing/testing_api_cmd_withdraw.c +++ b/src/testing/testing_api_cmd_withdraw.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2018-2022 Taler Systems SA + Copyright (C) 2018-2024 Taler Systems SA TALER is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -41,13 +41,13 @@ * How long do we wait AT LEAST if the exchange says the reserve is unknown? */ #define UNKNOWN_MIN_BACKOFF GNUNET_TIME_relative_multiply ( \ - GNUNET_TIME_UNIT_MILLISECONDS, 10) + GNUNET_TIME_UNIT_MILLISECONDS, 10) /** * How long do we wait AT MOST if the exchange says the reserve is unknown? */ #define UNKNOWN_MAX_BACKOFF GNUNET_TIME_relative_multiply ( \ - GNUNET_TIME_UNIT_MILLISECONDS, 100) + GNUNET_TIME_UNIT_MILLISECONDS, 100) /** * State for a "withdraw" CMD. @@ -93,7 +93,7 @@ struct WithdrawState /** * URI if the reserve we are withdrawing from. */ - char *reserve_payto_uri; + struct TALER_NormalizedPayto reserve_payto_uri; /** * Private key of the reserve we are withdrawing from. @@ -179,7 +179,7 @@ struct WithdrawState * Set to the KYC requirement payto hash *if* the exchange replied with a * request for KYC. */ - struct TALER_PaytoHashP h_payto; + struct TALER_NormalizedPaytoHashP h_payto; /** * Set to the KYC requirement row *if* the exchange replied with @@ -499,7 +499,7 @@ withdraw_cleanup (void *cls, if (ws->age > 0) TALER_age_commitment_proof_free (&ws->age_commitment_proof); GNUNET_free (ws->exchange_url); - GNUNET_free (ws->reserve_payto_uri); + GNUNET_free (ws->reserve_payto_uri.normalized_payto); GNUNET_free (ws); } @@ -540,8 +540,8 @@ withdraw_traits (void *cls, TALER_TESTING_make_trait_reserve_pub (&ws->reserve_pub), TALER_TESTING_make_trait_amount (&ws->amount), TALER_TESTING_make_trait_legi_requirement_row (&ws->requirement_row), - TALER_TESTING_make_trait_h_payto (&ws->h_payto), - TALER_TESTING_make_trait_payto_uri (ws->reserve_payto_uri), + TALER_TESTING_make_trait_h_normalized_payto (&ws->h_payto), + TALER_TESTING_make_trait_normalized_payto_uri (&ws->reserve_payto_uri), TALER_TESTING_make_trait_exchange_url (ws->exchange_url), TALER_TESTING_make_trait_age_commitment_proof (0, 0 < ws->age diff --git a/src/testing/testing_api_misc.c b/src/testing/testing_api_misc.c index 80ff0b6c8..7cea29f1a 100644 --- a/src/testing/testing_api_misc.c +++ b/src/testing/testing_api_misc.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2018-2023 Taler Systems SA + Copyright (C) 2018-2024 Taler Systems SA TALER is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -60,7 +60,7 @@ TALER_TESTING_get_credentials ( struct TALER_TESTING_Credentials *ua) { unsigned long long port; - char *exchange_payto_uri; + struct TALER_FullPayto exchange_payto_uri; ua->cfg = GNUNET_CONFIGURATION_create (); if (GNUNET_OK != @@ -80,10 +80,11 @@ TALER_TESTING_get_credentials ( return GNUNET_SYSERR; } if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_string (ua->cfg, - exchange_account_section, - "PAYTO_URI", - &exchange_payto_uri)) + GNUNET_CONFIGURATION_get_value_string ( + ua->cfg, + exchange_account_section, + "PAYTO_URI", + &exchange_payto_uri.full_payto)) { GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, exchange_account_section, @@ -163,18 +164,18 @@ TALER_TESTING_get_credentials ( case TALER_TESTING_BS_FAKEBANK: ua->exchange_payto = exchange_payto_uri; - ua->user42_payto + ua->user42_payto.full_payto = GNUNET_strdup ("payto://x-taler-bank/localhost/42?receiver-name=42"); - ua->user43_payto + ua->user43_payto.full_payto = GNUNET_strdup ("payto://x-taler-bank/localhost/43?receiver-name=43"); break; case TALER_TESTING_BS_IBAN: ua->exchange_payto = exchange_payto_uri; - ua->user42_payto + ua->user42_payto.full_payto = GNUNET_strdup ( "payto://iban/SANDBOXX/FR7630006000011234567890189?receiver-name=User42"); - ua->user43_payto + ua->user43_payto.full_payto = GNUNET_strdup ( "payto://iban/SANDBOXX/GB33BUKB20201555555555?receiver-name=User43"); break; @@ -184,7 +185,7 @@ TALER_TESTING_get_credentials ( json_t * -TALER_TESTING_make_wire_details (const char *payto) +TALER_TESTING_make_wire_details (struct TALER_FullPayto payto) { struct TALER_WireSaltP salt; @@ -193,8 +194,8 @@ TALER_TESTING_make_wire_details (const char *payto) 47, sizeof (salt)); return GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("payto_uri", - payto), + TALER_JSON_pack_full_payto ("payto_uri", + payto), GNUNET_JSON_pack_data_auto ("salt", &salt)); } |