gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-merchant] branch master updated: no need to convert


From: gnunet
Subject: [GNUnet-SVN] [taler-merchant] branch master updated: no need to convert amount now
Date: Mon, 29 Jan 2018 19:28:09 +0100

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

dold pushed a commit to branch master
in repository merchant.

The following commit(s) were added to refs/heads/master by this push:
     new f587019  no need to convert amount now
f587019 is described below

commit f587019dcb27ae15991b6166ac31427b1c6e782c
Author: Florian Dold <address@hidden>
AuthorDate: Mon Jan 29 19:28:06 2018 +0100

    no need to convert amount now
---
 src/backend/taler-merchant-httpd.c               | 24 ------------------------
 src/backend/taler-merchant-httpd.h               | 13 -------------
 src/backend/taler-merchant-httpd_proposal.c      |  5 -----
 src/backend/taler-merchant-httpd_refund.c        |  5 -----
 src/backend/taler-merchant-httpd_tip-authorize.c |  5 -----
 5 files changed, 52 deletions(-)

diff --git a/src/backend/taler-merchant-httpd.c 
b/src/backend/taler-merchant-httpd.c
index 5390b00..a3081be 100644
--- a/src/backend/taler-merchant-httpd.c
+++ b/src/backend/taler-merchant-httpd.c
@@ -1545,27 +1545,3 @@ TMH_make_absolute_backend_url (struct MHD_Connection 
*connection,
   return res;
 }
 
-
-/**
- * Convert an amount in a JSON object from the string amount format to the JSON
- * amount format.  Does nothing if the field is missing or already a JSON
- * object.
- *
- * @param json json with the amount to convert
- * @param field_name name of the field to convert
- * @returns #GNUNET_OK on success, #GNUNET_SYSERR on invalid format
- */
-int
-TMH_convert_amount (json_t *json, const char *field_name)
-{
-  if (! json_is_string (json_object_get (json, field_name)))
-    return GNUNET_OK;
-  const char *amount_str = json_string_value (json_object_get (json, 
field_name));
-  GNUNET_assert (NULL != amount_str);
-  struct TALER_Amount amount;
-  if (GNUNET_OK != TALER_string_to_amount (amount_str, &amount))
-    return GNUNET_SYSERR;
-  json_object_del (json, field_name);
-  json_object_set_new (json, field_name, TALER_JSON_from_amount (&amount));
-  return GNUNET_OK;
-}
diff --git a/src/backend/taler-merchant-httpd.h 
b/src/backend/taler-merchant-httpd.h
index 078c038..baac847 100644
--- a/src/backend/taler-merchant-httpd.h
+++ b/src/backend/taler-merchant-httpd.h
@@ -370,17 +370,4 @@ TMH_lookup_instance_json (struct json_t *json);
 char *
 TMH_make_absolute_backend_url (struct MHD_Connection *connection, const char 
*path, ...);
 
-
-/**
- * Convert an amount in a JSON object from the string amount format to the JSON
- * amount format.  Does nothing if the field is missing or already a JSON
- * object.
- *
- * @param json json with the amount to convert
- * @param field_name name of the field to convert
- * @returns #GNUNET_OK on success, #GNUNET_SYSERR on invalid format
- */
-int
-TMH_convert_amount (json_t *json, const char *field_name);
-
 #endif
diff --git a/src/backend/taler-merchant-httpd_proposal.c 
b/src/backend/taler-merchant-httpd_proposal.c
index a5756d1..390ddd1 100644
--- a/src/backend/taler-merchant-httpd_proposal.c
+++ b/src/backend/taler-merchant-httpd_proposal.c
@@ -192,11 +192,6 @@ proposal_put (struct MHD_Connection *connection,
                          json_string (buf));
   }
 
-  if (GNUNET_OK != TMH_convert_amount (order, "amount"))
-    return TMH_RESPONSE_reply_arg_invalid (connection,
-                                           TALER_EC_PARAMETER_MALFORMED,
-                                           "amount");
-
   /* Add timestamp if it doesn't exist */
   if (NULL == json_object_get (order,
                                "timestamp"))
diff --git a/src/backend/taler-merchant-httpd_refund.c 
b/src/backend/taler-merchant-httpd_refund.c
index 57cff6a..f875be1 100644
--- a/src/backend/taler-merchant-httpd_refund.c
+++ b/src/backend/taler-merchant-httpd_refund.c
@@ -153,11 +153,6 @@ MH_handler_refund_increase (struct TMH_RequestHandler *rh,
        (NULL == root) )
     return MHD_YES;
 
-  if (GNUNET_OK != TMH_convert_amount (root, "refund"))
-    return TMH_RESPONSE_reply_arg_invalid (connection,
-                                           TALER_EC_PARAMETER_MALFORMED,
-                                           "refund");
-
   res = TMH_PARSE_json_data (connection,
                              root,
                              spec);
diff --git a/src/backend/taler-merchant-httpd_tip-authorize.c 
b/src/backend/taler-merchant-httpd_tip-authorize.c
index 3650acf..5eb274d 100644
--- a/src/backend/taler-merchant-httpd_tip-authorize.c
+++ b/src/backend/taler-merchant-httpd_tip-authorize.c
@@ -337,11 +337,6 @@ MH_handler_tip_authorize (struct TMH_RequestHandler *rh,
       GNUNET_free (pickup_url);
     }
 
-    if (GNUNET_OK != TMH_convert_amount (tac->root, "amount"))
-      return TMH_RESPONSE_reply_arg_invalid (connection,
-                                             TALER_EC_PARAMETER_MALFORMED,
-                                             "amount");
-
     res = TMH_PARSE_json_data (connection,
                                tac->root,
                                spec);

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



reply via email to

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