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-972: Submission (Blue Interface) Client Types #597

Merged
merged 3 commits into from
Nov 8, 2023
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 @@ -6,5 +6,7 @@ public enum ClientTypeEnum {
A,
I,
P,
L
L,
RSP,
USP
}
4 changes: 2 additions & 2 deletions backend/src/main/java/ca/bc/gov/app/util/ClientMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ public class ClientMapper {
* @param submissionId the submission ID to be set on the {@link SubmissionDetailEntity}
* @param clientBusinessInformationDto the {@link ClientBusinessInformationDto} object to be
* mapped to a {@link SubmissionDetailEntity}
* @return the {@link SubmissionDetailEntity}
* object mapped from {@link ClientBusinessInformationDto}
* @return the {@link SubmissionDetailEntity} object mapped from
* {@link ClientBusinessInformationDto}
*/
public static SubmissionDetailEntity mapToSubmissionDetailEntity(
Integer submissionId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public static ClientTypeEnum getClientType(LegalTypeEnum legalType) {
case A, B, BC, C, CP, EPR, FOR, LIC, REG -> ClientTypeEnum.C;
case S, XS -> ClientTypeEnum.S;
case XCP -> ClientTypeEnum.A;
case SP -> ClientTypeEnum.I;
case SP -> ClientTypeEnum.RSP;
case GP -> ClientTypeEnum.P;
case LP, XL, XP -> ClientTypeEnum.L;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ private void validateProvince(ClientAddressDto address, String country, Errors e
if ("CA".equalsIgnoreCase(country)) {
errors.rejectValue(provinceField, "You must select a province or territory.");
return;
}
}
else if ("US".equalsIgnoreCase(country)) {
errors.rejectValue(provinceField, "You must select a state.");
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ drop sequence if exists nrfc.submission_submitter_seq;
create schema if not exists nrfc;

create table if not exists nrfc.client_type_code (
client_type_code varchar(1) not null,
client_type_code varchar(5) not null,
description varchar(100) not null,
effective_date date not null,
expiry_date date default to_date('99991231','YYYYMMDD') not null,
Expand All @@ -51,7 +51,7 @@ comment on column nrfc.client_type_code.create_user is 'The user or proxy accoun
comment on column nrfc.client_type_code.update_user is 'The user or proxy account that created or last updated the record.';

create table if not exists nrfc.submission_status_code (
submission_status_code varchar(5) not null,
submission_status_code varchar(5) not null,
description varchar(100) not null,
effective_date date not null,
expiry_date date default to_date('99991231','YYYYMMDD') not null,
Expand Down Expand Up @@ -217,7 +217,7 @@ create table if not exists nrfc.submission_detail (
business_type_code varchar(1) not null,
incorporation_number varchar(50) null,
organization_name varchar(100) null,
client_type_code varchar(1) not null,
client_type_code varchar(5) not null,
good_standing_ind varchar(1) null,
constraint submission_detail_id_pk primary key (submission_detail_id),
constraint submission_id_fk foreign key (submission_id) references nrfc.submission(submission_id),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ insert into nrfc.client_type_code (client_type_code, description, effective_date
insert into nrfc.client_type_code (client_type_code, description, effective_date, create_user) values ('S', 'Society', current_timestamp, 'mariamar') on conflict (client_type_code) do nothing;
insert into nrfc.client_type_code (client_type_code, description, effective_date, create_user) values ('T', 'First Nation Tribal Council', current_timestamp, 'mariamar') on conflict (client_type_code) do nothing;
insert into nrfc.client_type_code (client_type_code, description, effective_date, create_user) values ('U', 'Unregistered Company', current_timestamp, 'mariamar') on conflict (client_type_code) do nothing;
insert into nrfc.client_type_code (client_type_code, description, effective_date, create_user) values ('USP', 'Unregistered sole proprietorship', current_timestamp, 'mariamar') on conflict (client_type_code) do nothing;
insert into nrfc.client_type_code (client_type_code, description, effective_date, create_user) values ('RSP', 'Registered sole proprietorship', current_timestamp, 'mariamar') on conflict (client_type_code) do nothing;

insert into nrfc.contact_type_code (contact_type_code, description, effective_date, create_user) values ('AP', 'Accounts Payable', current_timestamp, 'mariamar') on conflict (contact_type_code) do nothing;
insert into nrfc.contact_type_code (contact_type_code, description, effective_date, create_user) values ('AR', 'Accounts Receivable', current_timestamp, 'mariamar') on conflict (contact_type_code) do nothing;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void shouldListCodeAsExpected(LocalDate date) {
StepVerifier
.create(service.findActiveClientTypeCodes(date))
.assertNext(results -> assertEquals("A", results.code()))
.expectNextCount(11)
.expectNextCount(13)
.verifyComplete();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ private static Stream<Arguments> getClientType() {
Arguments.of(LegalTypeEnum.S, ClientTypeEnum.S),
Arguments.of(LegalTypeEnum.XS, ClientTypeEnum.S),
Arguments.of(LegalTypeEnum.XCP, ClientTypeEnum.A),
Arguments.of(LegalTypeEnum.SP, ClientTypeEnum.I),
Arguments.of(LegalTypeEnum.SP, ClientTypeEnum.RSP),
Arguments.of(LegalTypeEnum.GP, ClientTypeEnum.P),
Arguments.of(LegalTypeEnum.LP, ClientTypeEnum.L),
Arguments.of(LegalTypeEnum.XL, ClientTypeEnum.L),
Expand Down
80 changes: 40 additions & 40 deletions frontend/.devcontainer/frontend.code-workspace
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
{
"folders": [
"folders": [
{
"path": ".."
}
],
"settings": {
"editor.inlineSuggest.enabled": true,
"git.openRepositoryInParentFolders": "always",
"editor.defaultFormatter": "rvest.vs-code-prettier-eslint",
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"editor.tabSize": 2,
"vs-code-prettier-eslint.prettierLast": true,
"eslint.enable": true,
"eslint.alwaysShowStatus": true,
"eslint.validate": [
"javascript",
"typescript",
"vue"
],
"prettier.requireConfig": true,
"workbench.tree.indent": 20,
"workbench.iconTheme": "material-icon-theme",
"[vue]": {
"editor.defaultFormatter": "rvest.vs-code-prettier-eslint"
},
"[typescript]": {
"editor.defaultFormatter": "rvest.vs-code-prettier-eslint"
},
"[xml]": {
"editor.defaultFormatter": "redhat.vscode-xml"
},
"typescript.tsdk": "node_modules/typescript/lib",
"eslint.ignoreUntitled": true,
"eslint.options": {
"configFile": "./.eslintrc.js"
}
}
}
}
],
"settings": {
"editor.inlineSuggest.enabled": true,
"git.openRepositoryInParentFolders": "always",
"editor.defaultFormatter": "rvest.vs-code-prettier-eslint",
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"editor.tabSize": 2,
"vs-code-prettier-eslint.prettierLast": true,
"eslint.enable": true,
"eslint.alwaysShowStatus": true,
"eslint.validate": [
"javascript",
"typescript",
"vue"
],
"prettier.requireConfig": true,
"workbench.tree.indent": 20,
"workbench.iconTheme": "material-icon-theme",
"[vue]": {
"editor.defaultFormatter": "rvest.vs-code-prettier-eslint"
},
"[typescript]": {
"editor.defaultFormatter": "rvest.vs-code-prettier-eslint"
},
"[xml]": {
"editor.defaultFormatter": "redhat.vscode-xml"
},
"typescript.tsdk": "node_modules/typescript/lib",
"eslint.ignoreUntitled": true,
"eslint.options": {
"configFile": "./.eslintrc.js"
}
}
}
4 changes: 3 additions & 1 deletion frontend/src/dto/CommonTypesDto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ export enum ClientTypeEnum {
I,
P,
L,
RSP,
USP,
}

export interface ProgressData {
Expand Down Expand Up @@ -164,4 +166,4 @@ export interface SubmissionDetailsAddress {
export interface SubmissionDetailsMatchers {
goodStanding: string
legalName: string
}
}
2 changes: 1 addition & 1 deletion frontend/src/helpers/DataConversors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const retrieveClientType = (legalType: string): string => {
case "XCP":
return "A";
case "SP":
return "I";
return "RSP";
case "GP":
return "P";
case "LP":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import "@carbon/web-components/es/components/notification/index";
import { useEventBus } from "@vueuse/core";
import { useFetchTo } from "@/composables/useFetch";
// Importing types
import type {
import {
BusinessSearchResult,
ClientTypeEnum,
ProgressNotification
} from "@/dto/CommonTypesDto";
import { BusinessTypeEnum } from "@/dto/CommonTypesDto";
Expand All @@ -23,6 +24,7 @@ import { submissionValidation } from "@/helpers/validators/SubmissionValidators"
import { retrieveClientType, exportAddress } from "@/helpers/DataConversors";
// Importing session
import ForestClientUserSession from "@/helpers/ForestClientUserSession";
import { getEnumKeyByEnumValue } from "@/services/ForestClientService";

//Defining the props and emiter to reveice the data and emit an update
const props = defineProps<{ data: FormDataDto; active: boolean }>();
Expand Down Expand Up @@ -183,8 +185,8 @@ watch([selectedOption], () => {
if (selectedOption.value === BusinessTypeEnum.U) {
const fromName = `${ForestClientUserSession.user?.firstName} ${ForestClientUserSession.user?.lastName}`;

formData.value.businessInformation.businessType = "U";
formData.value.businessInformation.clientType = "U";
formData.value.businessInformation.businessType = getEnumKeyByEnumValue(BusinessTypeEnum, BusinessTypeEnum.U);
formData.value.businessInformation.clientType = getEnumKeyByEnumValue(ClientTypeEnum, ClientTypeEnum.USP);
formData.value.businessInformation.businessName = ForestClientUserSession
.user?.businessName
? ForestClientUserSession.user?.businessName
Expand Down
2 changes: 1 addition & 1 deletion frontend/tests/unittests/helpers/DataConversors.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('DataConversors.ts', () => {
})
it('retrieveClientType should return I when legalType is SP', () => {
const result = retrieveClientType('SP')
expect(result).toEqual('I')
expect(result).toEqual('RSP')
})
it('retrieveClientType should return P when legalType is GP', () => {
const result = retrieveClientType('GP')
Expand Down
Loading