Skip to content

Commit

Permalink
Merge pull request #17 from hmrc/RAS-328
Browse files Browse the repository at this point in the history
Ras 328
  • Loading branch information
RaminEsfandiari authored Jun 27, 2017
2 parents d6f8b74 + 10e80be commit b20ee1f
Show file tree
Hide file tree
Showing 3 changed files with 144 additions and 5 deletions.
51 changes: 48 additions & 3 deletions resources/public/api/conf/1.0/application.raml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ types:
relief at source claims.
displayName: Check if a customer is a Scottish resident
is: [headers.acceptHeader]
(annotations.sandboxData): !include testdata/get-residency-status.md
responses:
200:
body:
Expand All @@ -58,6 +59,50 @@ types:
"nextYearForecastResidencyStatus" : "scotResident"
}
403:
description:
The match has timed out and the UUID is no longer valid.
The match (POST to /match) will need to repeated.
body:
application/json:
description: |
The match has timed out and the UUID is no longer valid.
The match (POST to /match) will need to repeated.
type: !include schemas/ErrorCodes.schema.json
example: |
{
"code": "INVALID_UUID",
"message": "The match has timed out and the UUID is no longer valid. The match (POST to /match) will need to repeated."
}
404:
body:
application/json:
type: !include schemas/ErrorCodes.schema.json
examples:
ResourceNotFound:
description: Resource Not Found
value: |
{
"code" : "NOT_FOUND",
"message" : "Resource Not Found"
}
406:
body:
application/json:
type: !include schemas/ErrorCodes.schema.json
examples:
headerInvalid:
description: Accept header invalid
value: |
{
"code" : "ACCEPT_HEADER_INVALID",
"message" : "Accept header invalid"
}
500:
body:
application/json:
type: !include schemas/ErrorCodes.schema.json
examples:
internalServerError :
description: Internal Server Error
value: |
{
"code" : "INTERNAL_SERVER_ERROR",
"message" : "Internal Server Error"
}
3 changes: 1 addition & 2 deletions resources/public/api/conf/1.0/schemas/ErrorCodes.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
"INTERNAL_SERVER_ERROR",
"ACCEPT_HEADER_INVALID",
"NOT_FOUND",
"BAD_REQUEST",
"MATCHING_FAILED"
"INVALID_UUID"
]
}
}
Expand Down
95 changes: 95 additions & 0 deletions resources/public/api/conf/1.0/testdata/get-residency-status.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<table>
<col width="25%">
<col width="35%">
<col width="40%">
<thead>
<tr>
<th>Scenario</th>
<th>Request Payload</th>
<th>Example Response</th>
</tr>
</thead>
<tbody>
<tr>
<td><p>Request with a valid UUID</p><p class ="code--block">uuid: 2800a7ab-fe20-42ca-98d7-c33f4133cfc2</p></td>
<td>
<p>N/A</p>
</td>
<td><p>HTTP status: <code class="code--slim">200 (Ok)</code></p>
<p class="code--block">
{<br>
"currentYearResidencyStatus" : "otherUKResident",<br>
"nextYearForecastResidencyStatus" : "scotResident"<br>
}
</p>
</td>
</tr>
<tr>
<td><p>Request with an invalid UUID</p><p class ="code--block">uuid: 2800a7ab-fe20-42ca-98d7-c33f4133cfc</p></td>
<td>
<p>N/A</p>
</td>
<td><p>HTTP status: <code class="code--slim">403 (Forbidden)</code></p>
<p class ="code--block"> {<br>
"code": "INVALID_UUID",<br>
"message": "The match has timed out and the UUID is no longer valid.
The match (POST to /match) will need to be repeated."<br>
}<br>
</p>
</td>
</tr>
<tr>
<td><p>Request with a valid UUID that has timed out</p><p class ="code--block">uuid: 11548d82-309e-484d-a310-d0ffd2997795</p></td>
<td>
<p>N/A</p>
</td>
<td><p>HTTP status: <code class="code--slim">403 (Forbidden)</code></p>
<p class ="code--block"> {<br>
"code": "INVALID_UUID",<br>
"message": "The match has timed out and the UUID is no longer valid.
The match (POST to /match) will need to be repeated."<br>
}<br>
</p>
</td>
</tr>
<tr>
<td><p>Request sent to incorrect endpoint</p><p class ="code--block">Endpoint: /customer/mtch/2800a7ab-fe20-42ca-98d7-c33f4133cfc2/get-residency-status</p></td>
<td>
<p>N/A</p>
</td>
<td><p>HTTP status: <code class="code--slim">404 (Not Found)</code></p>
<p class ="code--block"> {<br>
"code": "NOT_FOUND",<br>
"message": "Resource Not Found"<br>
}
</p>
</td>
</tr>
<tr>
<td><p>Request with a valid UUID and an invalid 'Accept' header</p><p class ="code--block">uuid: 2800a7ab-fe20-42ca-98d7-c33f4133cfc2<br><br>Accept: application/vnd.hmrc.1.0</p></td>
<td>
<p>N/A</p>
</td>
<td><p>HTTP status: <code class="code--slim">406 (Not Acceptable)</code></p>
<p class ="code--block"> {<br>
"code": "ACCEPT_HEADER_INVALID",<br>
"message": "The accept header is missing or invalid"<br>
}
</p>
</td>
</tr>
<tr>
<td><p>Request which fails due to an unexpected error</p><p class ="code--block">uuid: 76648d82-309e-484d-a310-d0ffd2997795</p></td>
<td>
<p>N/A</p>
</td>
<td><p>HTTP status: <code class="code--slim">500 (Internal Server Error)</code></p>
<p class ="code--block"> {<br>
"code": "INTERNAL_SERVER_ERROR",<br>
"message": "Internal server error"<br>
}
</p>
</td>
</tr>
</tbody>
</table>

0 comments on commit b20ee1f

Please sign in to comment.