aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcello Stanisci <stanisci.m@gmail.com>2018-03-16 14:47:42 +0100
committerMarcello Stanisci <stanisci.m@gmail.com>2018-03-17 01:37:12 +0100
commit8f05359b58b7ec1f9772f48d594b526ec9765f61 (patch)
treedb178f8254b745ec7b4123fe4c675034b8a08379
parent66a55b5e35a174912c2a8c0790acafbfd33054d0 (diff)
trigger 404 @ /proposal
-rw-r--r--src/backend/taler-merchant-httpd_proposal.c10
-rw-r--r--src/lib/test_merchant_api_twisted.c15
-rw-r--r--src/lib/testing_api_cmd_proposal.c2
3 files changed, 21 insertions, 6 deletions
diff --git a/src/backend/taler-merchant-httpd_proposal.c b/src/backend/taler-merchant-httpd_proposal.c
index 4d0298b9..1cdea4a6 100644
--- a/src/backend/taler-merchant-httpd_proposal.c
+++ b/src/backend/taler-merchant-httpd_proposal.c
@@ -281,6 +281,7 @@ proposal_put (struct MHD_Connection *connection,
if (NULL == instance)
{
+ TALER_LOG_DEBUG ("Giving 'default' instance\n");
instance = "default";
}
@@ -296,9 +297,10 @@ proposal_put (struct MHD_Connection *connection,
if (NULL == mi)
{
- return TMH_RESPONSE_reply_internal_error (connection,
- TALER_EC_PROPOSAL_ORDER_PARSE_ERROR,
- "merchant instance not found");
+ TALER_LOG_WARNING ("Does 'default' instance exist?\n");
+ return TMH_RESPONSE_reply_not_found (connection,
+ TALER_EC_CONTRACT_INSTANCE_UNKNOWN,
+ "merchant instance (order:instance) not found");
}
if (NULL == json_object_get (order, "merchant"))
{
@@ -385,7 +387,7 @@ proposal_put (struct MHD_Connection *connection,
GNUNET_JSON_parse_free (spec);
return TMH_RESPONSE_reply_not_found (connection,
TALER_EC_CONTRACT_INSTANCE_UNKNOWN,
- "Unknown instance given");
+ "Unknown instance (order:merchant:instance) given");
}
/* add fields to the contract that the backend should provide */
json_object_set (order,
diff --git a/src/lib/test_merchant_api_twisted.c b/src/lib/test_merchant_api_twisted.c
index 8c02cb44..3ee5042c 100644
--- a/src/lib/test_merchant_api_twisted.c
+++ b/src/lib/test_merchant_api_twisted.c
@@ -261,7 +261,7 @@ run (void *cls,
"order_id"),
TALER_TESTING_cmd_proposal
- ("create-proposal-1",
+ ("create-proposal-3",
twister_merchant_url,
is->ctx,
0,
@@ -281,6 +281,19 @@ run (void *cls,
\"value\":\"{EUR:5}\"} ] }",
NULL),
+
+ /**
+ * Cause a 404 Not Found response code.
+ */
+ TALER_TESTING_cmd_proposal
+ ("create-proposal-4",
+ twister_merchant_url,
+ is->ctx,
+ MHD_HTTP_NOT_FOUND,
+ "{\"amount\":\"EUR:5\",\
+ \"summary\": \"merchant-lib testcase\"}",
+ "non-existent-instance"),
+
/**** Covering /history lib ****/
/**
diff --git a/src/lib/testing_api_cmd_proposal.c b/src/lib/testing_api_cmd_proposal.c
index e066c4c3..410f44ea 100644
--- a/src/lib/testing_api_cmd_proposal.c
+++ b/src/lib/testing_api_cmd_proposal.c
@@ -458,6 +458,7 @@ TALER_TESTING_cmd_proposal (const char *label,
ps->http_status = http_status;
ps->ctx = ctx;
ps->merchant_url = merchant_url;
+ ps->instance = instance;
cmd.cls = ps;
cmd.label = label;
@@ -541,7 +542,6 @@ proposal_lookup_run (void *cls,
}
-
/**
* Make a "proposal lookup" command.
*