-some FIXMEs from API review
This commit is contained in:
parent
65ce2eede6
commit
5dd03fe359
@ -225,17 +225,18 @@ create_transaction (void *cls,
|
||||
TALER_amount_set_zero (pcc->amount.currency,
|
||||
&purse_fee);
|
||||
/* 1) create purse */
|
||||
qs = TEH_plugin->insert_purse_request (TEH_plugin->cls,
|
||||
pcc->purse_pub,
|
||||
&pcc->merge_pub,
|
||||
pcc->purse_expiration,
|
||||
&pcc->h_contract_terms,
|
||||
pcc->min_age,
|
||||
TALER_WAMF_MODE_MERGE_FULLY_PAID_PURSE,
|
||||
&purse_fee,
|
||||
&pcc->amount,
|
||||
&pcc->purse_sig,
|
||||
&in_conflict);
|
||||
qs = TEH_plugin->insert_purse_request (
|
||||
TEH_plugin->cls,
|
||||
pcc->purse_pub,
|
||||
&pcc->merge_pub,
|
||||
pcc->purse_expiration,
|
||||
&pcc->h_contract_terms,
|
||||
pcc->min_age,
|
||||
TALER_WAMF_MODE_MERGE_FULLY_PAID_PURSE,
|
||||
&purse_fee,
|
||||
&pcc->amount,
|
||||
&pcc->purse_sig,
|
||||
&in_conflict);
|
||||
if (qs < 0)
|
||||
{
|
||||
if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
|
||||
@ -409,12 +410,13 @@ create_transaction (void *cls,
|
||||
void *econtract;
|
||||
struct GNUNET_HashCode h_econtract;
|
||||
|
||||
qs = TEH_plugin->select_contract_by_purse (TEH_plugin->cls,
|
||||
pcc->purse_pub,
|
||||
&pub_ckey,
|
||||
&econtract_sig,
|
||||
&econtract_size,
|
||||
&econtract);
|
||||
qs = TEH_plugin->select_contract_by_purse (
|
||||
TEH_plugin->cls,
|
||||
pcc->purse_pub,
|
||||
&pub_ckey,
|
||||
&econtract_sig,
|
||||
&econtract_size,
|
||||
&econtract);
|
||||
if (qs <= 0)
|
||||
{
|
||||
if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
|
||||
@ -478,6 +480,7 @@ parse_coin (struct MHD_Connection *connection,
|
||||
GNUNET_JSON_spec_fixed_auto ("h_age_commitment",
|
||||
&coin->cpi.h_age_commitment),
|
||||
&coin->cpi.no_age_commitment),
|
||||
// FIXME-Oec: proof of age is missing.
|
||||
GNUNET_JSON_spec_fixed_auto ("coin_sig",
|
||||
&coin->coin_sig),
|
||||
GNUNET_JSON_spec_fixed_auto ("coin_pub",
|
||||
|
@ -310,6 +310,7 @@ parse_coin (struct MHD_Connection *connection,
|
||||
GNUNET_JSON_spec_fixed_auto ("h_age_commitment",
|
||||
&coin->cpi.h_age_commitment),
|
||||
&coin->cpi.no_age_commitment),
|
||||
// FIXME-Oec: proof of age is missing!
|
||||
GNUNET_JSON_spec_fixed_auto ("coin_sig",
|
||||
&coin->coin_sig),
|
||||
GNUNET_JSON_spec_fixed_auto ("coin_pub",
|
||||
|
@ -139,11 +139,14 @@ reply_merge_success (struct MHD_Connection *connection,
|
||||
TALER_amount_cmp (&pcc->balance,
|
||||
&pcc->target_amount))
|
||||
{
|
||||
GNUNET_break (0);
|
||||
return TALER_MHD_REPLY_JSON_PACK (
|
||||
connection,
|
||||
MHD_HTTP_ACCEPTED,
|
||||
MHD_HTTP_INTERNAL_SERVER_ERROR,
|
||||
TALER_JSON_pack_amount ("balance",
|
||||
&pcc->balance));
|
||||
&pcc->balance),
|
||||
TALER_JSON_pack_amount ("target_amount",
|
||||
&pcc->target_amount));
|
||||
}
|
||||
if ( (NULL == pcc->provider_url) ||
|
||||
(0 == strcmp (pcc->provider_url,
|
||||
@ -221,6 +224,7 @@ merge_transaction (void *cls,
|
||||
bool no_balance = true;
|
||||
bool no_partner = true;
|
||||
|
||||
// FIXME: add KYC-check logic!
|
||||
qs = TEH_plugin->do_purse_merge (TEH_plugin->cls,
|
||||
pcc->purse_pub,
|
||||
&pcc->merge_sig,
|
||||
@ -248,7 +252,7 @@ merge_transaction (void *cls,
|
||||
{
|
||||
*mhd_ret =
|
||||
TALER_MHD_reply_with_error (connection,
|
||||
MHD_HTTP_BAD_REQUEST,
|
||||
MHD_HTTP_NOT_FOUND,
|
||||
TALER_EC_EXCHANGE_MERGE_PURSE_PARTNER_UNKNOWN,
|
||||
pcc->provider_url);
|
||||
return GNUNET_DB_STATUS_HARD_ERROR;
|
||||
@ -303,6 +307,7 @@ merge_transaction (void *cls,
|
||||
GNUNET_free (partner_url);
|
||||
return GNUNET_DB_STATUS_HARD_ERROR;
|
||||
}
|
||||
// FIXME: if ! kyc check, return 451!
|
||||
return qs;
|
||||
}
|
||||
|
||||
@ -488,7 +493,7 @@ TEH_handler_purses_merge (
|
||||
GNUNET_free (pcc.provider_url);
|
||||
return TALER_MHD_reply_with_error (
|
||||
connection,
|
||||
MHD_HTTP_BAD_REQUEST,
|
||||
MHD_HTTP_FORBIDDEN,
|
||||
TALER_EC_EXCHANGE_PURSE_MERGE_INVALID_MERGE_SIGNATURE,
|
||||
NULL);
|
||||
}
|
||||
@ -514,12 +519,17 @@ TEH_handler_purses_merge (
|
||||
GNUNET_free (pcc.provider_url);
|
||||
return TALER_MHD_reply_with_error (
|
||||
connection,
|
||||
MHD_HTTP_BAD_REQUEST,
|
||||
MHD_HTTP_FORBIDDEN,
|
||||
TALER_EC_EXCHANGE_PURSE_MERGE_INVALID_RESERVE_SIGNATURE,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
if (GNUNET_TIME_absolute_is_past (pcc.purse_expiration.abs_time))
|
||||
{
|
||||
// FIXME: idempotency check, otherwise generate 410!
|
||||
}
|
||||
|
||||
/* execute transaction */
|
||||
{
|
||||
MHD_RESULT mhd_ret;
|
||||
|
@ -174,6 +174,7 @@ reply_purse_success (struct MHD_Connection *connection,
|
||||
ec,
|
||||
NULL);
|
||||
}
|
||||
// FIXME: share logic with /purses/$PID/create API!
|
||||
return TALER_MHD_REPLY_JSON_PACK (
|
||||
connection,
|
||||
MHD_HTTP_OK,
|
||||
@ -211,6 +212,9 @@ 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,
|
||||
@ -289,6 +293,9 @@ purse_transaction (void *cls,
|
||||
&merge_pub));
|
||||
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!) */
|
||||
|
Loading…
Reference in New Issue
Block a user