[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-merchant] branch master updated: fix #6430
From: |
gnunet |
Subject: |
[taler-merchant] branch master updated: fix #6430 |
Date: |
Thu, 16 Jul 2020 23:03:18 +0200 |
This is an automated email from the git hooks/post-receive script.
jonathan-buchanan pushed a commit to branch master
in repository merchant.
The following commit(s) were added to refs/heads/master by this push:
new 6c04f55 fix #6430
6c04f55 is described below
commit 6c04f551883da165fa90ae830ebd56642abca361
Author: Jonathan Buchanan <jonathan.russ.buchanan@gmail.com>
AuthorDate: Thu Jul 16 17:03:07 2020 -0400
fix #6430
---
.../taler-merchant-httpd_private-get-orders-ID.c | 11 ++++-
src/testing/test_merchant_api.c | 4 ++
src/testing/testing_api_cmd_post_orders.c | 56 ++++++++--------------
3 files changed, 33 insertions(+), 38 deletions(-)
diff --git a/src/backend/taler-merchant-httpd_private-get-orders-ID.c
b/src/backend/taler-merchant-httpd_private-get-orders-ID.c
index 87408fe..de5cb98 100644
--- a/src/backend/taler-merchant-httpd_private-get-orders-ID.c
+++ b/src/backend/taler-merchant-httpd_private-get-orders-ID.c
@@ -825,6 +825,14 @@ TMH_private_get_orders_ID (const struct TMH_RequestHandler
*rh,
hc->infix,
&gorc->contract_terms,
&gorc->order_serial);
+ if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
+ {
+ /* We don't have contract terms, but the order may still exist. */
+ qs = TMH_db->lookup_order (TMH_db->cls,
+ hc->instance->settings.id,
+ hc->infix,
+ &gorc->contract_terms);
+ }
if (0 > qs)
{
/* single, read-only SQL statements should never cause
@@ -906,7 +914,7 @@ TMH_private_get_orders_ID (const struct TMH_RequestHandler
*rh,
gorc->session_id,
&paid,
&wired);
- if (0 >= qs)
+ if (0 > qs)
{
/* single, read-only SQL statements should never cause
serialization problems, and the entry should exist as per above */
@@ -916,6 +924,7 @@ TMH_private_get_orders_ID (const struct TMH_RequestHandler
*rh,
TALER_EC_GET_ORDERS_DB_FETCH_PAYMENT_STATUS,
"DB error fetching payment status");
}
+ /* qs == 0: the order hasn't been claimed, but this is okay. */
if ((! paid) &&
(NULL != gorc->session_id))
{
diff --git a/src/testing/test_merchant_api.c b/src/testing/test_merchant_api.c
index 2d9e926..1a07424 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 8ae0bab..6195d99 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.
*
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-merchant] branch master updated: fix #6430,
gnunet <=