diff options
author | Florian Dold <florian.dold@gmail.com> | 2018-01-29 19:28:06 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2018-01-29 19:28:06 +0100 |
commit | f587019dcb27ae15991b6166ac31427b1c6e782c (patch) | |
tree | ab3adde1bdfb6d00cec63a4f0a60b8586983b661 /src | |
parent | 60fdfe75bdd94a9a59caf453523a45f0c6f15ea4 (diff) | |
download | merchant-f587019dcb27ae15991b6166ac31427b1c6e782c.tar.gz merchant-f587019dcb27ae15991b6166ac31427b1c6e782c.tar.bz2 merchant-f587019dcb27ae15991b6166ac31427b1c6e782c.zip |
no need to convert amount now
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/taler-merchant-httpd.c | 24 | ||||
-rw-r--r-- | src/backend/taler-merchant-httpd.h | 13 | ||||
-rw-r--r-- | src/backend/taler-merchant-httpd_proposal.c | 5 | ||||
-rw-r--r-- | src/backend/taler-merchant-httpd_refund.c | 5 | ||||
-rw-r--r-- | src/backend/taler-merchant-httpd_tip-authorize.c | 5 |
5 files changed, 0 insertions, 52 deletions
diff --git a/src/backend/taler-merchant-httpd.c b/src/backend/taler-merchant-httpd.c index 5390b00a..a3081be0 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 078c0383..baac847c 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 a5756d1d..390ddd1c 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 57cff6a6..f875be1f 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 3650acf7..5eb274df 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); |