Skip to content

Commit

Permalink
- renamed some methods in App.vue
Browse files Browse the repository at this point in the history
- added amalgamations to App.vue
- added amalgamations to Actions.vue
- added amalgamations to EntityInfo.vue
- added amalgamations to SaveErrorDialog.vue
- added fallbacks to amalgamations in filing-template-mixin.ts
- added amalgamations to BreadCrumbResource.ts
- added amalgamations to legal-services.ts
- added amalgamations to feature-flag-utils.ts
- misc cleanup
  • Loading branch information
severinbeauvais committed Nov 18, 2023
1 parent 58a4ad6 commit 536eb08
Show file tree
Hide file tree
Showing 16 changed files with 85 additions and 66 deletions.
50 changes: 30 additions & 20 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -736,23 +732,23 @@ export default class App extends Mixins(CommonMixin, DateMixin, FilingTemplateMi
switch (this.getFilingType) {
case FilingTypes.AMALGAMATION:
this.$router.push(RouteNames.AMALGAMATION_REG_INFORMATION).catch(() => {})
return
break
case FilingTypes.DISSOLUTION:
if (this.isTypeFirm) {
this.$router.push(RouteNames.DISSOLUTION_FIRM).catch(() => {})
} else {
this.$router.push(RouteNames.DISSOLUTION_DEFINE_DISSOLUTION).catch(() => {})
}
return
return // *** TODO: should this be "break"?
case FilingTypes.INCORPORATION_APPLICATION:
this.$router.push(RouteNames.INCORPORATION_DEFINE_COMPANY).catch(() => {})
return
return // *** TODO: should this be "break"?
case FilingTypes.REGISTRATION:
this.$router.push(RouteNames.REGISTRATION_DEFINE_BUSINESS).catch(() => {})
return
return // *** TODO: should this be "break"?
case FilingTypes.RESTORATION:
this.$router.push(RouteNames.RESTORATION_BUSINESS_NAME).catch(() => {})
return
return // *** TODO: should this be "break"?
default:
this.invalidRouteDialog = true
throw new Error(`fetchData(): invalid filing type = ${this.getFilingType}`) // go to catch()
Expand Down Expand Up @@ -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<void> {
/**
* Fetches draft Dissolution / Restoration and sets the resources.
* (Only dissolutions/restorations have a Business ID.)
*/
private async handleDraftWithBusinessId (businessId: string): Promise<void> {
// ensure user is authorized to use this business
await this.checkAuth(businessId).catch(error => {
console.log('Auth error =', error) // eslint-disable-line no-console
Expand Down Expand Up @@ -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
Expand All @@ -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<void> {
/**
* Fetches draft Amalgamation / IA / Registration and sets the resources.
* (Only amalgamations/incorporations/registrations have a Temp ID.)
*/
private async handleDraftWithTempId (tempId: string): Promise<void> {
// ensure user is authorized to use this IA
await this.checkAuth(tempId).catch(error => {
console.log('Auth error =', error) // eslint-disable-line no-console
Expand All @@ -879,6 +881,14 @@ 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(),
...draftFiling
}
this.parseAmalgamationDraft(draftFiling)
resources = AmalgamationRegResources.find(x => x.entityType === this.getEntityType) as ResourceIF
break
case FilingTypes.INCORPORATION_APPLICATION:
draftFiling = {
...this.buildIncorporationFiling(),
Expand All @@ -896,7 +906,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
Expand Down
3 changes: 1 addition & 2 deletions src/components/Incorporation/SummaryDefineCompany.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
2 changes: 2 additions & 0 deletions src/components/common/Actions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 4 additions & 2 deletions src/components/common/EntityInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions src/dialogs/SaveErrorDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
10 changes: 5 additions & 5 deletions src/interfaces/store-interfaces/state-interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ import {
ContactPointIF,
BusinessIF,
CertifyIF,
CompletingPartyIF,
CourtOrderStepIF,
CreateMemorandumIF,
CreateResolutionIF,
CreateRulesIF,
DefineCompanyIF,
DissolutionStateIF,
Expand All @@ -17,18 +19,16 @@ import {
IncorporationAgreementIF,
NameRequestIF,
NameTranslationIF,
OrgInformationIF,
PartyIF,
PeopleAndRoleIF,
RegistrationStateIF,
ResourceIF,
RestorationStateIF,
ShareStructureIF,
StaffPaymentStepIF,
TombstoneIF,
UploadAffidavitIF,
CreateResolutionIF,
OrgInformationIF,
CompletingPartyIF,
PartyIF
UploadAffidavitIF
} from '@/interfaces'

// State model interface
Expand Down
47 changes: 27 additions & 20 deletions src/mixins/filing-template-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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/'
Expand Down Expand Up @@ -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.amalgamation.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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/resources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,4 @@ export const RestorationResources: Array<RestorationResourceIF> = [
RestorationResourceUlc
]

export * from './BreadCrumbResource'
export * from './BreadcrumbResource'
8 changes: 4 additions & 4 deletions src/services/legal-services.ts
Original file line number Diff line number Diff line change
@@ -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'

/**
Expand All @@ -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<IncorporationFilingIF | RegistrationFilingIF> {
// eslint-disable-next-line max-len
static async fetchFirstOrOnlyFiling (tempId: string): Promise<AmalgamationFilingIF | IncorporationFilingIF | RegistrationFilingIF> {
const url = `businesses/${tempId}/filings`
return axios.get(url)
.then(response => {
Expand Down
10 changes: 3 additions & 7 deletions src/utils/feature-flag-utils.ts
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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': []

}

Expand Down
2 changes: 1 addition & 1 deletion src/views/AmalgamationRegular/AmalgRegBusinessInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
2 changes: 1 addition & 1 deletion src/views/AmalgamationRegular/AmalgRegInformation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
2 changes: 1 addition & 1 deletion src/views/Incorporation/IncorporationDefineCompany.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
Loading

0 comments on commit 536eb08

Please sign in to comment.