commit e39133ca761b4f7a8cf9cbee3bb6c78e8f30fa69
parent ca4d9eed5190b6d79dd2f7eac03a21e0cf69c3c8
Author: Marcello Stanisci <marcello.stanisci@inria.fr>
Date: Thu, 24 Sep 2015 17:58:38 +0200
adapting the "abs to json" to the latest mint code
(for example, it is mandatory to round the time before)
(converting it to a JSON string).
Diffstat:
3 files changed, 11 insertions(+), 14 deletions(-)
diff --git a/src/backend/taler-merchant-httpd.c b/src/backend/taler-merchant-httpd.c
@@ -557,6 +557,11 @@ url_handler (void *cls,
edate = GNUNET_TIME_absolute_add (now, GNUNET_TIME_UNIT_WEEKS);
refund = GNUNET_TIME_absolute_add (now, GNUNET_TIME_UNIT_WEEKS);
+ TALER_round_abs_time (&now);
+ TALER_round_abs_time (&expiry);
+ TALER_round_abs_time (&edate);
+ TALER_round_abs_time (&refund);
+
/* getting the SEPA-aware JSON */
/* nounce for hashing the wire object */
nounce = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_NONCE, UINT64_MAX);
diff --git a/src/frontend/generate_taler_contract.php b/src/frontend/generate_taler_contract.php
@@ -25,7 +25,7 @@
to the wallet
*/
-$cli_debug = TRUE;
+$cli_debug = !TRUE;
// 1) recover the session information
session_start();
diff --git a/src/tests/merchant-contract-test.c b/src/tests/merchant-contract-test.c
@@ -79,7 +79,6 @@ run (void *cls, char *const *args, const char *cfgfile,
{
json_t *j_fake_contract;
- json_t *j_root;
json_t *j_wire;
json_t *j_details;
json_t *j_mints;
@@ -98,8 +97,6 @@ run (void *cls, char *const *args, const char *cfgfile,
json_t *j_merchant_zipcode;
json_t *j_lnames;
json_t *j_deldate;
- json_t *j_expiry;
- char *str;
char *contract_tmp_str;
char *desc;
struct TALER_Amount amount;
@@ -216,11 +213,10 @@ run (void *cls, char *const *args, const char *cfgfile,
/* End of 'item' object definition */
/* Delivery date: OPTIONAL FIELD */
- deldate = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (),
- GNUNET_TIME_UNIT_WEEKS);
- j_deldate = TALER_json_from_abs (deldate);
-
-
+ now = GNUNET_TIME_absolute_get ();
+ TALER_round_abs_time (&now);
+// deldate = GNUNET_TIME_absolute_add (now, GNUNET_TIME_UNIT_WEEKS);
+ j_deldate = TALER_json_from_abs (now);
/* Delivery location: OPTIONAL FIELD */
j_delloc = json_string ("MALTK"); /* just a 'tag' which points to some well defined location */
@@ -277,7 +273,6 @@ run (void *cls, char *const *args, const char *cfgfile,
#endif
nounce = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_NONCE, UINT64_MAX);
- now = GNUNET_TIME_absolute_get ();
j_wire = MERCHANT_get_wire_json (wire, nounce, now);
@@ -303,16 +298,13 @@ run (void *cls, char *const *args, const char *cfgfile,
*/
GNUNET_CRYPTO_hash (contract_tmp_str, strlen (contract_tmp_str) + 1, &h_contract_str);
-
-
-
if (GNUNET_SYSERR == MERCHANT_DB_get_contract_values (db_conn, &h_contract_str, &nounce, &edate))
printf ("no hash found\n");
else
{
char *late = GNUNET_STRINGS_absolute_time_to_string (edate);
- printf ("hash found!, nounce is : %d\n", nounce, late);
+ printf ("hash found!, nounce is : %llu\n", nounce);
printf ("hash found!, time is : %s\n", late);
}