diff options
Diffstat (limited to 'src/testing')
-rw-r--r-- | src/testing/test_exchange_p2p.c | 1 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_reserve_purse.c | 19 |
2 files changed, 20 insertions, 0 deletions
diff --git a/src/testing/test_exchange_p2p.c b/src/testing/test_exchange_p2p.c index 6d4017c1d..c70fe9d8b 100644 --- a/src/testing/test_exchange_p2p.c +++ b/src/testing/test_exchange_p2p.c @@ -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", diff --git a/src/testing/testing_api_cmd_reserve_purse.c b/src/testing/testing_api_cmd_reserve_purse.c index 8f44692fd..ada803d3d 100644 --- a/src/testing/testing_api_cmd_reserve_purse.c +++ b/src/testing/testing_api_cmd_reserve_purse.c @@ -72,6 +72,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. */ json_t *contract_terms; @@ -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); |