From a58cbb5129b94b995f9cecd6b6521ca349c9cf6c Mon Sep 17 00:00:00 2001 From: MS Date: Thu, 10 Jun 2021 16:30:28 +0200 Subject: early stop when currency doesn't match --- talerbank/app/views.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'talerbank/app/views.py') diff --git a/talerbank/app/views.py b/talerbank/app/views.py index 63387b7..f75d08b 100644 --- a/talerbank/app/views.py +++ b/talerbank/app/views.py @@ -905,6 +905,16 @@ def twg_add_incoming(request, user_account, acct_id): debit_account = BankAccount.objects.get(user=debit_user) subject = f"{reserve_pub}" + # check if currency is acceptable + if amount.currency != settings.TALER_CURRENCY: + return JsonResponse( + { + "code": 30, # TALER_EC_BANK_DUPLICATE_RESERVE_PUB_SUBJECT + "hint": "The specified currency is not supported." + }, + status=HTTPStatus.CONFLICT + ) + # check if reserve pub exists already. try: BankTransaction.objects.get(subject=subject) -- cgit v1.2.3