summaryrefslogtreecommitdiff
path: root/src/testing
diff options
context:
space:
mode:
authorJonathan Buchanan <jonathan.russ.buchanan@gmail.com>2020-07-16 17:03:07 -0400
committerJonathan Buchanan <jonathan.russ.buchanan@gmail.com>2020-07-16 17:03:07 -0400
commit6c04f551883da165fa90ae830ebd56642abca361 (patch)
tree694e835ff494786fa778a6534d70671ce1309f3c /src/testing
parent90adbb36f71224fe4ae8ebace1bc091c4651734f (diff)
downloadmerchant-6c04f551883da165fa90ae830ebd56642abca361.tar.gz
merchant-6c04f551883da165fa90ae830ebd56642abca361.tar.bz2
merchant-6c04f551883da165fa90ae830ebd56642abca361.zip
fix #6430
Diffstat (limited to 'src/testing')
-rw-r--r--src/testing/test_merchant_api.c4
-rw-r--r--src/testing/testing_api_cmd_post_orders.c56
2 files changed, 23 insertions, 37 deletions
diff --git a/src/testing/test_merchant_api.c b/src/testing/test_merchant_api.c
index 2d9e9266..1a074240 100644
--- a/src/testing/test_merchant_api.c
+++ b/src/testing/test_merchant_api.c
@@ -189,6 +189,10 @@ run (void *cls,
false,
false,
MHD_HTTP_OK),
+ TALER_TESTING_cmd_merchant_purge_instance ("purge-default",
+ merchant_url,
+ "default",
+ MHD_HTTP_NO_CONTENT),
TALER_TESTING_cmd_end ()
};
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
};
-
/**
* Offer internal data to other commands.
*
@@ -538,46 +537,29 @@ make_order_json (const char *order_id,
const char *amount,
char **order)
{
- struct GNUNET_TIME_Absolute refund_deadline_round = refund_deadline;
- char rd_str[64];
-
- struct GNUNET_TIME_Absolute pay_deadline_round = pay_deadline;
- char pd_str[64];
+ struct GNUNET_TIME_Absolute refund = refund_deadline;
+ struct GNUNET_TIME_Absolute pay = pay_deadline;
- GNUNET_TIME_round_abs (&refund_deadline_round);
- GNUNET_TIME_round_abs (&pay_deadline_round);
+ json_t *contract_terms;
- GNUNET_snprintf (rd_str,
- 64,
- "{\"t_ms\":%llu}",
- refund_deadline_round.abs_value_us / 1000LL);
- if (GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us == pay_deadline.abs_value_us)
- {
- GNUNET_snprintf (pd_str,
- 64,
- "{\"t_ms\":\"never\"}");
- }
- else
- {
- GNUNET_snprintf (pd_str,
- 64,
- "{\"t_ms\":%llu}",
- pay_deadline_round.abs_value_us / 1000LL);
- }
- GNUNET_asprintf (order,
- "{\"max_fee\":\"EUR:0.5\",\
- \"order_id\":\"%s\",\
- \"refund_deadline\":%s,\
- \"pay_deadline\":%s,\
- \"amount\":\"%s\",\
- \"summary\":\"merchant-lib testcase\",\
- \"fulfillment_url\":\"https://example.com/\"}",
- order_id,
- rd_str,
- pd_str,
- amount);
+ GNUNET_TIME_round_abs (&refund);
+ GNUNET_TIME_round_abs (&pay);
+
+ contract_terms = json_pack (
+ "{s:s, s:s, s:s, s:s, s:o, s:o}",
+ "summary", "merchant-lib testcase",
+ "order_id", order_id,
+ "amount", amount,
+ "fulfillment_url", "https://example.com",
+ "refund_deadline", GNUNET_JSON_from_time_abs (refund_deadline),
+ "pay_deadline", GNUNET_JSON_from_time_abs (pay_deadline)
+ );
+
+ *order = json_dumps (contract_terms, 0);
+ json_decref (contract_terms);
}
+
/**
* Make the "proposal" command AVOIDING claiming the order.
*