From 81e3d4fe0930e964a2012df3d5e994edcff1da26 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 17 May 2021 21:39:05 +0200 Subject: check for compatible currency during POST --- src/backend/taler-merchant-httpd_private-post-reserves.c | 11 +++++++++++ src/backend/taler-merchant-httpd_private-post-transfers.c | 11 +++++++++++ 2 files changed, 22 insertions(+) (limited to 'src') diff --git a/src/backend/taler-merchant-httpd_private-post-reserves.c b/src/backend/taler-merchant-httpd_private-post-reserves.c index f4c001b1..095264d3 100644 --- a/src/backend/taler-merchant-httpd_private-post-reserves.c +++ b/src/backend/taler-merchant-httpd_private-post-reserves.c @@ -267,6 +267,17 @@ TMH_private_post_reserves (const struct TMH_RequestHandler *rh, ? MHD_YES : MHD_NO; } + if (0 != + strcasecmp (rc->initial_balance.currency, + TMH_currency)) + { + GNUNET_break_op (0); + return TALER_MHD_reply_with_error ( + connection, + MHD_HTTP_CONFLICT, + TALER_EC_GENERIC_CURRENCY_MISMATCH, + TMH_currency); + } rc->fo = TMH_EXCHANGES_find_exchange (rc->exchange_url, wire_method, GNUNET_NO, diff --git a/src/backend/taler-merchant-httpd_private-post-transfers.c b/src/backend/taler-merchant-httpd_private-post-transfers.c index 505ca33f..76f86ce2 100644 --- a/src/backend/taler-merchant-httpd_private-post-transfers.c +++ b/src/backend/taler-merchant-httpd_private-post-transfers.c @@ -928,6 +928,17 @@ TMH_private_post_transfers (const struct TMH_RequestHandler *rh, return (GNUNET_NO == res) ? MHD_YES : MHD_NO; + if (0 != + strcasecmp (ptc->amount.currency, + TMH_currency)) + { + GNUNET_break_op (0); + return TALER_MHD_reply_with_error ( + connection, + MHD_HTTP_CONFLICT, + TALER_EC_GENERIC_CURRENCY_MISMATCH, + TMH_currency); + } } /* Check if transfer data is in database, if not, add it. */ -- cgit v1.2.3