diff options
| author | Christian Grothoff <christian@grothoff.org> | 2023-02-02 14:55:56 +0100 | 
|---|---|---|
| committer | Christian Grothoff <christian@grothoff.org> | 2023-02-02 14:55:56 +0100 | 
| commit | 3898054b1070db0c6be0fa9f6772637069aa34e2 (patch) | |
| tree | cbe917775e0a44ef4e3140d9d605194f20136c39 /src/exchange | |
| parent | eab95d015412833c96568fb91d25aa23c53c45cd (diff) | |
more work on KYC/AML decision inspection
Diffstat (limited to 'src/exchange')
| -rw-r--r-- | src/exchange/taler-exchange-httpd_aml-decision-get.c | 11 | ||||
| -rw-r--r-- | src/exchange/taler-exchange-httpd_aml-decision.h | 4 | ||||
| -rw-r--r-- | src/exchange/taler-exchange-httpd_aml-decisions-get.c | 51 | 
3 files changed, 37 insertions, 29 deletions
| diff --git a/src/exchange/taler-exchange-httpd_aml-decision-get.c b/src/exchange/taler-exchange-httpd_aml-decision-get.c index 0754c0b8..09f9c8e8 100644 --- a/src/exchange/taler-exchange-httpd_aml-decision-get.c +++ b/src/exchange/taler-exchange-httpd_aml-decision-get.c @@ -64,8 +64,10 @@ kyc_attribute_cb (    json_t *kyc_attributes = cls;    json_t *attributes; -  attributes = NULL; // FIXME - +  attributes = TALER_CRYPTO_kyc_attributes_decrypt (&TEH_attribute_key, +                                                    enc_attributes, +                                                    enc_attributes_size); +  GNUNET_break (NULL != attributes);    GNUNET_assert (      0 ==      json_array_append ( @@ -77,8 +79,9 @@ kyc_attribute_cb (                                      collection_time),          GNUNET_JSON_pack_timestamp ("expiration_time",                                      expiration_time), -        GNUNET_JSON_pack_object_steal ("attributes", -                                       attributes) +        GNUNET_JSON_pack_allow_null ( +          GNUNET_JSON_pack_object_steal ("attributes", +                                         attributes))          )));  } diff --git a/src/exchange/taler-exchange-httpd_aml-decision.h b/src/exchange/taler-exchange-httpd_aml-decision.h index 033db4a8..8af742c0 100644 --- a/src/exchange/taler-exchange-httpd_aml-decision.h +++ b/src/exchange/taler-exchange-httpd_aml-decision.h @@ -43,13 +43,13 @@ TEH_handler_post_aml_decision (  /** - * Handle a GET "/aml/$OFFICER_PUB/decisions" request.  Parses the request + * Handle a GET "/aml/$OFFICER_PUB/decisions/$STATE" request.  Parses the request   * details, checks the signatures and if appropriately authorized returns   * the matching decisions.   *   * @param rc request context   * @param officer_pub public key of the AML officer who made the request - * @param args GET arguments (should be none) + * @param args GET arguments (should be the state)   * @return MHD result code   */  MHD_RESULT diff --git a/src/exchange/taler-exchange-httpd_aml-decisions-get.c b/src/exchange/taler-exchange-httpd_aml-decisions-get.c index 9f2fae3b..7c4a137d 100644 --- a/src/exchange/taler-exchange-httpd_aml-decisions-get.c +++ b/src/exchange/taler-exchange-httpd_aml-decisions-get.c @@ -80,13 +80,12 @@ TEH_handler_aml_decisions_get (    const char *const args[])  {    struct TALER_AmlOfficerSignatureP officer_sig; -  bool frozen = false; -  bool pending = false; -  bool normal = false; +  enum TALER_AmlDecisionState decision;    int delta = -20;    unsigned long long start = INT64_MAX; +  const char *state_str = args[0]; -  if (NULL != args[0]) +  if (NULL == state_str)    {      GNUNET_break_op (0);      return TALER_MHD_reply_with_error (rc->connection, @@ -94,6 +93,31 @@ TEH_handler_aml_decisions_get (                                         TALER_EC_GENERIC_ENDPOINT_UNKNOWN,                                         args[0]);    } +  if (0 == strcmp (state_str, +                   "pending")) +    decision = TALER_AML_PENDING; +  else if (0 == strcmp (state_str, +                        "frozen")) +    decision = TALER_AML_FROZEN; +  if (0 == strcmp (state_str, +                   "normal")) +    decision = TALER_AML_NORMAL; +  else +  { +    GNUNET_break_op (0); +    return TALER_MHD_reply_with_error (rc->connection, +                                       MHD_HTTP_BAD_REQUEST, +                                       TALER_EC_GENERIC_ENDPOINT_UNKNOWN, +                                       state_str); +  } +  if (NULL != args[1]) +  { +    GNUNET_break_op (0); +    return TALER_MHD_reply_with_error (rc->connection, +                                       MHD_HTTP_BAD_REQUEST, +                                       TALER_EC_GENERIC_ENDPOINT_UNKNOWN, +                                       args[1]); +  }    {      const char *sig_hdr; @@ -124,24 +148,6 @@ TEH_handler_aml_decisions_get (      p = MHD_lookup_connection_value (rc->connection,                                       MHD_GET_ARGUMENT_KIND, -                                     "frozen"); -    if (NULL != p) -      frozen = (0 == strcasecmp (p, -                                 "yes")); -    p = MHD_lookup_connection_value (rc->connection, -                                     MHD_GET_ARGUMENT_KIND, -                                     "pending"); -    if (NULL != p) -      pending = (0 == strcasecmp (p, -                                  "yes")); -    p = MHD_lookup_connection_value (rc->connection, -                                     MHD_GET_ARGUMENT_KIND, -                                     "normal"); -    if (NULL != p) -      normal = (0 == strcasecmp (p, -                                 "yes")); -    p = MHD_lookup_connection_value (rc->connection, -                                     MHD_GET_ARGUMENT_KIND,                                       "start");      if (NULL != p)      { @@ -183,7 +189,6 @@ TEH_handler_aml_decisions_get (    {      json_t *records;      enum GNUNET_DB_QueryStatus qs; -    enum TALER_AmlDecisionState decision = 42; // FIXME!      records = json_array ();      GNUNET_assert (NULL != records); | 
