Skip to content

Commit bde23bb

Browse files
authored
Hia 717 epf endpoint update (#404)
* Updated sentence for EPF * Added in courtAppearance * Updated Smoke tests * Updated OpenApi.yml * Delete localstack folder * Made fields depcreciated rather than deleted
1 parent f9eb048 commit bde23bb

File tree

6 files changed

+73
-43
lines changed

6 files changed

+73
-43
lines changed

openapi.yml

+26-5
Original file line numberDiff line numberDiff line change
@@ -1218,6 +1218,8 @@ components:
12181218
format: date
12191219
gender:
12201220
type: string
1221+
courtAppearance:
1222+
$ref: '#/components/schemas/CourtAppearance'
12211223
sentence:
12221224
$ref: '#/components/schemas/CaseSentence'
12231225
responsibleProvider:
@@ -1290,19 +1292,32 @@ components:
12901292
type: string
12911293
example: Some Additional Text
12921294
CaseSentence:
1293-
required:
1294-
- date
1295-
- sentencingCourt
12961295
type: object
12971296
properties:
12981297
date:
12991298
type: string
13001299
format: date
1300+
description: This field is depreciated and will be removed from the response soon.
13011301
sentencingCourt:
13021302
$ref: '#/components/schemas/Court'
13031303
releaseDate:
13041304
type: string
13051305
format: date
1306+
description: This field is depreciated and will be removed from the response soon.
1307+
expectedReleaseDate:
1308+
type: string
1309+
format: date
1310+
CourtAppearance:
1311+
required:
1312+
- date
1313+
- court
1314+
type: object
1315+
properties:
1316+
date:
1317+
type: string
1318+
format: date
1319+
court:
1320+
$ref: "#/components/schemas/CourtDetails"
13061321
CommunityOffenderManager:
13071322
type: object
13081323
properties:
@@ -1327,12 +1342,11 @@ components:
13271342
example: "leslie.knope@pawnee.gov"
13281343
description: A list of email addresses
13291344
Court:
1330-
required:
1331-
- name
13321345
type: object
13331346
properties:
13341347
name:
13351348
type: string
1349+
description: This field is depreciated and will be removed from the response soon.
13361350
Disability:
13371351
type: object
13381352
properties:
@@ -1811,6 +1825,13 @@ components:
18111825
surname:
18121826
type: string
18131827
nullable: true
1828+
CourtDetails:
1829+
required:
1830+
- name
1831+
type: object
1832+
properties:
1833+
name:
1834+
type: string
18141835
PersonResponsibleOfficerTeam:
18151836
type: object
18161837
properties:

src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/models/hmpps/CaseDetail.kt

+14
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ data class CaseDetail(
55
val name: Name? = null,
66
val dateOfBirth: String? = null,
77
val gender: String? = null,
8+
val courtAppearance: CourtAppearance? = null,
89
val sentence: CaseSentence? = null,
910
val responsibleProvider: ResponsibleProvider? = null,
1011
val ogrsScore: Long? = null,
@@ -19,9 +20,13 @@ data class Name(
1920
)
2021

2122
data class CaseSentence(
23+
@Deprecated("This field is depreciated and will be removed from the endpoint /v1/epf/person-details/{hmppsId}/{eventNumber} response soon.")
2224
val date: String? = null,
25+
@Deprecated("This field is depreciated and will be removed from the endpoint /v1/epf/person-details/{hmppsId}/{eventNumber} response soon.")
2326
val sentencingCourt: SentencingCourt? = null,
27+
@Deprecated("This field is depreciated and will be removed from the endpoint /v1/epf/person-details/{hmppsId}/{eventNumber} response soon.")
2428
val releaseDate: String? = null,
29+
val expectedReleaseDate: String? = null,
2530
)
2631

2732
data class SentencingCourt(
@@ -32,3 +37,12 @@ data class ResponsibleProvider(
3237
val code: String? = null,
3338
val name: String? = null,
3439
)
40+
41+
data class CourtAppearance(
42+
val date: String? = null,
43+
val court: CourtDetails? = null,
44+
)
45+
46+
data class CourtDetails(
47+
val name: String? = null,
48+
)

src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/models/probationintegrationepf/EPFCaseDetail.kt

+4-25
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@ package uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.probationintegra
22

33
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.CaseDetail
44
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.CaseSentence
5+
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.CourtAppearance
56
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.Name
67
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.ResponsibleProvider
7-
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.SentencingCourt
88

99
data class EPFCaseDetail(
1010
val nomsId: String? = null,
1111
val name: Name? = null,
1212
val dateOfBirth: String? = null,
1313
val gender: String? = null,
14+
val courtAppearance: CourtAppearance? = null,
1415
val sentence: CaseSentence? = null,
1516
val responsibleProvider: ResponsibleProvider? = null,
1617
val ogrsScore: Long? = null,
@@ -23,36 +24,14 @@ data class EPFCaseDetail(
2324
name = Name(forename = this.name?.forename, middleName = this.name?.middleName, surname = this.name?.surname),
2425
dateOfBirth = this.dateOfBirth,
2526
gender = this.gender,
27+
courtAppearance = this.courtAppearance,
2628
sentence =
2729
CaseSentence(
28-
date = this.sentence?.date,
29-
sentencingCourt = SentencingCourt(this.sentence?.sentencingCourt?.name),
30-
releaseDate = this.sentence?.releaseDate,
30+
expectedReleaseDate = sentence?.expectedReleaseDate,
3131
),
3232
responsibleProvider = ResponsibleProvider(code = this.responsibleProvider?.code, name = this.responsibleProvider?.name),
3333
ogrsScore = this.ogrsScore,
3434
age = this.age,
3535
ageAtRelease = this.ageAtRelease,
3636
)
3737
}
38-
39-
data class Name(
40-
val forename: String? = null,
41-
val middleName: String? = null,
42-
val surname: String? = null,
43-
)
44-
45-
data class CaseSentence(
46-
val date: String? = null,
47-
val sentencingCourt: SentencingCourt? = null,
48-
val releaseDate: String? = null,
49-
)
50-
51-
data class SentencingCourt(
52-
val name: String? = null,
53-
)
54-
55-
data class ResponsibleProvider(
56-
val code: String? = null,
57-
val name: String? = null,
58-
)

src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/gateways/probationintegrationEPF/fixtures/GetEPFPersonDetailsResponse.json

+8-6
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@
77
},
88
"dateOfBirth":"2000-03-01",
99
"gender": null,
10+
"courtAppearance": {
11+
"date": "2019-10-10",
12+
"court": {
13+
"name": "Crown"
14+
}
15+
},
1016
"sentence": {
11-
"date": "2021-03-03",
12-
"sentencingCourt": {
13-
"name": "Fakecourt"
14-
},
15-
"releaseDate": "2021-10-10"
17+
"expectedReleaseDate": "2021-10-10"
1618
},
1719
"responsibleProvider": {
1820
"code": "999000ABC",
@@ -21,4 +23,4 @@
2123
"ogrsScore": 123,
2224
"age": 23,
2325
"ageAtRelease": 24
24-
}
26+
}

src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/helpers/CaseDetailsHelper.kt

+11-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ package uk.gov.justice.digital.hmpps.hmppsintegrationapi.helpers
22

33
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.CaseDetail
44
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.CaseSentence
5+
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.CourtAppearance
6+
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.CourtDetails
57
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.Name
68
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.ResponsibleProvider
7-
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.SentencingCourt
89

910
fun generateCaseDetail(): CaseDetail {
1011
return CaseDetail(
@@ -17,7 +18,15 @@ fun generateCaseDetail(): CaseDetail {
1718
),
1819
dateOfBirth = "2000-03-01",
1920
gender = null,
20-
sentence = CaseSentence(date = "2021-03-03", sentencingCourt = SentencingCourt("Fakecourt"), releaseDate = "2021-10-10"),
21+
courtAppearance =
22+
CourtAppearance(
23+
date = "2019-10-10",
24+
court =
25+
CourtDetails(
26+
name = "Crown",
27+
),
28+
),
29+
sentence = CaseSentence(expectedReleaseDate = "2021-10-10"),
2130
responsibleProvider =
2231
ResponsibleProvider(
2332
code = "999000ABC",

src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/smoke/EPFPersonDetailSmokeTest.kt

+10-5
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class EPFPersonDetailSmokeTest : DescribeSpec(
2121
response.statusCode().shouldBe(HttpStatus.OK.value())
2222
response.body().shouldEqualJson(
2323
"""
24-
{
24+
{
2525
"data": {
2626
"nomsId": "string",
2727
"name": {
@@ -31,12 +31,17 @@ class EPFPersonDetailSmokeTest : DescribeSpec(
3131
},
3232
"dateOfBirth": "2019-08-24",
3333
"gender": "string",
34+
"courtAppearance": {
35+
"date": "2019-08-24",
36+
"court": {
37+
"name": "string"
38+
}
39+
},
3440
"sentence": {
3541
"date": null,
36-
"sentencingCourt": {
37-
"name": null
38-
},
39-
"releaseDate": null
42+
"sentencingCourt": null,
43+
"releaseDate": null,
44+
"expectedReleaseDate": "2019-08-24"
4045
},
4146
"responsibleProvider": {
4247
"code": "string",

0 commit comments

Comments
 (0)