summaryrefslogtreecommitdiff
path: root/integration-tests/json_checks.py
blob: 916712a687a60d9b1f74b7237e13371572285ac8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#!/usr/bin/env python3

# This minimal library checks only if the JSON values
# contains the expected fields, without actually checking
# if the fields' value match the API.

from util import CheckJsonField as F, CheckJsonTop as T

def checkNewUserRequest(json):
    c = T(F("username"), F("password"))
    return c.check(json)

def checkBankAccountElement(json):
    c = T(
        F("nexusBankAccountId"),
        F("iban"),
        F("bic"),
        F("ownerName")
    )
    return c.check(json)

def checkPreparePayment(json):
    c = T(
        F("iban"),
        F("bic"),
        F("name"),
        F("subject"),
        F("amount")
    )
    return c.check(json)

def checkBankConnection(json):
    c = T(
        F("bankConnectionId"),
        F("bankConnectionType"),
        F("ready"),
        F("bankKeysReviewed")
    )
    return c.check(json)

def checkDeleteConnection(json):
    c = T(F("bankConnectionId"))
    return c.check(json)

def checkConnectionListElement(json):
    c = T(
        F("name"),
        F("type")
    )
    return c.check(json)

def checkPreparedPaymentResponse(json):
    c = T(F("uuid"))
    return c.check(json)

def checkPreparedPaymentElement(json):
    c = T(
        F("paymentInitiationId"),
        F("submitted"),
        F("creditorIban"),
        F("creditorBic"),
        F("creditorName"),
        F("amount"),
        F("subject"),
        F("submissionDate"),
        F("preparationDate")
    )
    return c.check(json)

def checkFetchTransactions(json):
    c = T(
            F("rangeType"),
            F("level")
    )
    return c.check(json)

def checkTransaction(json):
    c = T(
            F("account"),
            F("counterpartIban"),
            F("counterpartBic"),
            F("counterpartName"),
            F("amount"),
            F("date"),
            F("subject")
    )
    return c.check(json)

def checkNewEbicsConnection(json):
    c = T(
            F("source"),
            F("name"),
            F("type"),
            F("data", T(
                F("ebicsURL"),
                F("hostID"),
                F("partnerID"),
                F("userID"),
            ))
    )
    return c.check(json)

def checkImportAccount(json):
    c = T(F("nexusBankAccountId"),
          F("offeredAccountId"))
    return c.check(json)

def checkSandboxEbicsHosts(json):
    c = T(F("hostID"),
          F("ebicsVersion"))
    return c.check(json)

def checkSandboxEbicsSubscriber(json):
    c = T(F("hostID"),
          F("userID"),
          F("partnerID"),
          F("systemID", optional=True))
    return c.check(json)

def checkSandboxBankAccount(json):
    c = T(
        F("iban"),
        F("bic"),
        F("name"),
        F("subscriber"),
        F("label")
    )
    return c.check(json)

def checkBackupDetails(json):
    return T(F("passphrase")).check(json)