commit 5dee406eec4ac6d44ccfaa746b2fb3e104dd60c2
parent 4545732a229676d1359c380f16dc8424d1e9d673
Author: Christian Grothoff <christian@grothoff.org>
Date: Wed, 17 Jul 2024 09:39:49 +0200
pass h_payto
Diffstat:
4 files changed, 37 insertions(+), 11 deletions(-)
diff --git a/src/exchange/taler-exchange-httpd_age-withdraw.c b/src/exchange/taler-exchange-httpd_age-withdraw.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2023 Taler Systems SA
+ Copyright (C) 2023, 2024 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
@@ -50,6 +50,12 @@ struct AgeWithdrawContext
struct TALER_EXCHANGEDB_KycStatus kyc;
/**
+ * Set to the hash of the payto account that established
+ * the reserve.
+ */
+ struct TALER_PaytoHashP h_payto;
+
+ /**
* Timestamp
*/
struct GNUNET_TIME_Timestamp now;
@@ -643,6 +649,7 @@ age_withdraw_transaction (void *cls,
struct TALER_Amount reserve_balance;
qs = TEH_withdraw_kyc_check (&awc->kyc,
+ &awc->h_payto,
connection,
mhd_ret,
&awc->commitment.reserve_pub,
@@ -903,20 +910,21 @@ TEH_handler_age_withdraw (struct TEH_RequestContext *rc,
/* Send back final response, depending on the outcome of
* the DB-transaction */
if (! awc.kyc.ok)
- mhd_ret = TEH_RESPONSE_reply_kyc_required (rc->connection,
- NULL, /* FIXME! */
- &awc.kyc);
+ mhd_ret = TEH_RESPONSE_reply_kyc_required (
+ rc->connection,
+ &awc.h_payto,
+ &awc.kyc);
else
- mhd_ret = reply_age_withdraw_success (rc->connection,
- &awc.commitment.h_commitment,
- awc.commitment.noreveal_index);
+ mhd_ret = reply_age_withdraw_success (
+ rc->connection,
+ &awc.commitment.h_commitment,
+ awc.commitment.noreveal_index);
} while (0);
GNUNET_JSON_parse_free (spec);
free_age_withdraw_context_resources (&awc);
return mhd_ret;
-
}
diff --git a/src/exchange/taler-exchange-httpd_batch-withdraw.c b/src/exchange/taler-exchange-httpd_batch-withdraw.c
@@ -86,6 +86,13 @@ struct BatchWithdrawContext
struct TALER_EXCHANGEDB_KycStatus kyc;
/**
+ * Hash of payto:// URI of the bank account that
+ * established the reserve, set during the @e kyc
+ * check (if any).
+ */
+ struct TALER_PaytoHashP h_payto;
+
+ /**
* Array of @e planchets_length planchets we are processing.
*/
struct PlanchetContext *planchets;
@@ -223,6 +230,7 @@ batch_withdraw_transaction (void *cls,
struct TALER_Amount reserve_balance;
qs = TEH_withdraw_kyc_check (&wc->kyc,
+ &wc->h_payto,
connection,
mhd_ret,
wc->reserve_pub,
@@ -436,10 +444,16 @@ prepare_transaction (const struct TEH_RequestContext *rc,
/* return final positive response */
if (! wc->kyc.ok)
{
+ MHD_RESULT mhd_ret;
+
+ if (check_request_idempotent (wc,
+ &mhd_ret))
+ return mhd_ret;
/* KYC required */
- return TEH_RESPONSE_reply_kyc_required (rc->connection,
- NULL, /* FIXME! */
- &wc->kyc);
+ return TEH_RESPONSE_reply_kyc_required (
+ rc->connection,
+ &wc->h_payto,
+ &wc->kyc);
}
return generate_reply_success (rc,
wc);
diff --git a/src/exchange/taler-exchange-httpd_withdraw.c b/src/exchange/taler-exchange-httpd_withdraw.c
@@ -204,6 +204,7 @@ withdraw_amount_cb (
enum GNUNET_DB_QueryStatus
TEH_withdraw_kyc_check (
struct TALER_EXCHANGEDB_KycStatus *kyc,
+ struct TALER_PaytoHashP *h_payto,
struct MHD_Connection *connection,
MHD_RESULT *mhd_ret,
const struct TALER_ReservePublicKeyP *reserve_pub,
@@ -236,6 +237,7 @@ TEH_withdraw_kyc_check (
merge already did that. */
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
return qs;
+ *h_payto = wc.h_payto;
return TEH_legitimization_check (
kyc,
connection,
diff --git a/src/exchange/taler-exchange-httpd_withdraw.h b/src/exchange/taler-exchange-httpd_withdraw.h
@@ -54,6 +54,7 @@ TEH_legitimization_check (
* from @a reserve_pub at time @a now.
*
* @param[out] kyc set to kyc status
+ * @param[out] h_payto set to payto hash of origin account
* @param[in,out] connection used to return hard errors
* @param[out] mhd_ret set if errors were returned
* (only on hard error)
@@ -66,6 +67,7 @@ TEH_legitimization_check (
enum GNUNET_DB_QueryStatus
TEH_withdraw_kyc_check (
struct TALER_EXCHANGEDB_KycStatus *kyc,
+ struct TALER_PaytoHashP *h_payto,
struct MHD_Connection *connection,
MHD_RESULT *mhd_ret,
const struct TALER_ReservePublicKeyP *reserve_pub,