From 53ab148ae9da93eea5eda7ee350f6e9695ef7978 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9verin=20Beauvais?= Date: Tue, 16 Jan 2024 16:34:31 -0800 Subject: [PATCH] 19209 Pre-populate TING business + error handling (#609) - app version = 7.0.36 - fixed some getLegalType types - added generic Technical Error Dialog (per Yui) - added amalgamation enums - refactored Legal Service function for better result and error handling - added dialog to Amalgamation Selection component - refactored Amalgamation Selection for error handling and to pre-populate TING business - added test suite for new dialog Co-authored-by: Severin Beauvais --- package-lock.json | 4 +- package.json | 2 +- .../dialogs/AddStaffNotationDialog.vue | 3 +- .../dialogs/ConfirmDissolutionDialog.vue | 3 +- .../dialogs/TechnicalErrorDialog.vue | 64 +++++++++++++++ src/components/dialogs/index.ts | 4 +- src/enums/amalgamationEnums.ts | 9 +++ src/enums/index.ts | 1 + src/services/legal-services.ts | 20 ++++- src/views/AmalgamationSelection.vue | 77 +++++++++++++------ tests/unit/AmalgamationSelection.spec.ts | 2 +- tests/unit/TechnicalErrorDialog.spec.ts | 43 +++++++++++ 12 files changed, 196 insertions(+), 36 deletions(-) create mode 100644 src/components/dialogs/TechnicalErrorDialog.vue create mode 100644 src/enums/amalgamationEnums.ts create mode 100644 tests/unit/TechnicalErrorDialog.spec.ts diff --git a/package-lock.json b/package-lock.json index 9127e3f0a..7fa77db9c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "business-filings-ui", - "version": "7.0.35", + "version": "7.0.36", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "business-filings-ui", - "version": "7.0.35", + "version": "7.0.36", "dependencies": { "@babel/compat-data": "^7.21.5", "@bcrs-shared-components/base-address": "2.0.9", diff --git a/package.json b/package.json index 68367069c..a3839165d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "business-filings-ui", - "version": "7.0.35", + "version": "7.0.36", "private": true, "appName": "Filings UI", "sbcName": "SBC Common Components", diff --git a/src/components/dialogs/AddStaffNotationDialog.vue b/src/components/dialogs/AddStaffNotationDialog.vue index 180ff47c3..0d94ae1d2 100644 --- a/src/components/dialogs/AddStaffNotationDialog.vue +++ b/src/components/dialogs/AddStaffNotationDialog.vue @@ -155,6 +155,7 @@ import { FormIF } from '@/interfaces' import { EffectOfOrderTypes, FilingSubTypes, FilingTypes, PageSizes } from '@/enums' import { EnumUtilities, LegalServices } from '@/services' import { useAuthenticationStore, useBusinessStore, useRootStore } from '@/stores' +import { CorpTypeCd } from '@bcrs-shared-components/corp-type-module' @Component({ components: { @@ -198,7 +199,7 @@ export default class AddStaffNotationDialog extends Mixins(DateMixin) { @Getter(useRootStore) getCurrentDate!: string @Getter(useBusinessStore) getFoundingDate!: Date @Getter(useBusinessStore) getLegalName!: string - @Getter(useBusinessStore) getLegalType!: string + @Getter(useBusinessStore) getLegalType!: CorpTypeCd @Getter(useBusinessStore) getIdentifier!: string @Getter(useAuthenticationStore) getKeycloakGuid!: string @Getter(useBusinessStore) isAdminFrozen!: boolean diff --git a/src/components/dialogs/ConfirmDissolutionDialog.vue b/src/components/dialogs/ConfirmDissolutionDialog.vue index 959a130ae..7720e5bbe 100644 --- a/src/components/dialogs/ConfirmDissolutionDialog.vue +++ b/src/components/dialogs/ConfirmDissolutionDialog.vue @@ -87,6 +87,7 @@ import { Component, Prop, Emit, Vue } from 'vue-property-decorator' import { Getter } from 'pinia-class' import { DissolutionConfirmationResourceIF } from '@/interfaces' import { useBusinessStore, useRootStore } from '@/stores' +import { CorpTypeCd } from '@bcrs-shared-components/corp-type-module' @Component({}) export default class ConfirmDissolutionDialog extends Vue { @@ -99,7 +100,7 @@ export default class ConfirmDissolutionDialog extends Vue { // Global getters @Getter(useRootStore) getDissolutionConfirmationResource!: DissolutionConfirmationResourceIF @Getter(useBusinessStore) getLegalName!: string - @Getter(useBusinessStore) getLegalType!: string + @Getter(useBusinessStore) getLegalType!: CorpTypeCd /** The entity title to display. */ get entityTitle (): string { diff --git a/src/components/dialogs/TechnicalErrorDialog.vue b/src/components/dialogs/TechnicalErrorDialog.vue new file mode 100644 index 000000000..75c91c60a --- /dev/null +++ b/src/components/dialogs/TechnicalErrorDialog.vue @@ -0,0 +1,64 @@ + + + diff --git a/src/components/dialogs/index.ts b/src/components/dialogs/index.ts index 5eb10af05..7155bade8 100644 --- a/src/components/dialogs/index.ts +++ b/src/components/dialogs/index.ts @@ -19,6 +19,7 @@ import PaymentErrorDialog from './PaymentErrorDialog.vue' import ResumeErrorDialog from './ResumeErrorDialog.vue' import SaveErrorDialog from './SaveErrorDialog.vue' import StaffPaymentDialog from './StaffPaymentDialog.vue' +import TechnicalErrorDialog from './TechnicalErrorDialog.vue' export { AddCommentDialog, @@ -41,5 +42,6 @@ export { PaymentErrorDialog, ResumeErrorDialog, SaveErrorDialog, - StaffPaymentDialog + StaffPaymentDialog, + TechnicalErrorDialog } diff --git a/src/enums/amalgamationEnums.ts b/src/enums/amalgamationEnums.ts new file mode 100644 index 000000000..28573900a --- /dev/null +++ b/src/enums/amalgamationEnums.ts @@ -0,0 +1,9 @@ +export enum AmlRoles { + AMALGAMATING = 'amalgamating', + HOLDING = 'holding' +} + +export enum AmlTypes { + LEAR = 'lear', + FOREIGN = 'foreign' +} diff --git a/src/enums/index.ts b/src/enums/index.ts index c87930650..f08167277 100644 --- a/src/enums/index.ts +++ b/src/enums/index.ts @@ -1,5 +1,6 @@ export * from './actions' export * from './allowableActions' +export * from './amalgamationEnums' export * from './applicationTypes' export * from './correctionTypes' export * from './effectOfOrderTypes' diff --git a/src/services/legal-services.ts b/src/services/legal-services.ts index bbe7f6665..1bb29ef4b 100644 --- a/src/services/legal-services.ts +++ b/src/services/legal-services.ts @@ -155,6 +155,7 @@ export default class LegalServices { if (isDraft) { url += '?draft=true' } + return axios.post(url, { filing }) .then(response => { const filing = response?.data?.filing @@ -168,13 +169,23 @@ export default class LegalServices { } /** - * Creates (posts) a draft (temporary) business record. - * Must be logged in to use this. - * Throws an exception on error. + * Creates (posts) a draft business record, which is used to bootstrap a new business. + * @param businessRequest the object body of the request + * @returns the filing object associated with the temporary business */ - static async createBusiness (businessRequest: any): Promise { + static async createDraftBusiness (businessRequest: any): Promise { const url = `businesses?draft=true` + return axios.post(url, businessRequest) + .then(response => { + const filing = response?.data?.filing + if (!filing) { + // eslint-disable-next-line no-console + console.log('createDraftBusiness() error - invalid response =', response) + throw new Error('Invalid filing') + } + return filing + }) } /** @@ -190,6 +201,7 @@ export default class LegalServices { if (isDraft) { url += '?draft=true' } + return axios.put(url, { filing }) .then(response => { const filing = response?.data?.filing diff --git a/src/views/AmalgamationSelection.vue b/src/views/AmalgamationSelection.vue index eef17efce..06c277f5b 100644 --- a/src/views/AmalgamationSelection.vue +++ b/src/views/AmalgamationSelection.vue @@ -1,5 +1,11 @@