diff options
| author | Christian Grothoff <christian@grothoff.org> | 2022-03-04 00:30:43 +0100 | 
|---|---|---|
| committer | Christian Grothoff <christian@grothoff.org> | 2022-03-04 00:30:43 +0100 | 
| commit | f9a2808ed02535427e4d2a8a45bcdc9777b8caf5 (patch) | |
| tree | 38d3ff08c215bfa1796b8ae0f68176b3a74799dd /src | |
| parent | 1643b745af309f754959621fa2a631c899ba1975 (diff) | |
-fix kyc test
Diffstat (limited to 'src')
| -rw-r--r-- | src/exchange/taler-exchange-httpd_kyc-check.c | 68 | ||||
| -rw-r--r-- | src/exchangedb/plugin_exchangedb_postgres.c | 8 | ||||
| -rw-r--r-- | src/testing/test_kyc_api.c | 2 | ||||
| -rw-r--r-- | src/testing/testing_api_cmd_bank_admin_add_incoming.c | 1 | ||||
| -rw-r--r-- | src/testing/testing_api_cmd_kyc_check_get.c | 3 | ||||
| -rw-r--r-- | src/testing/testing_api_cmd_kyc_proof.c | 3 | 
6 files changed, 46 insertions, 39 deletions
| diff --git a/src/exchange/taler-exchange-httpd_kyc-check.c b/src/exchange/taler-exchange-httpd_kyc-check.c index ba918686..de6ac42f 100644 --- a/src/exchange/taler-exchange-httpd_kyc-check.c +++ b/src/exchange/taler-exchange-httpd_kyc-check.c @@ -60,11 +60,6 @@ struct KycPoller    struct GNUNET_DB_EventHandler *eh;    /** -   * UUID found based on @e h_payto. -   */ -  uint64_t payment_target_uuid; - -  /**     * UUID being checked.     */    uint64_t auth_payment_target_uuid; @@ -81,6 +76,11 @@ struct KycPoller    struct TALER_PaytoHashP h_payto;    /** +   * Payto URL as a string, as given to us by t +   */ +  const char *hps; + +  /**     * When will this request time out?     */    struct GNUNET_TIME_Absolute timeout; @@ -183,9 +183,6 @@ kyc_check (void *cls,                                             "inselect_wallet_status");      return qs;    } -  // FIXME: avoid duplicating this... -  kyp->payment_target_uuid = kyp->kyc.payment_target_uuid; -    return qs;  } @@ -293,32 +290,28 @@ TEH_handler_kyc_check (                                           tms));        }      } +    kyp->hps = MHD_lookup_connection_value (rc->connection, +                                            MHD_GET_ARGUMENT_KIND, +                                            "h_payto"); +    if (NULL == kyp->hps)      { -      const char *hps; - -      hps = MHD_lookup_connection_value (rc->connection, -                                         MHD_GET_ARGUMENT_KIND, +      GNUNET_break_op (0); +      return TALER_MHD_reply_with_error (rc->connection, +                                         MHD_HTTP_BAD_REQUEST, +                                         TALER_EC_GENERIC_PARAMETER_MISSING, +                                         "h_payto"); +    } +    if (GNUNET_OK != +        GNUNET_STRINGS_string_to_data (kyp->hps, +                                       strlen (kyp->hps), +                                       &kyp->h_payto, +                                       sizeof (kyp->h_payto))) +    { +      GNUNET_break_op (0); +      return TALER_MHD_reply_with_error (rc->connection, +                                         MHD_HTTP_BAD_REQUEST, +                                         TALER_EC_GENERIC_PARAMETER_MALFORMED,                                           "h_payto"); -      if (NULL == hps) -      { -        GNUNET_break_op (0); -        return TALER_MHD_reply_with_error (rc->connection, -                                           MHD_HTTP_BAD_REQUEST, -                                           TALER_EC_GENERIC_PARAMETER_MISSING, -                                           "h_payto"); -      } -      if (GNUNET_OK != -          GNUNET_STRINGS_string_to_data (hps, -                                         strlen (hps), -                                         &kyp->h_payto, -                                         sizeof (kyp->h_payto))) -      { -        GNUNET_break_op (0); -        return TALER_MHD_reply_with_error (rc->connection, -                                           MHD_HTTP_BAD_REQUEST, -                                           TALER_EC_GENERIC_PARAMETER_MALFORMED, -                                           "h_payto"); -      }      }    } @@ -360,8 +353,13 @@ TEH_handler_kyc_check (      return res;    if (kyp->auth_payment_target_uuid != -      kyp->payment_target_uuid) +      kyp->kyc.payment_target_uuid)    { +    GNUNET_log (GNUNET_ERROR_TYPE_WARNING, +                "Account %llu provided, but payto %s is for %llu\n", +                (unsigned long long) kyp->auth_payment_target_uuid, +                kyp->hps, +                (unsigned long long) kyp->kyc.payment_target_uuid);      GNUNET_break_op (0);      return TALER_MHD_reply_with_error (rc->connection,                                         MHD_HTTP_UNAUTHORIZED, @@ -391,9 +389,9 @@ TEH_handler_kyc_check (      GNUNET_assert (TEH_KYC_OAUTH2 == TEH_kyc_config.mode);      GNUNET_asprintf (&redirect_uri, -                     "%s/kyc-proof/%llu", +                     "%s/kyc-proof/%s",                       TEH_base_url, -                     (unsigned long long) kyp->payment_target_uuid); +                     kyp->hps);      redirect_uri_encoded = TALER_urlencode (redirect_uri);      GNUNET_free (redirect_uri);      GNUNET_asprintf (&url, diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c index 53fd10e3..bdb15c4e 100644 --- a/src/exchangedb/plugin_exchangedb_postgres.c +++ b/src/exchangedb/plugin_exchangedb_postgres.c @@ -3970,7 +3970,7 @@ postgres_select_kyc_status (void *cls,  {    struct PostgresClosure *pg = cls;    struct GNUNET_PQ_QueryParam params[] = { -    GNUNET_PQ_query_param_auto_from_type (&h_payto), +    GNUNET_PQ_query_param_auto_from_type (h_payto),      GNUNET_PQ_query_param_end    };    struct GNUNET_PQ_ResultSpec rs[] = { @@ -9668,8 +9668,10 @@ postgres_get_denomination_revocation (      GNUNET_PQ_query_param_end    };    struct GNUNET_PQ_ResultSpec rs[] = { -    GNUNET_PQ_result_spec_auto_from_type ("master_sig", master_sig), -    GNUNET_PQ_result_spec_uint64 ("denom_revocations_serial_id", rowid), +    GNUNET_PQ_result_spec_auto_from_type ("master_sig", +                                          master_sig), +    GNUNET_PQ_result_spec_uint64 ("denom_revocations_serial_id", +                                  rowid),      GNUNET_PQ_result_spec_end    }; diff --git a/src/testing/test_kyc_api.c b/src/testing/test_kyc_api.c index ca87edd8..3a828646 100644 --- a/src/testing/test_kyc_api.c +++ b/src/testing/test_kyc_api.c @@ -125,7 +125,7 @@ run (void *cls,                                         0, /* age restriction off */                                         MHD_HTTP_ACCEPTED),      TALER_TESTING_cmd_proof_kyc ("proof-kyc", -                                 "withdraw-coin-1-lacking-kyc", +                                 "create-reserve-1",                                   "pass",                                   "state",                                   MHD_HTTP_SEE_OTHER), diff --git a/src/testing/testing_api_cmd_bank_admin_add_incoming.c b/src/testing/testing_api_cmd_bank_admin_add_incoming.c index 64e010ef..5b1d8b8a 100644 --- a/src/testing/testing_api_cmd_bank_admin_add_incoming.c +++ b/src/testing/testing_api_cmd_bank_admin_add_incoming.c @@ -427,6 +427,7 @@ admin_add_incoming_traits (void *cls,      struct TALER_TESTING_Trait traits[] = {        TALER_TESTING_make_trait_bank_row (&fts->serial_id),        TALER_TESTING_make_trait_debit_payto_uri (&fts->payto_debit_account), +      TALER_TESTING_make_trait_payto_uri (&fts->payto_debit_account),        /* Used as a marker, content does not matter */        TALER_TESTING_make_trait_credit_payto_uri (&void_uri),        TALER_TESTING_make_trait_exchange_bank_account_url ( diff --git a/src/testing/testing_api_cmd_kyc_check_get.c b/src/testing/testing_api_cmd_kyc_check_get.c index ffd5664a..03b2321d 100644 --- a/src/testing/testing_api_cmd_kyc_check_get.c +++ b/src/testing/testing_api_cmd_kyc_check_get.c @@ -157,6 +157,9 @@ check_kyc_run (void *cls,      TALER_TESTING_interpreter_fail (kcg->is);      return;    } +  GNUNET_log (GNUNET_ERROR_TYPE_INFO, +              "Running KYC check for payto URI: %s\n", +              *payto_uri);    TALER_payto_hash (*payto_uri,                      &h_payto);    kcg->kwh = TALER_EXCHANGE_kyc_check (is->exchange, diff --git a/src/testing/testing_api_cmd_kyc_proof.c b/src/testing/testing_api_cmd_kyc_proof.c index 05c1e7cb..3ee06972 100644 --- a/src/testing/testing_api_cmd_kyc_proof.c +++ b/src/testing/testing_api_cmd_kyc_proof.c @@ -153,6 +153,9 @@ proof_kyc_run (void *cls,      TALER_TESTING_interpreter_fail (kps->is);      return;    } +  GNUNET_log (GNUNET_ERROR_TYPE_INFO, +              "Triggering KYC proof for %s\n", +              *payto_uri);    TALER_payto_hash (*payto_uri,                      &h_payto);    kps->kph = TALER_EXCHANGE_kyc_proof (is->exchange, | 
