gnunet-svn
[Top][All Lists]
Advanced

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

[taler-merchant] branch master updated: implement payment target exposit


From: gnunet
Subject: [taler-merchant] branch master updated: implement payment target exposition in /config, finishes #4939
Date: Sat, 11 Apr 2020 18:47:40 +0200

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

grothoff pushed a commit to branch master
in repository merchant.

The following commit(s) were added to refs/heads/master by this push:
     new 68f197e  implement payment target exposition in /config, finishes #4939
68f197e is described below

commit 68f197e97e45a577f4b0a9a271efdb76bbb203d5
Author: Christian Grothoff <address@hidden>
AuthorDate: Sat Apr 11 18:47:38 2020 +0200

    implement payment target exposition in /config, finishes #4939
---
 src/backend/taler-merchant-httpd_config.c | 38 ++++++++++++++++++++++++++++---
 1 file changed, 35 insertions(+), 3 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_config.c 
b/src/backend/taler-merchant-httpd_config.c
index 27b46d7..d6f6c92 100644
--- a/src/backend/taler-merchant-httpd_config.c
+++ b/src/backend/taler-merchant-httpd_config.c
@@ -1,6 +1,6 @@
 /*
   This file is part of TALER
-  (C) 2019 Taler Systems SA
+  (C) 2019, 2020 Taler Systems SA
 
   TALER is free software; you can redistribute it and/or modify it under the
   terms of the GNU Affero General Public License as published by the Free 
Software
@@ -55,7 +55,37 @@ add_instance (void *cls,
   json_t *ja = cls;
   struct MerchantInstance *mi = value;
   char *url;
+  json_t *pta;
 
+  /* Compile array of all unique wire methods supported by this
+     instance */
+  pta = json_array ();
+  GNUNET_assert (NULL != pta);
+  for (struct WireMethod *wm = mi->wm_head;
+       NULL != wm;
+       wm = wm->next)
+  {
+    int duplicate = GNUNET_NO;
+
+    if (! wm->active)
+      break;
+    /* Yes, O(n^2), but really how many bank accounts can an
+       instance realistically have for this to matter? */
+    for (struct WireMethod *pm = mi->wm_head;
+         pm != wm;
+         pm = pm->next)
+      if (0 == strcasecmp (pm->wire_method,
+                           wm->wire_method))
+      {
+        duplicate = GNUNET_YES;
+        break;
+      }
+    if (duplicate)
+      continue;
+    GNUNET_assert (0 ==
+                   json_array_append_new (pta,
+                                          json_string (wm->wire_method)));
+  }
   GNUNET_asprintf (&url,
                    "/%s/",
                    mi->id);
@@ -64,14 +94,16 @@ add_instance (void *cls,
                    ja,
                    json_pack (
                      (NULL != mi->tip_exchange)
-                     ? "{s:s, s:s, s:o, s:s}"
-                     : "{s:s, s:s, s:o}",
+                     ? "{s:s, s:s, s:o, s:o, s:s}"
+                     : "{s:s, s:s, s:o, s:o}",
                      "name",
                      mi->name,
                      "backend_base_url",
                      url,
                      "merchant_pub",
                      GNUNET_JSON_from_data_auto (&mi->pubkey),
+                     "payment_targets",
+                     pta,
                      /* optional: */
                      "tipping_exchange_baseurl",
                      mi->tip_exchange)));

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]