diff --git a/src/App.vue b/src/App.vue index 1b45ebc26..f91ada409 100644 --- a/src/App.vue +++ b/src/App.vue @@ -252,9 +252,9 @@ import { CommonMixin, DateMixin, FilingTemplateMixin, NameRequestMixin } from '@ import { AccountInformationIF, AddressIF, BreadcrumbIF, BusinessIF, BusinessWarningIF, CompletingPartyIF, ConfirmDialogType, EmptyFees, FeesIF, FilingDataIF, NameRequestIF, OrgInformationIF, PartyIF, ResourceIF, StepIF } from '@/interfaces' -import { DissolutionResources, IncorporationResources, RegistrationResources, RestorationResources, - getEntityDashboardBreadcrumb, getMyBusinessRegistryBreadcrumb, getRegistryDashboardBreadcrumb, - getSbcStaffDashboardBreadcrumb, getStaffDashboardBreadcrumb } from '@/resources' +import { AmalgamationRegResources, DissolutionResources, IncorporationResources, RegistrationResources, + RestorationResources, getEntityDashboardBreadcrumb, getMyBusinessRegistryBreadcrumb, + getRegistryDashboardBreadcrumb, getSbcStaffDashboardBreadcrumb, getStaffDashboardBreadcrumb } from '@/resources' import { AuthServices, LegalServices, PayServices } from '@/services/' // Enums and Constants @@ -675,14 +675,10 @@ export default class App extends Mixins(CommonMixin, DateMixin, FilingTemplateMi if (!this.getBusinessId && !this.getTempId) throw new Error('Neither business id nor temp id exist') if (this.getBusinessId) { - // this should be a Dissolution or Restoration filing - // (only dissolutions/restorations have a business id) - await this.handleDissolutionOrRestoration(this.getBusinessId) + await this.handleDraftWithBusinessId(this.getBusinessId) } if (this.getTempId) { - // this should be an Incorporation or Registration filing - // (only incorporations/registrations have a temp id) - await this.handleIaOrRegistration(this.getTempId) + await this.handleDraftWithTempId(this.getTempId) } } catch (error) { // Log exception to Sentry due to incomplete business data. @@ -798,8 +794,11 @@ export default class App extends Mixins(CommonMixin, DateMixin, FilingTemplateMi } } - /** Fetches draft Dissolution or Restoration and sets the resources. */ - private async handleDissolutionOrRestoration (businessId: string): Promise { + /** + * Fetches draft Dissolution / Restoration and sets the resources. + * (Only dissolutions/restorations have a Business ID.) + */ + private async handleDraftWithBusinessId (businessId: string): Promise { // ensure user is authorized to use this business await this.checkAuth(businessId).catch(error => { console.log('Auth error =', error) // eslint-disable-line no-console @@ -840,7 +839,7 @@ export default class App extends Mixins(CommonMixin, DateMixin, FilingTemplateMi resources = RestorationResources.find(x => x.entityType === this.getEntityType) as ResourceIF break default: - throw new Error(`handleDissolutionOrRestoration(): invalid filing type = ${this.getFilingType}`) + throw new Error(`handleDraftWithBusinessId(): invalid filing type = ${this.getFilingType}`) } // set the resources @@ -857,8 +856,11 @@ export default class App extends Mixins(CommonMixin, DateMixin, FilingTemplateMi } } - /** Fetches draft IA or Registration and sets the resources. */ - private async handleIaOrRegistration (tempId: string): Promise { + /** + * Fetches draft Amalgamation / IA / Registration and sets the resources. + * (Only amalgamations/incorporations/registrations have a Temp ID.) + */ + private async handleDraftWithTempId (tempId: string): Promise { // ensure user is authorized to use this IA await this.checkAuth(tempId).catch(error => { console.log('Auth error =', error) // eslint-disable-line no-console @@ -879,6 +881,11 @@ export default class App extends Mixins(CommonMixin, DateMixin, FilingTemplateMi // parse draft filing into the store and get the resources let resources: ResourceIF switch (this.getFilingType) { + case FilingTypes.AMALGAMATION: + draftFiling = this.buildAmalgamationFiling() + this.parseAmalgamationDraft(draftFiling) + resources = AmalgamationRegResources.find(x => x.entityType === this.getEntityType) as ResourceIF + break case FilingTypes.INCORPORATION_APPLICATION: draftFiling = { ...this.buildIncorporationFiling(), @@ -896,7 +903,7 @@ export default class App extends Mixins(CommonMixin, DateMixin, FilingTemplateMi resources = RegistrationResources.find(x => x.entityType === this.getEntityType) as ResourceIF break default: - throw new Error(`handleIaOrRegistration(): invalid filing type = ${this.getFilingType}`) + throw new Error(`handleDraftWithTempId(): invalid filing type = ${this.getFilingType}`) } // set the resources diff --git a/src/components/Incorporation/SummaryDefineCompany.vue b/src/components/Incorporation/SummaryDefineCompany.vue index 7a2efa737..c85421042 100644 --- a/src/components/Incorporation/SummaryDefineCompany.vue +++ b/src/components/Incorporation/SummaryDefineCompany.vue @@ -143,8 +143,7 @@ import BusinessContactInfo from '@/components/common/BusinessContactInfo.vue' import FolioNumber from '@/components/common/FolioNumber.vue' import OfficeAddresses from '@/components/common/OfficeAddresses.vue' import { CoopTypes, RouteNames } from '@/enums' -import { CorpTypeCd } from '@bcrs-shared-components/enums/' -import { GetCorpFullDescription } from '@bcrs-shared-components/corp-type-module' +import { CorpTypeCd, GetCorpFullDescription } from '@bcrs-shared-components/corp-type-module' import { CoopTypeToDescription } from '@/utils' @Component({ diff --git a/src/components/common/Actions.vue b/src/components/common/Actions.vue index 1a46fc05f..2f2775eaf 100644 --- a/src/components/common/Actions.vue +++ b/src/components/common/Actions.vue @@ -293,6 +293,8 @@ export default class Actions extends Mixins(CommonMixin, DateMixin, FilingTempla /** Prepare filing for saving/filing. */ private prepareFiling (): any { switch (this.getFilingType) { + case FilingTypes.AMALGAMATION: + return this.buildAmalgamationFiling() case FilingTypes.INCORPORATION_APPLICATION: return this.buildIncorporationFiling() case FilingTypes.REGISTRATION: diff --git a/src/components/common/EntityInfo.vue b/src/components/common/EntityInfo.vue index 88c2602cb..3ed9ac034 100644 --- a/src/components/common/EntityInfo.vue +++ b/src/components/common/EntityInfo.vue @@ -86,12 +86,12 @@ import { Component, Mixins } from 'vue-property-decorator' import { Getter } from 'pinia-class' import { useStore } from '@/store/store' import { FilingNames, FilingTypes } from '@/enums' -import { CorpTypeCd } from '@bcrs-shared-components/enums/' import { ContactPointIF, RegistrationStateIF } from '@/interfaces' import { DateMixin } from '@/mixins' import { StaffComments } from '@bcrs-shared-components/staff-comments' import { AxiosInstance as axios } from '@/utils' -import { GetCorpFullDescription, GetCorpNumberedDescription } from '@bcrs-shared-components/corp-type-module' +import { CorpTypeCd, GetCorpFullDescription, GetCorpNumberedDescription } + from '@bcrs-shared-components/corp-type-module' @Component({ components: { @@ -130,6 +130,8 @@ export default class EntityInfo extends Mixins(DateMixin) { // name comes from different places depending on filing type switch (this.getFilingType) { + case FilingTypes.AMALGAMATION: + return (this.getNameRequestApprovedName || numberedDescription) case FilingTypes.DISSOLUTION: return (this.getBusinessLegalName || numberedDescription) case FilingTypes.INCORPORATION_APPLICATION: diff --git a/src/dialogs/SaveErrorDialog.vue b/src/dialogs/SaveErrorDialog.vue index 34cba89df..bdfb9f5ae 100644 --- a/src/dialogs/SaveErrorDialog.vue +++ b/src/dialogs/SaveErrorDialog.vue @@ -150,6 +150,7 @@ export default class SaveErrorDialog extends Vue { /** The filing name. */ get filingName (): string { switch (this.getFilingType) { + case FilingTypes.AMALGAMATION: return 'Application' case FilingTypes.INCORPORATION_APPLICATION: return 'Application' case FilingTypes.REGISTRATION: return 'Registration' case FilingTypes.RESTORATION: return 'Restoration' diff --git a/src/interfaces/store-interfaces/state-interface.ts b/src/interfaces/store-interfaces/state-interface.ts index e806d224f..15ae8ae67 100644 --- a/src/interfaces/store-interfaces/state-interface.ts +++ b/src/interfaces/store-interfaces/state-interface.ts @@ -6,8 +6,10 @@ import { ContactPointIF, BusinessIF, CertifyIF, + CompletingPartyIF, CourtOrderStepIF, CreateMemorandumIF, + CreateResolutionIF, CreateRulesIF, DefineCompanyIF, DissolutionStateIF, @@ -17,6 +19,8 @@ import { IncorporationAgreementIF, NameRequestIF, NameTranslationIF, + OrgInformationIF, + PartyIF, PeopleAndRoleIF, RegistrationStateIF, ResourceIF, @@ -24,11 +28,7 @@ import { ShareStructureIF, StaffPaymentStepIF, TombstoneIF, - UploadAffidavitIF, - CreateResolutionIF, - OrgInformationIF, - CompletingPartyIF, - PartyIF + UploadAffidavitIF } from '@/interfaces' // State model interface diff --git a/src/mixins/filing-template-mixin.ts b/src/mixins/filing-template-mixin.ts index 9938889d9..cb0d2af8a 100644 --- a/src/mixins/filing-template-mixin.ts +++ b/src/mixins/filing-template-mixin.ts @@ -5,13 +5,14 @@ import { DateMixin } from '@/mixins' import { AmalgamationFilingIF, BusinessAddressIF, ContactPointIF, CertifyIF, CompletingPartyIF, CourtOrderIF, CourtOrderStepIF, CreateMemorandumIF, CreateResolutionIF, CreateRulesIF, DefineCompanyIF, - DissolutionFilingIF, DissolutionStatementIF, DocumentDeliveryIF, EffectiveDateTimeIF, EmptyNaics, - IncorporationAgreementIF, IncorporationFilingIF, NaicsIF, NameRequestFilingIF, NameTranslationIF, - OfficeAddressIF, OrgPersonIF, PartyIF, PeopleAndRoleIF, RegisteredRecordsAddressesIF, + DissolutionFilingIF, DissolutionStatementIF, DocumentDeliveryIF, EffectiveDateTimeIF, EmptyContactPoint, + EmptyNaics, IncorporationAgreementIF, IncorporationFilingIF, NaicsIF, NameRequestFilingIF, + NameTranslationIF, OfficeAddressIF, OrgPersonIF, PartyIF, PeopleAndRoleIF, RegisteredRecordsAddressesIF, RegistrationFilingIF, RegistrationStateIF, RestorationFilingIF, RestorationStateIF, ShareClassIF, ShareStructureIF, SpecialResolutionIF, StaffPaymentIF, StaffPaymentStepIF, UploadAffidavitIF } from '@/interfaces' -import { AmalgamationTypes, ApprovalTypes, BusinessTypes, CoopTypes, CorrectNameOptions, DissolutionTypes, +import { + AmalgamationTypes, ApprovalTypes, BusinessTypes, CoopTypes, CorrectNameOptions, DissolutionTypes, EffectOfOrders, FilingTypes, PartyTypes, RelationshipTypes, RestorationTypes, RoleTypes, StaffPaymentOptions } from '@/enums' import { CorpTypeCd } from '@bcrs-shared-components/corp-type-module/' @@ -213,22 +214,30 @@ export default class FilingTemplateMixin extends Mixins(DateMixin) { this.setEntityType(draftFiling.amalgamation.nameRequest.legalType) // restore Office Addresses - this.setOfficeAddresses(draftFiling.amalgamation.offices) + // *** TODO: verify whether we need to assign fallback + // *** also fix IAs and registrations the same way? + if (draftFiling.restoration.offices) { + this.setOfficeAddresses(draftFiling.amalgamation.offices) + } // restore Name Translations if (draftFiling.amalgamation.nameTranslations) { this.setNameTranslations(draftFiling.amalgamation.nameTranslations) } - // restore Contact Info - this.setBusinessContact({ - ...draftFiling.amalgamation.contactPoint, - confirmEmail: draftFiling.amalgamation.contactPoint.email - }) + // restore Business Contact + if (draftFiling.amalgamation.contactPoint) { + this.setBusinessContact({ + ...draftFiling.amalgamation.contactPoint, + confirmEmail: draftFiling.amalgamation.contactPoint.email + }) + } else { + this.setBusinessContact({ ...EmptyContactPoint }) + } // restore Persons and Organizations if (draftFiling.amalgamation.parties) { - this.setOrgPersonList(draftFiling.amalgamation.parties) + this.setOrgPersonList(draftFiling.amalgamation.parties || []) } // restore Share Structure @@ -404,7 +413,7 @@ export default class FilingTemplateMixin extends Mixins(DateMixin) { this.setNameTranslations(draftFiling.incorporationApplication.nameTranslations) } - // restore Contact Info + // restore Business Contact this.setBusinessContact({ ...draftFiling.incorporationApplication.contactPoint, confirmEmail: draftFiling.incorporationApplication.contactPoint.email @@ -686,7 +695,7 @@ export default class FilingTemplateMixin extends Mixins(DateMixin) { // restore Business Type this.setRegistrationBusinessType(draftFiling.registration.businessType) - // restore Contact Info + // restore Business Contact this.setBusinessContact({ ...draftFiling.registration.contactPoint, confirmEmail: draftFiling.registration.contactPoint.email @@ -809,7 +818,7 @@ export default class FilingTemplateMixin extends Mixins(DateMixin) { this.setOfficeAddresses(draftFiling.restoration.offices) } - // restore Contact Info + // restore Business Contact if (draftFiling.restoration.contactPoint) { this.setBusinessContact({ ...draftFiling.restoration.contactPoint, @@ -1094,9 +1103,8 @@ export default class FilingTemplateMixin extends Mixins(DateMixin) { * Builds dissolution staff payment data from store data. * @param filing the filing body to update */ - private buildStaffPayment (filing: AmalgamationFilingIF | DissolutionFilingIF | RegistrationFilingIF | - RestorationFilingIF | IncorporationFilingIF - ): void { + // eslint-disable-next-line max-len + private buildStaffPayment (filing: AmalgamationFilingIF | DissolutionFilingIF | RegistrationFilingIF | RestorationFilingIF | IncorporationFilingIF): void { // Populate Staff Payment according to payment option const staffPayment = this.getStaffPaymentStep.staffPayment switch (staffPayment.option) { @@ -1142,9 +1150,8 @@ export default class FilingTemplateMixin extends Mixins(DateMixin) { * Parses dissolution staff payment data into the store. * @param filing the filing body to parse */ - private parseStaffPayment (filing: AmalgamationFilingIF | DissolutionFilingIF | RegistrationFilingIF | - RestorationFilingIF | IncorporationFilingIF - ): void { + // eslint-disable-next-line max-len + private parseStaffPayment (filing: AmalgamationFilingIF | DissolutionFilingIF | RegistrationFilingIF | RestorationFilingIF | IncorporationFilingIF): void { // Parse staff payment if (filing.header.routingSlipNumber) { this.setStaffPayment({ diff --git a/src/resources/BreadCrumbResource.ts b/src/resources/BreadcrumbResource.ts similarity index 97% rename from src/resources/BreadCrumbResource.ts rename to src/resources/BreadcrumbResource.ts index 1a408e63f..9b8769a10 100644 --- a/src/resources/BreadCrumbResource.ts +++ b/src/resources/BreadcrumbResource.ts @@ -14,6 +14,7 @@ function getLegalName (): string { const getNameRequestApprovedName: string = store.getNameRequestApprovedName switch (getFilingType) { + case FilingTypes.AMALGAMATION: return getNameRequestApprovedName case FilingTypes.DISSOLUTION: return getBusinessLegalName case FilingTypes.INCORPORATION_APPLICATION: return getNameRequestApprovedName case FilingTypes.REGISTRATION: return getNameRequestApprovedName diff --git a/src/resources/index.ts b/src/resources/index.ts index 7b540887a..c3b907b19 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -80,4 +80,4 @@ export const RestorationResources: Array = [ RestorationResourceUlc ] -export * from './BreadCrumbResource' +export * from './BreadcrumbResource' diff --git a/src/services/legal-services.ts b/src/services/legal-services.ts index a0380c065..59368d674 100644 --- a/src/services/legal-services.ts +++ b/src/services/legal-services.ts @@ -1,8 +1,7 @@ -// Libraries import { AxiosInstance as axios } from '@/utils' import { StatusCodes } from 'http-status-codes' -import { DissolutionFilingIF, IncorporationFilingIF, NameRequestIF, RegistrationFilingIF, RestorationFilingIF } - from '@/interfaces' +import { AmalgamationFilingIF, DissolutionFilingIF, IncorporationFilingIF, NameRequestIF, RegistrationFilingIF, + RestorationFilingIF } from '@/interfaces' import { FilingTypes } from '@/enums' /** @@ -15,7 +14,8 @@ export default class LegalServices { * @param tempId the temp registration number * @returns a promise to return the draft filing, else exception */ - static async fetchFirstOrOnlyFiling (tempId: string): Promise { + // eslint-disable-next-line max-len + static async fetchFirstOrOnlyFiling (tempId: string): Promise { const url = `businesses/${tempId}/filings` return axios.get(url) .then(response => { diff --git a/src/utils/feature-flag-utils.ts b/src/utils/feature-flag-utils.ts index 875a1669d..b64b5da95 100644 --- a/src/utils/feature-flag-utils.ts +++ b/src/utils/feature-flag-utils.ts @@ -1,5 +1,4 @@ import { initialize, LDClient, LDFlagSet, LDOptions, LDUser } from 'launchdarkly-js-client-sdk' -import { FilingTypes } from '@/enums' // get rid of "element implicitly has an 'any' type..." declare const window: any @@ -9,15 +8,12 @@ declare const window: any * Uses "business-create" project (per LD client id in config). */ const defaultFlagSet: LDFlagSet = { - 'supported-filings': [ - FilingTypes.DISSOLUTION, - FilingTypes.INCORPORATION_APPLICATION, - FilingTypes.REGISTRATION - ], + 'supported-filings': [], 'enable-web-chat': false, // by default, old webchat is disabled 'enable-genesys-web-message': false, // by default, genesys web message is disabled 'sentry-enable': false, // by default, no sentry logs - 'banner-text': '' // by default, there is no banner text + 'banner-text': '', // by default, there is no banner text + 'supported-amalgamation-entities': [] } diff --git a/src/views/AmalgamationRegular/AmalgRegBusinessInfo.vue b/src/views/AmalgamationRegular/AmalgRegBusinessInfo.vue index 140e9b268..ed1dda540 100644 --- a/src/views/AmalgamationRegular/AmalgRegBusinessInfo.vue +++ b/src/views/AmalgamationRegular/AmalgRegBusinessInfo.vue @@ -245,7 +245,7 @@ export default class AmalgRegBusinessInfo extends Mixins(CommonMixin) { } get addresses (): RegisteredRecordsAddressesIF { - return this.getDefineCompanyStep.officeAddresses as RegisteredRecordsAddressesIF + return this.getDefineCompanyStep.officeAddresses } /** Called when component is created. */ diff --git a/src/views/AmalgamationRegular/AmalgRegInformation.vue b/src/views/AmalgamationRegular/AmalgRegInformation.vue index 516274616..6244dfa46 100644 --- a/src/views/AmalgamationRegular/AmalgRegInformation.vue +++ b/src/views/AmalgamationRegular/AmalgRegInformation.vue @@ -245,7 +245,7 @@ export default class AmalgRegInformation extends Mixins(CommonMixin) { } get addresses (): RegisteredRecordsAddressesIF { - return this.getDefineCompanyStep.officeAddresses as RegisteredRecordsAddressesIF + return this.getDefineCompanyStep.officeAddresses } /** Called when component is created. */ diff --git a/src/views/Incorporation/IncorporationDefineCompany.vue b/src/views/Incorporation/IncorporationDefineCompany.vue index fad02aae1..0a8a63541 100644 --- a/src/views/Incorporation/IncorporationDefineCompany.vue +++ b/src/views/Incorporation/IncorporationDefineCompany.vue @@ -245,7 +245,7 @@ export default class IncorporationDefineCompany extends Mixins(CommonMixin) { } get addresses (): RegisteredRecordsAddressesIF { - return this.getDefineCompanyStep.officeAddresses as RegisteredRecordsAddressesIF + return this.getDefineCompanyStep.officeAddresses } /** Called when component is created. */ diff --git a/src/views/Restoration/RestorationBusinessInformation.vue b/src/views/Restoration/RestorationBusinessInformation.vue index a5c9c7baf..524141bfe 100644 --- a/src/views/Restoration/RestorationBusinessInformation.vue +++ b/src/views/Restoration/RestorationBusinessInformation.vue @@ -91,7 +91,7 @@ export default class RestorationBusinessInformation extends Mixins(CommonMixin) readonly CorpTypeCd = CorpTypeCd get addresses (): RegisteredRecordsAddressesIF { - return this.getDefineCompanyStep.officeAddresses as RegisteredRecordsAddressesIF + return this.getDefineCompanyStep.officeAddresses } /** Called when component is created. */ diff --git a/tests/unit/Actions.spec.ts b/tests/unit/Actions.spec.ts index c7cb95346..582e98eb6 100644 --- a/tests/unit/Actions.spec.ts +++ b/tests/unit/Actions.spec.ts @@ -11,7 +11,8 @@ import { AxiosInstance as axios } from '@/utils' import Actions from '@/components/common/Actions.vue' import mockRouter from './MockRouter' import LegalServices from '@/services/legal-services' -import { CorpTypeCd, FilingTypes } from '@/enums' +import { FilingTypes } from '@/enums' +import { CorpTypeCd } from '@bcrs-shared-components/corp-type-module' import { CourtOrderStepIF, DefineCompanyIF, EffectiveDateTimeIF, IncorporationAgreementIF, NameRequestIF, OrgPersonIF, PeopleAndRoleIF, ShareStructureIF, TombstoneIF } from '@/interfaces' import { ShareClassIF } from '@bcrs-shared-components/interfaces'