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

[FSADT1-1108] [FSADT1-1109] Display Business error messages #728

Merged
merged 4 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions frontend/src/pages/FormBCeIDPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ exitBus.on((event: Record<string, boolean | null>) => {
endAndLogOut.value = event.goodStanding ? event.goodStanding : false;
mailAndLogOut.value = event.duplicated ? event.duplicated : false;
endAndLogOut.value = event.nonPersonSP ? event.nonPersonSP : endAndLogOut.value;
endAndLogOut.value = event.unsupportedClientType || endAndLogOut.value;
});

progressIndicatorBus.on((event: ProgressNotification) => {
Expand Down
56 changes: 47 additions & 9 deletions frontend/src/pages/bceidform/BusinessInformationWizardStep.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
ClientTypeEnum,
ProgressNotification,
} from "@/dto/CommonTypesDto";
import { BusinessTypeEnum } from "@/dto/CommonTypesDto";
import { BusinessTypeEnum, CodeNameType } from "@/dto/CommonTypesDto";
import type {
FormDataDto,
ForestClientDetailsDto,
Expand Down Expand Up @@ -96,27 +96,37 @@ const showAutoCompleteInfo = ref<boolean>(false);
const showGoodStandingError = ref<boolean>(false);
const showDuplicatedError = ref<boolean>(false);
const showNonPersonSPError = ref<boolean>(false);
const showUnsupportedClientTypeError = ref<boolean>(false);
const showDetailsLoading = ref<boolean>(false);
const detailsData = ref(null);

const toggleErrorMessages = (
goodStanding: boolean | null = null,
duplicated: boolean | null = null,
nonPersonSP: boolean | null = null
nonPersonSP: boolean | null = null,
unsupportedClientType: boolean | null = null,
) => {
showGoodStandingError.value = goodStanding ?? false;
showDuplicatedError.value = duplicated ?? false;
showNonPersonSPError.value = nonPersonSP ?? false;
showUnsupportedClientTypeError.value = unsupportedClientType ?? false;

if (goodStanding || duplicated || nonPersonSP) {
if (goodStanding || duplicated || nonPersonSP || unsupportedClientType) {
progressIndicatorBus.emit({ kind: "disabled", value: true });
exitBus.emit({ goodStanding, duplicated, nonPersonSP });
exitBus.emit({ goodStanding, duplicated, nonPersonSP, unsupportedClientType });
} else {
progressIndicatorBus.emit({ kind: "disabled", value: false });
exitBus.emit({ goodStanding: false, duplicated: false, nonPersonSP: false });
exitBus.emit({
goodStanding: false,
duplicated: false,
nonPersonSP: false,
unsupportedClientType: false,
});
}
};

const receivedClientType = ref<CodeNameType>();

//Using this as we have to handle the selected result to get
//incorporation number and client type
const autoCompleteResult = ref<BusinessSearchResult>();
Expand Down Expand Up @@ -162,6 +172,15 @@ watch([autoCompleteResult], () => {
toggleErrorMessages(null, null, true);
return;
}
if (error.value.response?.status === 406) {
toggleErrorMessages(null, null, null, true);
receivedClientType.value = null;
useFetchTo(
`/api/clients/getClientTypeByCode/${formData.value.businessInformation.clientType}`,
receivedClientType,
);
return;
}
if (error.value.response?.status === 404) {
toggleErrorMessages();
validation.business = true;
Expand Down Expand Up @@ -282,7 +301,14 @@ const bcRegistryEmail = "[email protected]";
<cds-inline-loading status="active" v-if="showDetailsLoading">Loading client details...</cds-inline-loading>
<div
class="grouping-02"
v-if="(showAutoCompleteInfo && selectedOption === BusinessTypeEnum.R) || showGoodStandingError || showDuplicatedError || showNonPersonSPError">
v-if="
(showAutoCompleteInfo && selectedOption === BusinessTypeEnum.R) ||
showGoodStandingError ||
showDuplicatedError ||
showNonPersonSPError ||
showUnsupportedClientTypeError
"
>
<cds-inline-notification
v-shadow="2"
v-if="showAutoCompleteInfo && selectedOption === BusinessTypeEnum.R"
Expand Down Expand Up @@ -360,14 +386,26 @@ const bcRegistryEmail = "[email protected]";
low-contrast="true"
open="true"
kind="error"
title="Sole proprietor not owned by a person"
title="Unknown sole proprietor"
>
<p class="cds--inline-notification-content">
Looks like “{{ formData.businessInformation.businessName }}” is not
owned by a person. Please select another entry or logout.
We're unable to complete this application because we cannot identify the person who is the sole proprietor. Please email [email protected] for help.
</p>
</cds-inline-notification>

<cds-inline-notification
v-if="showUnsupportedClientTypeError && receivedClientType"
hide-close-button="true"
low-contrast="true"
open="true"
kind="error"
title="Client type not supported"
>
<p class="cds--inline-notification-content">
{{ receivedClientType.name }} client type is not supported. Please email
[email protected] for help.
</p>
</cds-inline-notification>

</div>
</data-fetcher>
Expand Down
6 changes: 6 additions & 0 deletions frontend/stub/__files/response-autocomplete.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,11 @@
"name":"British Columbia Forest Products",
"status":"ACTIVE",
"legalType": "SP"
},
{
"code":"BC1234567",
"name":"Unsupported Client Type Inc.",
"status":"ACTIVE",
"legalType": "BC"
}
]
44 changes: 44 additions & 0 deletions frontend/stub/mappings/backend.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,18 @@
"transformers": ["response-template"]
}
},
{
"name":"BC Registry Details Unsupported Client Type",
"request": {
"url": "/api/clients/BC1234567",
"method": "GET"
},
"response": {
"status": 406,
"body": "Client type BC is not supported at the moment",
"transformers": ["response-template"]
}
},

{
"name":"Country Codes",
Expand Down Expand Up @@ -98,6 +110,38 @@
"bodyFileName": "response-getCountryByCode-{{request.path.[3]}}.json" }
},

{
"name":"Get ClientType by Code",
"request": {
"urlPattern": "/api/clients/getClientTypeByCode/(.*)",
"method": "GET"
},
"response": {
"status": 200,
"transformers": ["response-template"],
"transformerParameters": {
"clientTypeMapping": {
"A": "Association",
"B": "First Nation Band",
"C": "Corporation",
"F": "Ministry of Forests and Range",
"G": "Government",
"I": "Individual",
"L": "Limited Partnership",
"P": "General Partnership",
"R": "First Nation Group",
"S": "Society",
"T": "First Nation Tribal Council",
"U": "Unregistered Company"
}
},
"jsonBody": {
"code": "{{#assign 'code'}}{{request.pathSegments.[3]}}{{/assign}}{{code}}",
"name": "{{lookup parameters.clientTypeMapping code}}"
}
}
},

{
"name":"Submission Success for XX",
"request": {
Expand Down
Loading