From 6b7307725174867da251d38091471a7b0430c704 Mon Sep 17 00:00:00 2001
From: Maria Martinez <77364706+mamartinezmejia@users.noreply.github.com>
Date: Wed, 10 Jan 2024 12:14:30 -0800
Subject: [PATCH 1/2] FSADT1-1116 (#727)
---
backend/src/main/resources/templates/approval.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/backend/src/main/resources/templates/approval.html b/backend/src/main/resources/templates/approval.html
index 6a8d5e80c4..4ad2c9c779 100644
--- a/backend/src/main/resources/templates/approval.html
+++ b/backend/src/main/resources/templates/approval.html
@@ -18,7 +18,7 @@
- An application for a client number for ${userName} has been approved.
+ An application for a client number for ${business.name} has been approved.
The client number is ${business.clientNumber}.
From b560982e8596de65650a2d2be3cc5eb00f5a3d57 Mon Sep 17 00:00:00 2001
From: Fernando Terra <79578735+fterra-encora@users.noreply.github.com>
Date: Thu, 11 Jan 2024 16:49:58 -0300
Subject: [PATCH 2/2] [FSADT1-1108] [FSADT1-1109] Display Business error
messages (#728)
* feat: handle 406 error
* feat: update Unknown sole proprietor error message
* test: add component tests
---------
Co-authored-by: Paulo Gomes da Cruz Junior
---
frontend/cypress/fixtures/business.json | 12 ++
frontend/src/pages/FormBCeIDPage.vue | 1 +
.../BusinessInformationWizardStep.vue | 56 +++++++--
.../stub/__files/response-autocomplete.json | 6 +
frontend/stub/mappings/backend.json | 44 +++++++
.../bceid/BusinessInformationWizardStep.cy.ts | 119 +++++++++++++++++-
6 files changed, 228 insertions(+), 10 deletions(-)
diff --git a/frontend/cypress/fixtures/business.json b/frontend/cypress/fixtures/business.json
index bf8e986dcc..c6158f2319 100644
--- a/frontend/cypress/fixtures/business.json
+++ b/frontend/cypress/fixtures/business.json
@@ -40,5 +40,17 @@
"name": "Totally Shady Company",
"status": "ACTIVE",
"legalType": "SP"
+ },
+ {
+ "code":"BC1234567",
+ "name":"Unsupported Client Type Inc.",
+ "status":"ACTIVE",
+ "legalType": "BC"
+ },
+ {
+ "code":"SP1234567",
+ "name":"Unknown Sole Proprietor Ltd.",
+ "status":"ACTIVE",
+ "legalType": "SP"
}
]
diff --git a/frontend/src/pages/FormBCeIDPage.vue b/frontend/src/pages/FormBCeIDPage.vue
index 49db5a0d7b..d220c3cea6 100644
--- a/frontend/src/pages/FormBCeIDPage.vue
+++ b/frontend/src/pages/FormBCeIDPage.vue
@@ -329,6 +329,7 @@ exitBus.on((event: Record) => {
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) => {
diff --git a/frontend/src/pages/bceidform/BusinessInformationWizardStep.vue b/frontend/src/pages/bceidform/BusinessInformationWizardStep.vue
index fa66a488ff..c827af8599 100644
--- a/frontend/src/pages/bceidform/BusinessInformationWizardStep.vue
+++ b/frontend/src/pages/bceidform/BusinessInformationWizardStep.vue
@@ -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,
@@ -96,27 +96,37 @@ const showAutoCompleteInfo = ref(false);
const showGoodStandingError = ref(false);
const showDuplicatedError = ref(false);
const showNonPersonSPError = ref(false);
+const showUnsupportedClientTypeError = ref(false);
const showDetailsLoading = ref(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();
+
//Using this as we have to handle the selected result to get
//incorporation number and client type
const autoCompleteResult = ref();
@@ -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;
@@ -282,7 +301,14 @@ const bcRegistryEmail = "BCRegistries@gov.bc.ca";
Loading client details...
+ v-if="
+ (showAutoCompleteInfo && selectedOption === BusinessTypeEnum.R) ||
+ showGoodStandingError ||
+ showDuplicatedError ||
+ showNonPersonSPError ||
+ showUnsupportedClientTypeError
+ "
+ >
- 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 FORHVAP.CLIADMIN@gov.bc.ca for help.
+
+
+ {{ receivedClientType.name }} client type is not supported. Please email
+ FORHVAP.CLIADMIN@gov.bc.ca for help.
+
+
diff --git a/frontend/stub/__files/response-autocomplete.json b/frontend/stub/__files/response-autocomplete.json
index 647104f1bb..9889fe64e4 100644
--- a/frontend/stub/__files/response-autocomplete.json
+++ b/frontend/stub/__files/response-autocomplete.json
@@ -52,5 +52,11 @@
"name":"British Columbia Forest Products",
"status":"ACTIVE",
"legalType": "SP"
+ },
+ {
+ "code":"BC1234567",
+ "name":"Unsupported Client Type Inc.",
+ "status":"ACTIVE",
+ "legalType": "BC"
}
]
diff --git a/frontend/stub/mappings/backend.json b/frontend/stub/mappings/backend.json
index f113141962..2f8e64758f 100644
--- a/frontend/stub/mappings/backend.json
+++ b/frontend/stub/mappings/backend.json
@@ -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",
@@ -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": {
diff --git a/frontend/tests/pages/bceid/BusinessInformationWizardStep.cy.ts b/frontend/tests/pages/bceid/BusinessInformationWizardStep.cy.ts
index d3d94d0407..5945cbd704 100644
--- a/frontend/tests/pages/bceid/BusinessInformationWizardStep.cy.ts
+++ b/frontend/tests/pages/bceid/BusinessInformationWizardStep.cy.ts
@@ -2,7 +2,31 @@ import BusinessInformationWizardStep from "@/pages/bceidform/BusinessInformation
import type { FormDataDto } from "@/dto/ApplyClientNumberDto";
describe('', () => {
-
+
+ beforeEach(() => {
+ cy.intercept("/api/clients/name/*", {
+ fixture: "business.json",
+ }).as("searchCompany");
+
+ cy.intercept("GET", "/api/clients/BC1234567", {
+ statusCode: 406,
+ body: "Client type BC is not supported at the moment",
+ });
+
+ cy.intercept("GET", "/api/clients/SP1234567", {
+ statusCode: 422,
+ body: "Unable to process request. This sole proprietor is not owner by a person",
+ });
+
+ cy.intercept("GET", "/api/clients/getClientTypeByCode/C", {
+ statusCode: 200,
+ body: {
+ code: "C",
+ name: "Corporation",
+ },
+ }).as("getClientType");
+ });
+
it('renders the BusinessInformationWizardStep component and interacts with elements', () => {
cy.mount(BusinessInformationWizardStep, {
props: {
@@ -28,4 +52,97 @@ describe('', () => {
cy.get('.link-button:visible span').should('exist');
cy.get('.link-button:visible span').invoke('text').should('not.be.empty');
});
+
+ it('shows "Client type not supported"', () => {
+ cy.mount(BusinessInformationWizardStep, {
+ props: {
+ data: {
+ businessInformation: {
+ businessType: "",
+ legalType: "",
+ clientType: "",
+ incorporationNumber: "",
+ businessName: "",
+ goodStandingInd: "",
+ birthdate: "",
+ address: ""
+ },
+ location: {
+ contacts: [
+ {
+ email: "john@doe.com",
+ firstName: "John",
+ },
+ ],
+ },
+ } as unknown as FormDataDto,
+ active: false,
+ },
+ });
+
+ cy.get("#businessTyperbR").click();
+
+ cy.get("#business")
+ .should("be.visible")
+ .shadow()
+ .find("input")
+ .should("have.value", "")
+ .type("Unsupported");
+ cy.wait("@searchCompany");
+
+ cy.get('cds-combo-box-item[data-id="BC1234567"]').click();
+
+ cy.get("cds-inline-notification")
+ .shadow()
+ .contains("Client type not supported")
+ .should("be.visible");
+
+ // The name of the client type
+ cy.contains("cds-inline-notification", "Corporation").should("be.visible");
+ });
+
+ it('shows "Unknown sole proprietor"', () => {
+ cy.mount(BusinessInformationWizardStep, {
+ props: {
+ data: {
+ businessInformation: {
+ businessType: "",
+ legalType: "",
+ clientType: "",
+ incorporationNumber: "",
+ businessName: "",
+ goodStandingInd: "",
+ birthdate: "",
+ address: ""
+ },
+ location: {
+ contacts: [
+ {
+ email: "john@doe.com",
+ firstName: "John",
+ },
+ ],
+ },
+ } as unknown as FormDataDto,
+ active: false,
+ },
+ });
+
+ cy.get("#businessTyperbR").click();
+
+ cy.get("#business")
+ .should("be.visible")
+ .shadow()
+ .find("input")
+ .should("have.value", "")
+ .type("Unknown");
+ cy.wait("@searchCompany");
+
+ cy.get('cds-combo-box-item[data-id="SP1234567"]').click();
+
+ cy.get("cds-inline-notification")
+ .shadow()
+ .contains("Unknown sole proprietor")
+ .should("be.visible");
+ });
});