diff --git a/backend/src/main/java/ca/bc/gov/app/dto/bcregistry/BcRegistryOfficerDto.java b/backend/src/main/java/ca/bc/gov/app/dto/bcregistry/BcRegistryOfficerDto.java index 1c2827164..96e4a4928 100644 --- a/backend/src/main/java/ca/bc/gov/app/dto/bcregistry/BcRegistryOfficerDto.java +++ b/backend/src/main/java/ca/bc/gov/app/dto/bcregistry/BcRegistryOfficerDto.java @@ -9,6 +9,8 @@ public record BcRegistryOfficerDto( String firstName, String lastName, String middleInitial, + String identifier, + String organizationName, String partyType ) { diff --git a/backend/src/main/java/ca/bc/gov/app/service/bcregistry/BcRegistryService.java b/backend/src/main/java/ca/bc/gov/app/service/bcregistry/BcRegistryService.java index 2c6e8bccf..991a04483 100644 --- a/backend/src/main/java/ca/bc/gov/app/service/bcregistry/BcRegistryService.java +++ b/backend/src/main/java/ca/bc/gov/app/service/bcregistry/BcRegistryService.java @@ -307,6 +307,8 @@ private BcRegistryPartyDto buildBcRegistryPartyDto(BcRegistryFacetPartyDto party naming.get("firstName"), naming.get("lastName"), null, + StringUtils.EMPTY, + StringUtils.EMPTY, party.partyType() ), roles diff --git a/backend/src/test/java/ca/bc/gov/app/BcRegistryTestConstants.java b/backend/src/test/java/ca/bc/gov/app/BcRegistryTestConstants.java index 36f9fd447..163320f06 100644 --- a/backend/src/test/java/ca/bc/gov/app/BcRegistryTestConstants.java +++ b/backend/src/test/java/ca/bc/gov/app/BcRegistryTestConstants.java @@ -229,6 +229,8 @@ public class BcRegistryTestConstants { null, null, null, + "BC0123456", + "EXAMPLE COMPANY LTD.", "organization" ), List.of( @@ -422,6 +424,8 @@ public class BcRegistryTestConstants { "JOHNATHAN", "WICK", null, + null, + null, "person" ), List.of( @@ -557,6 +561,8 @@ public class BcRegistryTestConstants { "JOHNATHAN", "WICK", "VALELONG", + null, + null, "person" ), List.of( @@ -573,6 +579,8 @@ public class BcRegistryTestConstants { "RUSKA", "ROMA", null, + null, + null, "person" ), List.of( diff --git a/backend/src/test/java/ca/bc/gov/app/validator/business/BusinessInformationBusinessRegisteredNumberValidatorTest.java b/backend/src/test/java/ca/bc/gov/app/validator/business/BusinessInformationBusinessRegisteredNumberValidatorTest.java index b0d06cd82..b06545f7b 100644 --- a/backend/src/test/java/ca/bc/gov/app/validator/business/BusinessInformationBusinessRegisteredNumberValidatorTest.java +++ b/backend/src/test/java/ca/bc/gov/app/validator/business/BusinessInformationBusinessRegisteredNumberValidatorTest.java @@ -2,12 +2,15 @@ import static ca.bc.gov.app.util.ClientValidationUtils.fieldIsMissingErrorMessage; import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Named.named; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import ca.bc.gov.app.dto.ValidationError; import ca.bc.gov.app.dto.bcregistry.BcRegistryBusinessDto; import ca.bc.gov.app.dto.bcregistry.BcRegistryDocumentDto; +import ca.bc.gov.app.dto.bcregistry.BcRegistryOfficerDto; +import ca.bc.gov.app.dto.bcregistry.BcRegistryPartyDto; import ca.bc.gov.app.dto.client.ClientBusinessInformationDto; import ca.bc.gov.app.dto.client.ValidationSourceEnum; import ca.bc.gov.app.service.bcregistry.BcRegistryService; @@ -37,7 +40,7 @@ void shouldSupportAllValidationSources(ValidationSourceEnum source, boolean supp assertEquals(support, validator.supports(source)); } - @ParameterizedTest + @ParameterizedTest(name = "{0}") @MethodSource("validation") @DisplayName("Should run validate") void shouldValidate( @@ -45,30 +48,13 @@ void shouldValidate( String legalType, String businessType, boolean isFoundOnBcRegistry, - boolean isGoodStanding, + BcRegistryDocumentDto document, String expectedMessage ) { if (isFoundOnBcRegistry) { when(service.requestDocumentData(registrationNumber)) - .thenReturn(Flux.just( - new BcRegistryDocumentDto( - new BcRegistryBusinessDto( - List.of(), - isGoodStanding, - false, - false, - false, - registrationNumber, - StringUtils.EMPTY, - StringUtils.EMPTY, - StringUtils.EMPTY - ), - null, - List.of() - ) - ) - ); + .thenReturn(Flux.just(document)); } else { when(service.requestDocumentData(registrationNumber)) .thenReturn(Flux.empty()); @@ -115,19 +101,146 @@ void shouldValidate( private static Stream validation() { return Stream.of( - Arguments.of(StringUtils.EMPTY, StringUtils.EMPTY, StringUtils.EMPTY, false, false, + Arguments.of( + named("all fine, no issues", StringUtils.EMPTY), + StringUtils.EMPTY, + StringUtils.EMPTY, + false, + null, + StringUtils.EMPTY + ), + + Arguments.of( + named("Registration number missing", StringUtils.EMPTY), + StringUtils.EMPTY, + "R", + false, + null, + fieldIsMissingErrorMessage("registrationNumber") + ), + + Arguments.of( + named("Big number, no no", "12345678901234"), + StringUtils.EMPTY, + "R", + false, + null, + "has more than 13 characters" + ), + + Arguments.of( + named("This is what I call good", "XX1234567"), + StringUtils.EMPTY, + "R", + false, + null, + StringUtils.EMPTY + ), + + Arguments.of(named("Another good day around here", "XX1234567"), + "C", "R", false, null, StringUtils.EMPTY), - Arguments.of(StringUtils.EMPTY, StringUtils.EMPTY, "R", false, false, - fieldIsMissingErrorMessage("registrationNumber")), - Arguments.of("12345678901234", StringUtils.EMPTY, "R", false, false, - "has more than 13 characters"), - Arguments.of("XX1234567", StringUtils.EMPTY, "R", false, false, StringUtils.EMPTY), - Arguments.of("XX1234567", "C", "R", false, false, StringUtils.EMPTY), - Arguments.of("XX1234567", "SP", "R", false, false, + + Arguments.of(named("Oops, not found on bc reg","XX1234567"), + "SP", "R", false,null, "Incorporation Number was not found in BC Registry"), - Arguments.of("XX1234567", "SP", "R", true, false, + + Arguments.of(named("I think you forgot to pay the bills","XX1234567"), + "SP", "R", true, + new BcRegistryDocumentDto( + new BcRegistryBusinessDto( + List.of(), + false, + false, + false, + false, + "XX1234567", + "SAMPLE CORP", + StringUtils.EMPTY, + StringUtils.EMPTY + ), + null, + List.of( + new BcRegistryPartyDto( + null,null, + new BcRegistryOfficerDto( + StringUtils.EMPTY, + "Johnathan", + "Wick", + StringUtils.EMPTY, + StringUtils.EMPTY, + StringUtils.EMPTY, + "person" + ), + List.of() + ) + ) + ), "Company is not in goodStanding in BC Registry"), - Arguments.of("XX1234567", "SP", "R", true, true, StringUtils.EMPTY) + + Arguments.of(named("Sole prop good for belly","XX1234567"), + "SP", "R", true, + new BcRegistryDocumentDto( + new BcRegistryBusinessDto( + List.of(), + true, + false, + false, + false, + "XX1234567", + "SAMPLE CORP", + StringUtils.EMPTY, + StringUtils.EMPTY + ), + null, + List.of( + new BcRegistryPartyDto( + null,null, + new BcRegistryOfficerDto( + StringUtils.EMPTY, + "Johnathan", + "Wick", + StringUtils.EMPTY, + StringUtils.EMPTY, + StringUtils.EMPTY, + "person" + ), + List.of() + ) + ) + ), StringUtils.EMPTY), + + Arguments.of(named("Sole prop from org is no bueno","XX1234567"), + "SP", "R", true, + new BcRegistryDocumentDto( + new BcRegistryBusinessDto( + List.of(), + true, + false, + false, + false, + "XX1234567", + "SAMPLE CORP", + StringUtils.EMPTY, + StringUtils.EMPTY + ), + null, + List.of( + new BcRegistryPartyDto( + null,null, + new BcRegistryOfficerDto( + StringUtils.EMPTY, + StringUtils.EMPTY, + StringUtils.EMPTY, + StringUtils.EMPTY, + StringUtils.EMPTY, + StringUtils.EMPTY, + "organization" + ), + List.of() + ) + ) + ), "SAMPLE CORP sole proprietor is not owned by a person") ); }