gnunet-svn
[Top][All Lists]
Advanced

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

[taler-bank] branch master updated (47ff439 -> 1250877)


From: gnunet
Subject: [taler-bank] branch master updated (47ff439 -> 1250877)
Date: Thu, 16 Jan 2020 20:14:12 +0100

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

dold pushed a change to branch master
in repository bank.

    from 47ff439  preparations towards the new bank API
     new 17c936d  new URL patterns and API skeleton
     new 1250877  completely remove history-range API

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/schemas.py | 10 -------
 talerbank/app/urls.py    | 17 +++++++++++-
 talerbank/app/views.py   | 70 ++++++++----------------------------------------
 3 files changed, 27 insertions(+), 70 deletions(-)

diff --git a/talerbank/app/schemas.py b/talerbank/app/schemas.py
index 91d6c0a..291ec5b 100644
--- a/talerbank/app/schemas.py
+++ b/talerbank/app/schemas.py
@@ -205,16 +205,6 @@ class HistoryParams(BankValidator):
         start = forms.IntegerField(required=False)
 
 
-class HistoryRangeParams(BankValidator):
-    def __init__(self, data):
-        super(HistoryRangeParams, self).__init__(self.InnerValidator, data)
-
-    class InnerValidator(HistoryParamsBase):
-        # FIXME: adjust min/max values.
-        end = forms.IntegerField()
-        start = forms.IntegerField()
-
-
 class PaytoField(forms.Field):
     def __init__(self, **kwargs):
         super().__init__(**kwargs)
diff --git a/talerbank/app/urls.py b/talerbank/app/urls.py
index cabdc22..58e7b70 100644
--- a/talerbank/app/urls.py
+++ b/talerbank/app/urls.py
@@ -23,7 +23,23 @@ from django.views.generic.base import RedirectView
 from django.contrib.auth import views as auth_views
 from . import views
 
+taler_wire_gateway_patterns = [
+    path("admin/add-incoming", views.add_incoming, name="add-incoming"),
+    path("history/incoming", views.twg_history_incoming, 
name="twg-history-incoming"),
+    path("history/outgoing", views.twg_history_outgoing, 
name="twg-history-outgoing"),
+    path("transfer", views.twg_history_outgoing, name="twg-history-outgoing"),
+]
+
+taler_bank_api_patterns = [
+    path("testing/withdraw", views.withdraw_headless, name="testing-withdraw"),
+    path("testing/withdraw-uri", views.withdraw_headless_uri, 
name="testing-withdraw-uri"),
+    path("testing/register", views.register_headless, 
name="testing-withdraw-register"),
+    path("withdrawal-operation/<str:withdraw_id>", views.register_headless, 
name="tba-withdrawal-operation"),
+]
+
 urlpatterns = [
+    path("taler-bank-api", include(taler_bank_api_patterns)),
+    path("taler-wire-gateway", include(taler_wire_gateway_patterns)),
     path("", RedirectView.as_view(pattern_name="profile"), name="index"),
     path("favicon.ico", views.ignore),
     path("admin/add/incoming", views.add_incoming, name="add-incoming"),
@@ -39,7 +55,6 @@ urlpatterns = [
     path("accounts/register", views.register, name="register"),
     path("profile", views.profile_page, name="profile"),
     path("history", views.serve_history, name="history"),
-    path("history-range", views.serve_history_range, name="history-range"),
     path(
         "api/withdraw-operation/<str:withdraw_id>",
         views.api_withdraw_operation,
diff --git a/talerbank/app/views.py b/talerbank/app/views.py
index 3df8505..22cf62f 100644
--- a/talerbank/app/views.py
+++ b/talerbank/app/views.py
@@ -51,7 +51,6 @@ import qrcode.image.svg
 import lxml
 from .schemas import (
     HistoryParams,
-    HistoryRangeParams,
     URLParamValidationError,
     AddIncomingData,
     JSONFieldException,
@@ -626,36 +625,6 @@ def direction_switch(bank_account, direction):
     return direction_switch.get(direction)
 
 
-##
-# Main routine querying for histories, based on _date ranges_.
-#
-# @param bank_account the bank account object whose
-#        history is being extracted.
-# @param direction takes the following three values,
-#        * debit: only entries where the querying user has _paid_
-#                 will be returned.
-#        * credit: only entries where the querying user _got_
-#                  paid will be returned.
-#        * both: both of the cases above will be returned.
-#        * cancel+: only entries where the querying user cancelled
-#                   the _receiving_ of money will be returned.
-#        * cancel-: only entries where the querying user cancelled
-#                   the _paying_ of money will be returned.
-# @param start timestamp of the oldest element allowed in the
-#        result.
-# @param end timestamp of the youngest element allowed in the
-#        result.
-# @param descending if True, then the results will have the
-#        youngest entry in the first position.
-def query_history_range(bank_account, direction, start, end, descending):
-    qs = BankTransaction.objects.filter(
-        direction_switch(bank_account, direction), Q(date__gte=start), 
Q(date__lte=end)
-    )
-
-    order = "-id" if descending else "id"
-    return qs.order_by(order)
-
-
 ##
 # Main routine querying for histories.
 #
@@ -733,34 +702,6 @@ def build_history_response(qs, cancelled, user_account):
     return history
 
 
-##
-# Serve a request of /history-range.
-#
-# @param request Django-specific HTTP request.
-# @param user_account the account whose history should be gotten.
-# @return Django-specific HTTP response object.
-@require_GET
-@login_via_headers
-def serve_history_range(request, user_account):
-
-    args = HistoryRangeParams(request.GET.dict())
-
-    start_td = datetime.fromtimestamp(args.get("start"))
-    end_td = datetime.fromtimestamp(args.get("end"))
-
-    qs = query_history_range(
-        user_account.bankaccount,
-        args.get("direction", "both"),
-        start_td,
-        end_td,
-        args.get("ordering"),
-    )
-
-    history = build_history_response(qs, args.get("cancelled", "show"), 
user_account)
-
-    return JsonResponse(dict(data=history), status=200)
-
-
 ##
 # Serve a request of /history.
 #
@@ -783,6 +724,17 @@ def serve_history(request, user_account):
     return JsonResponse(dict(data=history), status=200)
 
 
+@require_GET
+@login_via_headers
+def twg_history_incoming(request, user_account):
+    pass
+
+@require_GET
+@login_via_headers
+def twg_history_outgoing(request, user_account):
+    pass
+
+
 ##
 # Implements the HTTP basic auth schema.
 #

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



reply via email to

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