gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-merchant] branch master updated: benefit from #6524 implementatio


From: gnunet
Subject: [taler-merchant] branch master updated: benefit from #6524 implementation in GNUnet
Date: Sun, 25 Oct 2020 22:40:13 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository merchant.

The following commit(s) were added to refs/heads/master by this push:
     new 46bfed8  benefit from #6524 implementation in GNUnet
46bfed8 is described below

commit 46bfed8c3b1463c26ac0404188e9ff0613177c57
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun Oct 25 22:40:11 2020 +0100

    benefit from #6524 implementation in GNUnet
---
 src/backenddb/merchant-0001.sql                  |  4 +--
 src/backenddb/plugin_merchantdb_postgres.c       | 39 +++++-------------------
 src/testing/testing_api_cmd_merchant_get_order.c |  5 ---
 3 files changed, 9 insertions(+), 39 deletions(-)

diff --git a/src/backenddb/merchant-0001.sql b/src/backenddb/merchant-0001.sql
index f75cbb2..a39a243 100644
--- a/src/backenddb/merchant-0001.sql
+++ b/src/backenddb/merchant-0001.sql
@@ -242,7 +242,7 @@ CREATE TABLE IF NOT EXISTS merchant_contract_terms
   ,refund_deadline INT8 NOT NULL
   ,paid BOOLEAN DEFAULT FALSE NOT NULL
   ,wired BOOLEAN DEFAULT FALSE NOT NULL
-  ,fulfillment_url VARCHAR NOT NULL
+  ,fulfillment_url VARCHAR 
   ,session_id VARCHAR DEFAULT '' NOT NULL
   ,UNIQUE (merchant_serial, order_id)
   ,UNIQUE (merchant_serial, h_contract_terms)
@@ -264,7 +264,7 @@ COMMENT ON COLUMN merchant_contract_terms.paid
 COMMENT ON COLUMN merchant_contract_terms.wired
   IS 'true implies the exchange wired us the full amount for all non-refunded 
payments under this contract';
 COMMENT ON COLUMN merchant_contract_terms.fulfillment_url
-  IS 'also included in contract_terms, but we need it here to SELECT on it 
during repurchase detection';
+  IS 'also included in contract_terms, but we need it here to SELECT on it 
during repurchase detection; can be NULL if the contract has no fulfillment 
URL';
 COMMENT ON COLUMN merchant_contract_terms.session_id
   IS 'last session_id from we confirmed the paying client to use, empty string 
for none';
 COMMENT ON COLUMN merchant_contract_terms.pay_deadline
diff --git a/src/backenddb/plugin_merchantdb_postgres.c 
b/src/backenddb/plugin_merchantdb_postgres.c
index 4726979..1a52c79 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -1488,31 +1488,6 @@ postgres_lookup_contract_terms (void *cls,
 }
 
 
-/**
- * Create a dummy URL for the 'fulfillment' URL that consist
- * of random letters. Used because we do not like putting NULL
- * into the database, but do need to ensure that a query
- * never matches this URL.
- *
- * @return randomized URL starting with "void://", changes at
- *         ever call to this function
- */
-static const char *
-make_dummy_url ()
-{
-  static char buf[128] = "void://";
-  struct GNUNET_HashCode hc;
-
-  GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_NONCE,
-                                    &hc);
-  GNUNET_STRINGS_data_to_string (&hc,
-                                 sizeof (hc),
-                                 &buf[7],
-                                 sizeof (buf) - 8);
-  return buf;
-}
-
-
 /**
  * Store contract terms given its @a order_id. Note that some attributes are
  * expected to be calculated inside of the function, like the hash of the
@@ -1571,8 +1546,6 @@ postgres_insert_contract_terms (void *cls,
   fulfillment_url =
     json_string_value (json_object_get (contract_terms,
                                         "fulfillment_url"));
-  if (NULL == fulfillment_url)
-    fulfillment_url = make_dummy_url ();
   check_connection (pg);
   {
     struct GNUNET_PQ_QueryParam params[] = {
@@ -1582,7 +1555,9 @@ postgres_insert_contract_terms (void *cls,
       GNUNET_PQ_query_param_auto_from_type (&h_contract_terms),
       GNUNET_PQ_query_param_absolute_time (&pay_deadline),
       GNUNET_PQ_query_param_absolute_time (&refund_deadline),
-      GNUNET_PQ_query_param_string (fulfillment_url),
+      (NULL == fulfillment_url)
+      ? GNUNET_PQ_query_param_null ()
+      : GNUNET_PQ_query_param_string (fulfillment_url),
       GNUNET_PQ_query_param_end
     };
 
@@ -1651,9 +1626,6 @@ postgres_update_contract_terms (void *cls,
   fulfillment_url =
     json_string_value (json_object_get (contract_terms,
                                         "fulfillment_url"));
-  if (NULL == fulfillment_url)
-    fulfillment_url = make_dummy_url ();
-
   check_connection (pg);
   {
     struct GNUNET_PQ_QueryParam params[] = {
@@ -1663,7 +1635,9 @@ postgres_update_contract_terms (void *cls,
       GNUNET_PQ_query_param_auto_from_type (&h_contract_terms),
       GNUNET_PQ_query_param_absolute_time (&pay_deadline),
       GNUNET_PQ_query_param_absolute_time (&refund_deadline),
-      GNUNET_PQ_query_param_string (fulfillment_url),
+      (NULL == fulfillment_url)
+      ? GNUNET_PQ_query_param_null ()
+      : GNUNET_PQ_query_param_string (fulfillment_url),
       GNUNET_PQ_query_param_end
     };
 
@@ -3284,6 +3258,7 @@ postgres_lookup_order_by_fulfillment (void *cls,
                                   order_id),
     GNUNET_PQ_result_spec_end
   };
+
   return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
                                                    
"lookup_order_by_fulfillment",
                                                    params,
diff --git a/src/testing/testing_api_cmd_merchant_get_order.c 
b/src/testing/testing_api_cmd_merchant_get_order.c
index 55a5453..fa9b6fb 100644
--- a/src/testing/testing_api_cmd_merchant_get_order.c
+++ b/src/testing/testing_api_cmd_merchant_get_order.c
@@ -140,11 +140,6 @@ merchant_get_order_cb (
 {
   /* FIXME, deeper checks should be implemented here. */
   struct MerchantGetOrderState *gos = cls;
-  const struct TALER_TESTING_Command *order_cmd;
-
-  order_cmd = TALER_TESTING_interpreter_lookup_command (
-    gos->is,
-    gos->order_reference);
 
   gos->ogh = NULL;
   if (gos->http_status != hr->http_status)

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]