gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] 02/02: update to match merchant API change


From: gnunet
Subject: [taler-anastasis] 02/02: update to match merchant API change
Date: Fri, 30 Oct 2020 17:13:18 +0100

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

grothoff pushed a commit to branch master
in repository anastasis.

commit 48e6c1df6beacd714bfbb5c25d27459c510a4492
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Fri Oct 30 17:12:47 2020 +0100

    update to match merchant API change
---
 src/backend/anastasis-httpd_policy_upload.c | 33 ++++++++++++-----------------
 src/backend/anastasis-httpd_truth.c         | 31 ++++++++++++---------------
 2 files changed, 27 insertions(+), 37 deletions(-)

diff --git a/src/backend/anastasis-httpd_policy_upload.c 
b/src/backend/anastasis-httpd_policy_upload.c
index 9036e5d..3063d4b 100644
--- a/src/backend/anastasis-httpd_policy_upload.c
+++ b/src/backend/anastasis-httpd_policy_upload.c
@@ -279,17 +279,14 @@ amount_to_post_counter (const struct TALER_Amount *amount)
 
 /**
  * Callbacks of this type are used to serve the result of submitting a
- * /contract request to a merchant.
+ * POST /private/orders request to a merchant.
  *
  * @param cls our `struct PolicyUploadContext`
- * @param hr HTTP response details
- * @param order_id payment_identifier (base32 encoded) of the newly created 
order
+ * @param por response details
  */
 static void
 proposal_cb (void *cls,
-             const struct TALER_MERCHANT_HttpResponse *hr,
-             const char *order_id,
-             const struct TALER_ClaimTokenP *claim_token)
+             const struct TALER_MERCHANT_PostOrdersReply *por)
 {
   struct PolicyUploadContext *puc = cls;
   enum ANASTASIS_DB_QueryStatus qs;
@@ -299,40 +296,38 @@ proposal_cb (void *cls,
 
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               "Resuming connection with order `%s'\n",
-              order_id);
+              puc->order_id);
   GNUNET_CONTAINER_DLL_remove (puc_head,
                                puc_tail,
                                puc);
   MHD_resume_connection (puc->con);
   AH_trigger_daemon ();
-  if (MHD_HTTP_OK != hr->http_status)
+  if (MHD_HTTP_OK != por->hr.http_status)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                 "Backend returned status %u/%d\n",
-                hr->http_status,
-                (int) hr->ec);
+                por->hr.http_status,
+                (int) por->hr.ec);
     GNUNET_break (0);
     puc->resp = TALER_MHD_make_json_pack (
-      (NULL == hr->reply)
-      ? "{s:I, s:s, s:I, s:I}"
-      : "{s:I, s:s, s:I, s:I, s:O}",
+      "{s:I, s:s, s:I, s:I, s:O?}",
       "code",
       (json_int_t) TALER_EC_SYNC_PAYMENT_CREATE_BACKEND_ERROR,
       "hint",
       "Failed to setup order with merchant backend",
       "backend-ec",
-      (json_int_t) hr->ec,
+      (json_int_t) por->hr.ec,
       "backend-http-status",
-      (json_int_t) hr->http_status,
+      (json_int_t) por->hr.http_status,
       "backend-reply",
-      hr->reply);
+      por->hr.reply);
     GNUNET_assert (NULL != puc->resp);
     puc->response_code = MHD_HTTP_INTERNAL_SERVER_ERROR;
     return;
   }
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               "Storing payment request for order `%s'\n",
-              order_id);
+              por->details.ok.order_id);
 
   post_counter = (uint32_t) amount_to_post_counter (&AH_annual_fee);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -356,8 +351,8 @@ proposal_cb (void *cls,
   }
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               "Obtained fresh order `%s'\n",
-              order_id);
-  puc->resp = make_payment_request (order_id);
+              por->details.ok.order_id);
+  puc->resp = make_payment_request (por->details.ok.order_id);
   GNUNET_assert (NULL != puc->resp);
   puc->response_code = MHD_HTTP_PAYMENT_REQUIRED;
 }
diff --git a/src/backend/anastasis-httpd_truth.c 
b/src/backend/anastasis-httpd_truth.c
index d56b274..8aadf38 100644
--- a/src/backend/anastasis-httpd_truth.c
+++ b/src/backend/anastasis-httpd_truth.c
@@ -203,14 +203,11 @@ make_payment_request (const char *order_id)
  * /contract request to a merchant.
  *
  * @param cls our `struct PolicyUploadContext`
- * @param hr HTTP response details
- * @param order_id payment_identifier (base32 encoded) of the newly created 
order
+ * @param por response details
  */
 static void
 proposal_cb (void *cls,
-             const struct TALER_MERCHANT_HttpResponse *hr,
-             const char *order_id,
-             const struct TALER_ClaimTokenP *claim_token)
+             const struct TALER_MERCHANT_PostOrdersReply *por)
 {
   struct GetContext *gc = cls;
   enum ANASTASIS_DB_QueryStatus qs;
@@ -219,40 +216,38 @@ proposal_cb (void *cls,
 
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               "Resuming connection with order `%s'\n",
-              order_id);
+              gc->order_id);
   GNUNET_CONTAINER_DLL_remove (gc_head,
                                gc_tail,
                                gc);
   MHD_resume_connection (gc->connection);
   AH_trigger_daemon ();
-  if (MHD_HTTP_OK != hr->http_status)
+  if (MHD_HTTP_OK != por->hr.http_status)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                 "Backend returned status %u/%d\n",
-                hr->http_status,
-                (int) hr->ec);
+                por->hr.http_status,
+                (int) por->hr.ec);
     GNUNET_break (0);
     gc->resp = TALER_MHD_make_json_pack (
-      (NULL == hr->reply)
-      ? "{s:I, s:s, s:I, s:I}"
-      : "{s:I, s:s, s:I, s:I, s:O}",
+      "{s:I, s:s, s:I, s:I, s:O?}",
       "code",
       (json_int_t) TALER_EC_SYNC_PAYMENT_CREATE_BACKEND_ERROR,
       "hint",
       "Failed to setup order with merchant backend",
       "backend-ec",
-      (json_int_t) hr->ec,
+      (json_int_t) por->hr.ec,
       "backend-http-status",
-      (json_int_t) hr->http_status,
+      (json_int_t) por->hr.http_status,
       "backend-reply",
-      hr->reply);
+      por->hr.reply);
     GNUNET_assert (NULL != gc->resp);
     gc->response_code = MHD_HTTP_INTERNAL_SERVER_ERROR;
     return;
   }
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               "Storing payment request for order `%s'\n",
-              order_id);
+              por->details.ok.order_id);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Payment-Identifier to be saved to db: %s\n",
               TALER_B2S (&gc->payment_identifier));
@@ -271,8 +266,8 @@ proposal_cb (void *cls,
   }
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               "Obtained fresh order `%s'\n",
-              order_id);
-  gc->resp = make_payment_request (order_id);
+              por->details.ok.order_id);
+  gc->resp = make_payment_request (por->details.ok.order_id);
   GNUNET_assert (NULL != gc->resp);
   gc->response_code = MHD_HTTP_PAYMENT_REQUIRED;
 }

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