Commit 0e6e50c9 authored by Angelo Veltens's avatar Angelo Veltens

describe error handling

parent 2a4f1616
# Ticket Scanner Code Kata
Inspired by:
https://ccd-school.de/coding-dojo/application-katas/ticket-scanner/
## Register valid ticket / generate code
......@@ -19,16 +21,6 @@ POST /codes
<from>2019-10-02 06:00</from>
<to>2019-10-03 10:00</from>
</validity>
<seats>
<seat>
<row>45</row>
<number>4</number>
</seat>
<seat>
<row>45</row>
<number>5</number>
</seat>
</seats>
</ticket>
```
......@@ -58,16 +50,6 @@ GET /codes/ABC123
<from>2019-10-02 06:00</from>
<to>2019-10-03 10:00</from>
</validity>
<seats>
<seat>
<row>45</row>
<number>4</number>
</seat>
<seat>
<row>45</row>
<number>5</number>
</seat>
</seats>
</ticket>
</ticket>
```
......@@ -79,3 +61,39 @@ DELETE /codes/ABC123
```
The code is thereby invalidated and he seats are marked as "in-use".
## Check in denied
Both, GET and DELETE request will cause errors, when the code is invalid
```http request
GET /codes/ABC123
```
```http request
DELETE /codes/ABC123
```
### Responses
`404 Not found` unknown code
`403 Forbidden` when access is not granted
```xml
<errors>
<error code="event.id">
<code id="ABC123" />
<message>The code is not valid for the current event</message>
<actualValue>36937a9d-ee73-4f43-b2ee-c17c0d1eba30</actualValue>
<expectedValue>1c65bfdf-d1d4-4a69-9958-850f850d0766</expectedValue>
</error>
<error code="validity.from">
<code id="ABC123" />
<message>The code is not yet valid</message>
<actualValue>2019-10-01 06:00</actualValue>
<expectedValue>2019-10-02 06:00</expectedValue>
</error>
</errors>
```
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment