|
23 | 23 | VALIDATE_RELATIONSHIP_INCLUDE_009, |
24 | 24 | VALIDATE_RELATIONSHIP_INCLUDE_025, |
25 | 25 | INTERNAL_SERVER_ERROR_EXAMPLE, |
| 26 | + CONSENT__ADULT_CONSENTING_EXAMPLE, |
| 27 | + CONSENT__MIXED_EXAMPLE, |
| 28 | + CONSENT__MOTHER_CHILD_EXAMPLE, |
| 29 | + CONSENT_PERFORMER, |
26 | 30 | ) |
27 | 31 |
|
28 | 32 | app = Flask(__name__) |
@@ -122,8 +126,30 @@ def get_consent() -> Union[dict, tuple]: |
122 | 126 | Union[dict, tuple]: Response for GET /Consent |
123 | 127 | """ |
124 | 128 | try: |
125 | | - return generate_response_from_example(INTERNAL_SERVER_ERROR_EXAMPLE, 500) |
126 | | - |
| 129 | + performer_identifier = remove_system(request.args.get("performer:identifier")) |
| 130 | + status = request.args.get("status") |
| 131 | + _include = request.args.get("_include") |
| 132 | + |
| 133 | + if ( |
| 134 | + performer_identifier == "9000000017" |
| 135 | + and status == "active" |
| 136 | + and _include == CONSENT_PERFORMER |
| 137 | + ): |
| 138 | + return generate_response_from_example( |
| 139 | + CONSENT__ADULT_CONSENTING_EXAMPLE, 200 |
| 140 | + ) |
| 141 | + elif ( |
| 142 | + performer_identifier == "9000000016" |
| 143 | + and status == "active" |
| 144 | + and _include == CONSENT_PERFORMER |
| 145 | + ): |
| 146 | + return generate_response_from_example(CONSENT__MIXED_EXAMPLE, 200) |
| 147 | + elif ( |
| 148 | + performer_identifier == "9000000015" |
| 149 | + and status == "active" |
| 150 | + and _include == CONSENT_PERFORMER |
| 151 | + ): |
| 152 | + return generate_response_from_example(CONSENT__MOTHER_CHILD_EXAMPLE, 200) |
127 | 153 | # else: |
128 | 154 | # logger.error(e) |
129 | 155 | # return generate_response(load_json_file(ERROR_RESPONSE), 400) |
|
0 commit comments