diff options
-rw-r--r-- | src/exchange/taler-exchange-httpd_purses_deposit.c | 2 | ||||
-rw-r--r-- | src/exchangedb/exchange-0001-part.sql | 8 | ||||
-rw-r--r-- | src/exchangedb/plugin_exchangedb_postgres.c | 4 | ||||
-rw-r--r-- | src/include/taler_testing_lib.h | 2 | ||||
-rw-r--r-- | src/lib/exchange_api_purse_create_with_merge.c | 3 | ||||
-rw-r--r-- | src/testing/test_exchange_p2p.c | 1 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_reserve_purse.c | 19 |
7 files changed, 34 insertions, 5 deletions
diff --git a/src/exchange/taler-exchange-httpd_purses_deposit.c b/src/exchange/taler-exchange-httpd_purses_deposit.c index 2c0991e00..08a7d63b1 100644 --- a/src/exchange/taler-exchange-httpd_purses_deposit.c +++ b/src/exchange/taler-exchange-httpd_purses_deposit.c @@ -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. diff --git a/src/exchangedb/exchange-0001-part.sql b/src/exchangedb/exchange-0001-part.sql index d17e5a837..9053e4884 100644 --- a/src/exchangedb/exchange-0001-part.sql +++ b/src/exchangedb/exchange-0001-part.sql @@ -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 diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c index 8091cba41..238322c93 100644 --- a/src/exchangedb/plugin_exchangedb_postgres.c +++ b/src/exchangedb/plugin_exchangedb_postgres.c @@ -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 ( diff --git a/src/include/taler_testing_lib.h b/src/include/taler_testing_lib.h index a1fa8c16f..f8ad120d3 100644 --- a/src/include/taler_testing_lib.h +++ b/src/include/taler_testing_lib.h @@ -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); diff --git a/src/lib/exchange_api_purse_create_with_merge.c b/src/lib/exchange_api_purse_create_with_merge.c index c1ccf7b89..dddf5e4a5 100644 --- a/src/lib/exchange_api_purse_create_with_merge.c +++ b/src/lib/exchange_api_purse_create_with_merge.c @@ -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 ( 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); |