summaryrefslogtreecommitdiff
path: root/src/backenddb
diff options
context:
space:
mode:
authorMarcello Stanisci <marcello.stanisci@inria.fr>2017-02-10 17:33:04 +0100
committerMarcello Stanisci <marcello.stanisci@inria.fr>2017-02-10 17:33:04 +0100
commit3e4ae933093b6161aa4f7c6ec21f3210f4f23945 (patch)
tree4d2070cd704a74e3dd3026e5491cd4793c289cfa /src/backenddb
parent60c5ee76aebfda9c378a4d9fe81544ba0ec5b214 (diff)
downloadmerchant-3e4ae933093b6161aa4f7c6ec21f3210f4f23945.tar.gz
merchant-3e4ae933093b6161aa4f7c6ec21f3210f4f23945.tar.bz2
merchant-3e4ae933093b6161aa4f7c6ec21f3210f4f23945.zip
Fix track API tests.
Diffstat (limited to 'src/backenddb')
-rw-r--r--src/backenddb/plugin_merchantdb_postgres.c21
-rw-r--r--src/backenddb/test_merchantdb.c4
2 files changed, 17 insertions, 8 deletions
diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c
index 6a8bb46b..1c479029 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -165,8 +165,9 @@ postgres_initialize (void *cls)
PG_EXEC (pg,
"CREATE TABLE IF NOT EXISTS merchant_proposal_data ("
"h_order_id BYTEA NOT NULL"
+ ",merchant_pub BYTEA NOT NULL"
",proposal_data BYTEA NOT NULL"
- ",PRIMARY KEY (h_order_id)"
+ ",PRIMARY KEY (h_order_id, merchant_pub)"
");");
PG_EXEC (pg,
@@ -279,17 +280,19 @@ postgres_initialize (void *cls)
"insert_proposal_data",
"INSERT INTO merchant_proposal_data"
"(h_order_id"
+ ",merchant_pub"
",proposal_data)"
" VALUES "
- "($1, $2)",
- 2);
+ "($1, $2, $3)",
+ 3);
PG_PREPARE (pg,
"find_proposal_data",
"SELECT proposal_data FROM merchant_proposal_data"
" WHERE"
- " h_order_id=$1",
- 1);
+ " h_order_id=$1"
+ " AND merchant_pub=$2",
+ 2);
PG_PREPARE (pg,
"find_transactions_by_date",
@@ -406,7 +409,8 @@ postgres_initialize (void *cls)
static int
postgres_find_proposal_data (void *cls,
json_t **proposal_data,
- struct GNUNET_HashCode *h_transaction_id)
+ const struct GNUNET_HashCode *h_transaction_id,
+ const struct TALER_MerchantPublicKeyP *merchant_pub)
{
struct PostgresClosure *pg = cls;
PGresult *result;
@@ -414,6 +418,7 @@ postgres_find_proposal_data (void *cls,
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (h_transaction_id),
+ GNUNET_PQ_query_param_auto_from_type (merchant_pub),
GNUNET_PQ_query_param_end
};
@@ -461,7 +466,8 @@ postgres_find_proposal_data (void *cls,
*/
static int
postgres_insert_proposal_data (void *cls,
- struct GNUNET_HashCode *h_transaction_id,
+ const struct GNUNET_HashCode *h_transaction_id,
+ const struct TALER_MerchantPublicKeyP *merchant_pub,
const json_t *proposal_data)
{
struct PostgresClosure *pg = cls;
@@ -470,6 +476,7 @@ postgres_insert_proposal_data (void *cls,
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (h_transaction_id),
+ GNUNET_PQ_query_param_auto_from_type (merchant_pub),
TALER_PQ_query_param_json (proposal_data),
GNUNET_PQ_query_param_end
};
diff --git a/src/backenddb/test_merchantdb.c b/src/backenddb/test_merchantdb.c
index b74549d4..c8366f34 100644
--- a/src/backenddb/test_merchantdb.c
+++ b/src/backenddb/test_merchantdb.c
@@ -372,6 +372,7 @@ run (void *cls)
FAILIF (GNUNET_OK !=
plugin->insert_proposal_data (plugin->cls,
&h_transaction_id,
+ &merchant_pub,
proposal_data));
json_t *out;
@@ -379,7 +380,8 @@ run (void *cls)
FAILIF (GNUNET_OK !=
plugin->find_proposal_data (plugin->cls,
&out, // plain data
- &h_transaction_id));
+ &h_transaction_id,
+ &merchant_pub));
FAILIF (GNUNET_OK !=
plugin->store_transaction (plugin->cls,