summaryrefslogtreecommitdiff
path: root/talerbank/app/schemas.py
diff options
context:
space:
mode:
Diffstat (limited to 'talerbank/app/schemas.py')
-rw-r--r--talerbank/app/schemas.py22
1 files changed, 9 insertions, 13 deletions
diff --git a/talerbank/app/schemas.py b/talerbank/app/schemas.py
index 91771d1..e43947d 100644
--- a/talerbank/app/schemas.py
+++ b/talerbank/app/schemas.py
@@ -20,9 +20,8 @@ definitions of JSON schemas for validating data
"""
import validictory
-from django.core.exceptions import ValidationError
-wiredetails_schema = {
+WIREDETAILS_SCHEMA = {
"type": "object",
"properties": {
"test": {
@@ -37,7 +36,7 @@ wiredetails_schema = {
}
}
-auth_schema = {
+AUTH_SCHEMA = {
"type": "object",
"properties": {
"type": {"type": "string"},
@@ -45,7 +44,7 @@ auth_schema = {
}
}
-amount_schema = {
+AMOUNT_SCHEMA = {
"type": "object",
"properties": {
"value": {"type": "integer"},
@@ -54,25 +53,22 @@ amount_schema = {
}
}
-incoming_request_schema = {
+INCOMING_REQUEST_SCHEMA = {
"type": "object",
"properties": {
- "amount": {"type": amount_schema},
+ "amount": {"type": AMOUNT_SCHEMA},
"wtid": {"type": "string"},
"exchange_url": {"type": "string"},
"credit_account": {"type": "integer"},
- "auth": auth_schema
+ "auth": AUTH_SCHEMA
}
}
def validate_amount(amount):
- validictory.validate(amount, amount_schema)
+ validictory.validate(amount, AMOUNT_SCHEMA)
def validate_wiredetails(wiredetails):
- validictory.validate(wiredetails, wiredetails_schema)
+ validictory.validate(wiredetails, WIREDETAILS_SCHEMA)
def validate_incoming_request(incoming_request):
- validictory.validate(incoming_request, incoming_request_schema)
-
-def validate_auth_basic(auth_basic):
- validictory.validate(auth_basic, auth_basic_schema)
+ validictory.validate(incoming_request, INCOMING_REQUEST_SCHEMA)