aboutsummaryrefslogtreecommitdiff
path: root/src/exchange
diff options
context:
space:
mode:
Diffstat (limited to 'src/exchange')
-rw-r--r--src/exchange/taler-exchange-httpd_batch-withdraw.c6
-rw-r--r--src/exchange/taler-exchange-httpd_purses_merge.c23
-rw-r--r--src/exchange/taler-exchange-httpd_reserves_purse.c28
-rw-r--r--src/exchange/taler-exchange-httpd_withdraw.c6
4 files changed, 53 insertions, 10 deletions
diff --git a/src/exchange/taler-exchange-httpd_batch-withdraw.c b/src/exchange/taler-exchange-httpd_batch-withdraw.c
index f4276ef6..d1311f8a 100644
--- a/src/exchange/taler-exchange-httpd_batch-withdraw.c
+++ b/src/exchange/taler-exchange-httpd_batch-withdraw.c
@@ -150,7 +150,7 @@ batch_withdraw_transaction (void *cls,
{
*mhd_ret = TALER_MHD_reply_with_error (connection,
MHD_HTTP_NOT_FOUND,
- TALER_EC_EXCHANGE_WITHDRAW_RESERVE_UNKNOWN,
+ TALER_EC_EXCHANGE_GENERIC_RESERVE_UNKNOWN,
NULL);
return GNUNET_DB_STATUS_HARD_ERROR;
}
@@ -171,7 +171,7 @@ batch_withdraw_transaction (void *cls,
/* Wallet-to-wallet payments _always_ require KYC */
*mhd_ret = TALER_MHD_REPLY_JSON_PACK (
connection,
- MHD_HTTP_ACCEPTED,
+ MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS,
GNUNET_JSON_pack_uint64 ("payment_target_uuid",
wc->kyc.payment_target_uuid));
return GNUNET_DB_STATUS_HARD_ERROR;
@@ -206,7 +206,7 @@ batch_withdraw_transaction (void *cls,
{
*mhd_ret = TALER_MHD_REPLY_JSON_PACK (
connection,
- MHD_HTTP_ACCEPTED,
+ MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS,
GNUNET_JSON_pack_uint64 ("payment_target_uuid",
wc->kyc.payment_target_uuid));
return GNUNET_DB_STATUS_HARD_ERROR;
diff --git a/src/exchange/taler-exchange-httpd_purses_merge.c b/src/exchange/taler-exchange-httpd_purses_merge.c
index b0055eda..14dba523 100644
--- a/src/exchange/taler-exchange-httpd_purses_merge.c
+++ b/src/exchange/taler-exchange-httpd_purses_merge.c
@@ -223,6 +223,8 @@ merge_transaction (void *cls,
bool in_conflict = true;
bool no_balance = true;
bool no_partner = true;
+ bool no_kyc = true;
+ bool no_reserve = true;
// FIXME: add KYC-check logic!
qs = TEH_plugin->do_purse_merge (TEH_plugin->cls,
@@ -234,6 +236,8 @@ merge_transaction (void *cls,
&pcc->reserve_pub,
&no_partner,
&no_balance,
+ &no_reserve,
+ &no_kyc,
&in_conflict);
if (qs < 0)
{
@@ -257,6 +261,25 @@ merge_transaction (void *cls,
pcc->provider_url);
return GNUNET_DB_STATUS_HARD_ERROR;
}
+ if (no_reserve)
+ {
+ *mhd_ret =
+ TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_NOT_FOUND,
+ TALER_EC_EXCHANGE_GENERIC_RESERVE_UNKNOWN,
+ NULL);
+ 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 (no_balance)
{
*mhd_ret =
diff --git a/src/exchange/taler-exchange-httpd_reserves_purse.c b/src/exchange/taler-exchange-httpd_reserves_purse.c
index 09ef3b37..f56852d5 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
diff --git a/src/exchange/taler-exchange-httpd_withdraw.c b/src/exchange/taler-exchange-httpd_withdraw.c
index ca4ed9a7..1d48045b 100644
--- a/src/exchange/taler-exchange-httpd_withdraw.c
+++ b/src/exchange/taler-exchange-httpd_withdraw.c
@@ -133,7 +133,7 @@ withdraw_transaction (void *cls,
{
*mhd_ret = TALER_MHD_reply_with_error (connection,
MHD_HTTP_NOT_FOUND,
- TALER_EC_EXCHANGE_WITHDRAW_RESERVE_UNKNOWN,
+ TALER_EC_EXCHANGE_GENERIC_RESERVE_UNKNOWN,
NULL);
return GNUNET_DB_STATUS_HARD_ERROR;
}
@@ -153,7 +153,7 @@ withdraw_transaction (void *cls,
/* Wallet-to-wallet payments _always_ require KYC */
*mhd_ret = TALER_MHD_REPLY_JSON_PACK (
connection,
- MHD_HTTP_ACCEPTED,
+ MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS,
GNUNET_JSON_pack_uint64 ("payment_target_uuid",
wc->kyc.payment_target_uuid));
return GNUNET_DB_STATUS_HARD_ERROR;
@@ -188,7 +188,7 @@ withdraw_transaction (void *cls,
{
*mhd_ret = TALER_MHD_REPLY_JSON_PACK (
connection,
- MHD_HTTP_ACCEPTED,
+ MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS,
GNUNET_JSON_pack_uint64 ("payment_target_uuid",
wc->kyc.payment_target_uuid));
return GNUNET_DB_STATUS_HARD_ERROR;