commit 7612d3c0d5c5855088705bcc76142877f5ba6bc1
parent f7a956bf01babb2ac010cc2fbe2ff663c8290198
Author: Marcello Stanisci <marcello.stanisci@inria.fr>
Date: Thu, 22 Jun 2017 14:58:00 +0200
reject non increasing amounts
Diffstat:
3 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/backend/taler-merchant-httpd_refund.c b/src/backend/taler-merchant-httpd_refund.c
@@ -484,7 +484,7 @@ MH_handler_refund_lookup (struct TMH_RequestHandler *rh,
/*This is very odd, as the unhashed version *was* found earlier*/
return TMH_RESPONSE_reply_not_found (connection,
TALER_EC_REFUND_H_CONTRACT_TERMS_UNKNOWN,
- "h_contract_terms not found in database");
+ "h_contract_terms not found among granted refunds");
}
if (GNUNET_SYSERR == res)
diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c
@@ -2084,8 +2084,8 @@ process_deposits_cb (void *cls,
/**
* Check if the refund is bigger than the previous awarded.
*/
- if (-1 == TALER_amount_cmp (&attempted_refund,
- &previous_refund))
+ if (2 != (1 + TALER_amount_cmp (&attempted_refund,
+ &previous_refund)))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
diff --git a/src/backenddb/test_merchantdb.c b/src/backenddb/test_merchantdb.c
@@ -576,6 +576,14 @@ run (void *cls)
&refund_amount,
"refund testing"));
+ FAILIF (GNUNET_NO !=
+ plugin->increase_refund_for_contract (plugin->cls,
+ &h_contract_terms,
+ &merchant_pub,
+ &refund_amount,
+ "same refund amount as "
+ "the previous one, should fail"));
+
/*Should fail as this refund a lesser amount respect to the previous one*/
FAILIF (GNUNET_NO !=
plugin->increase_refund_for_contract (plugin->cls,