Skip to content

Commit

Permalink
PI-1965 Add Extra Status Detail to CAS2 Contacts (#3400)
Browse files Browse the repository at this point in the history
* Add Extra Status Detail to CAS2 Contacts

* Formatting changes

* apply review comments

* only add required field to notes

* StringBuilder does not seem to work nicely with muilt line strings.  Therefore, use StringBuilder for notes as well

* Formatting changes

* use trimMargin, rather than trimIndent to format notes

* PI-1965

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Anthony Britton <[email protected]>
  • Loading branch information
3 people authored Mar 28, 2024
1 parent c34b6ae commit 255ddb3
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,17 @@
"newStatus": {
"name": "moreInfoRequested",
"label": "More information requested",
"description": "More information about the application has been requested from the POM (Prison Offender Manager)."
"description": "More information about the application has been requested from the POM (Prison Offender Manager).",
"statusDetails": [
{
"label": "personalInformation",
"name": "Personal Information"
},
{
"label": "healthNeeds",
"name": "Health Needs"
}
]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,12 @@ internal class IntegrationTest {
assertThat(
contact.notes, equalTo(
"""
Application status was updated to: More information requested - More information about the application has been requested from the POM (Prison Offender Manager).
Application status was updated to: More information requested
Details: More information about the application has been requested from the POM (Prison Offender Manager).
* Personal Information
* Health Needs
Details of the application can be found here: https://example.com/application/00000000-0000-0000-0000-000000000001
""".trimIndent()
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,10 @@ data class ApplicationStatus(
val name: String,
val label: String,
val description: String,
val statusDetails: List<ApplicationStatusDetail>,
)

data class ApplicationStatusDetail(
val label: String,
val name: String,
)
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package uk.gov.justice.digital.hmpps.service

import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import jakarta.transaction.Transactional
import org.springframework.stereotype.Service
import uk.gov.justice.digital.hmpps.client.approvedpremises.EventDetailsClient
Expand Down Expand Up @@ -38,10 +39,13 @@ class Cas2Service(
date = details.eventDetails.updatedAt,
description = "CAS2 Referral Updated - ${details.eventDetails.newStatus.label}",
notes = """
Application status was updated to: ${details.eventDetails.newStatus.label} - ${details.eventDetails.newStatus.description}
Details of the application can be found here: ${details.eventDetails.applicationUrl}
""".trimIndent(),
|Application status was updated to: ${details.eventDetails.newStatus.label}
|
|Details: ${details.eventDetails.newStatus.description}
|* ${details.eventDetails.newStatus.statusDetails.joinToString(separator = System.lineSeparator() + "|* ") { it.name }}
|
|Details of the application can be found here: ${details.eventDetails.applicationUrl}
""".trimMargin(),
urn = "urn:hmpps:cas2:application-status-updated:${details.id}",
)
if (success) telemetryService.trackEvent(
Expand Down

0 comments on commit 255ddb3

Please sign in to comment.