[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-merchant] branch master updated: making testcase pas
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-merchant] branch master updated: making testcase pass to new "flagged as paid" policy |
Date: |
Sun, 16 Jul 2017 12:39:06 +0200 |
This is an automated email from the git hooks/post-receive script.
marcello pushed a commit to branch master
in repository merchant.
The following commit(s) were added to refs/heads/master by this push:
new 73e2e5a making testcase pass to new "flagged as paid" policy
73e2e5a is described below
commit 73e2e5a73a1a096c3e66649ffd92261320178614
Author: Marcello Stanisci <address@hidden>
AuthorDate: Sun Jul 16 12:38:40 2017 +0200
making testcase pass to new "flagged as paid" policy
---
src/backenddb/plugin_merchantdb_postgres.c | 34 +++++++++++++++++++++++++-----
src/backenddb/test_merchantdb.c | 14 +++++++++++-
2 files changed, 42 insertions(+), 6 deletions(-)
diff --git a/src/backenddb/plugin_merchantdb_postgres.c
b/src/backenddb/plugin_merchantdb_postgres.c
index 1728605..e060059 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -288,6 +288,15 @@ postgres_initialize (void *cls)
" FROM merchant_refunds"
" WHERE coin_pub=$1",
1),
+ GNUNET_PQ_make_prepare ("find_contract_terms_history",
+ "SELECT"
+ " contract_terms"
+ " FROM merchant_contract_terms"
+ " WHERE"
+ " order_id=$1"
+ " AND merchant_pub=$2"
+ " AND paid=$3",
+ 3),
GNUNET_PQ_make_prepare ("find_contract_terms",
"SELECT"
" contract_terms"
@@ -296,6 +305,7 @@ postgres_initialize (void *cls)
" order_id=$1"
" AND merchant_pub=$2",
2),
+
GNUNET_PQ_make_prepare ("find_contract_terms_by_date",
"SELECT"
" contract_terms"
@@ -305,9 +315,10 @@ postgres_initialize (void *cls)
" WHERE"
" timestamp<$1"
" AND merchant_pub=$2"
+ " AND paid=$4"
" ORDER BY row_id DESC, timestamp DESC"
" LIMIT $3",
- 3),
+ 4),
GNUNET_PQ_make_prepare ("find_refunds_from_contract_terms_hash",
"SELECT"
" coin_pub"
@@ -333,9 +344,10 @@ postgres_initialize (void *cls)
" timestamp<$1"
" AND merchant_pub=$2"
" AND row_id<$3"
+ " AND paid=$5"
" ORDER BY row_id DESC, timestamp DESC"
" LIMIT $4",
- 4),
+ 5),
GNUNET_PQ_make_prepare ("find_contract_terms_by_date_and_range_future",
"SELECT"
" contract_terms"
@@ -346,9 +358,10 @@ postgres_initialize (void *cls)
" timestamp>$1"
" AND merchant_pub=$2"
" AND row_id>$3"
+ " AND paid=$5"
" ORDER BY row_id DESC, timestamp DESC"
" LIMIT $4",
- 4),
+ 5),
GNUNET_PQ_make_prepare ("find_transaction",
"SELECT"
" exchange_uri"
@@ -579,7 +592,8 @@ postgres_find_contract_terms_from_hash (void *cls,
/**
- * Retrieve proposal data given its order id.
+ * Retrieve proposal data given its order id. Ignores if the
+ * proposal has been paid or not.
*
* @param cls closure
* @param[out] contract_terms where to store the retrieved contract terms
@@ -593,6 +607,7 @@ postgres_find_contract_terms (void *cls,
const struct TALER_MerchantPublicKeyP
*merchant_pub)
{
struct PostgresClosure *pg = cls;
+
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_string (order_id),
GNUNET_PQ_query_param_auto_from_type (merchant_pub),
@@ -883,9 +898,12 @@ postgres_find_contract_terms_history (void *cls,
struct PostgresClosure *pg = cls;
json_t *contract_terms;
enum GNUNET_DB_QueryStatus qs;
+ unsigned int yes = GNUNET_YES;
+
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_string (order_id),
GNUNET_PQ_query_param_auto_from_type (merchant_pub),
+ GNUNET_PQ_query_param_auto_from_type (&yes),
GNUNET_PQ_query_param_end
};
struct GNUNET_PQ_ResultSpec rs[] = {
@@ -895,7 +913,7 @@ postgres_find_contract_terms_history (void *cls,
};
qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
- "find_contract_terms",
+ "find_contract_terms_history",
params,
rs);
if (qs <= 0)
@@ -1016,11 +1034,14 @@ postgres_find_contract_terms_by_date_and_range (void
*cls,
void *cb_cls)
{
struct PostgresClosure *pg = cls;
+ unsigned int yes = GNUNET_YES;
+
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_absolute_time (&date),
GNUNET_PQ_query_param_auto_from_type (merchant_pub),
GNUNET_PQ_query_param_uint64 (&start),
GNUNET_PQ_query_param_uint64 (&nrows),
+ GNUNET_PQ_query_param_auto_from_type (&yes),
GNUNET_PQ_query_param_end
};
const char *stmt;
@@ -1068,10 +1089,13 @@ postgres_find_contract_terms_by_date (void *cls,
void *cb_cls)
{
struct PostgresClosure *pg = cls;
+ unsigned int yes = GNUNET_YES;
+
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_absolute_time (&date),
GNUNET_PQ_query_param_auto_from_type (merchant_pub),
GNUNET_PQ_query_param_uint64 (&nrows),
+ GNUNET_PQ_query_param_auto_from_type (&yes),
GNUNET_PQ_query_param_end
};
enum GNUNET_DB_QueryStatus qs;
diff --git a/src/backenddb/test_merchantdb.c b/src/backenddb/test_merchantdb.c
index 9a12a1b..0f43b8f 100644
--- a/src/backenddb/test_merchantdb.c
+++ b/src/backenddb/test_merchantdb.c
@@ -84,7 +84,7 @@ struct GNUNET_HashCode h_contract_terms;
/**
* Proposal's hash.
*/
-struct GNUNET_HashCode h_contract_terms;
+struct GNUNET_HashCode h_contract_terms_future;
/**
* Time of the transaction.
@@ -462,6 +462,11 @@ run (void *cls)
timestamp,
contract_terms));
+ FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
+ plugin->mark_proposal_paid (plugin->cls,
+ &h_contract_terms,
+ &merchant_pub));
+
json_t *out;
FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
@@ -503,6 +508,13 @@ run (void *cls)
fake_now = GNUNET_TIME_absolute_subtract (timestamp, delta);
+ TALER_JSON_hash (contract_terms_future,
+ &h_contract_terms_future);
+
+ FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
+ plugin->mark_proposal_paid (plugin->cls,
+ &h_contract_terms_future,
+ &merchant_pub));
FAILIF (2 !=
plugin->find_contract_terms_by_date_and_range (plugin->cls,
fake_now,
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [taler-merchant] branch master updated: making testcase pass to new "flagged as paid" policy,
gnunet <=