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
  • Loading branch information
SujitMBRDI committed Oct 29, 2024
1 parent 6f16cdb commit 7e809f6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,15 @@ class BusinessPartnerMappings {
} }
.map(::toIdentifierDto)
}?: emptyList(),
states = toStateDtos(entity.states, BusinessPartnerType.GENERIC),
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 7e809f6

Please sign in to comment.