Skip to content

Commit

Permalink
feat(api): #181 Gate API: Nameparts
Browse files Browse the repository at this point in the history
fix after merge
  • Loading branch information
rainer-exxcellent committed Jun 1, 2023
1 parent e20714d commit f10b623
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ package com.catenax.bpdm.bridge.dummy.dto
import org.eclipse.tractusx.bpdm.common.dto.LegalEntityDto

data class GateLegalEntityInfo(
val legalNameParts: Array<String> = emptyArray(),
val legalEntity: LegalEntityDto,
val externalId: String,
val bpn: String?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ class PoolUpdateService(
val createRequests = entriesToCreate.map {
LegalEntityPartnerCreateRequest(
legalEntity = it.legalEntity,
index = it.externalId
index = it.externalId,
legalName = it.legalNameParts[0]
)
}

Expand All @@ -53,7 +54,8 @@ class PoolUpdateService(
val updateRequests = entriesToUpdate.map {
LegalEntityPartnerUpdateRequest(
legalEntity = it.legalEntity,
bpnl = it.bpn!!
bpnl = it.bpn!!,
legalName = it.legalNameParts[0]
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import io.swagger.v3.oas.annotations.media.Schema
data class LegalEntityDto(
@ArraySchema(arraySchema = Schema(description = "Additional identifiers (except BPN)", required = false))
val identifiers: Collection<LegalEntityIdentifierDto> = emptyList(),

@get:Schema(description = "Abbreviated name or shorthand")
val legalShortName: String?,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ object SaasMappings {
)
}

fun BusinessPartnerSaas.toNameDto(): SassNameDto? {
private fun BusinessPartnerSaas.toNameDto(): SassNameDto? {
if (names.size > 1) {
logger.warn { "Business Partner with ID $externalId has more than one name" }
}
Expand Down Expand Up @@ -292,7 +292,7 @@ object SaasMappings {
)
}

data class SassNameDto(
private data class SassNameDto(
val value: String,
val shortName: String?
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,6 @@ private fun Street.toStreetDto(): StreetDto {

fun LegalEntity.toLegalEntityDto(): LegalEntityDto {
return LegalEntityDto(
legalName = legalName.value,
legalForm = legalForm,
legalShortName = legalName.shortName,
legalAddress = legalAddress.toLogisticAddressDto(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ internal class LegalEntityControllerInputIT @Autowired constructor(
private val webTestClient: WebTestClient,
private val objectMapper: ObjectMapper,
val gateClient: GateClient,
private val legalEntityRepository: LegalEntityRepository,
private val testHelpers: DbTestHelpers
private val legalEntityRepository: LegalEntityRepository
) {
companion object {
@RegisterExtension
Expand Down Expand Up @@ -241,12 +240,11 @@ internal class LegalEntityControllerInputIT @Autowired constructor(
content = expectedLegalEntities
)

// TODO check administrativeAreaLevel1
assertThat(pageResponse).usingRecursiveComparison().ignoringCollectionOrder().ignoringAllOverriddenEquals()
.ignoringFieldsMatchingRegexes(".*processStartedAt*", ".*administrativeAreaLevel1*").isEqualTo(
expectedPage
)

testHelpers.assertRecursively(pageResponse).isEqualTo(expectedResponse)
expectedPage
)
}


Expand Down Expand Up @@ -289,8 +287,8 @@ internal class LegalEntityControllerInputIT @Autowired constructor(

assertThat(pageResponse).usingRecursiveComparison().ignoringCollectionOrder().ignoringAllOverriddenEquals()
.ignoringFieldsMatchingRegexes(".*processStartedAt*", ".*administrativeAreaLevel1*").isEqualTo(
expectedPage
)
expectedPage
)
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,6 @@ object RequestValues {

val legalEntity3 = LegalEntityDto(
identifiers = listOf(identifier1, identifier2),
legalName = CommonValues.name1,
legalShortName = CommonValues.shortName1,
legalForm = CommonValues.legalFormTechnicalKey1,
states = listOf(leBusinessStatus1),
Expand All @@ -274,6 +273,7 @@ object RequestValues {

val legalEntityGateInputRequest3 = LegalEntityGateInputRequest(
legalEntity = legalEntity3,
legalNameParts = arrayOf(CommonValues.name1),
externalId = CommonValues.externalId3,
bpn = CommonValues.bpn3
)
Expand Down

0 comments on commit f10b623

Please sign in to comment.