gnunet-svn
[Top][All Lists]
Advanced

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

[taler-merchant] branch master updated (3fa7d3be -> 4e207441)


From: gnunet
Subject: [taler-merchant] branch master updated (3fa7d3be -> 4e207441)
Date: Wed, 29 Mar 2023 16:39:47 +0200

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

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

    from 3fa7d3be debian: release patch version
     new 702d2fc2 daily pull
     new 21bce668 update of the test TOTP but not finish
     new 03f432af update of the test TOTP but not finish
     new ecf97743 pull
     new ed3003dd pull
     new 8e104cfe pull
     new 4e207441 update pay order / using templates for test case totp

The 7 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:
 ...r-merchant-httpd_private-patch-templates-ID.c#} |   4 +-
 src/include/taler_merchant_service.h               |  10 +
 src/include/taler_merchant_testing_lib.h           |  13 +-
 src/lib/merchant_api_post_order_pay.c              |   5 +
 src/testing/test_merchant_api.c                    |  15 +-
 src/testing/testing_api_cmd_get_template.c         |  11 +-
 src/testing/testing_api_cmd_patch_template.c       |  10 +-
 src/testing/testing_api_cmd_pay_order.c            |  28 +++
 src/testing/testing_api_cmd_post_templates.c       |  11 +-
 src/testing/testing_api_cmd_post_using_templates.c | 258 ++++++++++++++++++++-
 10 files changed, 339 insertions(+), 26 deletions(-)
 copy src/backend/{taler-merchant-httpd_private-patch-templates-ID.c => 
#taler-merchant-httpd_private-patch-templates-ID.c#} (99%)

diff --git a/src/backend/taler-merchant-httpd_private-patch-templates-ID.c 
b/src/backend/#taler-merchant-httpd_private-patch-templates-ID.c#
similarity index 99%
copy from src/backend/taler-merchant-httpd_private-patch-templates-ID.c
copy to src/backend/#taler-merchant-httpd_private-patch-templates-ID.c#
index b5938368..6739c7a9 100644
--- a/src/backend/taler-merchant-httpd_private-patch-templates-ID.c
+++ b/src/backend/#taler-merchant-httpd_private-patch-templates-ID.c#
@@ -34,7 +34,7 @@
 #define MAX_RETRIES 3
 
 
-/**
+/**                    
  * Determine the cause of the PATCH failure in more detail and report.
  *
  * @param connection connection to report on
@@ -116,7 +116,7 @@ TMH_private_patch_templates_ID (const struct 
TMH_RequestHandler *rh,
     GNUNET_JSON_spec_mark_optional (
       GNUNET_JSON_spec_uint32 ("pos_algorithm",
                                &pos_algorithm),
-      NULL),
+     0),
     GNUNET_JSON_spec_mark_optional (
       GNUNET_JSON_spec_string ("pos_key",
                                (const char **) &tp.pos_key),
diff --git a/src/include/taler_merchant_service.h 
b/src/include/taler_merchant_service.h
index 20da7abd..b2f2f334 100644
--- a/src/include/taler_merchant_service.h
+++ b/src/include/taler_merchant_service.h
@@ -2179,6 +2179,11 @@ struct TALER_MERCHANT_PayResponse
        */
       struct TALER_MerchantSignatureP merchant_sig;
 
+      /**
+       * Optional payment confirmation code returned by the service.
+       */
+      const char *pos_confirmation;
+ 
     } success;
 
     // TODO: might want to return further details on errors,
@@ -4207,6 +4212,11 @@ struct TALER_MERCHANT_TemplateGetResponse
        */
       const char *pos_key;
 
+      /**
+       * Option that add amount of the order
+       */
+      const enum TALER_MerchantConfirmationAlgorithm pos_alg;
+
       /**
        * Template for the contract.
        */
diff --git a/src/include/taler_merchant_testing_lib.h 
b/src/include/taler_merchant_testing_lib.h
index 02f386c4..886b052b 100644
--- a/src/include/taler_merchant_testing_lib.h
+++ b/src/include/taler_merchant_testing_lib.h
@@ -1498,7 +1498,8 @@ TALER_TESTING_cmd_merchant_kyc_get (const char *label,
  *        POST /templates request.
  * @param template_id the ID of the template to query
  * @param template_description description of the template
- * @param image base64-encoded template image
+ * @param pos_key base32-encoded key to verify the payment
+ * @param pos_alg is an option that show the amount of the order. it is linked 
with the pos_key
  * @param template_contract where the contract of the company is
  * @param http_status expected HTTP response code.
  * @return the command.
@@ -1509,7 +1510,8 @@ TALER_TESTING_cmd_merchant_post_templates2 (
   const char *merchant_url,
   const char *template_id,
   const char *template_description,
-  const char *image,
+  const char *pos_key,
+  const enum TALER_MerchantConfirmationAlgorithm pos_alg,
   json_t *template_contract,
   unsigned int http_status);
 
@@ -1541,7 +1543,8 @@ TALER_TESTING_cmd_merchant_post_templates (const char 
*label,
  *        PATCH /template request.
  * @param template_id the ID of the template to query
  * @param template_description description of the template
- * @param image base64-encoded template image
+ * @param pos_key base32-encoded key to verify the payment
+ * @param pos_alg is an option that show the amount of the order. it is linked 
with the pos_key
  * @param template_contract contract of the company
  * @param http_status expected HTTP response code.
  * @return the command.
@@ -1552,7 +1555,8 @@ TALER_TESTING_cmd_merchant_patch_template (
   const char *merchant_url,
   const char *template_id,
   const char *template_description,
-  const char *image,
+  const char *pos_key,
+  const enum TALER_MerchantConfirmationAlgorithm pos_alg,
   json_t *template_contract,
   unsigned int http_status);
 
@@ -1867,6 +1871,7 @@ TALER_TESTING_cmd_checkserver2 (const char *label,
   op (proposal_reference, const char *) \
   op (template_description, const char *) \
   op (template_pos_key, const char *) \
+  op (template_pos_alg, const enum TALER_MerchantConfirmationAlgorithm) \
   op (template_id, const char *) \
   op (template_contract, const json_t) \
   op (event_type, const char *)   \
diff --git a/src/lib/merchant_api_post_order_pay.c 
b/src/lib/merchant_api_post_order_pay.c
index 765ca1a6..3923db21 100644
--- a/src/lib/merchant_api_post_order_pay.c
+++ b/src/lib/merchant_api_post_order_pay.c
@@ -407,6 +407,11 @@ handle_pay_finished (void *cls,
         GNUNET_JSON_spec_fixed_auto (
           "sig",
           &pr.details.success.merchant_sig),
+        GNUNET_JSON_spec_mark_optional (
+          GNUNET_JSON_spec_string (
+            "pos_confirmation",
+            &pr.details.success.pos_confirmation),
+          NULL),
         GNUNET_JSON_spec_end ()
       };
 
diff --git a/src/testing/test_merchant_api.c b/src/testing/test_merchant_api.c
index 8509f6aa..6c8e5abd 100644
--- a/src/testing/test_merchant_api.c
+++ b/src/testing/test_merchant_api.c
@@ -1362,7 +1362,8 @@ run (void *cls,
       merchant_url,
       "template-2",
       "another template",
-      "data:image/jpeg;base64,RAWDATA",
+      NULL,
+      TALER_MCA_NONE,
       GNUNET_JSON_PACK (
         GNUNET_JSON_pack_uint64 ("minimum_age", 0),
         GNUNET_JSON_pack_time_rel ("pay_duration",
@@ -1383,7 +1384,8 @@ run (void *cls,
       merchant_url,
       "template-3",
       "updated template",
-      "data:image/jpeg;base64,RAWDATA",
+      NULL,
+      TALER_MCA_WITH_PRICE,
       GNUNET_JSON_PACK (
         GNUNET_JSON_pack_uint64 ("minimum_age", 0),
         GNUNET_JSON_pack_time_rel ("pay_duration",
@@ -1395,6 +1397,7 @@ run (void *cls,
       "template-amount",
       "a different template with an amount",
       NULL,
+      TALER_MCA_NONE,
       GNUNET_JSON_PACK (
         GNUNET_JSON_pack_uint64 ("minimum_age", 0),
         GNUNET_JSON_pack_time_rel ("pay_duration",
@@ -1437,6 +1440,14 @@ run (void *cls,
       "summary-1",
       "EUR:4",
       MHD_HTTP_CONFLICT),
+    TALER_TESTING_cmd_merchant_pay_order ("pay-100",
+                                          merchant_url,
+                                          MHD_HTTP_OK,
+                                          "using-templates-t1",
+                                          
"withdraw-coin-10a;withdraw-coin-10b",
+                                          "EUR:9.99",
+                                          "EUR:9",
+                                          NULL),
     TALER_TESTING_cmd_merchant_delete_template ("get-templates-empty",
                                                 merchant_url,
                                                 "t1",
diff --git a/src/testing/testing_api_cmd_get_template.c 
b/src/testing/testing_api_cmd_get_template.c
index 8b32156d..3866d6fa 100644
--- a/src/testing/testing_api_cmd_get_template.c
+++ b/src/testing/testing_api_cmd_get_template.c
@@ -115,21 +115,20 @@ get_template_cb (void *cls,
     }
     {
       const char **expected_pos_key;
-      const char *pos_key = tgr->details.success.pos_key;
 
       if (GNUNET_OK !=
           TALER_TESTING_get_trait_template_pos_key (template_cmd,
                                                     &expected_pos_key))
         TALER_TESTING_interpreter_fail (gis->is);
-      if ( ( (NULL == pos_key) && (NULL != *expected_pos_key)) ||
-           ( (NULL != pos_key) && (NULL == *expected_pos_key)) ||
-           ( (NULL != pos_key) &&
-             (0 != strcmp (pos_key,
+      if ( ( (NULL == tgr->details.success.pos_key) && (NULL != 
*expected_pos_key)) ||
+           ( (NULL != tgr->details.success.pos_key) && (NULL == 
*expected_pos_key)) ||
+           ( (NULL != tgr->details.success.pos_key) &&
+             (0 != strcmp (tgr->details.success.pos_key,
                            *expected_pos_key)) ) )
       {
         GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                     "Template pos_key `%s' does not match `%s'\n",
-                    pos_key,
+                    tgr->details.success.pos_key,
                     *expected_pos_key);
         TALER_TESTING_interpreter_fail (gis->is);
         return;
diff --git a/src/testing/testing_api_cmd_patch_template.c 
b/src/testing/testing_api_cmd_patch_template.c
index 81560fa7..bc260c00 100644
--- a/src/testing/testing_api_cmd_patch_template.c
+++ b/src/testing/testing_api_cmd_patch_template.c
@@ -64,6 +64,11 @@ struct PatchTemplateState
    */
   char *pos_key;
 
+  /**
+   * Option that add amount of the order
+   */
+  enum TALER_MerchantConfirmationAlgorithm pos_alg;
+
   /**
    * Contract of the company
    */
@@ -142,7 +147,7 @@ patch_template_run (void *cls,
                                             pis->template_id,
                                             pis->template_description,
                                             pis->pos_key,
-                                            TALER_MCA_NONE,
+                                            pis->pos_alg,
                                             pis->template_contract,
                                             &patch_template_cb,
                                             pis);
@@ -171,6 +176,7 @@ patch_template_traits (void *cls,
     TALER_TESTING_make_trait_template_description (&pts->template_description),
     TALER_TESTING_make_trait_template_pos_key (
       (const char **) &pts->pos_key),
+    TALER_TESTING_make_trait_template_pos_alg (&pts->pos_alg),
     TALER_TESTING_make_trait_template_contract (pts->template_contract),
     TALER_TESTING_make_trait_template_id (&pts->template_id),
     TALER_TESTING_trait_end (),
@@ -215,6 +221,7 @@ TALER_TESTING_cmd_merchant_patch_template (
   const char *template_id,
   const char *template_description,
   const char *pos_key,
+  const enum TALER_MerchantConfirmationAlgorithm pos_alg,
   json_t *template_contract,
   unsigned int http_status)
 {
@@ -226,6 +233,7 @@ TALER_TESTING_cmd_merchant_patch_template (
   pis->http_status = http_status;
   pis->template_description = template_description;
   pis->pos_key = (NULL == pos_key) ? NULL : GNUNET_strdup (pos_key);
+  pis->pos_alg = pos_alg;
   pis->template_contract = template_contract; /* ownership taken */
   {
     struct TALER_TESTING_Command cmd = {
diff --git a/src/testing/testing_api_cmd_pay_order.c 
b/src/testing/testing_api_cmd_pay_order.c
index cd589965..cff679a8 100644
--- a/src/testing/testing_api_cmd_pay_order.c
+++ b/src/testing/testing_api_cmd_pay_order.c
@@ -91,6 +91,21 @@ struct PayState
    * The session for which the payment is made.
    */
   const char *session_id;
+
+  /**
+   * base64-encoded key
+   */
+  const char *pos_key;
+
+  /**
+   * Option that add amount of the order
+   */
+  enum TALER_MerchantConfirmationAlgorithm pos_alg;
+
+  /**
+   * This variable is for the verification of the payment.
+   */
+  const char *pos_confirmation;
 };
 
 
@@ -239,6 +254,17 @@ pay_cb (void *cls,
   if (MHD_HTTP_OK == pr->hr.http_status)
   {
     ps->merchant_sig = pr->details.success.merchant_sig;
+    // FIXME: check if pr->details.success.pos_confirmation;
+    // for that, get pos_secret from ps->proposal_reference CMD and amount 
from pay/order creation cmd using traits
+    struct TALER_Amount amount_with_fee;
+    GNUNET_assert (GNUNET_OK ==
+                   TALER_string_to_amount (ps->amount_with_fee,
+                                           &amount_with_fee));
+    ps->pos_confirmation = TALER_build_pos_confirmation (ps->pos_key,
+                                                         ps->pos_alg,
+                                                         &amount_with_fee,
+                                                         
GNUNET_TIME_timestamp_get());
+    ps->pos_confirmation = pr->details.success.pos_confirmation;
   }
   TALER_TESTING_interpreter_next (ps->is);
 }
@@ -472,6 +498,8 @@ pay_traits (void *cls,
         TALER_TESTING_make_trait_merchant_pub (merchant_pub),
         TALER_TESTING_make_trait_merchant_sig (&ps->merchant_sig),
         TALER_TESTING_make_trait_amount (&amount_with_fee),
+        TALER_TESTING_make_trait_template_pos_key (&ps->pos_key),
+        TALER_TESTING_make_trait_template_pos_alg (&ps->pos_alg),
         TALER_TESTING_trait_end ()
       };
 
diff --git a/src/testing/testing_api_cmd_post_templates.c 
b/src/testing/testing_api_cmd_post_templates.c
index 39728792..15a09125 100644
--- a/src/testing/testing_api_cmd_post_templates.c
+++ b/src/testing/testing_api_cmd_post_templates.c
@@ -64,6 +64,11 @@ struct PostTemplatesState
    */
   char *pos_key;
 
+  /**
+   * Option that add amount of the order
+   */
+  enum TALER_MerchantConfirmationAlgorithm pos_alg;
+
   /**
    * Contract of the company
    */
@@ -141,7 +146,7 @@ post_templates_run (void *cls,
                                             tis->template_id,
                                             tis->template_description,
                                             tis->pos_key,
-                                            TALER_MCA_NONE,
+                                            tis->pos_alg,
                                             tis->template_contract,
                                             &post_templates_cb,
                                             tis);
@@ -175,6 +180,7 @@ post_templates_traits (void *cls,
     TALER_TESTING_make_trait_template_description (&pts->template_description),
     TALER_TESTING_make_trait_template_pos_key (
       (const char **) &pts->pos_key),
+    TALER_TESTING_make_trait_template_pos_alg (&pts->pos_alg),
     TALER_TESTING_make_trait_template_contract (pts->template_contract),
     TALER_TESTING_make_trait_template_id (&pts->template_id),
     TALER_TESTING_trait_end (),
@@ -219,6 +225,7 @@ TALER_TESTING_cmd_merchant_post_templates2 (
   const char *template_id,
   const char *template_description,
   const char *pos_key,
+  const enum TALER_MerchantConfirmationAlgorithm pos_alg,
   json_t *template_contract,
   unsigned int http_status)
 {
@@ -233,6 +240,7 @@ TALER_TESTING_cmd_merchant_post_templates2 (
   tis->http_status = http_status;
   tis->template_description = template_description;
   tis->pos_key = (NULL == pos_key) ? NULL : GNUNET_strdup (pos_key);
+  tis->pos_alg = pos_alg;
   tis->template_contract = template_contract;
   {
     struct TALER_TESTING_Command cmd = {
@@ -261,6 +269,7 @@ TALER_TESTING_cmd_merchant_post_templates (const char 
*label,
     template_id,
     template_description,
     NULL,
+    TALER_MCA_NONE,
     GNUNET_JSON_PACK (
       GNUNET_JSON_pack_uint64 ("minimum_age", 0),
       GNUNET_JSON_pack_time_rel ("pay_duration",
diff --git a/src/testing/testing_api_cmd_post_using_templates.c 
b/src/testing/testing_api_cmd_post_using_templates.c
index 956a421a..88fe9f9b 100644
--- a/src/testing/testing_api_cmd_post_using_templates.c
+++ b/src/testing/testing_api_cmd_post_using_templates.c
@@ -43,6 +43,13 @@ struct PostUsingTemplatesState
    */
   struct TALER_TESTING_Interpreter *is;
 
+  /**
+   * The (initial) POST /orders/$ID/claim operation handle.
+   * The logic is such that after an order creation,
+   * we immediately claim the order.
+   */
+  struct TALER_MERCHANT_OrderClaimHandle *och;
+
   /**
    * Base URL of the merchant serving the request.
    */
@@ -63,6 +70,72 @@ struct PostUsingTemplatesState
    */
   const char *template_ref;
 
+  /**
+   * Order id.
+   */
+  const char *order_id;
+
+  /**
+   * The order id we expect the merchant to assign (if not NULL).
+   */
+  const char *expected_order_id;
+
+  /**
+   * Contract terms obtained from the backend.
+   */
+  json_t *contract_terms;
+
+  /**
+   * Order submitted to the backend.
+   */
+  json_t *order_terms;
+
+  /**
+   * Contract terms hash code.
+   */
+  struct TALER_PrivateContractHashP h_contract_terms;
+
+  /**
+   * Merchant signature over the orders.
+   */
+  struct TALER_MerchantSignatureP merchant_sig;
+
+  /**
+   * Merchant public key.
+   */
+  struct TALER_MerchantPublicKeyP merchant_pub;
+
+  /**
+   * The nonce.
+   */
+  struct GNUNET_CRYPTO_EddsaPublicKey nonce;
+
+  /**
+   * The claim token
+   */
+  struct TALER_ClaimTokenP claim_token;
+
+  /**
+   * Should the command also CLAIM the order?
+   */
+  bool with_claim;
+
+  /**
+   * If not NULL, the command should duplicate the request and verify the
+   * response is the same as in this command.
+   */
+  const char *duplicate_of;
+
+  /**
+   * Encoded key for the payment verification.
+   */
+  const char **template_pos_key;
+
+  /**
+   * Option that add amount of the order
+   */
+  const enum TALER_MerchantConfirmationAlgorithm *template_pos_alg;
+
   /**
    * Expected HTTP response code.
    */
@@ -70,6 +143,71 @@ struct PostUsingTemplatesState
 
 };
 
+/**
+ * Used to fill the "orders" CMD state with backend-provided
+ * values.  Also double-checks that the order was correctly
+ * created.
+ *
+ * @param cls closure
+ * @param hr HTTP response we got
+ * @param contract_terms contract terms of this order
+ * @param sig merchant's signature
+ * @param hash hash over the contract
+ */
+static void
+orders_claim_cb (void *cls,
+                 const struct TALER_MERCHANT_HttpResponse *hr,
+                 const json_t *contract_terms,
+                 const struct TALER_MerchantSignatureP *sig,
+                 const struct TALER_PrivateContractHashP *hash)
+{
+  struct PostUsingTemplatesState *tis = cls;
+  struct TALER_MerchantPublicKeyP merchant_pub;
+  const char *error_name;
+  unsigned int error_line;
+  struct GNUNET_JSON_Specification spec[] = {
+    GNUNET_JSON_spec_fixed_auto ("merchant_pub",
+                                 &merchant_pub),
+    GNUNET_JSON_spec_end ()
+  };
+
+  tis->och = NULL;
+  if (tis->http_status != hr->http_status)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Expected status %u, got %u\n",
+                tis->http_status,
+                hr->http_status);
+    TALER_TESTING_FAIL (tis->is);
+  }
+
+  tis->contract_terms = json_deep_copy (contract_terms);
+  tis->h_contract_terms = *hash;
+  tis->merchant_sig = *sig;
+  if (GNUNET_OK !=
+      GNUNET_JSON_parse (contract_terms,
+                         spec,
+                         &error_name,
+                         &error_line))
+  {
+    char *log;
+
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Parser failed on %s:%u\n",
+                error_name,
+                error_line);
+    log = json_dumps (tis->contract_terms,
+                      JSON_INDENT (1));
+    fprintf (stderr,
+             "%s\n",
+             log);
+    free (log);
+    TALER_TESTING_FAIL (tis->is);
+  }
+  tis->merchant_pub = merchant_pub;
+  TALER_TESTING_interpreter_next (tis->is);
+}
+
 
 /**
  * Callback for a POST /using-templates operation.
@@ -94,22 +232,101 @@ post_using_templates_cb (void *cls,
     TALER_TESTING_interpreter_fail (tis->is);
     return;
   }
+  if (0 == tis->http_status)
+  {
+    TALER_LOG_DEBUG ("/using_templates, expected 0 status code\n");
+    TALER_TESTING_interpreter_next (tis->is);
+    return;
+  }
+  // check for order
   switch (por->hr.http_status)
   {
   case MHD_HTTP_OK:
-    break;
-  case MHD_HTTP_CONFLICT:
+    if (NULL != por->details.ok.token)
+      tis->claim_token = *por->details.ok.token;
+    tis->order_id = GNUNET_strdup (por->details.ok.order_id);
+    if ((NULL != tis->expected_order_id) &&
+        (0 != strcmp (por->details.ok.order_id,
+                      tis->expected_order_id)))
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                  "Order id assigned does not match\n");
+      TALER_TESTING_interpreter_fail (tis->is);
+      return;
+    }
+    if (NULL != tis->duplicate_of)
+    {
+      const struct TALER_TESTING_Command *order_cmd;
+      const struct TALER_ClaimTokenP *prev_token;
+      struct TALER_ClaimTokenP zero_token = {0};
+
+      order_cmd = TALER_TESTING_interpreter_lookup_command (
+        tis->is,
+        tis->duplicate_of);
+      if (GNUNET_OK !=
+          TALER_TESTING_get_trait_claim_token (order_cmd,
+                                               &prev_token))
+      {
+        GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                    "Could not fetch previous order claim token\n");
+        TALER_TESTING_interpreter_fail (tis->is);
+        return;
+      }
+      if (NULL == por->details.ok.token)
+        prev_token = &zero_token;
+      if (0 != GNUNET_memcmp (prev_token,
+                              por->details.ok.token))
+      {
+        GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                    "Claim tokens for identical requests do not match\n");
+        TALER_TESTING_interpreter_fail (tis->is);
+        return;
+      }
+    }
     break;
   case MHD_HTTP_NOT_FOUND:
-    break;
+    TALER_TESTING_interpreter_next (tis->is);
+    return;
+  case MHD_HTTP_GONE:
+    TALER_TESTING_interpreter_next (tis->is);
+    return;
+  case MHD_HTTP_CONFLICT:
+    TALER_TESTING_interpreter_next (tis->is);
+    return;
   default:
-    GNUNET_break (0);
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "Unhandled HTTP status %u for POST /templates/$ID.\n",
-                por->hr.http_status);
-    break;
+    {
+      char *s = json_dumps (por->hr.reply,
+                            JSON_COMPACT);
+      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                  "Unexpected status code from /orders: %u (%d) at %s; JSON: 
%s\n",
+                  por->hr.http_status,
+                  (int) por->hr.ec,
+                  TALER_TESTING_interpreter_get_current_label (tis->is),
+                  s);
+      GNUNET_free (s);
+      /**
+       * Not failing, as test cases are _supposed_
+       * to create non 200 OK situations.
+       */
+      TALER_TESTING_interpreter_next (tis->is);
+    }
+    return;
   }
-  TALER_TESTING_interpreter_next (tis->is);
+
+  if (! tis->with_claim)
+  {
+    TALER_TESTING_interpreter_next (tis->is);
+    return;
+  }
+  if (NULL ==
+      (tis->och = TALER_MERCHANT_order_claim (tis->is->ctx,
+                                             tis->merchant_url,
+                                             tis->order_id,
+                                             &tis->nonce,
+                                             &tis->claim_token,
+                                             &orders_claim_cb,
+                                             tis)))
+    TALER_TESTING_FAIL (tis->is);
 }
 
 
@@ -137,6 +354,16 @@ post_using_templates_run (void *cls,
       TALER_TESTING_get_trait_template_id (ref,
                                            &template_id))
     TALER_TESTING_FAIL (is);
+
+  if (GNUNET_OK !=
+      TALER_TESTING_get_trait_template_pos_key (ref,
+                                                &tis->template_pos_key))
+    TALER_TESTING_FAIL (is);
+
+  if (GNUNET_OK !=
+      TALER_TESTING_get_trait_template_pos_alg (ref,
+                                                &tis->template_pos_alg))
+    TALER_TESTING_FAIL (is);
   tis->iph = TALER_MERCHANT_using_templates_post (
     is->ctx,
     tis->merchant_url,
@@ -169,6 +396,16 @@ post_using_templates_traits (void *cls,
 {
   struct PostUsingTemplatesState *pts = cls;
   struct TALER_TESTING_Trait traits[] = {
+    TALER_TESTING_make_trait_order_id (&pts->order_id),
+    TALER_TESTING_make_trait_contract_terms (pts->contract_terms),
+    TALER_TESTING_make_trait_order_terms (pts->order_terms),
+    TALER_TESTING_make_trait_h_contract_terms (&pts->h_contract_terms),
+    TALER_TESTING_make_trait_merchant_sig (&pts->merchant_sig),
+    TALER_TESTING_make_trait_merchant_pub (&pts->merchant_pub),
+    TALER_TESTING_make_trait_claim_nonce (&pts->nonce),
+    TALER_TESTING_make_trait_claim_token (&pts->claim_token),
+    TALER_TESTING_make_trait_template_pos_key (&pts->template_pos_key), // 
extract from template creation CMD
+    TALER_TESTING_make_trait_template_pos_alg (&pts->template_pos_alg),
     TALER_TESTING_trait_end (),
   };
 
@@ -209,7 +446,8 @@ TALER_TESTING_cmd_merchant_post_using_templates (
   const char *template_ref,
   const char *merchant_url,
   const char *summary,
-  const char *amount,  unsigned int http_status)
+  const char *amount,
+  unsigned int http_status)
 {
   struct PostUsingTemplatesState *tis;
 

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