diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-10-17 15:58:23 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-10-17 15:58:23 +0200 |
commit | b38b51d5e8b71f2fcf30dc6aaef82c1fbcede5f8 (patch) | |
tree | f1b8938c3c61c7313ab80ff2e7026cfadf7d90cd /src/exchange/taler-exchange-httpd_kyc-proof.c | |
parent | c6c9db0c8e3768b44b8ec41a8ef173fbd2985c5b (diff) | |
download | exchange-b38b51d5e8b71f2fcf30dc6aaef82c1fbcede5f8.tar.gz exchange-b38b51d5e8b71f2fcf30dc6aaef82c1fbcede5f8.tar.bz2 exchange-b38b51d5e8b71f2fcf30dc6aaef82c1fbcede5f8.zip |
implement /kyc-check, add skeleton for /kyc-proof
Diffstat (limited to 'src/exchange/taler-exchange-httpd_kyc-proof.c')
-rw-r--r-- | src/exchange/taler-exchange-httpd_kyc-proof.c | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/src/exchange/taler-exchange-httpd_kyc-proof.c b/src/exchange/taler-exchange-httpd_kyc-proof.c new file mode 100644 index 000000000..cb3f00dde --- /dev/null +++ b/src/exchange/taler-exchange-httpd_kyc-proof.c @@ -0,0 +1,99 @@ +/* + This file is part of TALER + Copyright (C) 2021 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU Affero General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> +*/ +/** + * @file taler-exchange-httpd_kyc-proof.c + * @brief Handle request for proof for KYC check. + * @author Christian Grothoff + */ +#include "platform.h" +#include <gnunet/gnunet_util_lib.h> +#include <gnunet/gnunet_json_lib.h> +#include <jansson.h> +#include <microhttpd.h> +#include <pthread.h> +#include "taler_json_lib.h" +#include "taler_mhd_lib.h" +#include "taler-exchange-httpd_kyc-proof.h" +#include "taler-exchange-httpd_responses.h" + + +/** + * Context for the proof. + */ +struct KycProofContext +{ + +}; + + +/** + * Function implementing database transaction to check proof's KYC status. + * Runs the transaction logic; IF it returns a non-error code, the transaction + * logic MUST NOT queue a MHD response. IF it returns an hard error, the + * transaction logic MUST queue a MHD response and set @a mhd_ret. IF it + * returns the soft error code, the function MAY be called again to retry and + * MUST not queue a MHD response. + * + * @param cls closure with a `struct KycProofContext *` + * @param connection MHD proof which triggered the transaction + * @param[out] mhd_ret set to MHD response status for @a connection, + * if transaction failed (!) + * @return transaction status + */ +static enum GNUNET_DB_QueryStatus +proof_kyc_check (void *cls, + struct MHD_Connection *connection, + MHD_RESULT *mhd_ret) +{ + struct KycProofContext *kpc = cls; + + (void) kpc; // FIXME: do work here! + return -2; +} + + +MHD_RESULT +TEH_handler_kyc_proof ( + struct MHD_Connection *connection, + ...) +{ + struct KycProofContext kpc; + MHD_RESULT res; + enum GNUNET_GenericReturnValue ret; + + if (1 || (TEH_KYC_NONE == TEH_kyc_config.mode)) + return TALER_MHD_reply_static ( + connection, + MHD_HTTP_NO_CONTENT, + NULL, + NULL, + 0); + ret = TEH_DB_run_transaction (connection, + "check proof kyc", + &res, + &proof_kyc_check, + &kpc); + if (GNUNET_SYSERR == ret) + return res; + return TALER_MHD_REPLY_JSON_PACK ( + connection, + MHD_HTTP_OK, + GNUNET_JSON_pack_uint64 ("42", + 42)); +} + + +/* end of taler-exchange-httpd_kyc-proof.c */ |