diff options
Diffstat (limited to 'src/testing/testing_api_cmd_take_aml_decision.c')
-rw-r--r-- | src/testing/testing_api_cmd_take_aml_decision.c | 73 |
1 files changed, 46 insertions, 27 deletions
diff --git a/src/testing/testing_api_cmd_take_aml_decision.c b/src/testing/testing_api_cmd_take_aml_decision.c index 871cdb712..c0e23de22 100644 --- a/src/testing/testing_api_cmd_take_aml_decision.c +++ b/src/testing/testing_api_cmd_take_aml_decision.c @@ -90,31 +90,26 @@ struct AmlDecisionState /** - * Callback to analyze the /management/XXX response, just used to check + * Callback to analyze the /aml-decision/$OFFICER_PUB response, just used to check * if the response code is acceptable. * * @param cls closure. - * @param hr HTTP response details + * @param adr response details */ static void -take_aml_decision_cb (void *cls, - const struct TALER_EXCHANGE_HttpResponse *hr) +take_aml_decision_cb ( + void *cls, + const struct TALER_EXCHANGE_AddAmlDecisionResponse *adr) { struct AmlDecisionState *ds = cls; + const struct TALER_EXCHANGE_HttpResponse *hr = &adr->hr; ds->dh = NULL; if (ds->expected_response != hr->http_status) { - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - "Unexpected response code %u to command %s in %s:%u\n", - hr->http_status, - ds->is->commands[ds->is->ip].label, - __FILE__, - __LINE__); - json_dumpf (hr->reply, - stderr, - 0); - TALER_TESTING_interpreter_fail (ds->is); + TALER_TESTING_unexpected_status (ds->is, + hr->http_status, + ds->expected_response); return; } TALER_TESTING_interpreter_next (ds->is); @@ -139,8 +134,24 @@ take_aml_decision_run (void *cls, const struct TALER_AmlOfficerPrivateKeyP *officer_priv; const struct TALER_TESTING_Command *ref; json_t *kyc_requirements = NULL; + const char *exchange_url; (void) cmd; + { + const struct TALER_TESTING_Command *exchange_cmd; + + exchange_cmd = TALER_TESTING_interpreter_get_command (is, + "exchange"); + if (NULL == exchange_cmd) + { + GNUNET_break (0); + TALER_TESTING_interpreter_fail (is); + return; + } + GNUNET_assert (GNUNET_OK == + TALER_TESTING_get_trait_exchange_url (exchange_cmd, + &exchange_url)); + } now = GNUNET_TIME_timestamp_get (); ds->is = is; ref = TALER_TESTING_interpreter_lookup_command (is, @@ -151,9 +162,14 @@ take_aml_decision_run (void *cls, TALER_TESTING_interpreter_fail (is); return; } - GNUNET_assert (GNUNET_OK == - TALER_TESTING_get_trait_h_payto (ref, - &h_payto)); + if (GNUNET_OK != + TALER_TESTING_get_trait_h_payto (ref, + &h_payto)) + { + GNUNET_break (0); + TALER_TESTING_interpreter_fail (is); + return; + } ref = TALER_TESTING_interpreter_lookup_command (is, ds->officer_ref_cmd); if (NULL == ref) @@ -162,9 +178,14 @@ take_aml_decision_run (void *cls, TALER_TESTING_interpreter_fail (is); return; } - GNUNET_assert (GNUNET_OK == - TALER_TESTING_get_trait_officer_priv (ref, - &officer_priv)); + if (GNUNET_OK != + TALER_TESTING_get_trait_officer_priv (ref, + &officer_priv)) + { + GNUNET_break (0); + TALER_TESTING_interpreter_fail (is); + return; + } ds->h_payto = *h_payto; if (NULL != ds->kyc_requirement) { @@ -176,8 +197,8 @@ take_aml_decision_run (void *cls, } ds->dh = TALER_EXCHANGE_add_aml_decision ( - is->ctx, - is->exchange_url, + TALER_TESTING_interpreter_get_context (is), + exchange_url, ds->justification, now, &ds->new_threshold, @@ -212,10 +233,8 @@ take_aml_decision_cleanup (void *cls, if (NULL != ds->dh) { - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - "Command %u (%s) did not complete\n", - ds->is->ip, - cmd->label); + TALER_TESTING_command_incomplete (ds->is, + cmd->label); TALER_EXCHANGE_add_aml_decision_cancel (ds->dh); ds->dh = NULL; } @@ -242,7 +261,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_aml_justification (&ws->justification), + TALER_TESTING_make_trait_aml_justification (ws->justification), TALER_TESTING_make_trait_aml_decision (&ws->new_state), TALER_TESTING_make_trait_amount (&ws->new_threshold), TALER_TESTING_trait_end () |