summaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2022-05-11 15:47:00 -0300
committerSebastian <sebasjm@gmail.com>2022-05-11 15:51:13 -0300
commit4b77ed9f39cd0512735dee9f4f9daeb80f4c1f97 (patch)
treec9dfe63b3e986b72823d83c1fcd4d40ff5daabc1 /src/backend
parent26e4d3e24ff5f567bde3905a5185c54ccc6553c4 (diff)
downloadmerchant-4b77ed9f39cd0512735dee9f4f9daeb80f4c1f97.tar.gz
merchant-4b77ed9f39cd0512735dee9f4f9daeb80f4c1f97.tar.bz2
merchant-4b77ed9f39cd0512735dee9f4f9daeb80f4c1f97.zip
fix: should calculate contract hash when was not send as req param
used in lookup_refunds_detailed
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/taler-merchant-httpd_get-orders-ID.c64
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)