summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcello Stanisci <marcello.stanisci@inria.fr>2016-12-12 10:19:42 +0100
committerMarcello Stanisci <marcello.stanisci@inria.fr>2016-12-12 10:19:42 +0100
commit06cbd85ce434285cf6f22987ea0aa6885ac2afab (patch)
treee7a8aaa9aa1538c6593533c7185b890b6ecae61a
parent5389eb481bd4799fa61a043b336e26a9fbe6742c (diff)
parentfafa39d35b8d83aed23371f0966a996e322f7c71 (diff)
downloadmerchant-06cbd85ce434285cf6f22987ea0aa6885ac2afab.tar.gz
merchant-06cbd85ce434285cf6f22987ea0aa6885ac2afab.tar.bz2
merchant-06cbd85ce434285cf6f22987ea0aa6885ac2afab.zip
Merge branch '4795' of taler.net:merchant into 4795
-rw-r--r--src/backenddb/plugin_merchantdb_postgres.c1
-rw-r--r--src/lib/test_merchant_api.c42
2 files changed, 37 insertions, 6 deletions
diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c
index 6a2d891b..751c3658 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -137,6 +137,7 @@ postgres_drop_tables (void *cls)
PG_EXEC_INDEX (pg, "DROP TABLE merchant_deposits;");
PG_EXEC_INDEX (pg, "DROP TABLE merchant_transactions;");
PG_EXEC_INDEX (pg, "DROP TABLE merchant_proofs;");
+ PG_EXEC_INDEX (pg, "DROP TABLE merchant_contract_maps;");
return GNUNET_OK;
}
diff --git a/src/lib/test_merchant_api.c b/src/lib/test_merchant_api.c
index 0603dddf..e509f350 100644
--- a/src/lib/test_merchant_api.c
+++ b/src/lib/test_merchant_api.c
@@ -1297,6 +1297,26 @@ track_transfer_cb (void *cls,
next_command (is);
}
+/**
+ * Callback for /map/in issued at backend. Just check
+ * whether response code is as expected.
+ *
+ * @param cls closure
+ * @param http_status HTTP status code we got
+ */
+static void
+map_in_cb (void *cls,
+ unsigned int http_status)
+{
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Cb for /map/in\n");
+ struct InterpreterState *is = cls;
+ struct Command *cmd = &is->commands[is->ip];
+
+ cmd->details.map_in.mio = NULL;
+ GNUNET_assert (cmd->expected_response_code == http_status);
+ next_command (is);
+}
/**
* Function called with detailed wire transfer data.
@@ -1501,11 +1521,10 @@ interpreter_run (void *cls)
is);
return;
case OC_MAP_IN:
- /*TBD*/
+ {
struct GNUNET_HashCode h_proposal;
json_error_t error;
- json_t *proposal;
-
+ json_t *proposal;
// get contract (proposal)
// hash it
// call lib
@@ -1517,7 +1536,7 @@ interpreter_run (void *cls)
* WARNING, make sure what is hashed here, is exactly the same
* contract hashed then by /map/in handler.
*/
- proposal = json_loads (cmd->details.map_in.proposal,
+ proposal = json_loads (ref->details.contract.proposal,
JSON_REJECT_DUPLICATES,
&error);
@@ -1528,9 +1547,12 @@ interpreter_run (void *cls)
TALER_MERCHANT_map_in (ctx,
MERCHANT_URI,
proposal,
- /*CB - TBD*/,
- is)); /* Needs 'is' to "move on" the cmd*/
+ &h_proposal,
+ map_in_cb,
+ is));
+ }
+ return;
case OC_ADMIN_ADD_INCOMING:
if (NULL !=
cmd->details.admin_add_incoming.reserve_reference)
@@ -2279,6 +2301,14 @@ run (void *cls)
.details.pay.amount_with_fee = "EUR:5",
.details.pay.amount_without_fee = "EUR:4.99" },
+ /* Store contract-1 */
+ {
+ .oc = OC_MAP_IN,
+ .label = "store-contract-1",
+ .expected_response_code = MHD_HTTP_OK,
+ .details.map_in.contract_reference = "create-contract-1",
+ },
+
/* Create another contract */
{ .oc = OC_CONTRACT,
.label = "create-contract-2",