aboutsummaryrefslogtreecommitdiff
path: root/src/testing/testing_api_cmd_post_orders.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-12-14 16:10:40 +0100
committerChristian Grothoff <christian@grothoff.org>2021-12-14 16:10:40 +0100
commitad5d54f48534ac0ad5bfd7f048bd7782e674a89b (patch)
tree4443e41c1aec412d82642b194aa3d837c9eb5cfd /src/testing/testing_api_cmd_post_orders.c
parent49e2e44b09dd845d0922c0acef5ff487b52bf26d (diff)
downloadmerchant-ad5d54f48534ac0ad5bfd7f048bd7782e674a89b.tar.gz
merchant-ad5d54f48534ac0ad5bfd7f048bd7782e674a89b.tar.bz2
merchant-ad5d54f48534ac0ad5bfd7f048bd7782e674a89b.zip
migration to protocol v11
Diffstat (limited to 'src/testing/testing_api_cmd_post_orders.c')
-rw-r--r--src/testing/testing_api_cmd_post_orders.c39
1 files changed, 17 insertions, 22 deletions
diff --git a/src/testing/testing_api_cmd_post_orders.c b/src/testing/testing_api_cmd_post_orders.c
index 81b79091..bb31dacc 100644
--- a/src/testing/testing_api_cmd_post_orders.c
+++ b/src/testing/testing_api_cmd_post_orders.c
@@ -377,11 +377,10 @@ orders_run (void *cls,
struct GNUNET_TIME_Absolute now;
char *order_id;
- // FIXME: should probably use get_monotone() to ensure uniqueness!
- now = GNUNET_TIME_absolute_get ();
- order_id = GNUNET_STRINGS_data_to_string_alloc
- (&now.abs_value_us,
- sizeof (now.abs_value_us));
+ now = GNUNET_TIME_absolute_get_monotonic (is->cfg);
+ order_id = GNUNET_STRINGS_data_to_string_alloc (
+ &now,
+ sizeof (now));
GNUNET_assert (0 ==
json_object_set_new (ps->order_terms,
"order_id",
@@ -451,8 +450,7 @@ orders_run2 (void *cls,
struct GNUNET_TIME_Absolute now;
char *order_id;
- // FIXME: should probably use get_monotone() to ensure uniqueness!
- now = GNUNET_TIME_absolute_get ();
+ now = GNUNET_TIME_absolute_get_monotonic (is->cfg);
order_id = GNUNET_STRINGS_data_to_string_alloc (
&now.abs_value_us,
sizeof (now.abs_value_us));
@@ -621,18 +619,15 @@ mark_forgettable (void *cls,
*/
static void
make_order_json (const char *order_id,
- struct GNUNET_TIME_Absolute refund_deadline,
- struct GNUNET_TIME_Absolute pay_deadline,
+ struct GNUNET_TIME_Timestamp refund_deadline,
+ struct GNUNET_TIME_Timestamp pay_deadline,
const char *amount,
json_t **order)
{
- struct GNUNET_TIME_Absolute refund = refund_deadline;
- struct GNUNET_TIME_Absolute pay = pay_deadline;
+ struct GNUNET_TIME_Timestamp refund = refund_deadline;
+ struct GNUNET_TIME_Timestamp pay = pay_deadline;
json_t *contract_terms;
- GNUNET_TIME_round_abs (&refund);
- GNUNET_TIME_round_abs (&pay);
-
/* Include required fields and some dummy objects to test forgetting. */
contract_terms = json_pack (
"{s:s, s:s?, s:s, s:s, s:o, s:o, s:s, s:[{s:s}, {s:s}, {s:s}]}",
@@ -640,8 +635,8 @@ make_order_json (const char *order_id,
"order_id", order_id,
"amount", amount,
"fulfillment_url", "https://example.com",
- "refund_deadline", GNUNET_JSON_from_time_abs (refund),
- "pay_deadline", GNUNET_JSON_from_time_abs (pay),
+ "refund_deadline", GNUNET_JSON_from_timestamp (refund),
+ "pay_deadline", GNUNET_JSON_from_timestamp (pay),
"dummy_obj", "EUR:1.0",
"dummy_array", /* For testing forgetting parts of arrays */
"item", "speakers",
@@ -668,8 +663,8 @@ TALER_TESTING_cmd_merchant_post_orders_no_claim (
const char *merchant_url,
unsigned int http_status,
const char *order_id,
- struct GNUNET_TIME_Absolute refund_deadline,
- struct GNUNET_TIME_Absolute pay_deadline,
+ struct GNUNET_TIME_Timestamp refund_deadline,
+ struct GNUNET_TIME_Timestamp pay_deadline,
const char *amount)
{
struct OrdersState *ps;
@@ -704,8 +699,8 @@ TALER_TESTING_cmd_merchant_post_orders (
const char *merchant_url,
unsigned int http_status,
const char *order_id,
- struct GNUNET_TIME_Absolute refund_deadline,
- struct GNUNET_TIME_Absolute pay_deadline,
+ struct GNUNET_TIME_Timestamp refund_deadline,
+ struct GNUNET_TIME_Timestamp pay_deadline,
const char *amount)
{
struct OrdersState *ps;
@@ -740,8 +735,8 @@ TALER_TESTING_cmd_merchant_post_orders2 (
const char *merchant_url,
unsigned int http_status,
const char *order_id,
- struct GNUNET_TIME_Absolute refund_deadline,
- struct GNUNET_TIME_Absolute pay_deadline,
+ struct GNUNET_TIME_Timestamp refund_deadline,
+ struct GNUNET_TIME_Timestamp pay_deadline,
bool claim_token,
const char *amount,
const char *payment_target,