[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-bank] branch master updated: +details about wire tra
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-bank] branch master updated: +details about wire transfer errors |
Date: |
Thu, 16 Nov 2017 16:07:30 +0100 |
This is an automated email from the git hooks/post-receive script.
marcello pushed a commit to branch master
in repository bank.
The following commit(s) were added to refs/heads/master by this push:
new 7d6e222 +details about wire transfer errors
7d6e222 is described below
commit 7d6e222081930433444e79410a2a7d0bba96f808
Author: Marcello Stanisci <address@hidden>
AuthorDate: Thu Nov 16 16:07:09 2017 +0100
+details about wire transfer errors
---
talerbank/app/templates/profile_page.html | 36 +++++++++++++++++--------------
talerbank/app/views.py | 21 ++++++++++++------
2 files changed, 34 insertions(+), 23 deletions(-)
diff --git a/talerbank/app/templates/profile_page.html
b/talerbank/app/templates/profile_page.html
index 74dfb85..3bc8ebd 100644
--- a/talerbank/app/templates/profile_page.html
+++ b/talerbank/app/templates/profile_page.html
@@ -45,30 +45,34 @@
<article>
<div class="notification">
{% if wire_transfer_error %}
- <p class="informational informational-fail">
- Could not perform wire transfer, check all fields are correctly
- entered.
- </p>
+ <p class="informational informational-fail">
+ {% if info_bar %}
+ {{ info_bar }}
+ {% else %}
+ Could not perform wire transfer, check all fields are correctly
+ entered.
+ {% endif %}
+ </p>
{% endif %}
{% if just_wire_transferred %}
- <p class="informational informational-ok">
- Wire transfer done!
- </p>
+ <p class="informational informational-ok">
+ Wire transfer done!
+ </p>
{% endif %}
{% if no_initial_bonus %}
- <p class="informational informational-fail">
- No initial bonus given, poor bank!
- </p>
+ <p class="informational informational-fail">
+ No initial bonus given, poor bank!
+ </p>
{% endif %}
{% if just_withdrawn %}
- <p class="informational informational-ok">
- Withdrawal approved!
- </p>
+ <p class="informational informational-ok">
+ Withdrawal approved!
+ </p>
{% endif %}
{% if just_registered %}
- <p class="informational informational-ok">
- Registration successful!
- </p>
+ <p class="informational informational-ok">
+ Registration successful!
+ </p>
{% endif %}
</div>
</article>
diff --git a/talerbank/app/views.py b/talerbank/app/views.py
index 3001e32..2723efa 100644
--- a/talerbank/app/views.py
+++ b/talerbank/app/views.py
@@ -27,7 +27,7 @@ import django.contrib.auth
import django.contrib.auth.views
import django.contrib.auth.forms
from decimal import Decimal
-from django.db import transaction
+from django.db import transaction, models
from django import forms
from django.conf import settings
from django.contrib.auth.decorators import login_required
@@ -101,6 +101,7 @@ class WTForm(forms.Form):
@login_required
def profile_page(request):
+ info_bar = None
if request.method == "POST":
wtf = WTForm(request.POST)
if wtf.is_valid():
@@ -112,10 +113,14 @@ def profile_page(request):
BankAccount.objects.get(account_no=wtf.cleaned_data.get("counterpart")),
wtf.cleaned_data.get("subject"))
request.session["just_wire_transferred"] = True
- except (WireTransferException, BadFormatAmount) as exc:
- LOGGER.error(exc)
+ except BankAccount.DoesNotExist:
request.session["wire_transfer_error"] = True
-
+ info_bar = "Specified account for receiver does not exist"
+ except WireTransferException as exc:
+ request.session["wire_transfer_error"] = True
+ info_bar = "Internal server error, sorry!"
+ if isinstance(exc.exc, SameAccountException):
+ info_bar = "Operation not possible: debit and credit
account are the same!"
else:
wtf = WTForm()
@@ -141,7 +146,8 @@ def profile_page(request):
just_registered=just_registered,
no_initial_bonus=no_initial_bonus,
just_wire_transferred=just_wire_transferred,
- wire_transfer_error=wire_transfer_error
+ wire_transfer_error=wire_transfer_error,
+ info_bar = info_bar
)
if settings.TALER_SUGGESTED_EXCHANGE:
context["suggested_exchange"] = settings.TALER_SUGGESTED_EXCHANGE
@@ -507,13 +513,14 @@ def withdraw_nojs(request):
return response
class WireTransferException(Exception):
- def __init__(self, response):
+ def __init__(self, exc, response):
+ self.exc = exc
self.response = response
def wire_transfer_exc_handler(view_func):
def err_cb(exc, resp):
LOGGER.error(str(exc))
- raise WireTransferException(resp)
+ raise WireTransferException(exc, resp)
def _decorator(*args, request=None, session_expand=None):
try:
return view_func(*args)
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [taler-bank] branch master updated: +details about wire transfer errors,
gnunet <=