Skip to content

Commit

Permalink
fix(bpdm-gate): output stage to only provide generic states for uncat…
Browse files Browse the repository at this point in the history
…egorized states

fix(bpdm-gate): output stage to only provide generic states for uncategorized states
  • Loading branch information
SujitMBRDI committed Oct 29, 2024
1 parent 8214ae6 commit 2422faf
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ For changes to the BPDM Helm charts please consult the [changelog](charts/bpdm/C
- BPDM Gate: Fixed logic for identifiers to retrieve only generic type on output business partner
- BPDM Gate: Fixed construction logic for states and identifiers by enabling business partner type
- BPDM Pool: When processing golden record tasks the Pool now ignores isCatenaXMemberData field if it is set to null. ([#1069](https://github.com/eclipse-tractusx/bpdm/issues/1069))
- BPDM Gate: Fixed gate output logic to provide only generic states for uncategorized states.

## [6.1.0] - [2024-07-15]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,15 @@ class BusinessPartnerMappings {
} }
.map(::toIdentifierDto)
}?: emptyList(),
states = entity.states.map(::toStateDto),
states = entity.postalAddress.addressType?.let { addressType ->
entity.states
.filter { it.businessPartnerTyp == when (addressType) {
AddressType.LegalAndSiteMainAddress, AddressType.LegalAddress -> BusinessPartnerType.LEGAL_ENTITY
AddressType.AdditionalAddress -> BusinessPartnerType.ADDRESS
AddressType.SiteMainAddress -> return@let emptyList() // No identifiers for SiteMainAddress
} }
.map(::toStateDto)
}?: emptyList(),
roles = entity.roles,
isOwnCompanyData = entity.isOwnCompanyData,
legalEntity = toLegalEntityComponentOutputDto(entity),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class BusinessPartnerControllerAndSharingControllerIT @Autowired constructor(

// Expect outputBusinessPartner without identifiers as there are not Address identifier provided.
val outputBusinessPartners = listOf(
BusinessPartnerVerboseValues.bpOutputDtoCleaned.copy(identifiers = emptyList())
BusinessPartnerVerboseValues.bpOutputDtoCleaned.copy(identifiers = emptyList(), states = emptyList()),
)

val upsertRequests = listOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,9 @@ class BusinessPartnerControllerIT @Autowired constructor(
fun `insert one business partners and finalize cleaning task without error`() {
this.mockAndAssertUtils.mockOrchestratorApiCleaned(gateWireMockServer)

// Expect outputBusinessPartner without identifiers as there are not Address identifier provided.
// Expect outputBusinessPartner without identifiers and states as there are no Address identifier and states provided.
val outputBusinessPartners = listOf(
BusinessPartnerVerboseValues.bpOutputDtoCleaned.copy(identifiers = emptyList())
BusinessPartnerVerboseValues.bpOutputDtoCleaned.copy(identifiers = emptyList(), states = emptyList())
)

val upsertRequests = listOf(
Expand Down

0 comments on commit 2422faf

Please sign in to comment.