diff --git a/.gitignore b/.gitignore index b397e3b6eb..bcf8886efa 100644 --- a/.gitignore +++ b/.gitignore @@ -572,3 +572,4 @@ frontend/reports/ **/sonar-report.xml **/config/*.jks +**/reports-merge/ \ No newline at end of file diff --git a/backend/src/main/java/ca/bc/gov/app/dto/bcregistry/ClientDetailsDto.java b/backend/src/main/java/ca/bc/gov/app/dto/bcregistry/ClientDetailsDto.java index 16269a3cfd..50e95dfb31 100644 --- a/backend/src/main/java/ca/bc/gov/app/dto/bcregistry/ClientDetailsDto.java +++ b/backend/src/main/java/ca/bc/gov/app/dto/bcregistry/ClientDetailsDto.java @@ -12,7 +12,7 @@ public record ClientDetailsDto( String name, String id, - boolean goodStanding, + Boolean goodStanding, List addresses, List contacts diff --git a/backend/src/main/java/ca/bc/gov/app/service/client/ClientService.java b/backend/src/main/java/ca/bc/gov/app/service/client/ClientService.java index ba298b6153..09392d082d 100644 --- a/backend/src/main/java/ca/bc/gov/app/service/client/ClientService.java +++ b/backend/src/main/java/ca/bc/gov/app/service/client/ClientService.java @@ -2,6 +2,7 @@ import ca.bc.gov.app.ApplicationConstant; import ca.bc.gov.app.dto.bcregistry.BcRegistryAddressDto; +import ca.bc.gov.app.dto.bcregistry.BcRegistryBusinessDto; import ca.bc.gov.app.dto.bcregistry.BcRegistryDocumentDto; import ca.bc.gov.app.dto.bcregistry.BcRegistryFacetSearchResultEntryDto; import ca.bc.gov.app.dto.bcregistry.BcRegistryPartyDto; @@ -152,7 +153,7 @@ public Flux listProvinces(String countryCode, int page, int size) { * @param size The amount of entries per page. * @return A list of {@link CodeNameDto} entries. */ - public Flux listClientContactTypeCodes(LocalDate activeDate,int page, int size) { + public Flux listClientContactTypeCodes(LocalDate activeDate, int page, int size) { return contactTypeCodeRepository .findActiveAt(activeDate, PageRequest.of(page, size)) .map(entity -> new CodeNameDto( @@ -216,8 +217,9 @@ public Mono getClientDetails( ) .map(BcRegistryDocumentDto.class::cast) - .flatMap(client ->{ - if(ApplicationConstant.AVAILABLE_CLIENT_TYPES.contains(client.business().legalType())){ + .flatMap(client -> { + if (ApplicationConstant.AVAILABLE_CLIENT_TYPES.contains( + client.business().legalType())) { return Mono.just(client); } return Mono.error(new UnsuportedClientTypeException(client.business().legalType())); @@ -226,8 +228,8 @@ public Mono getClientDetails( //if document type is SP and party contains only one entry that is not a person, fail .filter(document -> !("SP".equalsIgnoreCase(document.business().legalType()) - && document.parties().size() == 1 - && !document.parties().get(0).isPerson()) + && document.parties().size() == 1 + && !document.parties().get(0).isPerson()) ) .flatMap(buildDetails()) .switchIfEmpty(Mono.error(new UnableToProcessRequestException( @@ -308,14 +310,33 @@ public Mono findByIndividual(String userId, String lastName) { private Function> buildDetails() { return document -> - buildAddress(document, - new ClientDetailsDto( - document.business().legalName(), - document.business().identifier(), - document.business().goodStanding(), - List.of(), - List.of() - ) + buildAddress( + document, + buildSimpleClientDetails(document.business()) + ); + } + + private ClientDetailsDto buildSimpleClientDetails( + BcRegistryBusinessDto businessDto + ) { + + if (businessDto == null) { + return new ClientDetailsDto( + "", + "", + false, + List.of(), + List.of() + ); + } + log.info("Building simple client details for {} with standing {}", businessDto.identifier(),businessDto.goodStanding()); + return + new ClientDetailsDto( + businessDto.legalName(), + businessDto.identifier(), + businessDto.goodStanding(), + List.of(), + List.of() ); } diff --git a/backend/src/main/resources/application.yml b/backend/src/main/resources/application.yml index f1f04557aa..15e6f25251 100644 --- a/backend/src/main/resources/application.yml +++ b/backend/src/main/resources/application.yml @@ -120,6 +120,8 @@ ca: - X-User-Email - x-user-name - X-User-Name + - x-user-businessid + - X-User-Businessid methods: - OPTIONS - GET diff --git a/frontend/.gitignore b/frontend/.gitignore index a97aa64476..31d280311d 100644 --- a/frontend/.gitignore +++ b/frontend/.gitignore @@ -186,4 +186,5 @@ cypress/videos/* # End of https://www.toptal.com/developers/gitignore/api/visualstudiocode,vue,vuejs,node,cypressio reports/ -sonar-report.xml \ No newline at end of file +sonar-report.xml +reports-merge/ \ No newline at end of file diff --git a/frontend/src/pages/bceidform/BusinessInformationWizardStep.vue b/frontend/src/pages/bceidform/BusinessInformationWizardStep.vue index b309f29462..aaefcfb365 100644 --- a/frontend/src/pages/bceidform/BusinessInformationWizardStep.vue +++ b/frontend/src/pages/bceidform/BusinessInformationWizardStep.vue @@ -208,9 +208,10 @@ watch([detailsData], () => { formData.value.location.addresses = exportAddress( forestClientDetails.addresses ); + console.log(forestClientDetails.goodStanding === null ? false : (forestClientDetails.goodStanding ? false : true),forestClientDetails.goodStanding === null ? null : (forestClientDetails.goodStanding ? "Y" : "N")); formData.value.businessInformation.goodStandingInd = - forestClientDetails.goodStanding ? "Y" : "N"; - toggleErrorMessages(!forestClientDetails.goodStanding, null); + forestClientDetails.goodStanding === null ? null : (forestClientDetails.goodStanding ? "Y" : "N"); + toggleErrorMessages(forestClientDetails.goodStanding === null ? false : (forestClientDetails.goodStanding ? false : true), null); validation.business = forestClientDetails.goodStanding; emit("update:data", formData.value);