diff options
Diffstat (limited to 'src/exchange/taler-exchange-httpd_aml-decision.c')
-rw-r--r-- | src/exchange/taler-exchange-httpd_aml-decision.c | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/src/exchange/taler-exchange-httpd_aml-decision.c b/src/exchange/taler-exchange-httpd_aml-decision.c index 2830e54ed..bf43fdbf2 100644 --- a/src/exchange/taler-exchange-httpd_aml-decision.c +++ b/src/exchange/taler-exchange-httpd_aml-decision.c @@ -74,7 +74,7 @@ struct DecisionContext /** * KYC requirements imposed, NULL for none. */ - json_t *kyc_requirements; + const json_t *kyc_requirements; }; @@ -165,6 +165,7 @@ make_aml_decision (void *cls, TEH_plugin->cls, res, &dc->h_payto, + NULL, /* not a reserve */ &requirement_row); if (qs < 0) { @@ -245,7 +246,6 @@ TEH_handler_post_aml_decision ( struct DecisionContext dc = { .officer_pub = officer_pub }; - uint32_t new_state32; struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_fixed_auto ("officer_sig", &dc.officer_sig), @@ -258,11 +258,11 @@ TEH_handler_post_aml_decision ( &dc.justification), GNUNET_JSON_spec_timestamp ("decision_time", &dc.decision_time), - GNUNET_JSON_spec_uint32 ("new_state", - &new_state32), + TALER_JSON_spec_aml_decision ("new_state", + &dc.new_state), GNUNET_JSON_spec_mark_optional ( - GNUNET_JSON_spec_json ("kyc_requirements", - &dc.kyc_requirements), + GNUNET_JSON_spec_array_const ("kyc_requirements", + &dc.kyc_requirements), NULL), GNUNET_JSON_spec_end () }; @@ -281,7 +281,6 @@ TEH_handler_post_aml_decision ( return MHD_YES; /* failure */ } } - dc.new_state = (enum TALER_AmlDecisionState) new_state32; TEH_METRICS_num_verifications[TEH_MT_SIGNATURE_EDDSA]++; if (GNUNET_OK != TALER_officer_aml_decision_verify (dc.justification, @@ -306,17 +305,6 @@ TEH_handler_post_aml_decision ( size_t index; json_t *elem; - if (! json_is_array (dc.kyc_requirements)) - { - GNUNET_break_op (0); - GNUNET_JSON_parse_free (spec); - return TALER_MHD_reply_with_error ( - connection, - MHD_HTTP_BAD_REQUEST, - TALER_EC_GENERIC_PARAMETER_MALFORMED, - "kyc_requirements must be an array"); - } - json_array_foreach (dc.kyc_requirements, index, elem) { const char *val; @@ -324,7 +312,6 @@ TEH_handler_post_aml_decision ( if (! json_is_string (elem)) { GNUNET_break_op (0); - GNUNET_JSON_parse_free (spec); return TALER_MHD_reply_with_error ( connection, MHD_HTTP_BAD_REQUEST, @@ -336,7 +323,6 @@ TEH_handler_post_aml_decision ( TALER_KYCLOGIC_check_satisfiable (val)) { GNUNET_break_op (0); - GNUNET_JSON_parse_free (spec); return TALER_MHD_reply_with_error ( connection, MHD_HTTP_BAD_REQUEST, @@ -357,11 +343,9 @@ TEH_handler_post_aml_decision ( &make_aml_decision, &dc)) { - GNUNET_JSON_parse_free (spec); return mhd_ret; } } - GNUNET_JSON_parse_free (spec); return TALER_MHD_reply_static ( connection, MHD_HTTP_NO_CONTENT, |