Skip to content

Commit

Permalink
14529 Don't allow editing numbered company name (#429)
Browse files Browse the repository at this point in the history
* - filtered out Correct Name option for numbered company
- renamed CorrectionTypes -> NameChangeOptions
- app version = 3.9.6

* - added unit tests

* - renamed resource files to resolve name conflicts
- added Name Change Options test suite

* - moved duplicate test logic into a single function
  • Loading branch information
severinbeauvais authored Dec 8, 2022
1 parent 9c2ed62 commit 17acae0
Show file tree
Hide file tree
Showing 49 changed files with 476 additions and 222 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-edit-ui",
"version": "3.9.5",
"version": "3.9.6",
"private": true,
"appName": "Edit UI",
"sbcName": "SBC Common Components",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ import { Component, Prop, Watch, Emit, Mixins } from 'vue-property-decorator'
import { Action, Getter } from 'vuex-class'
import { CommonMixin } from '@/mixins/'
import { ActionBindingIF, NameRequestIF } from '@/interfaces/'
import { CorrectionTypes } from '@/enums/'
import { NameChangeOptions } from '@/enums/'
@Component({})
export default class CorrectCompanyName extends Mixins(CommonMixin) {
/** Form Submission Prop */
@Prop({ default: null }) readonly formType!: CorrectionTypes
@Prop({ default: null }) readonly formType!: NameChangeOptions
@Action setNameRequest!: ActionBindingIF
Expand Down Expand Up @@ -54,7 +54,8 @@ export default class CorrectCompanyName extends Mixins(CommonMixin) {
/** Watch for form submission and emit results. */
@Watch('formType')
private onSubmit (): void {
if (this.formType === CorrectionTypes.CORRECT_NAME) {
// this component should only see correct-name form type
if (this.formType === NameChangeOptions.CORRECT_NAME) {
// set the new company name
this.setNameRequest({
...this.getNameRequest,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
import Vue from 'vue'
import { Component, Emit, Prop } from 'vue-property-decorator'
import { CorrectNameOptionIF } from '@/interfaces/'
import { CorrectionTypes } from '@/enums/'
import { NameChangeOptions } from '@/enums/'
// for some reason, CorrectXXX cannot be imported from ./
// (it breaks a bunch of unit tests)
Expand All @@ -85,27 +85,27 @@ export default class CorrectNameOptions extends Vue {
// local properties
protected displayedOptions: Array<CorrectNameOptionIF> = []
protected panel: number = null
protected formType: CorrectionTypes = null
protected currentFormType: CorrectionTypes = null
protected formType: NameChangeOptions = null
protected currentFormType: NameChangeOptions = null
protected isLoading = false
protected isFormValid = false
protected validateNameChange = false
readonly correctionNameOptions: Array<CorrectNameOptionIF> = [
{
id: CorrectionTypes.CORRECT_NAME,
id: NameChangeOptions.CORRECT_NAME,
title: 'Edit the company name',
description: 'Correct typographical errors in the existing company name.',
component: CorrectCompanyName
},
{
id: CorrectionTypes.CORRECT_NAME_TO_NUMBER,
id: NameChangeOptions.CORRECT_NAME_TO_NUMBER,
title: 'Use the incorporation number as the name',
description: null,
component: CorrectNameToNumber
},
{
id: CorrectionTypes.CORRECT_NEW_NR,
id: NameChangeOptions.CORRECT_NEW_NR,
title: 'Use a new name request number',
description: 'Enter the new Name Request Number (e.g., NR 1234567) and either the applicant phone number ' +
'OR the applicant email that was used when the name was requested.',
Expand Down Expand Up @@ -139,7 +139,7 @@ export default class CorrectNameOptions extends Vue {
}
/** Identify the current form */
protected identifyForm (type: CorrectionTypes) {
protected identifyForm (type: NameChangeOptions) {
this.currentFormType = type
this.isFormValid = false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ import { Action, Getter } from 'vuex-class'
import { ConfirmDialog as ConfirmDialogShared } from '@bcrs-shared-components/confirm-dialog/'
import { CommonMixin, NameRequestMixin } from '@/mixins/'
import { ActionBindingIF, ConfirmDialogType, NameRequestIF, NrCorrectionIF, NrResponseIF } from '@/interfaces/'
import { CorrectionTypes } from '@/enums/'
import { NameChangeOptions } from '@/enums/'
import { CorpTypeCd, GetCorpFullDescription } from '@bcrs-shared-components/corp-type-module/'
@Component({
Expand All @@ -82,7 +82,7 @@ export default class CorrectNameRequest extends Mixins(CommonMixin, NameRequestM
}
/** The form type. */
@Prop({ default: null }) readonly formType!: CorrectionTypes
@Prop({ default: null }) readonly formType!: NameChangeOptions
/** Whether to perform validation. */
@Prop({ default: false }) readonly validate!: boolean
Expand Down Expand Up @@ -147,7 +147,8 @@ export default class CorrectNameRequest extends Mixins(CommonMixin, NameRequestM
/** Watch for form submission and emit results. */
@Watch('formType')
private async onSubmit (): Promise<any> {
if (this.formType === CorrectionTypes.CORRECT_NEW_NR) {
// this component should only see correct-new-nr form type
if (this.formType === NameChangeOptions.CORRECT_NEW_NR) {
try {
// Validate and return the name request data
const nr: NrResponseIF = await this.validateNameRequest(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ import { Action, Getter } from 'vuex-class'
// Interfaces && enums
import { ActionBindingIF, NameRequestIF } from '@/interfaces/'
import { CorrectionTypes } from '@/enums/'
import { NameChangeOptions } from '@/enums/'
@Component({})
export default class CorrectNameToNumber extends Vue {
/** Form Submission Prop */
@Prop({ default: null }) readonly formType!: CorrectionTypes
@Prop({ default: null }) readonly formType!: NameChangeOptions
@Action setNameRequest!: ActionBindingIF
Expand All @@ -43,7 +43,8 @@ export default class CorrectNameToNumber extends Vue {
/** Watch for form submission and emit results. */
@Watch('formType')
private async onSubmit (): Promise<any> {
if (this.formType === CorrectionTypes.CORRECT_NAME_TO_NUMBER) {
// this component should only see correct-name-to-number form type
if (this.formType === NameChangeOptions.CORRECT_NAME_TO_NUMBER) {
// delete the current legal name and NR number
this.setNameRequest({
...this.getNameRequest,
Expand Down
12 changes: 7 additions & 5 deletions src/components/common/YourCompany/YourCompany.vue
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ import { ContactPointIF } from '@bcrs-shared-components/interfaces/'
import { AssociationType, BusinessContactInfo, ChangeBusinessType, FolioInformation, CorrectNameOptions,
NameTranslation, NatureOfBusiness, OfficeAddresses, BusinessStartDate } from './'
import { CommonMixin, DateMixin, NameRequestMixin } from '@/mixins/'
import { CoopTypes, CorrectionTypes } from '@/enums/'
import { CoopTypes, NameChangeOptions } from '@/enums/'
import { CorpTypeCd, GetCorpFullDescription } from '@bcrs-shared-components/corp-type-module/'
import { ConversionNOB } from '@/components/Conversion'
Expand Down Expand Up @@ -488,11 +488,13 @@ export default class YourCompany extends Mixins(
}
/** The current options for change of name correction or edit. */
get nameChangeOptions (): Array<CorrectionTypes> {
// remove name-to-numbered-company option when already a numbered company
get nameChangeOptions (): Array<NameChangeOptions> {
// if this is a numbered company, remove correct-name and name-to-number options
if (this.isNumberedCompany) {
return this.getResource.changeData.nameChangeOptions
.filter(option => option !== CorrectionTypes.CORRECT_NAME_TO_NUMBER)
return this.getResource.changeData.nameChangeOptions.filter(option => (
option !== NameChangeOptions.CORRECT_NAME &&
option !== NameChangeOptions.CORRECT_NAME_TO_NUMBER
))
}
return this.getResource.changeData.nameChangeOptions
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export enum CorrectionTypes {
export enum NameChangeOptions {
CORRECT_NAME = 'correct-name',
CORRECT_NAME_TO_NUMBER = 'correct-name-to-number',
CORRECT_NEW_NR = 'correct-new-nr'
Expand Down
2 changes: 1 addition & 1 deletion src/enums/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export * from './compareModes'
export * from './componentsCompanyInfo'
export * from './componentsReviewCertify'
export * from './correctionErrorTypes'
export * from './correctionTypes'
export * from './effectiveDateTypes'
export * from './effectOfOrders'
export * from './entitySubtypes'
Expand All @@ -13,6 +12,7 @@ export * from './filingNames'
export * from './filingStatus'
export * from './filingTypes'
export * from './partyTypes'
export * from './NameChangeOptions'
export * from './nameRequestStates'
export * from './nameRequestTypes'
export * from './roleTypes'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { NameRequestApplicantIF } from '@/interfaces/'
import { CorrectionTypes, NameRequestStates, NameRequestTypes } from '@/enums/'
import { NameChangeOptions, NameRequestStates, NameRequestTypes } from '@/enums/'
import { CorpTypeCd } from '@bcrs-shared-components/corp-type-module/'

export interface CorrectNameOptionIF {
id: CorrectionTypes,
id: NameChangeOptions,
title: string,
description?: string,
component: any
Expand Down
4 changes: 2 additions & 2 deletions src/interfaces/resource-interfaces/resource-interface.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CorrectionTypes, NameRequestTypes } from '@/enums/'
import { NameChangeOptions, NameRequestTypes } from '@/enums/'
import { CorpTypeCd } from '@bcrs-shared-components/corp-type-module/'
import { HelpSectionIF, FilingDataIF, SpecialResolutionSampleFormIF } from '@/interfaces/'

Expand All @@ -13,7 +13,7 @@ export interface ResourceIF {
description?: string // BEN corrections only
filingData: FilingDataIF
changeData?: {
nameChangeOptions?: Array<CorrectionTypes>
nameChangeOptions?: Array<NameChangeOptions>
typeChangeInfo?: string
orgPersonInfo?: {
orgPersonLabel: string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { CorrectionTypes, FilingCodes } from '@/enums/'
import { NameChangeOptions, FilingCodes } from '@/enums/'
import { CorpTypeCd, GetCorpFullDescription } from '@bcrs-shared-components/corp-type-module/'
import { ResourceIF } from '@/interfaces/'

export const LimitedCompanyResource: ResourceIF = {
export const BcAlterationResource: ResourceIF = {
entityReference: 'Company',
contactLabel: 'Registered Office',
displayName: GetCorpFullDescription(CorpTypeCd.BC_COMPANY),
Expand All @@ -14,8 +14,8 @@ export const LimitedCompanyResource: ResourceIF = {
},
changeData: {
nameChangeOptions: [
CorrectionTypes.CORRECT_NEW_NR,
CorrectionTypes.CORRECT_NAME_TO_NUMBER
NameChangeOptions.CORRECT_NEW_NR,
NameChangeOptions.CORRECT_NAME_TO_NUMBER
]
},
certifyClause: 'Note: It is an offence to make a false or misleading statement in respect ' +
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { CorrectionTypes, FilingCodes } from '@/enums/'
import { NameChangeOptions, FilingCodes } from '@/enums/'
import { CorpTypeCd, GetCorpFullDescription } from '@bcrs-shared-components/corp-type-module/'
import { ResourceIF } from '@/interfaces/'

export const BenefitCompanyResource: ResourceIF = {
export const BenAlterationResource: ResourceIF = {
entityReference: 'Company',
contactLabel: 'Registered Office',
displayName: GetCorpFullDescription(CorpTypeCd.BENEFIT_COMPANY),
Expand All @@ -14,8 +14,8 @@ export const BenefitCompanyResource: ResourceIF = {
},
changeData: {
nameChangeOptions: [
CorrectionTypes.CORRECT_NEW_NR,
CorrectionTypes.CORRECT_NAME_TO_NUMBER
NameChangeOptions.CORRECT_NEW_NR,
NameChangeOptions.CORRECT_NAME_TO_NUMBER
]
},
certifyClause: 'Note: It is an offence to make a false or misleading statement in respect ' +
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { CorrectionTypes, FilingCodes } from '@/enums/'
import { NameChangeOptions, FilingCodes } from '@/enums/'
import { CorpTypeCd, GetCorpFullDescription } from '@bcrs-shared-components/corp-type-module/'
import { ResourceIF } from '@/interfaces/'

export const CommunityContributionCompanyResource: ResourceIF = {
export const CccAlterationResource: ResourceIF = {
entityReference: 'Company',
contactLabel: 'Registered Office',
displayName: GetCorpFullDescription(CorpTypeCd.BC_CCC),
Expand All @@ -14,8 +14,8 @@ export const CommunityContributionCompanyResource: ResourceIF = {
},
changeData: {
nameChangeOptions: [
CorrectionTypes.CORRECT_NEW_NR,
CorrectionTypes.CORRECT_NAME_TO_NUMBER
NameChangeOptions.CORRECT_NEW_NR,
NameChangeOptions.CORRECT_NAME_TO_NUMBER
]
},
certifyClause: 'Note: It is an offence to make a false or misleading statement in respect ' +
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { CorrectionTypes, FilingCodes } from '@/enums/'
import { NameChangeOptions, FilingCodes } from '@/enums/'
import { CorpTypeCd, GetCorpFullDescription } from '@bcrs-shared-components/corp-type-module/'
import { ResourceIF } from '@/interfaces/'

export const UnlimitedLiabilityCompanyResource: ResourceIF = {
export const UlcAlterationResource: ResourceIF = {
entityReference: 'Company',
contactLabel: 'Registered Office',
displayName: GetCorpFullDescription(CorpTypeCd.BC_ULC_COMPANY),
Expand All @@ -14,8 +14,8 @@ export const UnlimitedLiabilityCompanyResource: ResourceIF = {
},
changeData: {
nameChangeOptions: [
CorrectionTypes.CORRECT_NEW_NR,
CorrectionTypes.CORRECT_NAME_TO_NUMBER
NameChangeOptions.CORRECT_NEW_NR,
NameChangeOptions.CORRECT_NAME_TO_NUMBER
]
},
certifyClause: 'Note: It is an offence to make a false or misleading statement in respect ' +
Expand Down
8 changes: 4 additions & 4 deletions src/resources/Alteration/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * from './BenefitCompanyResource'
export * from './LimitedCompanyResource'
export * from './CommunityContributionCompanyResource'
export * from './UnlimitedLiabilityCompanyResource'
export * from './BC'
export * from './BEN'
export * from './CCC'
export * from './ULC'
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { CorrectionTypes, FilingCodes, NameRequestTypes } from '@/enums/'
import { NameChangeOptions, FilingCodes, NameRequestTypes } from '@/enums/'
import { CorpTypeCd, GetCorpFullDescription } from '@bcrs-shared-components/corp-type-module/'
import { ResourceIF } from '@/interfaces/'

export const GeneralPartnershipResource: ResourceIF = {
export const GpChangeResource: ResourceIF = {
entityReference: 'Business',
contactLabel: 'Business',
displayName: GetCorpFullDescription(CorpTypeCd.PARTNERSHIP),
Expand All @@ -14,7 +14,7 @@ export const GeneralPartnershipResource: ResourceIF = {
},
changeData: {
nameChangeOptions: [
CorrectionTypes.CORRECT_NEW_NR
NameChangeOptions.CORRECT_NEW_NR
],
typeChangeInfo: 'General Partnership cannot be changed into a Sole Proprietorship. If this is necessary, a new ' +
'Name Request Number and Statement of Registration (along with associated fees) will be required.',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { CorrectionTypes, FilingCodes, NameRequestTypes } from '@/enums/'
import { NameChangeOptions, FilingCodes, NameRequestTypes } from '@/enums/'
import { CorpTypeCd, GetCorpFullDescription } from '@bcrs-shared-components/corp-type-module/'
import { ResourceIF } from '@/interfaces/'

export const SoleProprietorshipResource: ResourceIF = {
export const SpChangeResource: ResourceIF = {
entityReference: 'Business',
contactLabel: 'Business',
displayName: GetCorpFullDescription(CorpTypeCd.SOLE_PROP),
Expand All @@ -14,7 +14,7 @@ export const SoleProprietorshipResource: ResourceIF = {
},
changeData: {
nameChangeOptions: [
CorrectionTypes.CORRECT_NEW_NR
NameChangeOptions.CORRECT_NEW_NR
],
typeChangeInfo: 'You cannot change the business type of a Sole Proprietorship / DBA. You must form a new ' +
'business and dissolve this business once the new business is registered.',
Expand Down
4 changes: 2 additions & 2 deletions src/resources/Change/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from './GeneralPartnershipResource'
export * from './SoleProprietorshipResource'
export * from './GP'
export * from './SP'
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { CorrectionTypes, FilingCodes } from '@/enums/'
import { NameChangeOptions, FilingCodes } from '@/enums/'
import { CorpTypeCd, GetCorpFullDescription } from '@bcrs-shared-components/corp-type-module/'
import { ResourceIF } from '@/interfaces/'

export const GeneralPartnershipResource: ResourceIF = {
export const GpConversionResource: ResourceIF = {
entityReference: 'Business',
contactLabel: 'Business',
displayName: GetCorpFullDescription(CorpTypeCd.PARTNERSHIP),
Expand All @@ -15,7 +15,7 @@ export const GeneralPartnershipResource: ResourceIF = {
},
changeData: {
nameChangeOptions: [
CorrectionTypes.CORRECT_NEW_NR
NameChangeOptions.CORRECT_NEW_NR
],
typeChangeInfo: 'General Partnership cannot be changed into a Sole Proprietorship. If this is necessary, a new ' +
'Name Request Number and Statement of Registration (along with associated fees) will be required.',
Expand Down
Loading

0 comments on commit 17acae0

Please sign in to comment.