Skip to content

Commit 30160e5

Browse files
Add client name to message body (#782)
1 parent 9a7ddfe commit 30160e5

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

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

+3-2
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,15 @@ data class CreateVisitRequest(
4747
fun toHmppsMessage(who: String): HmppsMessage =
4848
HmppsMessage(
4949
eventType = HmppsMessageEventType.VISIT_CREATED,
50-
messageAttributes = modelToMap(),
50+
messageAttributes = modelToMap(who),
5151
who = who,
5252
)
5353

54-
private fun modelToMap(): Map<String, Any?> =
54+
private fun modelToMap(clientName: String): Map<String, Any?> =
5555
mapOf(
5656
"prisonerId" to this.prisonerId,
5757
"prisonId" to this.prisonId,
58+
"clientName" to clientName,
5859
"clientVisitReference" to this.clientVisitReference,
5960
"visitRoom" to this.visitRoom,
6061
"visitType" to this.visitType,

src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/models/hmpps/CreateVisitRequestTest.kt

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class CreateVisitRequestTest :
3737
val hmppsMessageString = objectMapper.writeValueAsString(hmppsMessage)
3838
hmppsMessageString.shouldBeValidJson()
3939
hmppsMessageString.shouldContainJsonKeyValue("$.messageAttributes.prisonerId", createVisitRequest.prisonerId)
40+
hmppsMessageString.shouldContainJsonKeyValue("$.messageAttributes.clientName", consumerName)
4041
hmppsMessageString.shouldContainJsonKeyValue("$.messageAttributes.startTimestamp", timestamp)
4142
hmppsMessageString.shouldContainJsonKeyValue("$.messageAttributes.endTimestamp", timestamp)
4243
hmppsMessageString.shouldContainJsonKeyValue("$.messageAttributes.visitNotes[0].type", createVisitRequest.visitNotes.first().type)

0 commit comments

Comments
 (0)