gnunet-svn
[Top][All Lists]
Advanced

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

[taler-donau] branch master updated (cf373e7 -> 7130aee)


From: gnunet
Subject: [taler-donau] branch master updated (cf373e7 -> 7130aee)
Date: Wed, 13 Mar 2024 20:16:28 +0100

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

lukas-matyja pushed a change to branch master
in repository donau.

    from cf373e7  working on keys path, signing keys not found
     new a2359c8  [testing] working on issue receipts
     new 6d0ca36  [doc] update timechart
     new 7130aee  Merge remote-tracking branch 'refs/remotes/origin/master'

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:
 doc/flows/protocol/main.pdf                        | Bin 0 -> 273903 bytes
 doc/flows/timechart/timechart.ods                  | Bin 20495 -> 20475 bytes
 doc/flows/timechart/timechart.pdf                  | Bin 22790 -> 22786 bytes
 src/include/donau_testing_lib.h                    |  38 ++++++-
 src/testing/Makefile.am                            |   1 +
 src/testing/test_donau_api.c                       |   6 ++
 ...ity_post.c => testing_api_cmd_issue_receipts.c} | 112 +++++++++------------
 7 files changed, 90 insertions(+), 67 deletions(-)
 create mode 100644 doc/flows/protocol/main.pdf
 copy src/testing/{testing_api_cmd_charity_post.c => 
testing_api_cmd_issue_receipts.c} (62%)

diff --git a/doc/flows/protocol/main.pdf b/doc/flows/protocol/main.pdf
new file mode 100644
index 0000000..75a25fb
Binary files /dev/null and b/doc/flows/protocol/main.pdf differ
diff --git a/doc/flows/timechart/timechart.ods 
b/doc/flows/timechart/timechart.ods
index 7903f42..2493d7f 100644
Binary files a/doc/flows/timechart/timechart.ods and 
b/doc/flows/timechart/timechart.ods differ
diff --git a/doc/flows/timechart/timechart.pdf 
b/doc/flows/timechart/timechart.pdf
index 29bd41f..207574d 100644
Binary files a/doc/flows/timechart/timechart.pdf and 
b/doc/flows/timechart/timechart.pdf differ
diff --git a/src/include/donau_testing_lib.h b/src/include/donau_testing_lib.h
index 41d386e..3d91504 100644
--- a/src/include/donau_testing_lib.h
+++ b/src/include/donau_testing_lib.h
@@ -38,9 +38,7 @@
  *
  * @param label command label
  * @param cfg configuration to use
- * @param last_keys_ref reference to command with prior /keys response, NULL 
for none
  * @param wait_for_keys block until we got /keys
- * @param load_private_key obtain private key from file indicated in @a cfg
  * @return the command.
  */
 struct TALER_TESTING_Command
@@ -53,7 +51,7 @@ TALER_TESTING_cmd_get_donau (
  * Create a GET "charity" command.
  *
  * @param label the command label.
- * @param charity_id
+ * @param charity_reference reference for traits
  * @param bearer authorization token
  * @param expected_response_code expected HTTP response code.
  * @return the command.
@@ -68,7 +66,10 @@ TALER_TESTING_cmd_charity_get (const char *label,
  * Create a POST "charity" command.
  *
  * @param label the command label.
- * @param charity_id
+ * @param name of the charity
+ * @param url of the charity
+ * @param max_per_year max donation receipt amount per year
+ * @param receipts_to_date
  * @param bearer authorization token
  * @param expected_response_code expected HTTP response code.
  * @return the command.
@@ -83,6 +84,15 @@ TALER_TESTING_cmd_charity_post (const char *label,
                                 const struct DONAU_BearerToken *bearer,
                                 unsigned int expected_response_code);
 
+/**
+ * Create a DELETE "charity" command.
+ *
+ * @param label the command label.
+ * @param charity_reference reference for traits
+ * @param bearer authorization token
+ * @param expected_response_code expected HTTP response code.
+ * @return the command.
+ */
 struct TALER_TESTING_Command
 TALER_TESTING_cmd_charity_delete (const char *label,
                                   const char *charity_reference,
@@ -93,6 +103,7 @@ TALER_TESTING_cmd_charity_delete (const char *label,
  * Create a GET "charities" command.
  *
  * @param label the command label.
+ * @param bearer authorization token
  * @param expected_response_code expected HTTP response code.
  * @return the command.
  */
@@ -101,6 +112,25 @@ TALER_TESTING_cmd_charities_get (const char *label,
                                  const struct DONAU_BearerToken *bearer,
                                  unsigned int expected_response_code);
 
+/**
+ * Create a POST "batch-issue" command.
+ *
+ * @param label the command label.
+ * @param charity_reference reference for traits
+ * @param year current year (mostly)
+ * @param num_bkp number of @bkp
+ * @param bkp budi key pair array
+ * @param expected_response_code expected HTTP response code.
+ * @return the command.
+ */
+struct TALER_TESTING_Command
+TALER_TESTING_cmd_issue_receipts (const char *label,
+                                                               const char 
*charity_reference,
+                const uint64_t year,
+                                                               const unsigned 
int num_bkp,
+                                                               const struct 
DONAU_BlindedUniqueDonationIdentifierKeyPair *bkp[static num_bkp],
+                unsigned int expected_response_code);
+
 /**
  * Convenience function to run a test.
  *
diff --git a/src/testing/Makefile.am b/src/testing/Makefile.am
index 5623c1c..dbeb39b 100644
--- a/src/testing/Makefile.am
+++ b/src/testing/Makefile.am
@@ -25,6 +25,7 @@ libdonautesting_la_SOURCES = \
   testing_api_cmd_charity_get.c \
   testing_api_cmd_charity_post.c \
   testing_api_cmd_charity_delete.c \
+  testing_api_cmd_issue_receipts.c \
   testing_api_traits.c \
   testing_api_loop.c
 
diff --git a/src/testing/test_donau_api.c b/src/testing/test_donau_api.c
index 76aace5..40df674 100644
--- a/src/testing/test_donau_api.c
+++ b/src/testing/test_donau_api.c
@@ -91,6 +91,12 @@ run (void *cls,
          TALER_TESTING_cmd_charities_get ("get-charities",
                                                                          
&bearer,
                                                                          
MHD_HTTP_OK),
+         TALER_TESTING_cmd_issue_receipts ("issue-receipts",
+                                                                         
"post-charity",
+                                                                         2024,
+                                                                         24,
+                                                                         bkp,
+                                                                         
MHD_HTTP_CREATED),
          TALER_TESTING_cmd_charity_delete("delete-charity",
                                                                          
"post-charity", // cmd trait reference
                                                                          
&bearer,
diff --git a/src/testing/testing_api_cmd_charity_post.c 
b/src/testing/testing_api_cmd_issue_receipts.c
similarity index 62%
copy from src/testing/testing_api_cmd_charity_post.c
copy to src/testing/testing_api_cmd_issue_receipts.c
index 2702fa2..a9eac50 100644
--- a/src/testing/testing_api_cmd_charity_post.c
+++ b/src/testing/testing_api_cmd_issue_receipts.c
@@ -17,7 +17,7 @@
   <http://www.gnu.org/licenses/>
 */
 /**
- * @file testing/testing_api_cmd_charity_post.c
+ * @file testing/testing_api_cmd_issue_receipts.c
  * @brief Implement the POST /charities test command.
  * @author Lukas Matyja
  */
@@ -36,7 +36,7 @@ struct StatusState
   /**
    * Handle to the "charity status" operation.
    */
-  struct DONAU_CharityPostHandle *cph;
+  struct DONAU_BatchIssueReceiptHandle *birh;
 
   /**
    * The charity POST request.
@@ -44,15 +44,10 @@ struct StatusState
   struct DONAU_CharityRequest charity_req;
 
   /**
-   * Private key of the charity, created here.
+   * Private key of the charity, for signature.
    */
   struct DONAU_CharityPrivateKeyP charity_priv;
 
-  /**
-   * The bearer token for authorization.
-   */
-  const struct DONAU_BearerToken *bearer;
-
   /**
    * Expected HTTP response code.
    */
@@ -68,6 +63,21 @@ struct StatusState
    */
   unsigned long long charity_id;
 
+  /**
+   * charity id
+   */
+  unsigned long long year;
+
+  /**
+   * number of budi key pair.
+   */
+  uint64_t num_bkp;
+
+  /**
+   * budi key pair array
+   */
+  const struct DONAU_BlindedUniqueDonationIdentifierKeyPair *bkp;
+
 };
 
 
@@ -76,30 +86,30 @@ struct StatusState
  * both acceptable.
  *
  * @param cls closure.
- * @param gcr HTTP response details
+ * @param biresp HTTP response details
  */
 static void
-charity_status_cb (void *cls,
-                   const struct DONAU_PostCharityResponse *gcr)
+issue_receipts_status_cb (void *cls,
+                   const struct DONAU_BatchIssueResponse *biresp)
 {
   struct StatusState *ss = cls;
 
-  ss->cph = NULL;
-  if (ss->expected_response_code != gcr->hr.http_status)
+  ss->birh = NULL;
+  if (ss->expected_response_code != biresp->hr.http_status)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 "Unexpected HTTP response code: %d in %s:%u\n",
-                gcr->hr.http_status,
+                biresp->hr.http_status,
                 __FILE__,
                 __LINE__);
-    json_dumpf (gcr->hr.reply,
+    json_dumpf (biresp->hr.reply,
                 stderr,
                 0);
     TALER_TESTING_interpreter_fail (ss->is);
     return;
   }
-  if (ss->expected_response_code == gcr->hr.http_status)
-    ss->charity_id = (unsigned long long) gcr->details.ok.charity_id;
+  //if (ss->expected_response_code == biresp->hr.http_status)
+    //ss->charity_id = (unsigned long long) biresp->details.ok.charity_id;
   TALER_TESTING_interpreter_next (ss->is);
 }
 
@@ -120,13 +130,17 @@ status_run (void *cls,
 
   ss->is = is;
 
-  ss->cph = DONAU_charity_post (
+  ss->birh = DONAU_charity_issue_receipt (
     TALER_TESTING_interpreter_get_context (is),
     TALER_TESTING_get_donau_url (is),
-    &ss->charity_req,
-    ss->bearer,
-    &charity_status_cb,
+    &ss->charity_priv,
+    ss->charity_id,
+    ss->year,
+       ss->num_bkp,
+       &ss->bkp,
+    &issue_receipts_status_cb,
     ss);
+
 }
 
 
@@ -143,13 +157,13 @@ cleanup (void *cls,
 {
   struct StatusState *ss = cls;
 
-  if (NULL != ss->cph)
+  if (NULL != ss->birh)
   {
     // log incomplete command
     TALER_TESTING_command_incomplete (ss->is,
                                       cmd->label);
-    DONAU_charity_post_cancel (ss->cph);
-    ss->cph = NULL;
+    DONAU_charity_issue_receipt_cancel (ss->birh);
+    ss->birh = NULL;
   }
   GNUNET_free (ss);
 }
@@ -186,57 +200,29 @@ charity_post_traits (void *cls,
 
 
 struct TALER_TESTING_Command
-TALER_TESTING_cmd_charity_post (const char *label,
-                                const char *name,
-                                const char *url,
-                                const char *max_per_year,
-                                const char *receipts_to_date,
-                                uint64_t current_year,
-                                const struct DONAU_BearerToken *bearer,
-                                unsigned int expected_response_code)
+TALER_TESTING_cmd_issue_receipts (const char *label,
+                                                               const char 
*charity_reference,
+                                                               const uint64_t 
year,
+                                                               const unsigned 
int num_bkp,
+                                                               const struct 
DONAU_BlindedUniqueDonationIdentifierKeyPair *bkp[static num_bkp],
+                                                               unsigned int 
expected_response_code)
 {
   struct StatusState *ss;
 
   ss = GNUNET_new (struct StatusState);
-  GNUNET_CRYPTO_eddsa_key_create (&ss->charity_priv.eddsa_priv);
-  GNUNET_CRYPTO_eddsa_key_get_public (&ss->charity_priv.eddsa_priv,
-                                      &ss->charity_req.charity_pub.eddsa_pub);
-  ss->charity_req.name = name;
-  ss->charity_req.charity_url = url;
-  // parse string max_per_year to amount
-  if (GNUNET_OK !=
-      TALER_string_to_amount (max_per_year,
-                              &ss->charity_req.max_per_year))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Failed to parse amount `%s' at %s\n",
-                max_per_year,
-                label);
-    GNUNET_assert (0);
-  }
-  // parse string receipts_to_date to amount
-  if (GNUNET_OK !=
-      TALER_string_to_amount (receipts_to_date,
-                              &ss->charity_req.receipts_to_date))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Failed to parse amount `%s' at %s\n",
-                receipts_to_date,
-                label);
-    GNUNET_assert (0);
-  }
-  ss->charity_req.current_year = current_year;
+
+  ss->year = year;
   ss->expected_response_code = expected_response_code;
-  ss->bearer = bearer;
   {
     struct TALER_TESTING_Command cmd = {
       .cls = ss,
       .label = label,
       .run = &status_run,
-      .cleanup = &cleanup,
-      .traits = &charity_post_traits
+      .cleanup = &cleanup
+      //.traits = &charity_post_traits
     };
 
     return cmd;
+
   }
 }

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