Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(FSADT1-1514): fixed doing business as processing #1177

Merged
merged 2 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { getValidations } from "@/helpers/validators/GlobalValidators";
import { submissionValidation } from "@/helpers/validators/SubmissionValidators";
// Importing helper functions
import { retrieveClientType, exportAddress } from "@/helpers/DataConversors";
import { formDataDto } from '../../dto/ApplyClientNumberDto';
import {
getEnumKeyByEnumValue,
adminEmail,
Expand Down Expand Up @@ -159,6 +160,7 @@ const autoCompleteResult = ref<BusinessSearchResult>();
watch([autoCompleteResult], () => {
// reset business validation state
validation.business = false;
formData.value.businessInformation.doingBusinessAs = null;

if (autoCompleteResult.value && autoCompleteResult.value.code) {
toggleErrorMessages(false, false, false);
Expand All @@ -172,6 +174,10 @@ watch([autoCompleteResult], () => {
);
showAutoCompleteInfo.value = false;

if (formData.value.businessInformation.clientType === 'RSP') {
formData.value.businessInformation.doingBusinessAs = autoCompleteResult.value.name;
}

emit("update:data", formData.value);

//Also, we will load the backend data to fill all the other information as well
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public final class ApplicationConstant {
public static final String MATCHING_KIND = "kind";
public static final String MATCHED_USER = "matched-user";
public static final String IS_DOING_BUSINESS_AS = "isDoingBusinessAs";
public static final String DOING_BUSINESS_AS = "isDoingBusinessAs";
public static final String DOING_BUSINESS_AS = "doingBusinessAsName";

public static final BcRegistryDocumentRequestBodyDto
BUSINESS_SUMMARY_FILING_HISTORY =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.RegExUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
Expand Down Expand Up @@ -320,13 +319,12 @@ private Mono<String> createClientDoingBusinessAs(MessagingWrapper<ForestClientDt
.just(clientNumber)
//FSADT1-1388: Allow doing business as based on parameter
.filter(
forestClientNumber -> BooleanUtils
.toBoolean(
message
.getParameter(
ApplicationConstant.IS_DOING_BUSINESS_AS,
String.class
)
forestClientNumber ->
Boolean.TRUE.equals(message
.getParameter(
ApplicationConstant.IS_DOING_BUSINESS_AS,
Boolean.class
)
)
)
.doOnNext(forestClientNumber ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,12 @@ public Mono<MessagingWrapper<ForestClientDto>> generateForestClient(

//if Staff submitted, get the client name from the submission as doing business as
.doOnNext(submissionDetail -> {
if (isStaffSubmitted(message)) {
atomicClientName.set(submissionDetail.getDoingBusinessAs());
}
atomicClientName.set(
Optional
.ofNullable(submissionDetail.getDoingBusinessAs())
.filter(StringUtils::isNotBlank)
.orElse(submissionDetail.getOrganizationName())
);
})

.map(submissionDetail ->
Expand Down Expand Up @@ -139,15 +142,7 @@ public Mono<MessagingWrapper<ForestClientDto>> generateForestClient(
message.parameters()
)
.withParameter(ApplicationConstant.FOREST_CLIENT_NAME,
BooleanUtils.toString(
isStaffSubmitted(message),
atomicClientName.get(),
Optional
.ofNullable(forestClient.clientComment())
.filter(StringUtils::isNotBlank)
.map(comment -> comment.split("and company name ")[1])
.orElse(StringUtils.EMPTY)
)
atomicClientName.get().toUpperCase()
)
.withParameter(ApplicationConstant.REGISTRATION_NUMBER,
String.join(StringUtils.EMPTY,
Expand All @@ -161,16 +156,7 @@ public Mono<MessagingWrapper<ForestClientDto>> generateForestClient(
)
.withParameter(
ApplicationConstant.DOING_BUSINESS_AS,
BooleanUtils.toString(
isStaffSubmitted(message),
atomicClientName.get().toUpperCase(),
Optional
.ofNullable(forestClient.clientComment())
.filter(StringUtils::isNotBlank)
.map(comment -> comment.split("and company name ")[1])
.orElse(StringUtils.EMPTY)
.toUpperCase()
)
atomicClientName.get().toUpperCase()
)
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ private static Stream<Arguments> generateForestClient() {
.withParameter(ApplicationConstant.CREATED_BY, "IDIR\\JWICK")
.withParameter(ApplicationConstant.UPDATED_BY, "IDIR\\JWICK")
.withParameter(ApplicationConstant.FOREST_CLIENT_NAME,
"Baxter Corp")
"BAXTER CORP")
.withParameter(ApplicationConstant.REGISTRATION_NUMBER, "FM00184546")
.withParameter(ApplicationConstant.IS_DOING_BUSINESS_AS, true)
.withParameter(ApplicationConstant.DOING_BUSINESS_AS, "BAXTER CORP"),
Expand Down Expand Up @@ -497,7 +497,7 @@ private static Stream<Arguments> generateForestClient() {
.withParameter(ApplicationConstant.CREATED_BY, "IDIR\\JWICK")
.withParameter(ApplicationConstant.UPDATED_BY, "IDIR\\JWICK")
.withParameter(ApplicationConstant.FOREST_CLIENT_NAME,
"Baxter Corp")
"BAXTER CORP")
.withParameter(ApplicationConstant.REGISTRATION_NUMBER, "FM00184546")
.withParameter(ApplicationConstant.IS_DOING_BUSINESS_AS, true)
.withParameter(ApplicationConstant.DOING_BUSINESS_AS, "BAXTER CORP"),
Expand Down Expand Up @@ -638,7 +638,7 @@ private static Stream<Arguments> generateDoingBusinessAs() {
.withParameter(ApplicationConstant.CREATED_BY, "IDIR\\JWICK")
.withParameter(ApplicationConstant.UPDATED_BY, "IDIR\\JWICK")
.withParameter(ApplicationConstant.FOREST_CLIENT_NAME,
"Baxter Corp")
"BAXTER CORP")
.withParameter(ApplicationConstant.REGISTRATION_NUMBER, "FM00184546")
.withParameter(ApplicationConstant.IS_DOING_BUSINESS_AS, true)
.withParameter(ApplicationConstant.DOING_BUSINESS_AS, "BAXTER CORP")
Expand Down
Loading