diff options
Diffstat (limited to 'talerbank/app/schemas.py')
-rw-r--r-- | talerbank/app/schemas.py | 43 |
1 files changed, 6 insertions, 37 deletions
diff --git a/talerbank/app/schemas.py b/talerbank/app/schemas.py index a27524d..01503a2 100644 --- a/talerbank/app/schemas.py +++ b/talerbank/app/schemas.py @@ -63,9 +63,6 @@ class HistoryParamsBase(forms.Form): "^(omit|show)$", message="Only 'omit' or 'show' are valid")]) - # FIXME: adjust min/max values. - start = forms.IntegerField(required=False) - ordering = forms.CharField( required=False, empty_value="descending", @@ -85,6 +82,12 @@ class HistoryParamsBase(forms.Form): class HistoryParams(HistoryParamsBase): # FIXME: adjust min/max values. delta = forms.IntegerField() + start = forms.IntegerField(required=False) + +class HistoryRangeParams(HistoryParamsBase): + # FIXME: adjust min/max values. + end = forms.IntegerField() + start = forms.IntegerField() ## # Exception class to be raised when a expected URL parameter @@ -203,32 +206,6 @@ REJECT_REQUEST_SCHEMA = { } } - -## -# Definition for /history-range request URL parameters. -HISTORY_RANGE_REQUEST_SCHEMA = { - "type": "object", - "properties": { - "auth": {"type": "string", "pattern": "^basic$"}, - "cancelled": {"type": "string", - "pattern": "^(omit|show)$", - "required": False}, - "start": {"type": "string", - "pattern": r"^[0-9]+$"}, - "end": {"type": "string", - "pattern": r"^[0-9]+$"}, - "ordering": {"type": "string", - "pattern": r"^(ascending|descending)$", - "required": False}, - "direction": {"type": "string", - "pattern": r"^(debit|credit|both|cancel\+|cancel-)$"}, - "account_number": {"type": "string", - "pattern": "^([0-9]+)$", - "required": False} - } -} - - ## # Definition for /add/incoming request bodies. INCOMING_REQUEST_SCHEMA = { @@ -298,13 +275,6 @@ def validate_reject(data): validate(data, REJECT_REQUEST_SCHEMA) ## -# Check /history-range input data. -# -# @param data dict representing /history's GET parameters. -def validate_history_range(data): - validate(data, HISTORY_RANGE_REQUEST_SCHEMA) - -## # Check wire details # (regardless of which endpoint triggered the check) # @@ -342,7 +312,6 @@ def check_withdraw_session(data): def validate_data(request, data): switch = { "/reject": validate_reject, - "/history-range": validate_history_range, "/admin/add/incoming": validate_add_incoming, "/pin/verify": check_withdraw_session, "/pin/question": validate_pin_tan |