Skip to content

Commit

Permalink
Add series to metadata review request event (#4084)
Browse files Browse the repository at this point in the history
Add seriesCode to `MetadataReviewRequestEvent`
  • Loading branch information
thanhz authored Aug 12, 2024
1 parent 9310c01 commit e63ff23
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/controllers/RequestMetadataReviewController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class RequestMetadataReviewController @Inject() (
transferringBodyName = summary.transferringBodyName,
consignmentReference = summary.consignmentReference,
consignmentId = consignmentId.toString,
seriesCode = summary.seriesName,
userId = request.token.userId.toString,
userEmail = request.token.email
)
Expand Down
1 change: 1 addition & 0 deletions app/services/MessagingService.scala
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ object MessagingService {
transferringBodyName: Option[String],
consignmentReference: String,
consignmentId: String,
seriesCode: Option[String],
userId: String,
userEmail: String
)
Expand Down
5 changes: 3 additions & 2 deletions test/controllers/RequestMetadataReviewControllerSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class RequestMetadataReviewControllerSpec extends FrontEndTestHelper {

"add status, send metadata review request notification and render the metadata review page" in {
setConsignmentTypeResponse(wiremockServer, "standard")
setConsignmentSummaryResponse(wiremockServer, transferringBodyName = "Mock".some, consignmentReference = "TDR-2024")
setConsignmentSummaryResponse(wiremockServer, transferringBodyName = "Mock".some, consignmentReference = "TDR-2024", seriesName = "someSeries".some)
setConsignmentStatusResponse(app.configuration, wiremockServer)
setAddConsignmentStatusResponse(wiremockServer)
setUpdateConsignmentStatus(wiremockServer)
Expand All @@ -114,7 +114,8 @@ class RequestMetadataReviewControllerSpec extends FrontEndTestHelper {
playStatus(content) mustBe SEE_OTHER
redirectLocation(content).get must equal(s"/consignment/$consignmentId/metadata-review/review-progress")

val metadataReviewRequestEvent = MetadataReviewRequestEvent("Mock".some, "TDR-2024", consignmentId.toString, "c140d49c-93d0-4345-8d71-c97ff28b947e", "[email protected]")
val metadataReviewRequestEvent =
MetadataReviewRequestEvent("Mock".some, "TDR-2024", consignmentId.toString, "someSeries".some, "c140d49c-93d0-4345-8d71-c97ff28b947e", "[email protected]")
verify(messagingService, times(1)).sendMetadataReviewRequestNotification(metadataReviewRequestEvent)
}

Expand Down
2 changes: 2 additions & 0 deletions test/services/MessagingServiceSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,15 @@ class MessagingServiceSpec extends AnyFlatSpec with Matchers {
transferringBodyName = Some("TransferringBodyName"),
consignmentReference = "Ref123",
consignmentId = "ConsID456",
seriesCode = Some("SomeSeries"),
userId = "UserID789",
userEmail = "[email protected]"
)
val expectedMessageString = """{
| "transferringBodyName" : "TransferringBodyName",
| "consignmentReference" : "Ref123",
| "consignmentId" : "ConsID456",
| "seriesCode" : "SomeSeries",
| "userId" : "UserID789",
| "userEmail" : "[email protected]"
|}""".stripMargin
Expand Down

0 comments on commit e63ff23

Please sign in to comment.