From afe3f70d336e151598e02ebedb6498e13122530e Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 14 Feb 2023 14:26:00 +0100 Subject: begin API change to allow AML officers to trigger KYC process --- src/testing/test_kyc_api.c | 3 +++ src/testing/testing_api_cmd_take_aml_decision.c | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) (limited to 'src/testing') diff --git a/src/testing/test_kyc_api.c b/src/testing/test_kyc_api.c index feeed3c78..12f695690 100644 --- a/src/testing/test_kyc_api.c +++ b/src/testing/test_kyc_api.c @@ -448,6 +448,7 @@ run (void *cls, "EUR:10000", "party time", TALER_AML_NORMAL, + NULL, MHD_HTTP_FORBIDDEN), /* Check that no decision was taken, but that we are allowed to read this information */ @@ -468,6 +469,7 @@ run (void *cls, "EUR:10000", "party time", TALER_AML_NORMAL, + NULL, MHD_HTTP_NO_CONTENT), TALER_TESTING_cmd_check_aml_decisions ("check-decisions-one-normal", "create-aml-officer-1", @@ -489,6 +491,7 @@ run (void *cls, "EUR:1000", "party over", TALER_AML_FROZEN, + NULL, MHD_HTTP_NO_CONTENT), TALER_TESTING_cmd_check_aml_decisions ("check-decisions-one-frozen", "create-aml-officer-1", diff --git a/src/testing/testing_api_cmd_take_aml_decision.c b/src/testing/testing_api_cmd_take_aml_decision.c index 0992945d6..871cdb712 100644 --- a/src/testing/testing_api_cmd_take_aml_decision.c +++ b/src/testing/testing_api_cmd_take_aml_decision.c @@ -72,6 +72,11 @@ struct AmlDecisionState */ const char *justification; + /** + * KYC requirement to add. + */ + const char *kyc_requirement; + /** * Threshold transaction amount. */ @@ -133,6 +138,7 @@ take_aml_decision_run (void *cls, const struct TALER_PaytoHashP *h_payto; const struct TALER_AmlOfficerPrivateKeyP *officer_priv; const struct TALER_TESTING_Command *ref; + json_t *kyc_requirements = NULL; (void) cmd; now = GNUNET_TIME_timestamp_get (); @@ -160,6 +166,15 @@ take_aml_decision_run (void *cls, TALER_TESTING_get_trait_officer_priv (ref, &officer_priv)); ds->h_payto = *h_payto; + if (NULL != ds->kyc_requirement) + { + kyc_requirements = json_array (); + GNUNET_assert (NULL != kyc_requirements); + GNUNET_assert (0 == + json_array_append (kyc_requirements, + json_string (ds->kyc_requirement))); + } + ds->dh = TALER_EXCHANGE_add_aml_decision ( is->ctx, is->exchange_url, @@ -168,9 +183,11 @@ take_aml_decision_run (void *cls, &ds->new_threshold, h_payto, ds->new_state, + kyc_requirements, officer_priv, &take_aml_decision_cb, ds); + json_decref (kyc_requirements); if (NULL == ds->dh) { GNUNET_break (0); @@ -246,6 +263,7 @@ TALER_TESTING_cmd_take_aml_decision ( const char *new_threshold, const char *justification, enum TALER_AmlDecisionState new_state, + const char *kyc_requirement, unsigned int expected_response) { struct AmlDecisionState *ds; @@ -253,6 +271,7 @@ TALER_TESTING_cmd_take_aml_decision ( ds = GNUNET_new (struct AmlDecisionState); ds->officer_ref_cmd = ref_officer; ds->account_ref_cmd = ref_operation; + ds->kyc_requirement = kyc_requirement; if (GNUNET_OK != TALER_string_to_amount (new_threshold, &ds->new_threshold)) -- cgit v1.2.3