diff options
-rw-r--r-- | src/backend/taler-merchant-httpd_get-orders-ID.c | 64 |
1 files changed, 42 insertions, 22 deletions
diff --git a/src/backend/taler-merchant-httpd_get-orders-ID.c b/src/backend/taler-merchant-httpd_get-orders-ID.c index c563f7c2..1cc0098d 100644 --- a/src/backend/taler-merchant-httpd_get-orders-ID.c +++ b/src/backend/taler-merchant-httpd_get-orders-ID.c @@ -1052,33 +1052,53 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh, /* Check if client provided the right hash code of the contract terms */ if (NULL != god->contract_terms) { - struct TALER_PrivateContractHashP h; - contract_available = true; - if (GNUNET_OK != - TALER_JSON_contract_hash (god->contract_terms, - &h)) + + if (GNUNET_YES == GNUNET_is_zero (&god->h_contract_terms)) { - GNUNET_break (0); - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_GENERIC_FAILED_COMPUTE_JSON_HASH, - "contract terms"); + + if (GNUNET_OK != + TALER_JSON_contract_hash (god->contract_terms, + &god->h_contract_terms)) + { + GNUNET_break (0); + return TALER_MHD_reply_with_error (connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_GENERIC_FAILED_COMPUTE_JSON_HASH, + "contract terms"); + } + } - contract_match = (0 == - GNUNET_memcmp (&h, - &god->h_contract_terms)); - if ( (GNUNET_NO == - GNUNET_is_zero (&god->h_contract_terms)) && - (! contract_match) ) + else { - GNUNET_break_op (0); - return TALER_MHD_reply_with_error ( - connection, - MHD_HTTP_FORBIDDEN, - TALER_EC_MERCHANT_GENERIC_CONTRACT_HASH_DOES_NOT_MATCH_ORDER, - NULL); + + struct TALER_PrivateContractHashP h; + + if (GNUNET_OK != + TALER_JSON_contract_hash (god->contract_terms, + &h)) + { + GNUNET_break (0); + return TALER_MHD_reply_with_error (connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_GENERIC_FAILED_COMPUTE_JSON_HASH, + "contract terms"); + } + contract_match = (0 == + GNUNET_memcmp (&h, + &god->h_contract_terms)); + if ( !contract_match ) + { + GNUNET_break_op (0); + return TALER_MHD_reply_with_error ( + connection, + MHD_HTTP_FORBIDDEN, + TALER_EC_MERCHANT_GENERIC_CONTRACT_HASH_DOES_NOT_MATCH_ORDER, + NULL); + } + } + } if (contract_available) |