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

Incorporate now for named companies after NR is approved #627

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": "name-request",
"version": "5.0.6",
"version": "5.0.7",
"private": true,
"appName": "Name Request UI",
"sbcName": "SBC Common Components",
Expand Down
19 changes: 2 additions & 17 deletions src/components/common/bullets-colin-link.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,14 @@ import { Getter } from 'vuex-class'
import { CompanyType, EntityType } from '@/enums'
import NameInput from '@/components/new-request/name-input.vue'
import { Navigate } from '@/plugins'
import { NrAffiliationMixin } from '@/mixins'
import { CorpTypeCd } from '@bcrs-shared-components/corp-type-module'
import { CommonMixin, NrAffiliationMixin } from '@/mixins'
@Component({
components: {
NameInput
}
})
export default class BulletsColinLink extends Mixins(NrAffiliationMixin) {
export default class BulletsColinLink extends Mixins(CommonMixin, NrAffiliationMixin) {
/** The selected business type. */
@Prop({ default: '' }) readonly businessType!: EntityType
Expand All @@ -91,20 +90,6 @@ export default class BulletsColinLink extends Mixins(NrAffiliationMixin) {
// For template
readonly CompanyType = CompanyType
/**
* The alternate codes for entity types.
* Alternate codes are used in Entities UIs.
*/
entityTypeAlternateCode (entityType: EntityType): CorpTypeCd {
Copy link
Collaborator Author

@JazzarKarim JazzarKarim Jul 18, 2023

Choose a reason for hiding this comment

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

Moving this function to CommonMixin. It makes sense since it'll come in handy for even further work later on.

switch (entityType) {
case EntityType.BC: return CorpTypeCd.BENEFIT_COMPANY
case EntityType.CC: return CorpTypeCd.BC_CCC
case EntityType.CR: return CorpTypeCd.BC_COMPANY
case EntityType.UL: return CorpTypeCd.BC_ULC_COMPANY
default: return null
}
}
/** Navigate to the Entity Dashboard. */
goToEntityDashboard (businessId: string): void {
if (businessId) {
Expand Down
20 changes: 7 additions & 13 deletions src/components/existing-request/existing-request-display.vue
Original file line number Diff line number Diff line change
Expand Up @@ -194,23 +194,17 @@
:nrNum="nr && nr.nrNum"
:approvedName="approvedName && approvedName.name"
:emailAddress="nr && nr.applicants && nr.applicants.emailAddress"
:showIncorporateNowButton="showIncorporateButton"
:showRegisterButton="showRegisterButton"
:disabled="disableUnfurnished"
@registerYourBusiness="registerYourBusiness()"
@incorporateRegisterYourBusiness="incorporateRegisterYourBusiness()"
/>

<NrNotApprovedGrayBox
class="mt-5"
v-if="showNrNotApprovedGrayBox"
:nrNum="nr.nrNum"
/>

<!-- incorporate button -->
<div class="mt-5 text-center" v-if="showIncorporateButton">
<v-btn id="INCORPORATE-btn" @click="handleButtonClick(NrAction.INCORPORATE)">
Copy link
Collaborator Author

@JazzarKarim JazzarKarim Jul 18, 2023

Choose a reason for hiding this comment

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

This button is now in the NRApprovedGrayBoy component above. I'm following the UXPin. It has similar behavior as the Register Your Business button

Incorporate Using This Name Request
</v-btn>
</div>
</div>
</transition>
</template>
Expand Down Expand Up @@ -417,15 +411,15 @@ export default class ExistingRequestDisplay extends Mixins(
*/
get showIncorporateButton (): boolean {
return (
this.isBenefitCompany(this.nr) &&
this.actions.includes(NrAction.INCORPORATE)
this.isSupportedEntity(this.nr) &&
this.nr.request_action_cd === NrRequestActionCodes.NEW_BUSINESS &&
NrState.APPROVED === this.nr.state
Copy link
Collaborator Author

@JazzarKarim JazzarKarim Jul 18, 2023

Choose a reason for hiding this comment

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

We'll be showing the button if the current entity type is supported (from FF), new business, and if the NR has been approved. The isSupportedEntity function is in the CommonMixin for usage as we like. It'll take the place of isBenefitCompany.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think you can remove line 416 since line 417 will cover it.

Where did you copy the "if approved" logic from? It may be complicated that this (ie, conditional approval). Not certain but asking if you've looked into it.

Copy link
Collaborator Author

@JazzarKarim JazzarKarim Jul 19, 2023

Choose a reason for hiding this comment

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

The logic here is almost similar to the showRegisterButton on line 422 with the difference being instead of isFirm, it's isSupportedEntity.

I do agree with you on the first point. I was just using the similar condition to the existing one (showRegisterButton).

Copy link
Collaborator

Choose a reason for hiding this comment

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

Please call out for some extra testing on acceptable NR states to incorporate from (and/or confirm what's done in Auth Web for IA NRs).

Otherwise, my concerns are satisfied here.

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 don't think so. I took a look and this should be OK.

Keep in mind that the component takes a prop that disables the button when the NR was approved but still in processing (5 minutes or so).

)
}
/** True if the Register button should be shown. */
get showRegisterButton (): boolean {
return this.isFirm(this.nr) &&
this.nr.request_action_cd &&
this.nr.request_action_cd === NrRequestActionCodes.NEW_BUSINESS &&
(NrState.APPROVED === this.nr.state ||
this.isConsentUnRequired)
Expand Down Expand Up @@ -688,8 +682,8 @@ export default class ExistingRequestDisplay extends Mixins(
this.setConditionsModalVisible(true)
}
/** Called to register the business. */
async registerYourBusiness (): Promise<void> {
/** Called to incorporate/register the business. */
async incorporateRegisterYourBusiness (): Promise<void> {
// safety check
if (!this.isNrApprovedOrConditional) return
Expand Down
16 changes: 15 additions & 1 deletion src/components/existing-request/nr-approved-gray-box.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,23 @@
class="register-btn"
min-width="20rem"
:disabled="disabled"
@click="$emit('registerYourBusiness')"
@click="$emit('incorporateRegisterYourBusiness')"
>
<strong>Register Your Business</strong>
</v-btn>
</div>

<div v-else-if="showIncorporateNowButton" class="d-flex justify-center my-1 pb-1">
<v-btn
class="incorporate-now-btn"
min-width="20rem"
:disabled="disabled"
@click="$emit('incorporateRegisterYourBusiness')"
>
<strong>Incorporate Your Business</strong>
</v-btn>
</div>
severinbeauvais marked this conversation as resolved.
Show resolved Hide resolved

<p v-else>
Your Name Request <strong>{{nrNum}}</strong> for <strong>{{approvedName}}</strong> has been
approved for use. An email has been sent to <strong>{{emailAddress}}</strong> with instructions
Expand Down Expand Up @@ -48,6 +59,9 @@ export default class NrApprovedGrayBox extends Vue {
@Prop({ default: false })
readonly showRegisterButton: boolean
@Prop({ default: false })
readonly showIncorporateNowButton: boolean
@Prop({ default: false })
readonly disabled: boolean
}
Expand Down
23 changes: 20 additions & 3 deletions src/mixins/common-mixin.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Component, Vue } from 'vue-property-decorator'
import { EntityType, PriorityCode, NrRequestActionCodes } from '@/enums'
import { CorpTypeCd } from '@bcrs-shared-components/corp-type-module'
import { GetFeatureFlag } from '@/plugins'

@Component({})
export class CommonMixin extends Vue {
Expand Down Expand Up @@ -51,6 +53,20 @@ export class CommonMixin extends Vue {
}
}

/**
* The alternate codes for entity types.
* Alternate codes are used in Entities UIs.
*/
entityTypeAlternateCode (entityType: EntityType): CorpTypeCd {
switch (entityType) {
case EntityType.BC: return CorpTypeCd.BENEFIT_COMPANY
case EntityType.CC: return CorpTypeCd.BC_CCC
case EntityType.CR: return CorpTypeCd.BC_COMPANY
case EntityType.UL: return CorpTypeCd.BC_ULC_COMPANY
default: return null
}
}

/**
* Returns request action text for the the specified code.
* See namex -> api/namex/resources/name_requests/report_resource.py::_get_request_action_cd_description()
Expand Down Expand Up @@ -80,9 +96,10 @@ export class CommonMixin extends Vue {
return (nr?.priorityCd === PriorityCode.YES)
}

/** Returns true if the specified NR is for a Benefit Company. */
isBenefitCompany (nr: any): boolean {
return (nr?.entity_type_cd === EntityType.BC)
/** Returns true if the specified NR is for a supported Incorporation Entity Type (FF). */
isSupportedEntity (nr: any): boolean {
const supportedEntites = GetFeatureFlag('supported-incorporation-registration-entities')
return supportedEntites.includes(nr?.entity_type_cd)
}

/** Returns true if the specified NR is for a firm (SP/GP). */
Expand Down
8 changes: 6 additions & 2 deletions src/mixins/nr-affiliation-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,12 @@ export class NrAffiliationMixin extends Mixins(CommonMixin) {

/** Returns business request object. */
private getBusinessRequest (accountId: number, nr: NameRequestI): BusinessRequest {
const name = this.isBenefitCompany(nr) ? 'incorporationApplication' : 'registration'
const legalType = this.isBenefitCompany(nr) ? 'BEN' : nr.legalType
let name = 'registration'
let legalType = nr.legalType
if (this.isSupportedEntity(nr)) {
name = 'incorporationApplication'
legalType = this.entityTypeAlternateCode(nr.entity_type_cd)
}
const nrNumber = nr.nrNum

const businessRequest = {
Expand Down
Loading