merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

commit f587019dcb27ae15991b6166ac31427b1c6e782c
parent 60fdfe75bdd94a9a59caf453523a45f0c6f15ea4
Author: Florian Dold <florian.dold@gmail.com>
Date:   Mon, 29 Jan 2018 19:28:06 +0100

no need to convert amount now

Diffstat:
Msrc/backend/taler-merchant-httpd.c | 24------------------------
Msrc/backend/taler-merchant-httpd.h | 13-------------
Msrc/backend/taler-merchant-httpd_proposal.c | 5-----
Msrc/backend/taler-merchant-httpd_refund.c | 5-----
Msrc/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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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);