gnunet-svn
[Top][All Lists]
Advanced

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

[taler-merchant] 02/03: support 451 response in client API


From: gnunet
Subject: [taler-merchant] 02/03: support 451 response in client API
Date: Tue, 01 Oct 2024 14:05:47 +0200

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

grothoff pushed a commit to branch master
in repository merchant.

commit 1e2a6651223c41f9c3ed09c2e98678d175b0e2cc
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Tue Oct 1 14:05:09 2024 +0200

    support 451 response in client API
---
 src/lib/merchant_api_post_order_pay.c | 46 +++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/src/lib/merchant_api_post_order_pay.c 
b/src/lib/merchant_api_post_order_pay.c
index 14eebd28..d10fc6d7 100644
--- a/src/lib/merchant_api_post_order_pay.c
+++ b/src/lib/merchant_api_post_order_pay.c
@@ -322,6 +322,52 @@ handle_pay_finished (void *cls,
        of some disagreement on the PKI).  We should pass the JSON reply to the
        application */
     break;
+  case MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS:
+    {
+      json_t *ebus = json_object_get (json,
+                                      "exchange_base_urls");
+      if (NULL == ebus)
+      {
+        GNUNET_break_op (0);
+        pr.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
+        pr.hr.http_status = 0;
+        pr.hr.hint = "failed to parse exchange_base_urls field in response";
+        break;
+      }
+      {
+        size_t alen = json_array_size (ebus);
+        const char *ebua[GNUNET_NZL (alen)];
+        size_t idx;
+        json_t *jebu;
+        bool ok = true;
+
+        GNUNET_assert (alen <= UINT_MAX);
+        json_array_foreach (ebus, idx, jebu)
+        {
+          ebua[idx] = json_string_value (jebu);
+          if (NULL == ebua[idx])
+          {
+            GNUNET_break_op (0);
+            pr.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
+            pr.hr.http_status = 0;
+            pr.hr.hint = "non-string value in exchange_base_urls in response";
+            ok = false;
+            break;
+          }
+        }
+        if (! ok)
+          break;
+        pr.details.unavailable_for_legal_reasons.num_exchanges
+          = (unsigned int) alen;
+        pr.details.unavailable_for_legal_reasons.exchanges
+          = ebua;
+        oph->pay_cb (oph->pay_cb_cls,
+                     &pr);
+        TALER_MERCHANT_order_pay_cancel (oph);
+        return;
+      }
+    }
+    break;
   case MHD_HTTP_INTERNAL_SERVER_ERROR:
     TALER_MERCHANT_parse_error_details_ (json,
                                          response_code,

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