Skip to content

Commit

Permalink
feat(be:FSADT1-1575): Changes done after code review
Browse files Browse the repository at this point in the history
  • Loading branch information
mamartinezmejia committed Nov 29, 2024
1 parent 25f8e4e commit 33b32b9
Showing 1 changed file with 47 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,58 +161,60 @@ public Mono<ForestClientDetailsDto> getClientDetailsByClientNumber(

log.info("Retrieved corporation registration number: {}", corpRegnNmbr);

Mono<BcRegistryDocumentDto> documentMono = bcRegistryService
.requestDocumentData(corpRegnNmbr)
.next();
return populateGoodStandingInd(forestClientDetailsDto, documentMono);
return bcRegistryService
.requestDocumentData(corpRegnNmbr)
.next()
.flatMap(documentMono ->
populateGoodStandingInd(forestClientDetailsDto,
documentMono)
);
});
}

private Mono<ForestClientDetailsDto> populateGoodStandingInd(
ForestClientDetailsDto forestClientDetailsDto,
Mono<BcRegistryDocumentDto> documentMono
BcRegistryDocumentDto document
) {
return documentMono
.map(document -> {
Boolean goodStandingInd = document.business().goodStanding();
String goodStanding;

if (goodStandingInd == null) {
goodStanding = "";
} else {
goodStanding = goodStandingInd ? "Y" : "N";
}
log.info("Setting goodStandingInd for client: {} to {}",
forestClientDetailsDto.clientNumber(), goodStanding);

return new ForestClientDetailsDto(
forestClientDetailsDto.clientNumber(),
forestClientDetailsDto.clientName(),
forestClientDetailsDto.legalFirstName(),
forestClientDetailsDto.legalMiddleName(),
forestClientDetailsDto.clientStatusCode(),
forestClientDetailsDto.clientStatusDesc(),
forestClientDetailsDto.clientTypeCode(),
forestClientDetailsDto.clientTypeDesc(),
forestClientDetailsDto.clientIdTypeCode(),
forestClientDetailsDto.clientIdTypeDesc(),
forestClientDetailsDto.clientIdentification(),
forestClientDetailsDto.registryCompanyTypeCode(),
forestClientDetailsDto.corpRegnNmbr(),
forestClientDetailsDto.clientAcronym(),
forestClientDetailsDto.wcbFirmNumber(),
forestClientDetailsDto.clientComment(),
forestClientDetailsDto.clientCommentUpdateDate(),
forestClientDetailsDto.clientCommentUpdateUser(),
goodStanding,
forestClientDetailsDto.birthdate(),
forestClientDetailsDto.addresses(),
forestClientDetailsDto.contacts(),
forestClientDetailsDto.doingBusinessAs()
);
});
}
Boolean goodStandingInd = document.business().goodStanding();
String goodStanding;
if (goodStandingInd == null) {
goodStanding = "";
}
else {
goodStanding = goodStandingInd ? "Y" : "N";
}

log.info("Setting goodStandingInd for client: {} to {}",
forestClientDetailsDto.clientNumber(), goodStanding);

ForestClientDetailsDto updatedDetails = new ForestClientDetailsDto(
forestClientDetailsDto.clientNumber(),
forestClientDetailsDto.clientName(),
forestClientDetailsDto.legalFirstName(),
forestClientDetailsDto.legalMiddleName(),
forestClientDetailsDto.clientStatusCode(),
forestClientDetailsDto.clientStatusDesc(),
forestClientDetailsDto.clientTypeCode(),
forestClientDetailsDto.clientTypeDesc(),
forestClientDetailsDto.clientIdTypeCode(),
forestClientDetailsDto.clientIdTypeDesc(),
forestClientDetailsDto.clientIdentification(),
forestClientDetailsDto.registryCompanyTypeCode(),
forestClientDetailsDto.corpRegnNmbr(),
forestClientDetailsDto.clientAcronym(),
forestClientDetailsDto.wcbFirmNumber(),
forestClientDetailsDto.clientComment(),
forestClientDetailsDto.clientCommentUpdateDate(),
forestClientDetailsDto.clientCommentUpdateUser(),
goodStanding,
forestClientDetailsDto.birthdate(),
forestClientDetailsDto.addresses(),
forestClientDetailsDto.contacts(),
forestClientDetailsDto.doingBusinessAs()
);

return Mono.just(updatedDetails);
}

/**
* Searches the BC Registry API for {@link BcRegistryFacetSearchResultEntryDto} instances matching
Expand Down

0 comments on commit 33b32b9

Please sign in to comment.