Skip to content

Commit

Permalink
PI-1777 Set contact description for status updates (#3047)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-bcl authored Jan 17, 2024
1 parent 1891fdf commit f18a1a0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ package uk.gov.justice.digital.hmpps

import com.github.tomakehurst.wiremock.WireMockServer
import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.Matchers.equalTo
import org.hamcrest.Matchers.hasSize
import org.hamcrest.Matchers.*
import org.junit.jupiter.api.Test
import org.mockito.kotlin.verify
import org.springframework.beans.factory.annotation.Autowired
Expand Down Expand Up @@ -60,6 +59,7 @@ internal class IntegrationTest {
contact.notes,
equalTo("Details of the application can be found here: https://example.com/application/00000000-0000-0000-0000-000000000001")
)
assertThat(contact.description, nullValue())
assertThat(
contact.externalReference,
equalTo("urn:hmpps:cas2:application-submitted:00000000-0000-0000-0000-000000000001")
Expand Down Expand Up @@ -88,6 +88,7 @@ internal class IntegrationTest {
// Then a contact is created
val contact = contactRepository.findAll().single { it.type.code == REFERRAL_UPDATED }
assertThat(contact.externalReference, equalTo("urn:hmpps:cas2:application-status-updated:1"))
assertThat(contact.description, equalTo("CAS2 Referral Updated - More information requested"))
assertThat(
contact.notes, equalTo(
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ class Contact(
@[ManyToOne JoinColumn(name = "contact_type_id")]
val type: ContactType,

@Column
val description: String?,

@Column(name = "contact_date")
val date: LocalDate,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class Cas2Service(
crn = event.crn,
type = ContactType.REFERRAL_UPDATED,
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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class ContactService(
fun createContact(
crn: String,
type: String,
description: String? = null,
date: ZonedDateTime,
notes: String,
urn: String,
Expand All @@ -36,6 +37,7 @@ class ContactService(
Contact(
personId = person.id,
type = contactTypeRepository.getByCode(type),
description = description,
date = date.toLocalDate(),
startTime = date,
staffId = manager.staffId,
Expand Down

0 comments on commit f18a1a0

Please sign in to comment.