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

19041 Finished validations + updated certify statements + updated unit tests #646

Merged
merged 3 commits into from
Feb 6, 2024
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
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 @@ -328,7 +328,7 @@ export default class App extends Mixins(CommonMixin, DateMixin, FilingTemplateMi
@Action(useStore) setLastDirectorChangeDate!: (x: string) => void
// @Action(useStore) setNameRequest!: (x: NameRequestIF) => 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 @@ -667,8 +667,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 @@ -753,31 +753,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(() => {})
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is so that the new route replaces the old one, without pushing the old one (which was invalid for the current filing type) to the browser history. It's a small optimization. It means that, if the user clicks the Back button, they won't navigate to the invalid route.

} 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 @@ -143,12 +143,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 @@ -158,7 +160,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) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This failed when dateText was empty string (eg, when changing from immediate to future-effective) -- dateToValidate on line 243 became null and either line 250 or line 257 caused an exception.

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 @@ -236,7 +236,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) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code failed if courtApproval did not exist on the amalgamationApplication object (eg, initial draft).

Because courtApproval was undefined (not null), line 304 was run, which saved "undefined" in the store. Then, in AmalgamationStatement.vue, this code set the validity to True (which is incorrect), and the overall filing validation did not catch that the amalgamation statement had not been selected.

Now, it all works correctly.

if (
draftFiling.amalgamationApplication.courtApproval === true ||
jamespaologarcia marked this conversation as resolved.
Show resolved Hide resolved
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.',
jamespaologarcia marked this conversation as resolved.
Show resolved Hide resolved
'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 @@ -601,16 +601,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
)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically, don't check the share structure valid flag (because the share structure page was not displayed), but we can assume they are correct because we got them from the holding/primary company.

const isFolioNumberValid = !this.isPremiumAccount || this.getFolioNumberValid
const isCourtOrderValid = this.isRoleStaff ? this.getCourtOrderStep.valid : true
const isCertifyValid = this.getCertifyState.valid && !!this.getCertifyState.certifiedBy
Expand All @@ -620,7 +625,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
Loading