aboutsummaryrefslogtreecommitdiff
path: root/src/testing/testing_api_cmd_post_orders.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing/testing_api_cmd_post_orders.c')
-rw-r--r--src/testing/testing_api_cmd_post_orders.c56
1 files changed, 19 insertions, 37 deletions
diff --git a/src/testing/testing_api_cmd_post_orders.c b/src/testing/testing_api_cmd_post_orders.c
index 8ae0babc..6195d99c 100644
--- a/src/testing/testing_api_cmd_post_orders.c
+++ b/src/testing/testing_api_cmd_post_orders.c
@@ -119,7 +119,6 @@ struct OrdersState
119}; 119};
120 120
121 121
122
123/** 122/**
124 * Offer internal data to other commands. 123 * Offer internal data to other commands.
125 * 124 *
@@ -538,46 +537,29 @@ make_order_json (const char *order_id,
538 const char *amount, 537 const char *amount,
539 char **order) 538 char **order)
540{ 539{
541 struct GNUNET_TIME_Absolute refund_deadline_round = refund_deadline; 540 struct GNUNET_TIME_Absolute refund = refund_deadline;
542 char rd_str[64]; 541 struct GNUNET_TIME_Absolute pay = pay_deadline;
543
544 struct GNUNET_TIME_Absolute pay_deadline_round = pay_deadline;
545 char pd_str[64];
546 542
547 GNUNET_TIME_round_abs (&refund_deadline_round); 543 json_t *contract_terms;
548 GNUNET_TIME_round_abs (&pay_deadline_round);
549 544
550 GNUNET_snprintf (rd_str, 545 GNUNET_TIME_round_abs (&refund);
551 64, 546 GNUNET_TIME_round_abs (&pay);
552 "{\"t_ms\":%llu}", 547
553 refund_deadline_round.abs_value_us / 1000LL); 548 contract_terms = json_pack (
554 if (GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us == pay_deadline.abs_value_us) 549 "{s:s, s:s, s:s, s:s, s:o, s:o}",
555 { 550 "summary", "merchant-lib testcase",
556 GNUNET_snprintf (pd_str, 551 "order_id", order_id,
557 64, 552 "amount", amount,
558 "{\"t_ms\":\"never\"}"); 553 "fulfillment_url", "https://example.com",
559 } 554 "refund_deadline", GNUNET_JSON_from_time_abs (refund_deadline),
560 else 555 "pay_deadline", GNUNET_JSON_from_time_abs (pay_deadline)
561 { 556 );
562 GNUNET_snprintf (pd_str, 557
563 64, 558 *order = json_dumps (contract_terms, 0);
564 "{\"t_ms\":%llu}", 559 json_decref (contract_terms);
565 pay_deadline_round.abs_value_us / 1000LL);
566 }
567 GNUNET_asprintf (order,
568 "{\"max_fee\":\"EUR:0.5\",\
569 \"order_id\":\"%s\",\
570 \"refund_deadline\":%s,\
571 \"pay_deadline\":%s,\
572 \"amount\":\"%s\",\
573 \"summary\":\"merchant-lib testcase\",\
574 \"fulfillment_url\":\"https://example.com/\"}",
575 order_id,
576 rd_str,
577 pd_str,
578 amount);
579} 560}
580 561
562
581/** 563/**
582 * Make the "proposal" command AVOIDING claiming the order. 564 * Make the "proposal" command AVOIDING claiming the order.
583 * 565 *