summaryrefslogtreecommitdiff
path: root/src/testing
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-04-26 12:04:24 +0200
committerChristian Grothoff <christian@grothoff.org>2020-04-26 12:04:24 +0200
commitdcbac9e63f37f9a5dd8b47a2cfc068d73068d4fc (patch)
tree12a4a549b33538f3b6e07a9f12a55ab68198903e /src/testing
parent6ca84e4121cf4bd1b8c66d2ef4bd58eeb7003ea3 (diff)
downloadmerchant-dcbac9e63f37f9a5dd8b47a2cfc068d73068d4fc.tar.gz
merchant-dcbac9e63f37f9a5dd8b47a2cfc068d73068d4fc.tar.bz2
merchant-dcbac9e63f37f9a5dd8b47a2cfc068d73068d4fc.zip
fix fTBFS
Diffstat (limited to 'src/testing')
-rw-r--r--src/testing/Makefile.am2
-rw-r--r--src/testing/test_merchant_api.c75
-rw-r--r--src/testing/test_merchant_api_twisted.c158
-rw-r--r--src/testing/testing_api_cmd_post_orders.c (renamed from src/testing/testing_api_cmd_proposal.c)140
-rw-r--r--src/testing/testing_api_cmd_proposal_lookup.c2
5 files changed, 187 insertions, 190 deletions
diff --git a/src/testing/Makefile.am b/src/testing/Makefile.am
index a0977e7a..d7d0256b 100644
--- a/src/testing/Makefile.am
+++ b/src/testing/Makefile.am
@@ -24,6 +24,7 @@ libtalermerchanttesting_la_SOURCES = \
testing_api_cmd_lock_product.c \
testing_api_cmd_post_instances.c \
testing_api_cmd_post_products.c \
+ testing_api_cmd_post_orders.c \
testing_api_cmd_patch_instance.c \
testing_api_cmd_patch_product.c \
\
@@ -33,7 +34,6 @@ libtalermerchanttesting_la_SOURCES = \
testing_api_cmd_pay_abort.c \
testing_api_cmd_pay_abort_refund.c \
testing_api_cmd_poll_payment.c \
- testing_api_cmd_proposal.c \
testing_api_cmd_proposal_lookup.c \
testing_api_cmd_refund_increase.c \
testing_api_cmd_refund_lookup.c \
diff --git a/src/testing/test_merchant_api.c b/src/testing/test_merchant_api.c
index 18380845..e2fbfc29 100644
--- a/src/testing/test_merchant_api.c
+++ b/src/testing/test_merchant_api.c
@@ -261,10 +261,10 @@ run (void *cls,
"create-reserve-1",
"EUR:0",
MHD_HTTP_OK),
- TALER_TESTING_cmd_proposal ("create-proposal-1",
- merchant_url,
- MHD_HTTP_OK,
- "{\"max_fee\":\"EUR:0.5\",\
+ TALER_TESTING_cmd_merchant_post_orders ("create-proposal-1",
+ merchant_url,
+ MHD_HTTP_OK,
+ "{\"max_fee\":\"EUR:0.5\",\
\"order_id\":\"1\",\
\"refund_deadline\": {\"t_ms\": 0},\
\"pay_deadline\": {\"t_ms\": \"never\" },\
@@ -336,10 +336,10 @@ run (void *cls,
};
struct TALER_TESTING_Command double_spending[] = {
- TALER_TESTING_cmd_proposal ("create-proposal-2",
- merchant_url,
- MHD_HTTP_OK,
- "{\"max_fee\":\"EUR:0.5\",\
+ TALER_TESTING_cmd_merchant_post_orders ("create-proposal-2",
+ merchant_url,
+ MHD_HTTP_OK,
+ "{\"max_fee\":\"EUR:0.5\",\
\"order_id\":\"2\",\
\"refund_deadline\": {\"t_ms\": 0},\
\"pay_deadline\": {\"t_ms\": \"never\" },\
@@ -348,11 +348,11 @@ run (void *cls,
\"fulfillment_url\": \"https://example.com/\",\
\"products\": [ {\"description\":\"ice cream\",\
\"value\":\"{EUR:5}\"} ] }"),
- TALER_TESTING_cmd_proposal_lookup ("fetch-proposal-2",
- merchant_url,
- MHD_HTTP_OK,
- "create-proposal-2",
- NULL),
+ TALER_TESTING_cmd_merchant_post_orders_lookup ("fetch-proposal-2",
+ merchant_url,
+ MHD_HTTP_OK,
+ "create-proposal-2",
+ NULL),
TALER_TESTING_cmd_pay ("deposit-double-2",
merchant_url,
MHD_HTTP_CONFLICT,
@@ -481,10 +481,10 @@ run (void *cls,
"create-reserve-1r",
"EUR:0",
MHD_HTTP_OK),
- TALER_TESTING_cmd_proposal ("create-proposal-1r",
- merchant_url,
- MHD_HTTP_OK,
- "{\"max_fee\":\"EUR:0.5\",\
+ TALER_TESTING_cmd_merchant_post_orders ("create-proposal-1r",
+ merchant_url,
+ MHD_HTTP_OK,
+ "{\"max_fee\":\"EUR:0.5\",\
\"order_id\":\"1r\",\
\"refund_deadline\": {\"t_ms\": 0},\
\"pay_deadline\": {\"t_ms\": \"never\" },\
@@ -533,10 +533,10 @@ run (void *cls,
MHD_HTTP_NOT_FOUND),
/* Test /refund on a contract that was never paid. */
- TALER_TESTING_cmd_proposal ("create-proposal-not-to-be-paid",
- merchant_url,
- MHD_HTTP_OK,
- "{\"max_fee\":\"EUR:0.5\",\
+ TALER_TESTING_cmd_merchant_post_orders ("create-proposal-not-to-be-paid",
+ merchant_url,
+ MHD_HTTP_OK,
+ "{\"max_fee\":\"EUR:0.5\",\
\"order_id\":\"1-unpaid\",\
\"refund_deadline\":{\"t_ms\":0},\
\"pay_deadline\":{\"t_ms\":99999999999},\
@@ -581,10 +581,11 @@ run (void *cls,
"create-reserve-unincreased-refund",
"EUR:5",
MHD_HTTP_OK),
- TALER_TESTING_cmd_proposal ("create-proposal-unincreased-refund",
- merchant_url,
- MHD_HTTP_OK,
- "{\"max_fee\":\"EUR:0.5\",\
+ TALER_TESTING_cmd_merchant_post_orders (
+ "create-proposal-unincreased-refund",
+ merchant_url,
+ MHD_HTTP_OK,
+ "{\"max_fee\":\"EUR:0.5\",\
\"order_id\":\"unincreased-proposal\",\
\"refund_deadline\":{\"t_ms\":0},\
\"pay_deadline\":{\"t_ms\":\"never\"},\
@@ -745,10 +746,10 @@ run (void *cls,
"fake-tip-authorization",
pickup_amounts_1,
TALER_EC_TIP_PICKUP_TIP_ID_UNKNOWN),
- TALER_TESTING_cmd_proposal ("create-proposal-tip-1",
- merchant_url_internal ("tip"),
- MHD_HTTP_OK,
- "{\"max_fee\":\"EUR:0.5\",\
+ TALER_TESTING_cmd_merchant_post_orders ("create-proposal-tip-1",
+ merchant_url_internal ("tip"),
+ MHD_HTTP_OK,
+ "{\"max_fee\":\"EUR:0.5\",\
\"order_id\":\"1-tip\", \
\"refund_deadline\":{\"t_ms\":0},\
\"pay_deadline\":{\"t_ms\":99999999999999},\
@@ -796,10 +797,10 @@ run (void *cls,
"create-reserve-10",
"EUR:0",
MHD_HTTP_OK),
- TALER_TESTING_cmd_proposal ("create-proposal-10",
- merchant_url,
- MHD_HTTP_OK,
- "{\"max_fee\":\"EUR:0.5\",\
+ TALER_TESTING_cmd_merchant_post_orders ("create-proposal-10",
+ merchant_url,
+ MHD_HTTP_OK,
+ "{\"max_fee\":\"EUR:0.5\",\
\"order_id\":\"10\",\
\"refund_deadline\":{\"t_ms\":0},\
\"pay_deadline\":{\"t_ms\":99999999999999},\
@@ -853,10 +854,10 @@ run (void *cls,
"create-reserve-11",
"EUR:0",
MHD_HTTP_OK),
- TALER_TESTING_cmd_proposal ("create-proposal-11",
- merchant_url,
- MHD_HTTP_OK,
- "{\"max_fee\":\"EUR:0.5\",\
+ TALER_TESTING_cmd_merchant_post_orders ("create-proposal-11",
+ merchant_url,
+ MHD_HTTP_OK,
+ "{\"max_fee\":\"EUR:0.5\",\
\"order_id\":\"11\",\
\"refund_deadline\":{\"t_ms\":0},\
\"pay_deadline\":{\"t_ms\":99999999999999},\
diff --git a/src/testing/test_merchant_api_twisted.c b/src/testing/test_merchant_api_twisted.c
index e49e2380..69fe881f 100644
--- a/src/testing/test_merchant_api_twisted.c
+++ b/src/testing/test_merchant_api_twisted.c
@@ -216,10 +216,10 @@ run (void *cls,
"5719-create-reserve",
"EUR:0",
MHD_HTTP_OK),
- TALER_TESTING_cmd_proposal ("5719-create-proposal",
- twister_merchant_url,
- MHD_HTTP_OK,
- "{\"max_fee\":\"EUR:0.5\",\
+ TALER_TESTING_cmd_merchant_post_orders ("5719-create-proposal",
+ twister_merchant_url,
+ MHD_HTTP_OK,
+ "{\"max_fee\":\"EUR:0.5\",\
\"order_id\":\"5719TRIGGER\",\
\"refund_deadline\":{\"t_ms\":0},\
\"pay_deadline\":{\"t_ms\":\"never\"},\
@@ -253,7 +253,7 @@ run (void *cls,
/**** Covering /check-payment ****/
struct TALER_TESTING_Command check_payment[] = {
- TALER_TESTING_cmd_proposal
+ TALER_TESTING_cmd_merchant_post_orders
("proposal-for-check-payment",
twister_merchant_url,
MHD_HTTP_OK,
@@ -305,23 +305,23 @@ run (void *cls,
*/
TALER_TESTING_cmd_malform_request ("malform-order",
PROXY_MERCHANT_CONFIG_FILE),
- TALER_TESTING_cmd_proposal ("create-proposal-0",
- twister_merchant_url,
- MHD_HTTP_BAD_REQUEST,
- /* giving a valid JSON to not make it fail before
- * data reaches the merchant. */
- "{\"not\": \"used\"}"),
+ TALER_TESTING_cmd_merchant_post_orders ("create-proposal-0",
+ twister_merchant_url,
+ MHD_HTTP_BAD_REQUEST,
+ /* giving a valid JSON to not make it fail before
+ * data reaches the merchant. */
+ "{\"not\": \"used\"}"),
TALER_TESTING_cmd_hack_response_code ("proposal-500",
PROXY_MERCHANT_CONFIG_FILE,
MHD_HTTP_INTERNAL_SERVER_ERROR),
- TALER_TESTING_cmd_proposal ("create-proposal-1",
- twister_merchant_url,
- /* This status code == 0 is gotten via a 500 Internal Server
- * Error handed to the library. */
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- /* giving a valid JSON to not make it fail before
- * data reaches the merchant. */
- "{\"not\": \"used\"}"),
+ TALER_TESTING_cmd_merchant_post_orders ("create-proposal-1",
+ twister_merchant_url,
+ /* This status code == 0 is gotten via a 500 Internal Server
+ * Error handed to the library. */
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ /* giving a valid JSON to not make it fail before
+ * data reaches the merchant. */
+ "{\"not\": \"used\"}"),
/**
* Cause the PUT /proposal callback to be called
@@ -331,10 +331,10 @@ run (void *cls,
TALER_TESTING_cmd_malform_response ("malform-proposal",
PROXY_MERCHANT_CONFIG_FILE),
- TALER_TESTING_cmd_proposal ("create-proposal-2",
- twister_merchant_url,
- 0,
- "{\"max_fee\":\"EUR:0.5\",\
+ TALER_TESTING_cmd_merchant_post_orders ("create-proposal-2",
+ twister_merchant_url,
+ 0,
+ "{\"max_fee\":\"EUR:0.5\",\
\"order_id\":\"1\",\
\"refund_deadline\":{\"t_ms\":0},\
\"pay_deadline\":{\"t_ms\":\"never\"},\
@@ -349,10 +349,10 @@ run (void *cls,
TALER_TESTING_cmd_delete_object ("remove-order-id",
PROXY_MERCHANT_CONFIG_FILE,
"order_id"),
- TALER_TESTING_cmd_proposal ("create-proposal-3",
- twister_merchant_url,
- 0,
- "{\"max_fee\":\"EUR:0.5\",\
+ TALER_TESTING_cmd_merchant_post_orders ("create-proposal-3",
+ twister_merchant_url,
+ 0,
+ "{\"max_fee\":\"EUR:0.5\",\
\"fulfillment_url\": \"https://example.com/\",\
\"order_id\":\"2\",\
\"refund_deadline\":{\"t_ms\":0},\
@@ -365,31 +365,31 @@ run (void *cls,
* Cause a 404 Not Found response code,
* due to a non existing merchant instance.
*/
- TALER_TESTING_cmd_proposal ("create-proposal-4",
- twister_merchant_url_instance_nonexistent,
- MHD_HTTP_NOT_FOUND,
- "{\"amount\":\"EUR:5\",\
+ TALER_TESTING_cmd_merchant_post_orders ("create-proposal-4",
+ twister_merchant_url_instance_nonexistent,
+ MHD_HTTP_NOT_FOUND,
+ "{\"amount\":\"EUR:5\",\
\"fulfillment_url\": \"https://example.com/\",\
\"summary\": \"merchant-lib testcase\"}"),
/* Cause a 404 Not Found from /proposal/lookup,
* due to a non existing order id being queried. */
- TALER_TESTING_cmd_proposal_lookup ("lookup-0",
- twister_merchant_url,
- MHD_HTTP_NOT_FOUND,
- NULL,
- "does-not-exist"),
+ TALER_TESTING_cmd_merchant_post_orders_lookup ("lookup-0",
+ twister_merchant_url,
+ MHD_HTTP_NOT_FOUND,
+ NULL,
+ "does-not-exist"),
/* Cause a unparsable response to be returned. */
TALER_TESTING_cmd_malform_response
("malform-proposal-lookup",
PROXY_MERCHANT_CONFIG_FILE),
/* To be short, we'll make a _error_ response to be
* unparsable. */
- TALER_TESTING_cmd_proposal_lookup ("lookup-1",
- twister_merchant_url,
- 0, // response code.
- NULL,
- "does-not-exist"),
+ TALER_TESTING_cmd_merchant_post_orders_lookup ("lookup-1",
+ twister_merchant_url,
+ 0, // response code.
+ NULL,
+ "does-not-exist"),
/* Generating a proposal-lookup response which doesn't pass
* validation, by removing a field that is expected by the
@@ -398,10 +398,10 @@ run (void *cls,
/* First step is to create a _valid_ proposal, so that
* we can lookup for it later. */
- TALER_TESTING_cmd_proposal ("create-proposal-5",
- twister_merchant_url,
- MHD_HTTP_OK,
- "{\"max_fee\":\"EUR:0.5\",\
+ TALER_TESTING_cmd_merchant_post_orders ("create-proposal-5",
+ twister_merchant_url,
+ MHD_HTTP_OK,
+ "{\"max_fee\":\"EUR:0.5\",\
\"order_id\":\"5\",\
\"refund_deadline\":{\"t_ms\":0},\
\"pay_deadline\":{\"t_ms\":\"never\"},\
@@ -417,12 +417,12 @@ run (void *cls,
"contract_terms"),
/* lookup! */
- TALER_TESTING_cmd_proposal_lookup ("lookup-5",
- twister_merchant_url,
- // expected response code.
- 0,
- "create-proposal-5",
- NULL),
+ TALER_TESTING_cmd_merchant_post_orders_lookup ("lookup-5",
+ twister_merchant_url,
+ // expected response code.
+ 0,
+ "create-proposal-5",
+ NULL),
TALER_TESTING_cmd_end ()
};
@@ -486,14 +486,14 @@ run (void *cls,
"create-reserve-unaggregation",
"EUR:5",
MHD_HTTP_OK),
- TALER_TESTING_cmd_proposal ("create-proposal-unaggregation",
- /* Need a fresh instance in order to associate this
- * proposal with a fresh h_wire; this way, this proposal
- * won't get hooked by the aggregator gathering same-h_wire'd
- * transactions. */
- twister_merchant_url_instance_tor,
- MHD_HTTP_OK,
- "{\"max_fee\":\"EUR:0.5\",\
+ TALER_TESTING_cmd_merchant_post_orders ("create-proposal-unaggregation",
+ /* Need a fresh instance in order to associate this
+ * proposal with a fresh h_wire; this way, this proposal
+ * won't get hooked by the aggregator gathering same-h_wire'd
+ * transactions. */
+ twister_merchant_url_instance_tor,
+ MHD_HTTP_OK,
+ "{\"max_fee\":\"EUR:0.5\",\
\"refund_deadline\":{\"t_ms\":2000},\
\"pay_deadline\":{\"t_ms\":2366841500000},\
\"wire_transfer_deadline\":{\"t_ms\":2366841600000},\
@@ -535,10 +535,10 @@ run (void *cls,
"create-reserve-5383",
"EUR:1",
MHD_HTTP_OK),
- TALER_TESTING_cmd_proposal ("create-proposal-5383",
- twister_merchant_url,
- MHD_HTTP_OK,
- "{\"max_fee\":\"EUR:0.5\",\
+ TALER_TESTING_cmd_merchant_post_orders ("create-proposal-5383",
+ twister_merchant_url,
+ MHD_HTTP_OK,
+ "{\"max_fee\":\"EUR:0.5\",\
\"order_id\":\"5383\",\
\"refund_deadline\":{\"t_ms\":0},\
\"pay_deadline\":{\"t_ms\":\"never\"},\
@@ -610,10 +610,10 @@ run (void *cls,
"create-reserve-1",
"EUR:0",
MHD_HTTP_OK),
- TALER_TESTING_cmd_proposal ("create-proposal-6",
- twister_merchant_url,
- MHD_HTTP_OK,
- "{\"max_fee\":\"EUR:0.5\",\
+ TALER_TESTING_cmd_merchant_post_orders ("create-proposal-6",
+ twister_merchant_url,
+ MHD_HTTP_OK,
+ "{\"max_fee\":\"EUR:0.5\",\
\"order_id\":\"11\",\
\"refund_deadline\":{\"t_ms\":0},\
\"pay_deadline\":{\"t_ms\":\"never\"},\
@@ -707,10 +707,10 @@ run (void *cls,
"create-reserve-abort-1",
"EUR:0",
MHD_HTTP_OK),
- TALER_TESTING_cmd_proposal ("create-proposal-abort-1",
- twister_merchant_url,
- MHD_HTTP_OK,
- "{\"max_fee\":\"EUR:0.5\",\
+ TALER_TESTING_cmd_merchant_post_orders ("create-proposal-abort-1",
+ twister_merchant_url,
+ MHD_HTTP_OK,
+ "{\"max_fee\":\"EUR:0.5\",\
\"order_id\":\"abort-one\",\
\"refund_deadline\":{\"t_ms\":0},\
\"pay_deadline\":{\"t_ms\":\"never\"},\
@@ -769,10 +769,10 @@ run (void *cls,
CMD_TRANSFER_TO_EXCHANGE ("create-reserve-double-spend",
"EUR:1.01"),
CMD_EXEC_WIREWATCH ("wirewatch-double-spend"),
- TALER_TESTING_cmd_proposal ("create-proposal-double-spend",
- twister_merchant_url,
- MHD_HTTP_OK,
- "{\"max_fee\":\"EUR:0.5\",\
+ TALER_TESTING_cmd_merchant_post_orders ("create-proposal-double-spend",
+ twister_merchant_url,
+ MHD_HTTP_OK,
+ "{\"max_fee\":\"EUR:0.5\",\
\"order_id\":\"DS-1\",\
\"refund_deadline\":{\"t_ms\":0},\
\"pay_deadline\":{\"t_ms\":\"never\"},\
@@ -780,10 +780,10 @@ run (void *cls,
\"amount\":\"EUR:1.0\",\
\"summary\": \"merchant-lib testcase\",\
\"products\": [ {\"description\": \"will succeed\"}] }"),
- TALER_TESTING_cmd_proposal ("create-proposal-double-spend-1",
- twister_merchant_url,
- MHD_HTTP_OK,
- "{\"max_fee\":\"EUR:0.5\",\
+ TALER_TESTING_cmd_merchant_post_orders ("create-proposal-double-spend-1",
+ twister_merchant_url,
+ MHD_HTTP_OK,
+ "{\"max_fee\":\"EUR:0.5\",\
\"order_id\":\"DS-2\",\
\"refund_deadline\":{\"t_ms\":0},\
\"pay_deadline\":{\"t_ms\":\"never\"},\
diff --git a/src/testing/testing_api_cmd_proposal.c b/src/testing/testing_api_cmd_post_orders.c
index fd53db2a..c7635e31 100644
--- a/src/testing/testing_api_cmd_proposal.c
+++ b/src/testing/testing_api_cmd_post_orders.c
@@ -18,8 +18,8 @@
*/
/**
- * @file exchange/testing_api_cmd_proposal.c
- * @brief command to run /proposal
+ * @file testing_api_cmd_post_orders.c
+ * @brief command to run POST /orders
* @author Marcello Stanisci
*/
@@ -30,9 +30,9 @@
#include "taler_merchant_testing_lib.h"
/**
- * State for a "proposal" CMD.
+ * State for a "POST /orders" CMD.
*/
-struct ProposalState
+struct OrdersState
{
/**
@@ -61,14 +61,14 @@ struct ProposalState
struct GNUNET_HashCode h_contract_terms;
/**
- * The /proposal operation handle.
+ * The /orders operation handle.
*/
- struct TALER_MERCHANT_ProposalOperation *po;
+ struct TALER_MERCHANT_PostOrdersOperation *po;
/**
- * The (initial) /proposal/lookup operation handle.
- * The logic is such that after a proposal creation,
- * it soon makes a proposal lookup in order to check
+ * The (initial) GET /orders/$ID operation handle.
+ * The logic is such that after a orders creation,
+ * it soon makes a orders lookup in order to check
* if the merchant backend is actually aware.
*/
struct TALER_MERCHANT_ProposalLookupOperation *plo;
@@ -89,7 +89,7 @@ struct ProposalState
struct TALER_TESTING_Interpreter *is;
/**
- * Merchant signature over the proposal.
+ * Merchant signature over the orders.
*/
struct TALER_MerchantSignatureP merchant_sig;
@@ -110,15 +110,16 @@ struct ProposalState
* @return #GNUNET_OK on success
*/
static int
-proposal_traits (void *cls,
- const void **ret,
- const char *trait,
- unsigned int index)
+orders_traits (void *cls,
+ const void **ret,
+ const char *trait,
+ unsigned int index)
{
- struct ProposalState *ps = cls;
-#define MAKE_TRAIT_NONCE(ptr) \
- TALER_TESTING_make_trait_merchant_pub (1, (struct \
- TALER_MerchantPublicKeyP *) (ptr))
+ struct OrdersState *ps = cls;
+ // FIXME: wtf is this?
+#define MAKE_TRAIT_NONCE(ptr) \
+ TALER_TESTING_make_trait_merchant_pub ( \
+ 1, (struct TALER_MerchantPublicKeyP *) (ptr))
struct TALER_TESTING_Trait traits[] = {
TALER_TESTING_make_trait_order_id (0, ps->order_id),
TALER_TESTING_make_trait_contract_terms (0, ps->contract_terms),
@@ -137,8 +138,8 @@ proposal_traits (void *cls,
/**
- * Used to fill the "proposal" CMD state with backend-provided
- * values. Also double-checks that the proposal was correctly
+ * Used to fill the "orders" CMD state with backend-provided
+ * values. Also double-checks that the orders was correctly
* created.
*
* @param cls closure
@@ -147,13 +148,13 @@ proposal_traits (void *cls,
* @param hash hash over the contract
*/
static void
-proposal_lookup_initial_cb (void *cls,
- const struct TALER_MERCHANT_HttpResponse *hr,
- const json_t *contract_terms,
- const struct TALER_MerchantSignatureP *sig,
- const struct GNUNET_HashCode *hash)
+orders_lookup_initial_cb (void *cls,
+ const struct TALER_MERCHANT_HttpResponse *hr,
+ const json_t *contract_terms,
+ const struct TALER_MerchantSignatureP *sig,
+ const struct GNUNET_HashCode *hash)
{
- struct ProposalState *ps = cls;
+ struct OrdersState *ps = cls;
struct TALER_MerchantPublicKeyP merchant_pub;
const char *error_name;
unsigned int error_line;
@@ -197,20 +198,20 @@ proposal_lookup_initial_cb (void *cls,
/**
* Callback that processes the response following a
- * proposal's put. NOTE: no contract terms are included
- * here; they need to be taken via the "proposal lookup"
+ * POST /orders. NOTE: no contract terms are included
+ * here; they need to be taken via the "orders lookup"
* method.
*
* @param cls closure.
* @param hr HTTP response
- * @param order_id order id of the proposal.
+ * @param order_id order id of the orders.
*/
static void
-proposal_cb (void *cls,
- const struct TALER_MERCHANT_HttpResponse *hr,
- const char *order_id)
+order_cb (void *cls,
+ const struct TALER_MERCHANT_HttpResponse *hr,
+ const char *order_id)
{
- struct ProposalState *ps = cls;
+ struct OrdersState *ps = cls;
ps->po = NULL;
if (ps->http_status != hr->http_status)
@@ -221,14 +222,12 @@ proposal_cb (void *cls,
ps->http_status);
TALER_TESTING_FAIL (ps->is);
}
-
if (0 == ps->http_status)
{
- TALER_LOG_DEBUG ("/proposal, expected 0 status code\n");
+ TALER_LOG_DEBUG ("/orders, expected 0 status code\n");
TALER_TESTING_interpreter_next (ps->is);
return;
}
-
switch (hr->http_status)
{
case MHD_HTTP_OK:
@@ -239,7 +238,7 @@ proposal_cb (void *cls,
char *s = json_dumps (hr->reply,
JSON_COMPACT);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Unexpected status code from /proposal: %u (%d) at %s; JSON: %s\n",
+ "Unexpected status code from /orders: %u (%d) at %s; JSON: %s\n",
hr->http_status,
hr->ec,
TALER_TESTING_interpreter_get_current_label (ps->is),
@@ -259,25 +258,25 @@ proposal_cb (void *cls,
ps->merchant_url,
ps->order_id,
&ps->nonce,
- &proposal_lookup_initial_cb,
+ &orders_lookup_initial_cb,
ps)))
TALER_TESTING_FAIL (ps->is);
}
/**
- * Run a "proposal" CMD.
+ * Run a "orders" CMD.
*
* @param cls closure.
* @param cmd command currently being run.
* @param is interpreter state.
*/
static void
-proposal_run (void *cls,
- const struct TALER_TESTING_Command *cmd,
- struct TALER_TESTING_Interpreter *is)
+orders_run (void *cls,
+ const struct TALER_TESTING_Command *cmd,
+ struct TALER_TESTING_Interpreter *is)
{
- struct ProposalState *ps = cls;
+ struct OrdersState *ps = cls;
json_t *order;
json_error_t error;
@@ -310,41 +309,38 @@ proposal_run (void *cls,
json_string (order_id));
GNUNET_free (order_id);
}
-
- GNUNET_CRYPTO_random_block
- (GNUNET_CRYPTO_QUALITY_WEAK,
- &ps->nonce,
- sizeof (struct GNUNET_CRYPTO_EddsaPublicKey));
-
- ps->po = TALER_MERCHANT_order_put (is->ctx,
- ps->merchant_url,
- order,
- &proposal_cb,
- ps);
+ GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
+ &ps->nonce,
+ sizeof (struct GNUNET_CRYPTO_EddsaPublicKey));
+ ps->po = TALER_MERCHANT_orders_post (is->ctx,
+ ps->merchant_url,
+ order,
+ &order_cb,
+ ps);
json_decref (order);
GNUNET_assert (NULL != ps->po);
}
/**
- * Free the state of a "proposal" CMD, and possibly
+ * Free the state of a "orders" CMD, and possibly
* cancel it if it did not complete.
*
* @param cls closure.
* @param cmd command being freed.
*/
static void
-proposal_cleanup (void *cls,
- const struct TALER_TESTING_Command *cmd)
+orders_cleanup (void *cls,
+ const struct TALER_TESTING_Command *cmd)
{
- struct ProposalState *ps = cls;
+ struct OrdersState *ps = cls;
if (NULL != ps->po)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Command '%s' did not complete (proposal put)\n",
+ "Command '%s' did not complete (orders put)\n",
cmd->label);
- TALER_MERCHANT_proposal_cancel (ps->po);
+ TALER_MERCHANT_orders_post_cancel (ps->po);
ps->po = NULL;
}
@@ -352,7 +348,7 @@ proposal_cleanup (void *cls,
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Command '%s' did not complete"
- " (proposal lookup)\n",
+ " (orders lookup)\n",
cmd->label);
TALER_MERCHANT_proposal_lookup_cancel (ps->plo);
ps->plo = NULL;
@@ -365,25 +361,25 @@ proposal_cleanup (void *cls,
/**
- * Make the "proposal" command.
+ * Make the "orders" command.
*
* @param label command label
* @param merchant_url base URL of the merchant serving
- * the proposal request.
+ * the orders request.
* @param http_status expected HTTP status.
* @param order the order to PUT to the merchant.
*
* @return the command
*/
struct TALER_TESTING_Command
-TALER_TESTING_cmd_proposal (const char *label,
- const char *merchant_url,
- unsigned int http_status,
- const char *order)
+TALER_TESTING_cmd_merchant_post_orders (const char *label,
+ const char *merchant_url,
+ unsigned int http_status,
+ const char *order)
{
- struct ProposalState *ps;
+ struct OrdersState *ps;
- ps = GNUNET_new (struct ProposalState);
+ ps = GNUNET_new (struct OrdersState);
ps->order = order;
ps->http_status = http_status;
ps->merchant_url = merchant_url;
@@ -391,9 +387,9 @@ TALER_TESTING_cmd_proposal (const char *label,
struct TALER_TESTING_Command cmd = {
.cls = ps,
.label = label,
- .run = &proposal_run,
- .cleanup = &proposal_cleanup,
- .traits = &proposal_traits
+ .run = &orders_run,
+ .cleanup = &orders_cleanup,
+ .traits = &orders_traits
};
return cmd;
diff --git a/src/testing/testing_api_cmd_proposal_lookup.c b/src/testing/testing_api_cmd_proposal_lookup.c
index 1ea0c0cb..78f2fb8b 100644
--- a/src/testing/testing_api_cmd_proposal_lookup.c
+++ b/src/testing/testing_api_cmd_proposal_lookup.c
@@ -283,7 +283,7 @@ proposal_lookup_traits (void *cls,
* @return the command.
*/
struct TALER_TESTING_Command
-TALER_TESTING_cmd_proposal_lookup
+TALER_TESTING_cmd_merchant_post_orders_lookup
(const char *label,
const char *merchant_url,
unsigned int http_status,