-
Notifications
You must be signed in to change notification settings - Fork 44
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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' | ||
|
@@ -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)' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
// 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' | ||
|
@@ -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) { | ||
|
@@ -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 | ||
|
@@ -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 { | ||
|
@@ -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 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 { | ||
|
@@ -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 | ||
|
@@ -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 | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
|
||
const businessRequest = { | ||
filing: { | ||
header: { | ||
accountId: accountId | ||
}, | ||
business: { | ||
legalType: legalType | ||
} | ||
header: { accountId }, | ||
business: { legalType } | ||
} | ||
} as BusinessRequest | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 [] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
} | ||
} | ||
|
||
|
@@ -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 | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
There was a problem hiding this comment.
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.