gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-bank] branch master updated (75fbd51 -> 6e0b64b)


From: gnunet
Subject: [GNUnet-SVN] [taler-bank] branch master updated (75fbd51 -> 6e0b64b)
Date: Thu, 16 Nov 2017 13:54:41 +0100

This is an automated email from the git hooks/post-receive script.

marcello pushed a change to branch master
in repository bank.

    from 75fbd51  instantiate and show the wire transfer form
     new 626e8a7  show informational bar about wire transfer outcome
     new 6e0b64b  tolerating non fractional amounts given

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 talerbank/app/views.py | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/talerbank/app/views.py b/talerbank/app/views.py
index 6732b00..4567aa1 100644
--- a/talerbank/app/views.py
+++ b/talerbank/app/views.py
@@ -26,6 +26,7 @@ import requests
 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 import forms
 from django.conf import settings
@@ -91,7 +92,7 @@ def get_session_flag(request, name):
 
 class WTForm(forms.Form):
     '''Form used to wire transfer funds internally in the bank.'''
-    amount = forms.DecimalField(label=settings.TALER_CURRENCY)
+    amount = forms.FloatField(label=settings.TALER_CURRENCY)
     counterpart = forms.IntegerField()
     subject = forms.CharField()
 
@@ -103,14 +104,17 @@ def profile_page(request):
     if request.method == "POST":
         wtf = WTForm(request.POST)
         if wtf.is_valid(): 
+            amount_parts = (settings.TALER_CURRENCY,
+                            wtf.cleaned_data.get("amount") + 0.0)
             try:
-                wire_transfer(Amount.parse(settings.TALER_CURRENCY + ":" + 
str(wtf.cleaned_data.get("amount"))),
+                wire_transfer(Amount.parse("%s:%s" % amount_parts),
                               BankAccount.objects.get(user=request.user),
                               
BankAccount.objects.get(account_no=wtf.cleaned_data.get("counterpart")),
                               wtf.cleaned_data.get("subject"))
-                session["just_wire_transferred"] = True
-            except WireTransferException:
-                session["wire_transfer_error"] = True
+                request.session["just_wire_transferred"] = True
+            except (WireTransferException, BadFormatAmount) as exc:
+                LOGGER.error(exc)
+                request.session["wire_transfer_error"] = True
 
     else:
         wtf = WTForm()
@@ -136,6 +140,8 @@ def profile_page(request):
         just_withdrawn=just_withdrawn,
         just_registered=just_registered,
         no_initial_bonus=no_initial_bonus,
+        just_wire_transferred=just_wire_transferred,
+        wire_transfer_error=wire_transfer_error
     )
     if settings.TALER_SUGGESTED_EXCHANGE:
         context["suggested_exchange"] = settings.TALER_SUGGESTED_EXCHANGE

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]