Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev/hente-epostAdresser-fra-CPAe…
Browse files Browse the repository at this point in the history
…r' into dev/hente-epostAdresser-fra-CPAer
  • Loading branch information
terjenilssen committed Nov 29, 2024
2 parents daf3260 + 04da08a commit dd91731
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
4 changes: 3 additions & 1 deletion ebms-provider/src/main/kotlin/no/nav/emottak/ebms/Routes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ fun Route.postEbmsSync(
signingCertificate?.let { signatureDetails ->
it.signer(signatureDetails)
}
log.info(ebmsMessage.marker(), "Created MessageError response")
call.respondEbmsDokument(it)
return@post
}
Expand Down Expand Up @@ -282,7 +283,7 @@ fun Route.postEbmsAsync(validator: DokumentValidator, processingService: Process
processingService.processAsync(ebmsMessage, it.payloadProcessing)
}
if (ebmsMessage !is PayloadMessage) {
log.info(ebMSDocument.messageHeader().marker(), "Successfuly processed Signal Message")
log.info(ebMSDocument.messageHeader().marker(), "Successfully processed Signal Message")
call.respondText("Processed")
return@post
}
Expand All @@ -293,6 +294,7 @@ fun Route.postEbmsAsync(validator: DokumentValidator, processingService: Process
}
} catch (ex: EbmsException) {
ebmsMessage.createFail(ex.feil).toEbmsDokument().also {
log.info(ebmsMessage.marker(), "Created MessageError response")
call.respondEbmsDokument(it)
return@post
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,13 @@ fun MessageHeader.createResponseHeader(newAction: String?, newService: String?):
return messageHeader
}

fun MessageHeader.addressing() = Addressing(
Party(this.to.partyId.map { PartyId(it.type!!, it.value!!) }, this.to.role!!),
Party(this.from.partyId.map { PartyId(it.type!!, it.value!!) }, this.from.role!!),
fun MessageHeader.addressing(isRoleApplicable: Boolean = true) = Addressing(
Party(
this.to.partyId.map { PartyId(it.type!!, it.value!!) },
if (isRoleApplicable) this.to.role!! else "Not applicable"),
Party(
this.from.partyId.map { PartyId(it.type!!, it.value!!) },
if (isRoleApplicable) this.from.role!! else "Not applicable"),
this.service.value!!,
this.action
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ data class EbMSDocument(val requestId: String, val dokument: Document, val attac
messageHeader.messageData.refToMessageId!!,
messageHeader.conversationId,
messageHeader.cpaId!!,
messageHeader.addressing(),
messageHeader.addressing(isRoleApplicable = false),
errorList,
dokument

Expand All @@ -95,7 +95,7 @@ data class EbMSDocument(val requestId: String, val dokument: Document, val attac
header.acknowledgment()!!.refToMessageId,
messageHeader.conversationId,
messageHeader.cpaId!!,
messageHeader.addressing(),
messageHeader.addressing(isRoleApplicable = false),
dokument
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ data class EbmsFail(

override fun toEbmsDokument(): EbMSDocument {
val header = this.createMessageHeader(this.addressing.copy(action = EbXMLConstants.MESSAGE_ERROR_ACTION, service = EbXMLConstants.EBMS_SERVICE_URI))
// log.warn(this.marker(), "Oppretter ErrorList")
return ObjectFactory().createEnvelope()!!.also {
it.header = header.also {
it.any.add(this.feil.asErrorList())
Expand Down

0 comments on commit dd91731

Please sign in to comment.