diff --git a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/AddressGateOutputRequest.kt b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/AddressGateOutputRequest.kt index 6232e94c0..835152d12 100644 --- a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/AddressGateOutputRequest.kt +++ b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/AddressGateOutputRequest.kt @@ -43,5 +43,5 @@ data class AddressGateOutputRequest( val siteExternalId: String? = null, @Schema(description = "Business Partner Number") - val bpn: String? = null + val bpn: String ) \ No newline at end of file diff --git a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/AddressGateOutputResponse.kt b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/AddressGateOutputResponse.kt index 74ee67b8a..8f0362406 100644 --- a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/AddressGateOutputResponse.kt +++ b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/AddressGateOutputResponse.kt @@ -43,6 +43,6 @@ data class AddressGateOutputResponse( val siteExternalId: String? = null, @Schema(description = "Business Partner Number") - val bpn: String? = null, + val bpn: String ) \ No newline at end of file diff --git a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/LegalEntityGateInputRequest.kt b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/LegalEntityGateInputRequest.kt index a82785af0..2d9956768 100644 --- a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/LegalEntityGateInputRequest.kt +++ b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/LegalEntityGateInputRequest.kt @@ -19,6 +19,7 @@ package org.eclipse.tractusx.bpdm.gate.api.model +import com.fasterxml.jackson.annotation.JsonUnwrapped import com.fasterxml.jackson.databind.annotation.JsonDeserialize import io.swagger.v3.oas.annotations.media.Schema import org.eclipse.tractusx.bpdm.common.dto.LegalEntityDto @@ -31,6 +32,7 @@ data class LegalEntityGateInputRequest( val legalNameParts: Array = emptyArray(), @Schema(description = "legal Enity") + @JsonUnwrapped val legalEntity: LegalEntityDto, @get:Schema(description = "Address of the official seat of this legal entity") diff --git a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/LegalEntityGateOutputRequest.kt b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/LegalEntityGateOutputRequest.kt index aed85e5fa..7fccb1ebf 100644 --- a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/LegalEntityGateOutputRequest.kt +++ b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/LegalEntityGateOutputRequest.kt @@ -38,6 +38,7 @@ package org.eclipse.tractusx.bpdm.gate.api.model +import com.fasterxml.jackson.annotation.JsonUnwrapped import com.fasterxml.jackson.databind.annotation.JsonDeserialize import io.swagger.v3.oas.annotations.media.Schema import org.eclipse.tractusx.bpdm.common.dto.LegalEntityDto @@ -50,6 +51,7 @@ data class LegalEntityGateOutputRequest( val legalNameParts: Array = emptyArray(), @Schema(description = "legal Enity") + @field:JsonUnwrapped val legalEntity: LegalEntityDto, @get:Schema(description = "Address of the official seat of this legal entity") @@ -59,5 +61,5 @@ data class LegalEntityGateOutputRequest( val externalId: String, @Schema(description = "Business Partner Number") - val bpn: String?, + val bpn: String ) \ No newline at end of file diff --git a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/LegalEntityGateOutputResponse.kt b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/LegalEntityGateOutputResponse.kt index fd804bcd6..7e3a448ee 100644 --- a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/LegalEntityGateOutputResponse.kt +++ b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/LegalEntityGateOutputResponse.kt @@ -31,10 +31,13 @@ data class LegalEntityGateOutputResponse( @field:JsonUnwrapped val legalEntity: LegalEntityDto, + @get:Schema(description = "Address of the official seat of this legal entity") + val legalAddress: LogisticAddressGateDto, + @Schema(description = "ID the record has in the external system where the record originates from", required = true) val externalId: String, @Schema(description = "Business Partner Number") - val bpn: String? + val bpn: String ) \ No newline at end of file diff --git a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/SiteGateOutputRequest.kt b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/SiteGateOutputRequest.kt index a9782d1d6..563c6c680 100644 --- a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/SiteGateOutputRequest.kt +++ b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/SiteGateOutputRequest.kt @@ -39,5 +39,5 @@ data class SiteGateOutputRequest( val legalEntityExternalId: String, @Schema(description = "Business Partner Number") - val bpn: String?, + val bpn: String ) \ No newline at end of file diff --git a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/SiteGateOutputResponse.kt b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/SiteGateOutputResponse.kt index ed552e43f..7eab20a02 100644 --- a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/SiteGateOutputResponse.kt +++ b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/SiteGateOutputResponse.kt @@ -39,5 +39,5 @@ data class SiteGateOutputResponse( val legalEntityExternalId: String, @Schema(description = "Business Partner Number") - val bpn: String? + val bpn: String ) \ No newline at end of file diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/ResponseMappings.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/ResponseMappings.kt index 36fe45642..3c9e6ff65 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/ResponseMappings.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/ResponseMappings.kt @@ -431,7 +431,7 @@ fun LogisticAddress.toAddressGateOutputResponse(logisticAddressPage: LogisticAdd externalId = externalId, legalEntityExternalId = legalEntity?.externalId, siteExternalId = site?.externalId, - bpn = bpn, + bpn = bpn!!, ) return addressGateOutputResponse @@ -444,7 +444,7 @@ fun Site.toSiteGateOutputResponse(sitePage: Site): SiteGateOutputResponse { site = sitePage.toSiteDto(), externalId = externalId, legalEntityExternalId = legalEntity.externalId, - bpn = bpn + bpn = bpn!! ) } @@ -454,7 +454,8 @@ fun LegalEntity.toLegalEntityGateOutputResponse(legalEntity: LegalEntity): Legal return LegalEntityGateOutputResponse( legalEntity = legalEntity.toLegalEntityDto(), externalId = legalEntity.externalId, - bpn = legalEntity.bpn + bpn = legalEntity.bpn!!, + legalAddress = legalEntity.legalAddress.toLogisticAddressDto() ) } diff --git a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/controller/LegalEntityControllerOutputIT.kt b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/controller/LegalEntityControllerOutputIT.kt index cdf05ce3c..609e2debb 100644 --- a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/controller/LegalEntityControllerOutputIT.kt +++ b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/controller/LegalEntityControllerOutputIT.kt @@ -173,7 +173,8 @@ internal class LegalEntityControllerOutputIT @Autowired constructor( ) assertThat(pageResponse).usingRecursiveComparison().ignoringCollectionOrder().ignoringAllOverriddenEquals() - .ignoringFieldsMatchingRegexes(".*processStartedAt*").isEqualTo(expectedPage) + .ignoringFieldsMatchingRegexes(".*processStartedAt*", ".*administrativeAreaLevel1*.") + .isEqualTo(expectedPage) } /** @@ -222,6 +223,7 @@ internal class LegalEntityControllerOutputIT @Autowired constructor( ) assertThat(pageResponse).usingRecursiveComparison().ignoringCollectionOrder().ignoringAllOverriddenEquals() - .ignoringFieldsMatchingRegexes(".*processStartedAt*").isEqualTo(expectedPage) + .ignoringFieldsMatchingRegexes(".*processStartedAt*", ".*administrativeAreaLevel1*.") + .isEqualTo(expectedPage) } } \ No newline at end of file diff --git a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/util/ResponseValues.kt b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/util/ResponseValues.kt index fa4a795ff..557674616 100644 --- a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/util/ResponseValues.kt +++ b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/util/ResponseValues.kt @@ -303,12 +303,14 @@ object ResponseValues { legalEntity = RequestValues.legalEntity1, externalId = CommonValues.externalId1, bpn = CommonValues.bpn1, + legalAddress = RequestValues.address1 ) val legalEntityGateOutputResponse2 = LegalEntityGateOutputResponse( legalEntity = RequestValues.legalEntity2, externalId = CommonValues.externalId2, bpn = CommonValues.bpn2, + legalAddress = RequestValues.address2 ) //Values without processStartedAt value