commit 7080748524566f05688a3ba99b7bba2e46c5b2f4
parent 9d21c0598e11bac144bbb3333b95b0881127d76c
Author: Christian Grothoff <christian@grothoff.org>
Date: Tue, 7 May 2024 21:16:04 +0200
-add kyc data back for lookup_transfer_by_deposit
Diffstat:
5 files changed, 62 insertions(+), 54 deletions(-)
diff --git a/src/exchange/Makefile.am b/src/exchange/Makefile.am
@@ -136,6 +136,7 @@ taler_exchange_httpd_SOURCES = \
taler-exchange-httpd_contract.c taler-exchange-httpd_contract.h \
taler-exchange-httpd_csr.c taler-exchange-httpd_csr.h \
taler-exchange-httpd_db.c taler-exchange-httpd_db.h \
+ taler-exchange-httpd_deposits_get.c taler-exchange-httpd_deposits_get.h \
taler-exchange-httpd_extensions.c taler-exchange-httpd_extensions.h \
taler-exchange-httpd_keys.c taler-exchange-httpd_keys.h \
taler-exchange-httpd_kyc-proof.c taler-exchange-httpd_kyc-proof.h \
@@ -182,7 +183,6 @@ taler_exchange_httpd_SOURCES = \
taler-exchange-httpd_withdraw.c taler-exchange-httpd_withdraw.h
# taler-exchange-httpd_kyc-check.c taler-exchange-httpd_kyc-check.h \
-# taler-exchange-httpd_deposits_get.c taler-exchange-httpd_deposits_get.h \
# taler-exchange-httpd_aml-decision.c taler-exchange-httpd_aml-decision.h \
# taler-exchange-httpd_aml-decision-get.c \
# taler-exchange-httpd_aml-decisions-get.c
diff --git a/src/exchange/taler-exchange-httpd_deposits_get.c b/src/exchange/taler-exchange-httpd_deposits_get.c
@@ -90,7 +90,6 @@ struct DepositWtidContext
*/
struct TALER_MerchantSignatureP merchant_sig;
-
/**
* Set by #handle_wtid data to the coin's contribution to the wire transfer.
*/
@@ -244,36 +243,38 @@ deposits_get_transaction (void *cls,
bool pending;
struct TALER_Amount fee;
- qs = TEH_plugin->lookup_transfer_by_deposit (TEH_plugin->cls,
- &ctx->h_contract_terms,
- &ctx->h_wire,
- &ctx->coin_pub,
- &ctx->merchant,
- &pending,
- &ctx->wtid,
- &ctx->execution_time,
- &ctx->coin_contribution,
- &fee,
- &ctx->kyc,
- &ctx->aml_decision);
+ qs = TEH_plugin->lookup_transfer_by_deposit (
+ TEH_plugin->cls,
+ &ctx->h_contract_terms,
+ &ctx->h_wire,
+ &ctx->coin_pub,
+ &ctx->merchant,
+ &pending,
+ &ctx->wtid,
+ &ctx->execution_time,
+ &ctx->coin_contribution,
+ &fee,
+ &ctx->kyc);
if (0 > qs)
{
if (GNUNET_DB_STATUS_HARD_ERROR == qs)
{
GNUNET_break (0);
- *mhd_ret = TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_FETCH_FAILED,
- NULL);
+ *mhd_ret = TALER_MHD_reply_with_error (
+ connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ NULL);
}
return qs;
}
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
{
- *mhd_ret = TALER_MHD_reply_with_error (connection,
- MHD_HTTP_NOT_FOUND,
- TALER_EC_EXCHANGE_DEPOSITS_GET_NOT_FOUND,
- NULL);
+ *mhd_ret = TALER_MHD_reply_with_error (
+ connection,
+ MHD_HTTP_NOT_FOUND,
+ TALER_EC_EXCHANGE_DEPOSITS_GET_NOT_FOUND,
+ NULL);
return GNUNET_DB_STATUS_HARD_ERROR;
}
@@ -369,11 +370,11 @@ handle_track_transaction_request (
return mhd_ret;
}
if (GNUNET_SYSERR == ctx->pending)
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_INVARIANT_FAILURE,
- "wire fees exceed aggregate in database")
- ;
+ return TALER_MHD_reply_with_error (
+ connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_INVARIANT_FAILURE,
+ "wire fees exceed aggregate in database");
if (GNUNET_YES == ctx->pending)
{
if ( (GNUNET_TIME_absolute_is_future (ctx->timeout)) &&
@@ -397,8 +398,6 @@ handle_track_transaction_request (
NULL)
: GNUNET_JSON_pack_uint64 ("requirement_row",
ctx->kyc.requirement_row)),
- GNUNET_JSON_pack_uint64 ("aml_decision",
- (uint32_t) ctx->aml_decision),
GNUNET_JSON_pack_bool ("kyc_ok",
ctx->kyc.ok),
GNUNET_JSON_pack_timestamp ("execution_time",
@@ -450,10 +449,11 @@ TEH_handler_deposits_get (struct TEH_RequestContext *rc,
sizeof (ctx->h_wire)))
{
GNUNET_break_op (0);
- return TALER_MHD_reply_with_error (rc->connection,
- MHD_HTTP_BAD_REQUEST,
- TALER_EC_EXCHANGE_DEPOSITS_GET_INVALID_H_WIRE,
- args[0]);
+ return TALER_MHD_reply_with_error (
+ rc->connection,
+ MHD_HTTP_BAD_REQUEST,
+ TALER_EC_EXCHANGE_DEPOSITS_GET_INVALID_H_WIRE,
+ args[0]);
}
if (GNUNET_OK !=
GNUNET_STRINGS_string_to_data (args[1],
@@ -462,10 +462,11 @@ TEH_handler_deposits_get (struct TEH_RequestContext *rc,
sizeof (ctx->merchant)))
{
GNUNET_break_op (0);
- return TALER_MHD_reply_with_error (rc->connection,
- MHD_HTTP_BAD_REQUEST,
- TALER_EC_EXCHANGE_DEPOSITS_GET_INVALID_MERCHANT_PUB,
- args[1]);
+ return TALER_MHD_reply_with_error (
+ rc->connection,
+ MHD_HTTP_BAD_REQUEST,
+ TALER_EC_EXCHANGE_DEPOSITS_GET_INVALID_MERCHANT_PUB,
+ args[1]);
}
if (GNUNET_OK !=
GNUNET_STRINGS_string_to_data (args[2],
@@ -474,10 +475,11 @@ TEH_handler_deposits_get (struct TEH_RequestContext *rc,
sizeof (ctx->h_contract_terms)))
{
GNUNET_break_op (0);
- return TALER_MHD_reply_with_error (rc->connection,
- MHD_HTTP_BAD_REQUEST,
- TALER_EC_EXCHANGE_DEPOSITS_GET_INVALID_H_CONTRACT_TERMS,
- args[2]);
+ return TALER_MHD_reply_with_error (
+ rc->connection,
+ MHD_HTTP_BAD_REQUEST,
+ TALER_EC_EXCHANGE_DEPOSITS_GET_INVALID_H_CONTRACT_TERMS,
+ args[2]);
}
if (GNUNET_OK !=
GNUNET_STRINGS_string_to_data (args[3],
@@ -486,10 +488,11 @@ TEH_handler_deposits_get (struct TEH_RequestContext *rc,
sizeof (ctx->coin_pub)))
{
GNUNET_break_op (0);
- return TALER_MHD_reply_with_error (rc->connection,
- MHD_HTTP_BAD_REQUEST,
- TALER_EC_EXCHANGE_DEPOSITS_GET_INVALID_COIN_PUB,
- args[3]);
+ return TALER_MHD_reply_with_error (
+ rc->connection,
+ MHD_HTTP_BAD_REQUEST,
+ TALER_EC_EXCHANGE_DEPOSITS_GET_INVALID_COIN_PUB,
+ args[3]);
}
TALER_MHD_parse_request_arg_auto_t (rc->connection,
"merchant_sig",
@@ -506,10 +509,11 @@ TEH_handler_deposits_get (struct TEH_RequestContext *rc,
&ctx->merchant_sig))
{
GNUNET_break_op (0);
- return TALER_MHD_reply_with_error (rc->connection,
- MHD_HTTP_FORBIDDEN,
- TALER_EC_EXCHANGE_DEPOSITS_GET_MERCHANT_SIGNATURE_INVALID,
- NULL);
+ return TALER_MHD_reply_with_error (
+ rc->connection,
+ MHD_HTTP_FORBIDDEN,
+ TALER_EC_EXCHANGE_DEPOSITS_GET_MERCHANT_SIGNATURE_INVALID,
+ NULL);
}
}
}
diff --git a/src/exchangedb/pg_lookup_transfer_by_deposit.c b/src/exchangedb/pg_lookup_transfer_by_deposit.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2022-2023 Taler Systems SA
+ Copyright (C) 2022-2024 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
@@ -37,7 +37,8 @@ TEH_PG_lookup_transfer_by_deposit (
struct TALER_WireTransferIdentifierRawP *wtid,
struct GNUNET_TIME_Timestamp *exec_time,
struct TALER_Amount *amount_with_fee,
- struct TALER_Amount *deposit_fee)
+ struct TALER_Amount *deposit_fee,
+ struct TALER_EXCHANGEDB_KycStatus *kyc)
{
struct PostgresClosure *pg = cls;
enum GNUNET_DB_QueryStatus qs;
@@ -66,6 +67,7 @@ TEH_PG_lookup_transfer_by_deposit (
};
/* check if the aggregation record exists and get it */
+ // FIXME: KYC initialization logic REMOVED, needs to be added back!
PREPARE (pg,
"lookup_deposit_wtid",
"SELECT"
diff --git a/src/exchangedb/pg_lookup_transfer_by_deposit.h b/src/exchangedb/pg_lookup_transfer_by_deposit.h
@@ -42,7 +42,6 @@
* @param[out] amount_with_fee set to the total deposited amount
* @param[out] deposit_fee set to how much the exchange did charge for the deposit
* @param[out] kyc set to the kyc status of the receiver (if @a pending)
- * @param[out] aml_decision set to the AML status of the receiver
* @return transaction status code
*/
enum GNUNET_DB_QueryStatus
@@ -56,6 +55,7 @@ TEH_PG_lookup_transfer_by_deposit (
struct TALER_WireTransferIdentifierRawP *wtid,
struct GNUNET_TIME_Timestamp *exec_time,
struct TALER_Amount *amount_with_fee,
- struct TALER_Amount *deposit_fee);
+ struct TALER_Amount *deposit_fee,
+ struct TALER_EXCHANGEDB_KycStatus *kyc);
#endif
diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h
@@ -4781,6 +4781,7 @@ struct TALER_EXCHANGEDB_Plugin
* @param[out] coin_fee how much did the exchange charge for the deposit fee
* @param[out] execution_time when was the transaction done, or
* when we expect it to be done (if @a pending is false)
+ * @param[out] kyc set to the kyc status of the receiver (if @a pending)
* @return transaction status code
*/
enum GNUNET_DB_QueryStatus
@@ -4794,7 +4795,8 @@ struct TALER_EXCHANGEDB_Plugin
struct TALER_WireTransferIdentifierRawP *wtid,
struct GNUNET_TIME_Timestamp *exec_time,
struct TALER_Amount *amount_with_fee,
- struct TALER_Amount *deposit_fee);
+ struct TALER_Amount *deposit_fee,
+ struct TALER_EXCHANGEDB_KycStatus *kyc);
/**