Skip to content

Commit

Permalink
19041 Finished validations + updated certify statements + updated uni…
Browse files Browse the repository at this point in the history
…t tests (bcgov#646)

* - app version = 5.8.8
- deleted useless isViteRunning getter (was only used in 1 place)
- changed re-routing code to not push the wrong route to history
- update misc comments
- fixed amalgamation statement validation (was undefined on draft restore)
- updated certify statements (for regular and short-form amalgamations)
- fixed invalid date error in EffectiveDateTime
- updated isAmalgamationInformationValid()
- fixed amalgamation validation (ignore share structure validity for short-form amalg)
- refactored Business Info test suite to handle regular vs horiz vs vert
- misc cleanup

* - set new resources when holding/primary business is changed

* - also update resources when adopting a business' NOA or using a new NR
- refactored resource update into separate method for use in multiple places

---------

Co-authored-by: Severin Beauvais <[email protected]>
  • Loading branch information
2 people authored and JazzarKarim committed Feb 23, 2024
1 parent 6272ad1 commit 8d23945
Show file tree
Hide file tree
Showing 27 changed files with 264 additions and 120 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "business-create-ui",
"version": "5.8.7",
"version": "5.8.8",
"private": true,
"appName": "Create UI",
"sbcName": "SBC Common Components",
Expand Down
22 changes: 11 additions & 11 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ export default class App extends Mixins(CommonMixin, DateMixin, FilingTemplateMi
// @Action(useStore) setNameRequest!: (x: NameRequestIF) => void
@Action(useStore) setOperatingName!: (x: string) => void
@Action(useStore) setParties!: (x: Array<PartyIF>) => void
@Action(useStore) setResources!: (x: ResourceIF) => void
// @Action(useStore) setResources!: (x: ResourceIF) => void
@Action(useStore) setUserAddress!: (x: AddressIF) => void
@Action(useStore) setUserEmail!: (x: string) => void
@Action(useStore) setUserFirstName!: (x: string) => void
Expand Down Expand Up @@ -668,8 +668,8 @@ export default class App extends Mixins(CommonMixin, DateMixin, FilingTemplateMi
// reset errors in case this method is invoked more than once (ie, retry)
this.resetFlags()
// don't check FF during Vitest tests
if (!this.isVitestRunning) {
// only check FF when not in Vitest tests
if (import.meta.env.VITEST === undefined) {
// check that current route matches a supported filing type
const supportedFilings = await GetFeatureFlag('supported-filings')
if (!supportedFilings?.includes(this.$route.meta.filingType)) {
Expand Down Expand Up @@ -754,31 +754,31 @@ export default class App extends Mixins(CommonMixin, DateMixin, FilingTemplateMi
switch (this.getFilingType) {
case FilingTypes.AMALGAMATION_APPLICATION:
if (this.isAmalgamationFilingRegular) {
this.$router.push(RouteNames.AMALG_REG_INFORMATION).catch(() => {})
this.$router.replace(RouteNames.AMALG_REG_INFORMATION).catch(() => {})
} else if (this.isAmalgamationFilingHorizontal || this.isAmalgamationFilingVertical) {
this.$router.push(RouteNames.AMALG_SHORT_INFORMATION).catch(() => {})
this.$router.replace(RouteNames.AMALG_SHORT_INFORMATION).catch(() => {})
} else {
throw new Error('invalid amalgamation filing type')
}
return
case FilingTypes.CONTINUATION_IN:
this.$router.push(RouteNames.CONTINUATION_IN_BUSINESS_HOME).catch(() => {})
this.$router.replace(RouteNames.CONTINUATION_IN_BUSINESS_HOME).catch(() => {})
return
case FilingTypes.DISSOLUTION:
if (this.isTypeFirm) {
this.$router.push(RouteNames.DISSOLUTION_FIRM).catch(() => {})
this.$router.replace(RouteNames.DISSOLUTION_FIRM).catch(() => {})
} else {
this.$router.push(RouteNames.DISSOLUTION_DEFINE_DISSOLUTION).catch(() => {})
this.$router.replace(RouteNames.DISSOLUTION_DEFINE_DISSOLUTION).catch(() => {})
}
return
case FilingTypes.INCORPORATION_APPLICATION:
this.$router.push(RouteNames.INCORPORATION_DEFINE_COMPANY).catch(() => {})
this.$router.replace(RouteNames.INCORPORATION_DEFINE_COMPANY).catch(() => {})
return
case FilingTypes.REGISTRATION:
this.$router.push(RouteNames.REGISTRATION_DEFINE_BUSINESS).catch(() => {})
this.$router.replace(RouteNames.REGISTRATION_DEFINE_BUSINESS).catch(() => {})
return
case FilingTypes.RESTORATION:
this.$router.push(RouteNames.RESTORATION_BUSINESS_NAME).catch(() => {})
this.$router.replace(RouteNames.RESTORATION_BUSINESS_NAME).catch(() => {})
return
default:
this.invalidRouteDialog = true
Expand Down
4 changes: 4 additions & 0 deletions src/components/Amalgamation/ResultingBusinessName.vue
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,14 @@ export default class ResultingBusinessName extends Mixins(AmalgamationMixin, Nam
this.setNameRequestApprovedName(name)
// if adopting a business' name, also adopt its legal type
// and update resources (since legal type may have changed)
if (this.formType === CorrectNameOptions.CORRECT_AML_ADOPT) {
const business = this.getAmalgamatingBusinesses.find(b =>
(b.type === AmlTypes.LEAR && b.name === name)
)
if (business?.type === AmlTypes.LEAR) {
this.setEntityType(business.legalType)
this.updateResources()
}
}
}
Expand All @@ -155,7 +157,9 @@ export default class ResultingBusinessName extends Mixins(AmalgamationMixin, Nam
this.setNameRequest(nameRequest)
// as we are using a new NR, also use its legal type
// and update resources (since legal type may have changed)
this.setEntityType(nameRequest.legalType)
this.updateResources()
}
/**
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/Actions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ export default class Actions extends Mixins(AmalgamationMixin, CommonMixin,
this.setIsFilingPaying(false)
}
} else {
// don't call window.scrollTo during Vitest tests because jsdom doesn't implement it
// otherwise, smooth-scroll to the top of the page
window.scrollTo({ top: 0, behavior: 'smooth' })
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/common/EffectiveDateTime.vue
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export default class EffectiveDateTime extends Mixins(DateMixin) {
dateTimeForm: FormIF
}
@Prop({ default: null }) readonly effectiveDateTime!: EffectiveDateTimeIF
@Prop({ required: true }) readonly effectiveDateTime!: EffectiveDateTimeIF
@Prop({ default: 'Incorporation Date and Time' }) readonly label!: string
Expand Down Expand Up @@ -238,7 +238,7 @@ export default class EffectiveDateTime extends Mixins(DateMixin) {
/** Construct the Date Object for storage */
private constructDate (): void {
if (this.isFutureEffective) {
if (this.isFutureEffective && this.dateText) {
// Format the selected date string and create Date
const dateToValidate = this.yyyyMmDdToDate(this.dateText)
Expand Down
1 change: 0 additions & 1 deletion src/components/common/SummaryDefineCompany.vue
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ export default class SummaryDefineCompany extends Vue {
/** Whether this section is invalid. */
get invalidSection (): boolean {
if (this.isAmalgamationFiling) {
// *** FUTURE: update this for short-form amalgamation (needs to be valid)
return (!this.isAmalgamationInformationValid || !this.isDefineCompanyValid)
}
return !this.isDefineCompanyValid
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ async function start () {
await KeycloakService.setKeycloakConfigUrl(keycloakConfig)

// initialize token service which will do a check-sso to initiate session
// don't start during Vitest tests as it messes up the test JWT
// only do when not in Vitest tests as it messes up the test JWT
if (import.meta.env.VITEST === undefined) {
console.info('Starting token refresh service...') // eslint-disable-line no-console
await KeycloakService.initializeToken()
Expand Down
26 changes: 24 additions & 2 deletions src/mixins/amalgamation-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ import {
} from '@/enums'
import {
AmalgamatingBusinessIF, ContactPointIF, EmptyContactPoint, EmptyNameRequest, NameRequestIF,
NameTranslationIF, OrgPersonIF, PeopleAndRoleIF, RegisteredRecordsAddressesIF, ShareClassIF
NameTranslationIF, OrgPersonIF, PeopleAndRoleIF, RegisteredRecordsAddressesIF, ResourceIF,
ShareClassIF
} from '@/interfaces'
import { CorrectNameOptions } from '@bcrs-shared-components/enums/'
import { CorpTypeCd } from '@bcrs-shared-components/corp-type-module'
import { AuthServices, LegalServices } from '@/services'
import { AmalgamationRegResources, AmalgamationShortResources } from '@/resources'

/**
* Mixin that provides amalgamation rules, etc.
Expand All @@ -21,6 +23,7 @@ export default class AmalgamationMixin extends Vue {
@Getter(useStore) getAddPeopleAndRoleStep!: PeopleAndRoleIF
@Getter(useStore) getAmalgamatingBusinesses!: AmalgamatingBusinessIF[]
@Getter(useStore) getCurrentDate!: string
@Getter(useStore) getEntityType!: CorpTypeCd
@Getter(useStore) isAmalgamationFilingHorizontal!: boolean
@Getter(useStore) isAmalgamationFilingRegular!: boolean
@Getter(useStore) isAmalgamationFilingVertical!: boolean
Expand All @@ -37,6 +40,7 @@ export default class AmalgamationMixin extends Vue {
@Action(useStore) setNameTranslations!: (x: NameTranslationIF[]) => void
@Action(useStore) setOfficeAddresses!: (x: RegisteredRecordsAddressesIF) => void
@Action(useStore) setOrgPersonList!: (x: OrgPersonIF[]) => void
@Action(useStore) setResources!: (x: ResourceIF) => void
@Action(useStore) setShareClasses!: (x: ShareClassIF[]) => void

/** Iterable array of rule functions, in order of processing. */
Expand Down Expand Up @@ -400,9 +404,27 @@ export default class AmalgamationMixin extends Vue {
}
}

// set new resulting business name and type
// set new resulting business name and legal type
// and update resources (since legal type may have changed)
this.setNameRequestApprovedName(business.name)
this.setEntityType(business.legalType)
this.updateResources()
}

/**
* Updates the resources, for use when the entity type may have changed.
* NB - this is specific to amalgamation filings.
*/
updateResources (): void {
if (this.isAmalgamationFilingRegular) {
const resources = AmalgamationRegResources.find(x => x.entityType === this.getEntityType) as ResourceIF
this.setResources(resources)
} else if (this.isAmalgamationFilingHorizontal || this.isAmalgamationFilingVertical) {
const resources = AmalgamationShortResources.find(x => x.entityType === this.getEntityType) as ResourceIF
this.setResources(resources)
} else {
throw new Error('invalid amalgamation filing type')
}
}

//
Expand Down
5 changes: 0 additions & 5 deletions src/mixins/common-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ import { getName } from 'country-list'
*/
@Component({})
export default class CommonMixin extends Vue {
/** Is True if Vitest is running the code. */
get isVitestRunning (): boolean {
return (import.meta.env.VITEST !== undefined)
}

/**
* Compares two objects while omitting specified properties from the comparison.
* @param objA the first object to compare
Expand Down
7 changes: 5 additions & 2 deletions src/mixins/filing-template-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default class FilingTemplateMixin extends Mixins(AmalgamationMixin, DateM
@Getter(useStore) getDissolutionType!: DissolutionTypes
@Getter(useStore) getDocumentDelivery!: DocumentDeliveryIF
@Getter(useStore) getEffectiveDateTime!: EffectiveDateTimeIF
@Getter(useStore) getEntityType!: CorpTypeCd
// @Getter(useStore) getEntityType!: CorpTypeCd
@Getter(useStore) getFilingId!: number
@Getter(useStore) getFolioNumber!: string
@Getter(useStore) getIncorporationAgreementStep!: IncorporationAgreementIF
Expand Down Expand Up @@ -302,7 +302,10 @@ export default class FilingTemplateMixin extends Mixins(AmalgamationMixin, DateM
}

// restore the Amalgamation Court Approval if it's True or False
if (draftFiling.amalgamationApplication.courtApproval !== null) {
if (
draftFiling.amalgamationApplication.courtApproval === true ||
draftFiling.amalgamationApplication.courtApproval === false
) {
this.setAmalgamationCourtApproval(draftFiling.amalgamationApplication.courtApproval)
}

Expand Down
5 changes: 4 additions & 1 deletion src/resources/AmalgamationRegular/BC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ export const AmalgamationRegResourceBc: AmalgamationResourceIF = {
},
reviewAndConfirm: {
completingPartyStatement: {
certifyStatements: [],
certifyStatements: [
'I have relevant knowledge of the business and that I am authorized to make this filing.',
'I understand that this amalgamation cannot be reversed without a court order.'
],
certifyClause: `Note: It is an offence to make a false or misleading statement in respect
of a material fact in a record submitted to the Corporate Registry for filing.
See section 427 of the Business Corporations Act.`,
Expand Down
5 changes: 4 additions & 1 deletion src/resources/AmalgamationRegular/BEN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ export const AmalgamationRegResourceBen: AmalgamationResourceIF = {
},
reviewAndConfirm: {
completingPartyStatement: {
certifyStatements: [],
certifyStatements: [
'I have relevant knowledge of the business and that I am authorized to make this filing.',
'I understand that this amalgamation cannot be reversed without a court order.'
],
certifyClause: `Note: It is an offence to make a false or misleading statement in respect
of a material fact in a record submitted to the Corporate Registry for filing.
See section 427 of the Business Corporations Act.`,
Expand Down
5 changes: 4 additions & 1 deletion src/resources/AmalgamationRegular/CC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ export const AmalgamationRegResourceCc: AmalgamationResourceIF = {
},
reviewAndConfirm: {
completingPartyStatement: {
certifyStatements: [],
certifyStatements: [
'I have relevant knowledge of the business and that I am authorized to make this filing.',
'I understand that this amalgamation cannot be reversed without a court order.'
],
certifyClause: `Note: It is an offence to make a false or misleading statement in respect
of a material fact in a record submitted to the Corporate Registry for filing.
See section 427 of the Business Corporations Act.`,
Expand Down
5 changes: 4 additions & 1 deletion src/resources/AmalgamationRegular/ULC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ export const AmalgamationRegResourceUlc: AmalgamationResourceIF = {
},
reviewAndConfirm: {
completingPartyStatement: {
certifyStatements: [],
certifyStatements: [
'I have relevant knowledge of the business and that I am authorized to make this filing.',
'I understand that this amalgamation cannot be reversed without a court order.'
],
certifyClause: `Note: It is an offence to make a false or misleading statement in respect
of a material fact in a record submitted to the Corporate Registry for filing.
See section 427 of the Business Corporations Act.`,
Expand Down
5 changes: 4 additions & 1 deletion src/resources/AmalgamationShort/BC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ export const AmalgamationShortResourceBc: AmalgamationResourceIF = {
},
reviewAndConfirm: {
completingPartyStatement: {
certifyStatements: [],
certifyStatements: [
'I have relevant knowledge of the business and that I am authorized to make this filing.',
'I understand that this amalgamation cannot be reversed without a court order.'
],
certifyClause: `Note: It is an offence to make a false or misleading statement in respect
of a material fact in a record submitted to the Corporate Registry for filing.
See section 427 of the Business Corporations Act.`,
Expand Down
5 changes: 4 additions & 1 deletion src/resources/AmalgamationShort/BEN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ export const AmalgamationShortResourceBen: AmalgamationResourceIF = {
},
reviewAndConfirm: {
completingPartyStatement: {
certifyStatements: [],
certifyStatements: [
'I have relevant knowledge of the business and that I am authorized to make this filing.',
'I understand that this amalgamation cannot be reversed without a court order.'
],
certifyClause: `Note: It is an offence to make a false or misleading statement in respect
of a material fact in a record submitted to the Corporate Registry for filing.
See section 427 of the Business Corporations Act.`,
Expand Down
5 changes: 4 additions & 1 deletion src/resources/AmalgamationShort/CC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ export const AmalgamationShortResourceCc: AmalgamationResourceIF = {
},
reviewAndConfirm: {
completingPartyStatement: {
certifyStatements: [],
certifyStatements: [
'I have relevant knowledge of the business and that I am authorized to make this filing.',
'I understand that this amalgamation cannot be reversed without a court order.'
],
certifyClause: `Note: It is an offence to make a false or misleading statement in respect
of a material fact in a record submitted to the Corporate Registry for filing.
See section 427 of the Business Corporations Act.`,
Expand Down
5 changes: 4 additions & 1 deletion src/resources/AmalgamationShort/ULC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ export const AmalgamationShortResourceUlc: AmalgamationResourceIF = {
},
reviewAndConfirm: {
completingPartyStatement: {
certifyStatements: [],
certifyStatements: [
'I have relevant knowledge of the business and that I am authorized to make this filing.',
'I understand that this amalgamation cannot be reversed without a court order.'
],
certifyClause: `Note: It is an offence to make a false or misleading statement in respect
of a material fact in a record submitted to the Corporate Registry for filing.
See section 427 of the Business Corporations Act.`,
Expand Down
13 changes: 9 additions & 4 deletions src/store/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -602,16 +602,21 @@ export const useStore = defineStore('store', {
)
} else {
return (
// *** FUTURE: update this when Resulting Company Name is implemented
this.getAmalgamatingBusinessesValid &&
!!this.getCorrectNameOption &&
this.getNameTranslationsValid
// NB - this is the only valid Correct Name Option for short-form amalgamations:
(this.getCorrectNameOption === CorrectNameOptions.CORRECT_AML_ADOPT)
// NB - there are no name translations for short-form amalgamations
)
}
},

/** Whether all the amalgamation steps are valid. */
isAmalgamationValid (): boolean {
const isCreateShareStructureValid = (
this.isAmalgamationFilingHorizontal ||
this.isAmalgamationFilingVertical ||
this.isCreateShareStructureValid
)
const isFolioNumberValid = !this.isPremiumAccount || this.getFolioNumberValid
const isCourtOrderValid = this.isRoleStaff ? this.getCourtOrderStep.valid : true
const isCertifyValid = this.getCertifyState.valid && !!this.getCertifyState.certifiedBy
Expand All @@ -621,7 +626,7 @@ export const useStore = defineStore('store', {
this.isAmalgamationInformationValid &&
this.isDefineCompanyValid &&
this.isAddPeopleAndRolesValid &&
this.isCreateShareStructureValid &&
isCreateShareStructureValid &&
this.getEffectiveDateTime.valid &&
isFolioNumberValid &&
this.getAmalgamationCourtApprovalValid &&
Expand Down
8 changes: 4 additions & 4 deletions src/views/Amalgamation/BusinessInfo.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div id="amalgamation-business-info">
<!-- Registered Office Addresses -->
<!-- Office Addresses -->
<section
v-show="isEntityType"
class="mt-10"
Expand All @@ -14,9 +14,9 @@
</p>

<p v-if="isAmalgamationFilingHorizontal || isAmalgamationFilingVertical">
The resulting business will adopt the following Registered Office and Records Office Mailing
and Delivery Addresses of the {{ isAmalgamationFilingHorizontal ? 'primary' : 'holding' }}
business in this amalgamation.
The resulting business will adopt the following Registered Office and Records Office Mailing and
Delivery Addresses of the {{ isAmalgamationFilingHorizontal ? 'primary' : 'holding' }} business
in this amalgamation.
</p>
</header>

Expand Down
Loading

0 comments on commit 8d23945

Please sign in to comment.