gnunet-svn
[Top][All Lists]
Advanced

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

[taler-merchant] branch master updated (7aace51b -> 80b826ac)


From: gnunet
Subject: [taler-merchant] branch master updated (7aace51b -> 80b826ac)
Date: Tue, 21 Feb 2023 18:54:00 +0100

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

priscilla-huang pushed a change to branch master
in repository merchant.

    from 7aace51b make pos_algo optional
     new 9ac6fc8c update changes
     new 052e3b55 fix syntax
     new 80b826ac last changes for the implementation of pos_key and pos_algo 
in the templates table and function

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/backenddb/merchant-0004.sql            |  5 ++++-
 src/backenddb/plugin_merchantdb_postgres.c | 16 ++++++++++++++--
 src/backenddb/test_merchantdb.c            |  1 +
 3 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/src/backenddb/merchant-0004.sql b/src/backenddb/merchant-0004.sql
index 7c86a636..5456573b 100644
--- a/src/backenddb/merchant-0004.sql
+++ b/src/backenddb/merchant-0004.sql
@@ -32,7 +32,8 @@ CREATE TABLE IF NOT EXISTS merchant_template
     REFERENCES merchant_instances (merchant_serial) ON DELETE CASCADE
   ,template_id VARCHAR NOT NULL
   ,template_description VARCHAR NOT NULL
-  ,pos_key VARCHAR
+  ,pos_key VARCHAR DEFAULT NULL
+  ,pos_algorithm INT NOT NULL DEFAULT (0)
   ,template_contract VARCHAR NOT NULL -- in JSON format
   ,UNIQUE (merchant_serial, template_id)
   );
@@ -42,6 +43,8 @@ COMMENT ON COLUMN merchant_template.template_description
   IS 'Human-readable template description';
 COMMENT ON COLUMN merchant_template.pos_key
   IS 'A base64-encoded key of the point-of-sale. It will be use by the TOTP';
+COMMENT ON COLUMN merchant_template.pos_algorithm
+  IS 'algorithm to used to generate the confirmation code. It is link with the 
pos_key';
 COMMENT ON COLUMN merchant_template.template_contract
   IS 'The template contract will contains some additional information.';
 
diff --git a/src/backenddb/plugin_merchantdb_postgres.c 
b/src/backenddb/plugin_merchantdb_postgres.c
index 93d179fa..a5501e1d 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -6952,6 +6952,7 @@ postgres_insert_template (void *cls,
                           const struct TALER_MERCHANTDB_TemplateDetails *td)
 {
   struct PostgresClosure *pg = cls;
+  uint32_t pos32 = (uint32_t) td->pos_algorithm;
   struct GNUNET_PQ_QueryParam params[] = {
     GNUNET_PQ_query_param_string (instance_id),
     GNUNET_PQ_query_param_string (template_id),
@@ -6959,6 +6960,7 @@ postgres_insert_template (void *cls,
     (NULL == td->pos_key)
     ? GNUNET_PQ_query_param_null ()
     : GNUNET_PQ_query_param_string (td->pos_key),
+    GNUNET_PQ_query_param_uint32 (&pos32),
     TALER_PQ_query_param_json (td->template_contract),
     GNUNET_PQ_query_param_end
   };
@@ -6988,6 +6990,7 @@ postgres_update_template (void *cls,
                           const struct TALER_MERCHANTDB_TemplateDetails *td)
 {
   struct PostgresClosure *pg = cls;
+  uint32_t pos32 = (uint32_t) td->pos_algorithm;
   struct GNUNET_PQ_QueryParam params[] = {
     GNUNET_PQ_query_param_string (instance_id),
     GNUNET_PQ_query_param_string (template_id),
@@ -6995,6 +6998,7 @@ postgres_update_template (void *cls,
     (NULL == td->pos_key)
     ? GNUNET_PQ_query_param_null ()
     : GNUNET_PQ_query_param_string (td->pos_key),
+    GNUNET_PQ_query_param_uint32 (&pos32),
     TALER_PQ_query_param_json (td->template_contract),
     GNUNET_PQ_query_param_end
   };
@@ -7151,6 +7155,7 @@ postgres_lookup_template (void *cls,
   }
   else
   {
+    uint32_t pos32 = (uint32_t) td->pos_algorithm;
     struct GNUNET_PQ_ResultSpec rs[] = {
       GNUNET_PQ_result_spec_string ("template_description",
                                     &td->template_description),
@@ -7158,6 +7163,10 @@ postgres_lookup_template (void *cls,
         GNUNET_PQ_result_spec_string ("pos_key",
                                       &td->pos_key),
         NULL),
+      GNUNET_PQ_result_spec_allow_null (
+        GNUNET_PQ_result_spec_uint32 ("pos_algorithm",
+                                      &pos32),
+        NULL),
       TALER_PQ_result_spec_json ("template_contract",
                                  &td->template_contract),
       GNUNET_PQ_result_spec_end
@@ -10378,6 +10387,7 @@ postgres_connect (void *cls)
                             "SELECT"
                             " template_description"
                             ",pos_key"
+                            ",pos_algorithm"
                             ",template_contract"
                             " FROM merchant_template"
                             " JOIN merchant_instances"
@@ -10400,10 +10410,11 @@ postgres_connect (void *cls)
                             ",template_id"
                             ",template_description"
                             ",pos_key"
+                            ",pos_algorithm"
                             ",template_contract"
                             ")"
                             " SELECT merchant_serial,"
-                            " $2, $3, $4, $5"
+                            " $2, $3, $4, $5, $6"
                             " FROM merchant_instances"
                             " WHERE merchant_id=$1"),
     /* for postgres_update_template() */
@@ -10411,7 +10422,8 @@ postgres_connect (void *cls)
                             "UPDATE merchant_template SET"
                             " template_description=$3"
                             ",pos_key=$4"
-                            ",template_contract=$5"
+                            ",pos_algorithm=$5"
+                            ",template_contract=$6"
                             " WHERE merchant_serial="
                             "   (SELECT merchant_serial"
                             "      FROM merchant_instances"
diff --git a/src/backenddb/test_merchantdb.c b/src/backenddb/test_merchantdb.c
index 09cccc78..3d7d6b8c 100644
--- a/src/backenddb/test_merchantdb.c
+++ b/src/backenddb/test_merchantdb.c
@@ -6878,6 +6878,7 @@ make_template (const char *id,
   template->id = id;
   template->template.template_description = "This is a test template";
   template->template.pos_key = NULL;
+  template->template.pos_algorithm = 0;
   template->template.template_contract = json_array ();
   GNUNET_assert (NULL != template->template.template_contract);
 }

-- 
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]