gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated: deprecating currency code in cur


From: gnunet
Subject: [taler-exchange] branch master updated: deprecating currency code in currency specifications
Date: Fri, 22 Dec 2023 07:56:41 +0100

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

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new a5ee6722 deprecating currency code in currency specifications
a5ee6722 is described below

commit a5ee672256b1c362b67b6d9ed1a08f2e00ac133a
Author: Christian Grothoff <grothoff@gnunet.org>
AuthorDate: Fri Dec 22 14:54:48 2023 +0800

    deprecating currency code in currency specifications
---
 src/exchange/taler-exchange-httpd_config.h | 2 +-
 src/include/taler_json_lib.h               | 2 ++
 src/include/taler_util.h                   | 2 +-
 src/json/json_helper.c                     | 7 +++----
 src/lib/exchange_api_handle.c              | 7 ++++---
 src/util/config.c                          | 2 ++
 6 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/src/exchange/taler-exchange-httpd_config.h 
b/src/exchange/taler-exchange-httpd_config.h
index f3e67e37..362667ac 100644
--- a/src/exchange/taler-exchange-httpd_config.h
+++ b/src/exchange/taler-exchange-httpd_config.h
@@ -41,7 +41,7 @@
  *
  * Returned via both /config and /keys endpoints.
  */
-#define EXCHANGE_PROTOCOL_VERSION "17:1:0"
+#define EXCHANGE_PROTOCOL_VERSION "18:0:1"
 
 
 /**
diff --git a/src/include/taler_json_lib.h b/src/include/taler_json_lib.h
index 51fd17dd..31fd7f19 100644
--- a/src/include/taler_json_lib.h
+++ b/src/include/taler_json_lib.h
@@ -234,12 +234,14 @@ TALER_JSON_spec_amount (const char *name,
  * a currency specification.
  *
  * @param name name of the amount field in the JSON
+ * @param currency_code currency code to parse
  * @param[out] r_cspec where the currency spec has to be written
  * @return spec for parsing an amount
  */
 struct GNUNET_JSON_Specification
 TALER_JSON_spec_currency_specification (
   const char *name,
+  const char *currency_code,
   struct TALER_CurrencySpecification *r_cspec);
 
 
diff --git a/src/include/taler_util.h b/src/include/taler_util.h
index 7c2cc688..7d5542a1 100644
--- a/src/include/taler_util.h
+++ b/src/include/taler_util.h
@@ -215,7 +215,7 @@ TALER_config_get_currency (const struct 
GNUNET_CONFIGURATION_Handle *cfg,
 struct TALER_CurrencySpecification
 {
   /**
-   * Name of the currency.
+   * Currency code of the currency.
    */
   char currency[TALER_CURRENCY_LEN];
 
diff --git a/src/json/json_helper.c b/src/json/json_helper.c
index 450cc194..e1670d0d 100644
--- a/src/json/json_helper.c
+++ b/src/json/json_helper.c
@@ -162,15 +162,13 @@ parse_cspec (void *cls,
              struct GNUNET_JSON_Specification *spec)
 {
   struct TALER_CurrencySpecification *r_cspec = spec->ptr;
+  const char *currency = spec->cls;
   const char *name;
-  const char *currency;
   uint32_t fid;
   uint32_t fnd;
   uint32_t ftzd;
   const json_t *map;
   struct GNUNET_JSON_Specification gspec[] = {
-    GNUNET_JSON_spec_string ("currency",
-                             &currency),
     GNUNET_JSON_spec_string ("name",
                              &name),
     GNUNET_JSON_spec_uint32 ("num_fractional_input_digits",
@@ -257,12 +255,13 @@ clean_cspec (void *cls,
 struct GNUNET_JSON_Specification
 TALER_JSON_spec_currency_specification (
   const char *name,
+  const char *currency,
   struct TALER_CurrencySpecification *r_cspec)
 {
   struct GNUNET_JSON_Specification ret = {
     .parser = &parse_cspec,
     .cleaner = &clean_cspec,
-    .cls = NULL,
+    .cls = currency,
     .field = name,
     .ptr = r_cspec,
     .ptr_size = 0,
diff --git a/src/lib/exchange_api_handle.c b/src/lib/exchange_api_handle.c
index 4b029874..ed491c8b 100644
--- a/src/lib/exchange_api_handle.c
+++ b/src/lib/exchange_api_handle.c
@@ -850,9 +850,6 @@ decode_keys_json (const json_t *resp_obj,
       GNUNET_JSON_spec_string (
         "currency",
         &currency),
-      TALER_JSON_spec_currency_specification (
-        "currency_specification",
-        &key_data->cspec),
       GNUNET_JSON_spec_string (
         "asset_type",
         &asset_type),
@@ -913,6 +910,10 @@ decode_keys_json (const json_t *resp_obj,
     }
     {
       struct GNUNET_JSON_Specification sspec[] = {
+        TALER_JSON_spec_currency_specification (
+          "currency_specification",
+          currency,
+          &key_data->cspec),
         TALER_JSON_spec_amount (
           "stefan_abs",
           currency,
diff --git a/src/util/config.c b/src/util/config.c
index 188969c6..f5accaad 100644
--- a/src/util/config.c
+++ b/src/util/config.c
@@ -477,6 +477,8 @@ TALER_CONFIG_currency_specs_to_json (const struct
   return GNUNET_JSON_PACK (
     GNUNET_JSON_pack_string ("name",
                              cspec->name),
+    /* 'currency' is deprecated as of exchange v18 and merchant v6;
+       remove this line once current-age > 6*/
     GNUNET_JSON_pack_string ("currency",
                              cspec->currency),
     GNUNET_JSON_pack_uint64 ("num_fractional_input_digits",

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