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

20133 Convert entity types in numbered Continuation In drafts #764

Merged
merged 1 commit into from
May 2, 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
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "name-request",
"version": "5.4.8",
"version": "5.4.9",
"private": true,
"appName": "Name Request UI",
"sbcName": "SBC Common Components",
Expand All @@ -11,7 +11,8 @@
"test:unit": "vue-cli-service test:unit --testPathPattern --coverage",
"lint": "vue-cli-service lint",
"lint:nofix": "vue-cli-service lint --no-fix",
"build-check": "node --max_old_space_size=8000 node_modules/@vue/cli-service/bin/vue-cli-service.js build"},
"build-check": "node --max_old_space_size=8000 node_modules/@vue/cli-service/bin/vue-cli-service.js build"
},
"dependencies": {
"@babel/compat-data": "^7.21.5",
"@bcrs-shared-components/breadcrumb": "2.1.24",
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

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

1 change: 1 addition & 0 deletions src/enums/entity-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export enum EntityTypes {
CCC = CorpTypeCd.CCC_CONTINUE_IN,
CP = CorpTypeCd.COOP,
CR = CorpTypeCd.CORPORATION,
CS = CorpTypeCd.CONT_IN_SOCIETY,
Copy link
Collaborator Author

@severinbeauvais severinbeauvais May 1, 2024

Choose a reason for hiding this comment

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

I added this for completeness, since this code is not used as there's a feature flag that redirects users to Societies Online.

CUL = CorpTypeCd.ULC_CONTINUE_IN,
DBA = CorpTypeCd.DOING_BUSINESS_AS,
FI = CorpTypeCd.FINANCIAL,
Expand Down
11 changes: 7 additions & 4 deletions src/list-data/request-action-mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const EntityTypesBC = [
// maps request_action_cd (key) to array of allowable entities (value)
// { [request_action_cd]: entity_type_cd[] }
export const BcMapping: RequestActionMappingI = {
// Amalgamate
AML: [
EntityTypes.CR,
EntityTypes.UL,
Expand All @@ -29,6 +30,7 @@ export const BcMapping: RequestActionMappingI = {
EntityTypes.BC,
EntityTypes.SO
],
// Renew
REN: [
EntityTypes.CR,
EntityTypes.CP,
Expand All @@ -38,6 +40,7 @@ export const BcMapping: RequestActionMappingI = {
EntityTypes.BC,
EntityTypes.SO
],
// Restore
REH: [
EntityTypes.CR,
EntityTypes.CP,
Expand All @@ -47,16 +50,16 @@ export const BcMapping: RequestActionMappingI = {
EntityTypes.BC,
EntityTypes.SO
],
// every entity type except Parishes and Private Act
// Change Name
// (every entity type except Parishes and Private Act)
CHG: EntityTypesBC.filter(ent => ent !== EntityTypes.PAR && ent !== EntityTypes.PA),
// when a MVE (continuation in) NR is created, the resultant company will have a
// different entity type in LEAR, as per comments below
// MVE = Continuation In
MVE: [
EntityTypes.CR, // will become CorpTypeCd.CONTINUE_IN
EntityTypes.CC, // will become CorpTypeCd.CCC_CONTINUE_IN
EntityTypes.CP,
EntityTypes.UL, // will become CorpTypeCd.ULC_CONTINUE_IN
EntityTypes.SO,
EntityTypes.SO, // will becomes CorpTypeCd.CONT_IN_SOCIETY
EntityTypes.BC // will become CorpTypeCd.BEN_CONTINUE_IN
]
}
Expand Down
25 changes: 14 additions & 11 deletions src/mixins/common-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ export class CommonMixin extends Vue {
.join(' ')
}

/** Returns entity type text for the the specified code. */
/** Returns the description for the given entity type code. */
// FUTURE: use GetCorpFullDescription() instead
entityTypeCdToText (cd: EntityTypes): string {
switch (cd) {
// BC Entity Types:
// BC entity types:
case EntityTypes.BC: return 'BC Benefit Company'
case EntityTypes.CC: return 'BC Community Contribution Company'
case EntityTypes.CP: return 'BC Cooperative Association'
Expand All @@ -40,13 +40,14 @@ export class CommonMixin extends Vue {
case EntityTypes.SP: return 'BC Sole Proprietorship'
case EntityTypes.UL: return 'BC Unlimited Liability Company'

// Continuation In Entity Types:
case EntityTypes.C: return 'Continuation In (BC Limited Company)'
case EntityTypes.CBEN: return 'Continuation In (Benefit Company)'
case EntityTypes.CCC: return 'Continuation In (BC Community Contribution Company)'
case EntityTypes.CUL: return 'Continuation In (BC Unlimited Liability Company)'
// Continuation In entity types:
case EntityTypes.C: return 'BC Limited Company (Continuation In)'
case EntityTypes.CBEN: return 'Benefit Company (Continuation In)'
case EntityTypes.CCC: return 'BC Community Contribution Company (Continuation In)'
case EntityTypes.CS: return 'BC Social Enterprise (Continuation In)'
case EntityTypes.CUL: return 'BC Unlimited Liability Company (Continuation In)'
Copy link
Collaborator Author

@severinbeauvais severinbeauvais May 1, 2024

Choose a reason for hiding this comment

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

  1. I added CS for completeness (also in 2 other methods below).

  2. I changed the text because the name is more important than the type, but this really doesn't matter because these strings are not used for continuation in NRs in Namerequest UI.

Example (where name and type are displayed separately):

image


// XPRO Entity Types:
// XPRO entity types:
case EntityTypes.XCR: return 'Extraprovincial Limited Company'
case EntityTypes.XUL: return 'Extraprovincial Unlimited Liability Company'
case EntityTypes.RLC: return 'Extraprovincial Limited Liability Company'
Expand All @@ -60,8 +61,8 @@ export class CommonMixin extends Vue {
}

/**
* The alternate codes for entity types.
* Alternate codes are used in Entities UIs.
* Returns the Corp Type Code (used by LEAR) for the given Entity Type (used by Namex).
* @example UL --> ULC
*/
entityTypeToCorpType (entityType: EntityTypes): CorpTypeCd {
switch (entityType) {
Expand All @@ -72,6 +73,7 @@ export class CommonMixin extends Vue {
case EntityTypes.CCC: return CorpTypeCd.CCC_CONTINUE_IN
case EntityTypes.CP: return CorpTypeCd.COOP
case EntityTypes.CR: return CorpTypeCd.BC_COMPANY
case EntityTypes.CS: return CorpTypeCd.CONT_IN_SOCIETY
case EntityTypes.CUL: return CorpTypeCd.ULC_CONTINUE_IN
case EntityTypes.DBA: return CorpTypeCd.SOLE_PROP // same as FR
case EntityTypes.FI: return CorpTypeCd.FINANCIAL
Expand All @@ -98,7 +100,7 @@ export class CommonMixin extends Vue {
}

/**
* Entities UI codes to Name Request Code.
* Returns the Entity Type (used by Namex) for the given Corp Type Code (used by LEAR).
* @example ULC --> UL
*/
corpTypeToEntityType (entityType: CorpTypeCd): EntityTypes {
Expand All @@ -110,6 +112,7 @@ export class CommonMixin extends Vue {
case CorpTypeCd.BC_ULC_COMPANY: return EntityTypes.UL
case CorpTypeCd.CCC_CONTINUE_IN: return EntityTypes.CCC
case CorpTypeCd.COOP: return EntityTypes.CP
case CorpTypeCd.CONT_IN_SOCIETY: return EntityTypes.CS
case CorpTypeCd.CONTINUE_IN: return EntityTypes.C
case CorpTypeCd.EXTRA_PRO_A: return EntityTypes.XCR
case CorpTypeCd.FINANCIAL: return EntityTypes.FI
Expand Down
31 changes: 19 additions & 12 deletions src/mixins/nr-affiliation-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class NrAffiliationMixin extends Mixins(CommonMixin) {
/**
* Affiliates a NR to the current account, creates a temporary business, and then navigates
* to the entity dashboard page.
* @param nr the NR to affiliate
* @param nr The NR to affiliate.
*/
async createAffiliation (nr: NameRequestI): Promise<any> {
try {
Expand Down Expand Up @@ -214,10 +214,10 @@ export class NrAffiliationMixin extends Mixins(CommonMixin) {
}

/**
* Handle the action buttons (numbered selection).
* Create draft business depending on business type.
* Redirect to Dashboard.
* @param legalType The legal type of the business
* 1. Handles the action buttons (numbered selection).
* 2. Creates draft business depending on legal type.
* 3. Redirects to entity dashboard.
* @param legalType The legal type of the business.
*/
async actionNumberedEntity (legalType: CorpTypeCd): Promise<any> {
// show spinner since this is a network call
Expand All @@ -244,19 +244,26 @@ export class NrAffiliationMixin extends Mixins(CommonMixin) {
}

/**
* Create a draft numbered business based on selected business type (If applicable).
* Creates a draft numbered business based on specified legal type.
* @param accountId Account ID of logged in user.
* @param legalType The legal type of the business that's being created.
*/
async createNumberedBusiness (accountId: number, legalType: CorpTypeCd): Promise<string> {
if (this.isContinuationIn) {
// convert regular legal type to continuation in legal type
switch (legalType) {
case CorpTypeCd.BC_COMPANY: legalType = CorpTypeCd.CONTINUE_IN; break
case CorpTypeCd.BENEFIT_COMPANY: legalType = CorpTypeCd.BEN_CONTINUE_IN; break
case CorpTypeCd.BC_CCC: legalType = CorpTypeCd.CCC_CONTINUE_IN; break
case CorpTypeCd.BC_ULC_COMPANY: legalType = CorpTypeCd.ULC_CONTINUE_IN; break
case CorpTypeCd.SOCIETY: legalType = CorpTypeCd.CONT_IN_SOCIETY; break
}
}
Copy link
Collaborator Author

@severinbeauvais severinbeauvais May 1, 2024

Choose a reason for hiding this comment

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

So here's the gist of it. This is right where we create the draft filing in Legal API.

As far as Namerequest UI is concerned, up to this point, the entity type / corp type was CR/BC/CC/UL/SO.

Maybe you're wondering how this works for NRs? It's similar -- Namerequest UI uses CR/BC/CC/UL/SO, but then Namex API returns the new NR with a converted entityType (C/CBEN/CCC/CUL/CS).


const businessRequest = {
filing: {
header: {
accountId: accountId
},
business: {
legalType: legalType
}
header: { accountId },
business: { legalType }
}
} as BusinessRequest

Expand Down
17 changes: 11 additions & 6 deletions src/store/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ export const getEntityTypesBC = (state: StateIF): EntityI[] => {
return EntityTypesBcData
} catch (err) {
console.error('entityTypesBC() =', err) // eslint-disable-line no-console
return EntityTypesBcData
return []
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I carried over this change from my previous (closed) PR.

The old code masked any errors by returning what looks like legitimate data. I think it's better to return "nothing" as that will stand out during testing and we can fix any problems.

}
}

Expand Down Expand Up @@ -606,11 +606,16 @@ export const getXproRequestTypeCd = (state: StateIF): XproNameType => {
/** Get entity type options (short list only). */
export const getEntityTypeOptions = (state: StateIF): Array<EntityI> => {
const bcOptions: SelectOptionsI[] = getEntityTypesBC(state)?.filter(x => {
// Set shortlisted entity types for BC Move and Restoration requests.
if (
(isContinuationIn(state) || isRestoration(state)) &&
isLocationBC(state)
) {
if (isContinuationIn(state) && isLocationBC(state)) {
// Shortlist order: Limited Company, Unlimited Liability Company
if (x.value === EntityTypes.UL) {
x.shortlist = true
x.rank = 2
} else if ([EntityTypes.FR, EntityTypes.GP, EntityTypes.UL].includes(x.value)) {
x.shortlist = null
x.rank = null
}
Copy link
Collaborator Author

@severinbeauvais severinbeauvais May 1, 2024

Choose a reason for hiding this comment

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

Yes, I left the else-if block in here, even though I'm pretty sure it does nothing. This is the "don't make waves" pattern. If you've worked in Namerequest UI then you'll understand 😁

} else if (isRestoration(state) && isLocationBC(state)) {
// Shortlist order: Limited Company, Cooperative Association
if (x.value === EntityTypes.CP) {
x.shortlist = true
Expand Down
Loading