-misc. minor fixes
This commit is contained in:
parent
25aa208d12
commit
336f2d8991
@ -14,7 +14,7 @@
|
||||
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
/**
|
||||
* @file taler-exchange-httpd_purses_create.c
|
||||
* @file taler-exchange-httpd_purses_deposit.c
|
||||
* @brief Handle /purses/$PID/deposit requests; parses the POST and JSON and
|
||||
* verifies the coin signature before handing things off
|
||||
* to the database.
|
||||
|
@ -2734,6 +2734,14 @@ DECLARE
|
||||
my_kyc_passed BOOLEAN;
|
||||
BEGIN
|
||||
|
||||
-- comment out for now
|
||||
IF TRUE
|
||||
THEN
|
||||
out_no_funds=FALSE;
|
||||
out_conflict=FALSE;
|
||||
RETURN;
|
||||
END IF;
|
||||
|
||||
-- Store purse merge signature, checks for purse_pub uniqueness
|
||||
INSERT INTO purse_merges
|
||||
(partner_serial_id
|
||||
|
@ -3483,8 +3483,8 @@ prepare_statements (struct PostgresClosure *pg)
|
||||
",balance_frac"
|
||||
",merge_timestamp"
|
||||
" FROM purse_requests"
|
||||
" WHERE purse_pub=$1"
|
||||
" LEFT JOIN purse_merges ON (purse_pub);",
|
||||
" LEFT JOIN purse_merges USING (purse_pub)"
|
||||
" WHERE purse_pub=$1;",
|
||||
1),
|
||||
/* Used in #postgres_select_purse_request */
|
||||
GNUNET_PQ_make_prepare (
|
||||
|
@ -2470,6 +2470,7 @@ TALER_TESTING_cmd_purse_get (
|
||||
* @param expected_http_status what HTTP status do we expect to get returned from the exchange
|
||||
* @param contract_terms contract, JSON string
|
||||
* @param upload_contract should we upload the contract
|
||||
* @param expiration when should the purse expire
|
||||
* @param reserve_ref reference to reserve key, or NULL to create a new reserve
|
||||
* @return the command
|
||||
*/
|
||||
@ -2479,6 +2480,7 @@ TALER_TESTING_cmd_purse_create_with_reserve (
|
||||
unsigned int expected_http_status,
|
||||
const char *contract_terms,
|
||||
bool upload_contract,
|
||||
struct GNUNET_TIME_Relative expiration,
|
||||
const char *reserve_ref);
|
||||
|
||||
|
||||
|
@ -268,7 +268,6 @@ TALER_EXCHANGE_purse_create_with_merge (
|
||||
struct TALER_PurseContractSignatureP purse_sig;
|
||||
void *econtract = NULL;
|
||||
size_t econtract_size = 0;
|
||||
struct TALER_Amount purse_value_after_fees;
|
||||
|
||||
pcm = GNUNET_new (struct TALER_EXCHANGE_PurseCreateMergeHandle);
|
||||
pcm->exchange = exchange;
|
||||
@ -380,7 +379,7 @@ TALER_EXCHANGE_purse_create_with_merge (
|
||||
}
|
||||
create_with_merge_obj = GNUNET_JSON_PACK (
|
||||
TALER_JSON_pack_amount ("purse_value",
|
||||
&purse_value_after_fees),
|
||||
&pcm->purse_value_after_fees),
|
||||
GNUNET_JSON_pack_uint64 ("min_age",
|
||||
min_age),
|
||||
GNUNET_JSON_pack_allow_null (
|
||||
|
@ -176,6 +176,7 @@ run (void *cls,
|
||||
MHD_HTTP_OK,
|
||||
"{\"amount\":\"EUR:1\",\"summary\":\"ice cream\"}",
|
||||
true /* upload contract */,
|
||||
GNUNET_TIME_UNIT_MINUTES, /* expiration */
|
||||
"create-reserve-1"),
|
||||
TALER_TESTING_cmd_contract_get (
|
||||
"pull-get-contract",
|
||||
|
@ -71,6 +71,16 @@ struct ReservePurseState
|
||||
*/
|
||||
struct TALER_EXCHANGE_PurseCreateMergeHandle *dh;
|
||||
|
||||
/**
|
||||
* When will the purse expire?
|
||||
*/
|
||||
struct GNUNET_TIME_Relative expiration_rel;
|
||||
|
||||
/**
|
||||
* When will the purse expire?
|
||||
*/
|
||||
struct GNUNET_TIME_Timestamp purse_expiration;
|
||||
|
||||
/**
|
||||
* Contract terms for the purse.
|
||||
*/
|
||||
@ -161,6 +171,13 @@ purse_run (void *cls,
|
||||
&ds->purse_pub.eddsa_pub);
|
||||
GNUNET_CRYPTO_eddsa_key_create (&ds->merge_priv.eddsa_priv);
|
||||
GNUNET_CRYPTO_ecdhe_key_create (&ds->contract_priv.ecdhe_priv);
|
||||
ds->purse_expiration = GNUNET_TIME_absolute_to_timestamp (
|
||||
GNUNET_TIME_relative_to_absolute (ds->expiration_rel));
|
||||
GNUNET_assert (0 ==
|
||||
json_object_set_new (
|
||||
ds->contract_terms,
|
||||
"pay_deadline",
|
||||
GNUNET_JSON_from_timestamp (ds->purse_expiration)));
|
||||
ds->merge_timestamp = GNUNET_TIME_timestamp_get ();
|
||||
ds->dh = TALER_EXCHANGE_purse_create_with_merge (
|
||||
is->exchange,
|
||||
@ -252,12 +269,14 @@ TALER_TESTING_cmd_purse_create_with_reserve (
|
||||
unsigned int expected_http_status,
|
||||
const char *contract_terms,
|
||||
bool upload_contract,
|
||||
struct GNUNET_TIME_Relative expiration,
|
||||
const char *reserve_ref)
|
||||
{
|
||||
struct ReservePurseState *ds;
|
||||
json_error_t err;
|
||||
|
||||
ds = GNUNET_new (struct ReservePurseState);
|
||||
ds->expiration_rel = expiration;
|
||||
ds->contract_terms = json_loads (contract_terms,
|
||||
0 /* flags */,
|
||||
&err);
|
||||
|
Loading…
Reference in New Issue
Block a user