diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-11-09 20:36:30 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-11-09 20:36:30 +0100 |
commit | 016551dbb4af5de4725fb67787dff07c852c0280 (patch) | |
tree | d7199334658b8caaa51307ddff69d4fe1bb0a661 /src/exchange | |
parent | a9b2140b1ece806847aa45a6b95a959c9ddaa7bf (diff) | |
download | exchange-016551dbb4af5de4725fb67787dff07c852c0280.tar.gz exchange-016551dbb4af5de4725fb67787dff07c852c0280.tar.bz2 exchange-016551dbb4af5de4725fb67787dff07c852c0280.zip |
misc TODOs for KYC left
Diffstat (limited to 'src/exchange')
-rw-r--r-- | src/exchange/taler-exchange-httpd_kyc-check.c | 39 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd_withdraw.c | 20 |
2 files changed, 55 insertions, 4 deletions
diff --git a/src/exchange/taler-exchange-httpd_kyc-check.c b/src/exchange/taler-exchange-httpd_kyc-check.c index 38890e98c..5964da501 100644 --- a/src/exchange/taler-exchange-httpd_kyc-check.c +++ b/src/exchange/taler-exchange-httpd_kyc-check.c @@ -105,6 +105,7 @@ TEH_handler_kyc_check ( MHD_RESULT res; enum GNUNET_GenericReturnValue ret; char dummy; + struct TALER_PaytoHash h_payto; if (1 != sscanf (args[0], @@ -118,6 +119,34 @@ TEH_handler_kyc_check ( TALER_EC_GENERIC_PARAMETER_MALFORMED, "payment_target_uuid"); } + /* FIXME: write long polling logic ... */ + { + const char *hps; + + hps = MHD_lookup_connection_value (rc->connection, + MHD_GET_ARGUMENT_KIND, + "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), + &h_payto, + sizeof (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 (TEH_KYC_NONE == TEH_kyc_config.mode) return TALER_MHD_reply_static ( @@ -141,6 +170,16 @@ TEH_handler_kyc_check ( &kcc); if (GNUNET_SYSERR == ret) return res; + if (0 != + GNUNET_memcmp (&kcc.h_payto, + &h_payto)) + { + GNUNET_break_op (0); + return TALER_MHD_reply_with_error (rc->connection, + MHD_HTTP_FORBIDDEN, + 42, /* FIXME: EC! */ + "h_payto"); + } if (! kcc.kyc.ok) { char *url; diff --git a/src/exchange/taler-exchange-httpd_withdraw.c b/src/exchange/taler-exchange-httpd_withdraw.c index ef1bb27d9..d393567e4 100644 --- a/src/exchange/taler-exchange-httpd_withdraw.c +++ b/src/exchange/taler-exchange-httpd_withdraw.c @@ -224,6 +224,10 @@ withdraw_transaction (void *cls, return qs; } + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Asked to withdraw from %s amount of %s\n", + TALER_B2S (&wc->wsrd.reserve_pub), + TALER_amount2s (&wc->amount_required)); /* Don't sign again if we have already signed the coin */ if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs) { @@ -306,6 +310,10 @@ withdraw_transaction (void *cls, return GNUNET_DB_STATUS_HARD_ERROR; } + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "KYC status is %s for %s\n", + wc->kyc.ok ? "ok" : "missing", + TALER_B2S (&r.pub)); if ( (! wc->kyc.ok) && (TEH_KYC_NONE != TEH_kyc_config.mode) && (TALER_EXCHANGEDB_KYC_W2W == wc->kyc.type) ) @@ -323,10 +331,7 @@ withdraw_transaction (void *cls, struct TALER_Amount acc; enum GNUNET_DB_QueryStatus qs2; - TALER_amount_set_zero (TEH_currency, - &acc); - accumulate_withdraws (&acc, - &wc->amount_required); + acc = wc->amount_required; qs2 = TEH_plugin->select_withdraw_amounts_by_account ( TEH_plugin->cls, &wc->wsrd.reserve_pub, @@ -353,6 +358,9 @@ withdraw_transaction (void *cls, NULL); return GNUNET_DB_STATUS_HARD_ERROR; } + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Amount withdrawn so far is %s\n", + TALER_amount2s (&acc)); if (1 == /* 1: acc > withdraw_limit */ TALER_amount_cmp (&acc, &TEH_kyc_config.withdraw_limit)) @@ -388,6 +396,10 @@ withdraw_transaction (void *cls, wc->collectable.reserve_pub = wc->wsrd.reserve_pub; wc->collectable.h_coin_envelope = wc->wsrd.h_coin_envelope; wc->collectable.reserve_sig = wc->signature; + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Persisting withdraw from %s over %s\n", + TALER_B2S (&r.pub), + TALER_amount2s (&wc->amount_required)); qs = TEH_plugin->insert_withdraw_info (TEH_plugin->cls, &wc->collectable); if (0 > qs) |