diff options
author | Christian Grothoff <christian@grothoff.org> | 2022-06-04 15:19:57 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2022-06-04 15:19:57 +0200 |
commit | 93943bdb5b6ab43b6bcfdb721f67674cc89250d6 (patch) | |
tree | 17e98a062ba886f1389ce99f5cb2fecb242a5f76 /src/exchange/taler-exchange-httpd_reserves_purse.c | |
parent | 3e99c50c0f940fda34585225c38c9014cc1110d0 (diff) | |
download | exchange-93943bdb5b6ab43b6bcfdb721f67674cc89250d6.tar.gz exchange-93943bdb5b6ab43b6bcfdb721f67674cc89250d6.tar.bz2 exchange-93943bdb5b6ab43b6bcfdb721f67674cc89250d6.zip |
add KYC errors for p2p payments
Diffstat (limited to 'src/exchange/taler-exchange-httpd_reserves_purse.c')
-rw-r--r-- | src/exchange/taler-exchange-httpd_reserves_purse.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/src/exchange/taler-exchange-httpd_reserves_purse.c b/src/exchange/taler-exchange-httpd_reserves_purse.c index 09ef3b373..f56852d53 100644 --- a/src/exchange/taler-exchange-httpd_reserves_purse.c +++ b/src/exchange/taler-exchange-httpd_reserves_purse.c @@ -213,8 +213,6 @@ purse_transaction (void *cls, { bool in_conflict = true; - // FIXME: also check KYC state of the account - // FIXME: distinguish reserve-not-found! /* 1) store purse */ qs = TEH_plugin->insert_purse_request (TEH_plugin->cls, &rpc->purse_pub, @@ -294,14 +292,14 @@ purse_transaction (void *cls, return GNUNET_DB_STATUS_HARD_ERROR; } - // FIXME: return 404 if reserve-not-found! - // FIXME: if KYC check failed, generate 451 response! } /* 2) create purse with reserve (and debit reserve for purse creation!) */ { bool in_conflict = true; bool insufficient_funds = true; + bool no_reserve = true; + bool no_kyc = true; qs = TEH_plugin->do_reserve_purse ( TEH_plugin->cls, @@ -315,6 +313,8 @@ purse_transaction (void *cls, : &rpc->gf->fees.purse, rpc->reserve_pub, &in_conflict, + &no_reserve, + &no_kyc, &insufficient_funds); if (qs < 0) { @@ -377,6 +377,26 @@ purse_transaction (void *cls, GNUNET_free (partner_url); return GNUNET_DB_STATUS_HARD_ERROR; } + if (no_reserve) + { + *mhd_ret + = TALER_MHD_REPLY_JSON_PACK ( + connection, + MHD_HTTP_NOT_FOUND, + TALER_JSON_pack_ec ( + TALER_EC_EXCHANGE_GENERIC_RESERVE_UNKNOWN)); + return GNUNET_DB_STATUS_HARD_ERROR; + } + if (no_kyc) + { + *mhd_ret + = TALER_MHD_REPLY_JSON_PACK ( + connection, + MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS, + TALER_JSON_pack_ec ( + TALER_EC_EXCHANGE_GENERIC_KYC_REQUIRED)); + return GNUNET_DB_STATUS_HARD_ERROR; + } if (insufficient_funds) { *mhd_ret |