From 93ba397e3be959f6b82c910dc13415a5e7028a80 Mon Sep 17 00:00:00 2001 From: Paulo Gomes da Cruz Junior Date: Wed, 17 Jan 2024 16:11:28 -0800 Subject: [PATCH 1/2] fix(FSADT1-1148): fixing issue with Society --- .gitignore | 1 + .../app/dto/bcregistry/ClientDetailsDto.java | 2 +- .../gov/app/service/client/ClientService.java | 47 ++++++++++++++----- frontend/.gitignore | 3 +- .../BusinessInformationWizardStep.vue | 5 +- 5 files changed, 41 insertions(+), 17 deletions(-) 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 b278649a25..2046ffe26f 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( @@ -209,8 +210,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())); @@ -219,8 +221,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( @@ -280,14 +282,33 @@ public Mono triggerEmailDuplicatedClient(EmailRequestDto emailRequestDto) 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/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 c827af8599..e02fb026f8 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); From 1e5b3e47e0309058fdce25f07866ae0d647844c8 Mon Sep 17 00:00:00 2001 From: Paulo Gomes da Cruz Junior Date: Wed, 17 Jan 2024 16:25:25 -0800 Subject: [PATCH 2/2] fix: fixing cors issue --- backend/src/main/resources/application.yml | 2 ++ 1 file changed, 2 insertions(+) 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