diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-03-06 13:27:58 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-03-06 13:27:58 +0100 |
commit | 8cbdf68695418f1e879c4005615df82dea4ef688 (patch) | |
tree | 046558c3b43a22b8b8705ab45ea183bc0ac4f9b2 /src/backend | |
parent | 690b9c9e245a0c4a55e54f066348bd1200f5115d (diff) | |
download | merchant-8cbdf68695418f1e879c4005615df82dea4ef688.tar.gz merchant-8cbdf68695418f1e879c4005615df82dea4ef688.tar.bz2 merchant-8cbdf68695418f1e879c4005615df82dea4ef688.zip |
check if field is present before going for full spec-parser
Diffstat (limited to 'src/backend')
-rw-r--r-- | src/backend/taler-merchant-httpd_pay.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/backend/taler-merchant-httpd_pay.c b/src/backend/taler-merchant-httpd_pay.c index 090ae144..f2773edb 100644 --- a/src/backend/taler-merchant-httpd_pay.c +++ b/src/backend/taler-merchant-httpd_pay.c @@ -1,6 +1,6 @@ /* This file is part of TALER - (C) 2014, 2015, 2016, 2017 GNUnet e.V. and INRIA + (C) 2014-2017 GNUnet e.V. and INRIA 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 @@ -1060,6 +1060,8 @@ parse_pay (struct MHD_Connection *connection, } /* parse optional details */ + if (NULL != json_object_get (pc->proposal_data, + "max_wire_fee")) { struct GNUNET_JSON_Specification espec[] = { TALER_JSON_spec_amount ("max_wire_fee", @@ -1072,12 +1074,15 @@ parse_pay (struct MHD_Connection *connection, espec); if (GNUNET_YES != res) { + GNUNET_break_op (0); /* invalid input, use default */ /* default is we cover no fee */ GNUNET_assert (GNUNET_OK == TALER_amount_get_zero (pc->max_fee.currency, &pc->max_wire_fee)); } } + if (NULL != json_object_get (pc->proposal_data, + "wire_fee_amortization")) { struct GNUNET_JSON_Specification espec[] = { GNUNET_JSON_spec_uint32 ("wire_fee_amortization", @@ -1091,6 +1096,7 @@ parse_pay (struct MHD_Connection *connection, if ( (GNUNET_YES != res) || (0 == pc->wire_fee_amortization) ) { + GNUNET_break_op (0); /* invalid input, use default */ /* default is no amortization */ pc->wire_fee_amortization = 1; } |