diff options
author | Marcello Stanisci <marcello.stanisci@inria.fr> | 2017-06-13 21:05:32 +0200 |
---|---|---|
committer | Marcello Stanisci <marcello.stanisci@inria.fr> | 2017-06-13 21:06:06 +0200 |
commit | f432e22ff0e34ae0573cee58b783adbfbc54d1ec (patch) | |
tree | 95e88d564b94ad6c2ff5cbc8eeaf50e0cc70dd16 /src/backenddb/plugin_merchantdb_postgres.c | |
parent | bd79ca83a26aec30d5b5e60ef573b56d5f8c8645 (diff) | |
download | merchant-f432e22ff0e34ae0573cee58b783adbfbc54d1ec.tar.gz merchant-f432e22ff0e34ae0573cee58b783adbfbc54d1ec.tar.bz2 merchant-f432e22ff0e34ae0573cee58b783adbfbc54d1ec.zip |
Add error when coins are not sufficient to pay a refund
back.
Diffstat (limited to 'src/backenddb/plugin_merchantdb_postgres.c')
-rw-r--r-- | src/backenddb/plugin_merchantdb_postgres.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c index dee509cd..d51f4019 100644 --- a/src/backenddb/plugin_merchantdb_postgres.c +++ b/src/backenddb/plugin_merchantdb_postgres.c @@ -2039,6 +2039,9 @@ process_deposits_cb (void *cls, } + /** + * Check if the refund is bigger than the previous awarded. + */ if (-1 == TALER_amount_cmp (&attempted_refund, &previous_refund)) { @@ -2053,6 +2056,18 @@ process_deposits_cb (void *cls, } /** + * Check if all the refund has been allocated + */ + if ( (0 != ctx->refund->value) || + (0 != ctx->refund->fraction) ) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "This refund is bigger than the coins capacity\n"); + ctx->err = GNUNET_NO; + return; + } + + /** * NOTE: we don't check if all the refund has been covered. * Although this should be checked, it's safe to assume yes, * as the business will never issue a refund bigger than the |