aboutsummaryrefslogtreecommitdiff
path: root/src/exchange/taler-exchange-httpd_deposit.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/exchange/taler-exchange-httpd_deposit.c')
-rw-r--r--src/exchange/taler-exchange-httpd_deposit.c36
1 files changed, 11 insertions, 25 deletions
diff --git a/src/exchange/taler-exchange-httpd_deposit.c b/src/exchange/taler-exchange-httpd_deposit.c
index 6e75dac5..fa6a3232 100644
--- a/src/exchange/taler-exchange-httpd_deposit.c
+++ b/src/exchange/taler-exchange-httpd_deposit.c
@@ -21,6 +21,7 @@
* @author Florian Dold
* @author Benedikt Mueller
* @author Christian Grothoff
+ * @author Özgür Kesim
*/
#include "platform.h"
#include <gnunet/gnunet_util_lib.h>
@@ -218,6 +219,7 @@ TEH_handler_deposit (struct MHD_Connection *connection,
struct TALER_EXCHANGEDB_Deposit deposit;
const char *payto_uri;
struct TALER_ExtensionPolicyHashP *ph_policy = NULL;
+ bool no_policy_details;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_string ("merchant_payto_uri",
&payto_uri),
@@ -254,7 +256,7 @@ TEH_handler_deposit (struct MHD_Connection *connection,
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_json ("policy",
&deposit.policy_details),
- &deposit.no_policy_details),
+ &no_policy_details),
GNUNET_JSON_spec_end ()
};
struct TALER_MerchantWireHashP h_wire;
@@ -328,31 +330,15 @@ TEH_handler_deposit (struct MHD_Connection *connection,
dc.deposit = &deposit;
/* Check policy */
- if (! deposit.no_policy_details)
+ deposit.has_policy_details = ! no_policy_details;
+ if (! deposit.has_policy_details)
{
- enum GNUNET_GenericReturnValue ret;
- const struct TALER_Extension *ext;
const char *error_hint = NULL;
- GNUNET_assert (ext->parse_policy_details);
-
- do {
- ret = TALER_extensions_from_policy_details (deposit.policy_details,
- &ext,
- &error_hint);
-
- if (GNUNET_OK != ret)
- break;
-
- deposit.policy_deadline = GNUNET_TIME_UNIT_FOREVER_TS;
-
- ret = ext->parse_policy_details (deposit.policy_details,
- &deposit.policy_serial_id,
- &deposit.policy_deadline,
- &error_hint);
-
- } while(0);
-
- if (GNUNET_OK != ret)
+ if (GNUNET_OK !=
+ TALER_extensions_serial_from_policy_details (deposit.policy_details,
+ &deposit.policy_serial_id,
+ &deposit.policy_deadline,
+ &error_hint))
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_BAD_REQUEST,
TALER_EC_EXCHANGE_DEPOSITS_POLICY_NOT_ACCEPTED,
@@ -424,7 +410,7 @@ TEH_handler_deposit (struct MHD_Connection *connection,
NULL);
}
- if (! deposit.no_policy_details)
+ if (deposit.has_policy_details)
{
TALER_deposit_policy_hash (deposit.policy_details,
&deposit.h_policy);