commit 81e3d4fe0930e964a2012df3d5e994edcff1da26
parent 9d913c147b7a74fd24cac9d21e0064f0039aa919
Author: Christian Grothoff <christian@grothoff.org>
Date: Mon, 17 May 2021 21:39:05 +0200
check for compatible currency during POST
Diffstat:
2 files changed, 22 insertions(+), 0 deletions(-)
diff --git 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
@@ -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. */