diff --git a/projects/cas2-and-delius/src/integrationTest/kotlin/uk/gov/justice/digital/hmpps/IntegrationTest.kt b/projects/cas2-and-delius/src/integrationTest/kotlin/uk/gov/justice/digital/hmpps/IntegrationTest.kt index 822b451917..7ceb7bb6aa 100644 --- a/projects/cas2-and-delius/src/integrationTest/kotlin/uk/gov/justice/digital/hmpps/IntegrationTest.kt +++ b/projects/cas2-and-delius/src/integrationTest/kotlin/uk/gov/justice/digital/hmpps/IntegrationTest.kt @@ -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 @@ -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") @@ -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( """ diff --git a/projects/cas2-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/entity/Contact.kt b/projects/cas2-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/entity/Contact.kt index 4b2cf24100..cb69f0032a 100644 --- a/projects/cas2-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/entity/Contact.kt +++ b/projects/cas2-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/entity/Contact.kt @@ -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, diff --git a/projects/cas2-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/service/Cas2Service.kt b/projects/cas2-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/service/Cas2Service.kt index be667b426f..1e40272355 100644 --- a/projects/cas2-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/service/Cas2Service.kt +++ b/projects/cas2-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/service/Cas2Service.kt @@ -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} diff --git a/projects/cas2-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/service/ContactService.kt b/projects/cas2-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/service/ContactService.kt index 056640cb43..531a7e2ad5 100644 --- a/projects/cas2-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/service/ContactService.kt +++ b/projects/cas2-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/service/ContactService.kt @@ -23,6 +23,7 @@ class ContactService( fun createContact( crn: String, type: String, + description: String? = null, date: ZonedDateTime, notes: String, urn: String, @@ -36,6 +37,7 @@ class ContactService( Contact( personId = person.id, type = contactTypeRepository.getByCode(type), + description = description, date = date.toLocalDate(), startTime = date, staffId = manager.staffId,