Skip to content

Commit

Permalink
12570 Add transactional folio number to SP/GP registration filings (#410
Browse files Browse the repository at this point in the history
)

*Issue #:* /bcgov/entity#12570

SP/GP Registration filings:
1. Added Transactional Folio Number component in the Review and Confirm view for premium users.
2. Added unit tests for Registration Review Confirm view as there was no tests for it.
3. Remove business folio number for SP/GP registrations
4. Version number = 4.0.20
  • Loading branch information
lambert-alex authored Jun 21, 2022
1 parent f81152f commit a1660d9
Show file tree
Hide file tree
Showing 5 changed files with 166 additions and 48 deletions.
3 changes: 2 additions & 1 deletion src/interfaces/filing-interfaces/filing-interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export interface RegistrationFilingIF {
effectiveDate?: string // not saved by UI but may be provided by API
filingId?: number // not saved by UI but may be provided by API
folioNumber?: string // optional and only displayed for certain account types
isTransactionalFolioNumber?: boolean // Optional - Premium accounts only
isFutureEffective: boolean

// staff payment properties:
Expand Down Expand Up @@ -118,7 +119,7 @@ export interface DissolutionFilingIF {
effectiveDate?: string // Optional and should be set only for future effective filings
filingId?: number // Optional as this is not required when building a filing - causes an error for new filings
folioNumber?: string // Optional - applies to diss Premium accounts or diss BCOL staff payments (not both)
isTransactionalFolioNumber?: boolean // Optional - applies to dissolution Premium accounts only
isTransactionalFolioNumber?: boolean // Optional - Premium accounts only
isFutureEffective: boolean
documentOptionalEmail?: string // Optional for staff to provide user email

Expand Down
35 changes: 24 additions & 11 deletions src/mixins/filing-template-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,11 @@ export default class FilingTemplateMixin extends Mixins(DateMixin) {
this.buildStaffPayment(filing)
}

// NB: Premium account is mutually exclusive with staff role.
if (this.isPremiumAccount) {
this.buildFolioNumber(filing)
}

return filing
}

Expand Down Expand Up @@ -462,11 +467,12 @@ export default class FilingTemplateMixin extends Mixins(DateMixin) {
this.parseStaffPayment(draftFiling)
}

// if this is a premium account and Folio Number exists then restore it
// if this is a premium account and Transactional Folio Number exists then restore it
// NB: Premium account is mutually exclusive with staff role.
if (this.isPremiumAccount) {
if (draftFiling.header.folioNumber) {
this.setFolioNumber(draftFiling.header.folioNumber)
// if Transactional Folio Number exists then restore it
if (draftFiling.header.isTransactionalFolioNumber && draftFiling.header.folioNumber) {
this.setTransactionalFolioNumber(draftFiling.header.folioNumber)
}
}
}
Expand Down Expand Up @@ -603,14 +609,7 @@ export default class FilingTemplateMixin extends Mixins(DateMixin) {

// NB: Premium account is mutually exclusive with staff role.
if (this.isPremiumAccount) {
// override Folio Number if TFN exists and is different than default FN
// also save a flag to correctly restore a draft later
const fn = this.getFolioNumber
const tfn = this.getTransactionalFolioNumber
if (tfn && tfn !== fn) {
filing.header.folioNumber = tfn
filing.header.isTransactionalFolioNumber = true
}
this.buildFolioNumber(filing)
}

return filing
Expand Down Expand Up @@ -754,6 +753,20 @@ export default class FilingTemplateMixin extends Mixins(DateMixin) {
}
}

/** If a Transactional Folio number was entered then override the Folio number
* @param filing The dissolution or registration filing.
*/
private buildFolioNumber (filing: DissolutionFilingIF | RegistrationFilingIF): void {
// override Folio Number if TFN exists and is different than default FN
// also save a flag to correctly restore a draft later
const fn = this.getFolioNumber
const tfn = this.getTransactionalFolioNumber
if (tfn && tfn !== fn) {
filing.header.folioNumber = tfn
filing.header.isTransactionalFolioNumber = true
}
}

/**
* Parses dissolution staff payment data into the store.
* @param filing the filing body to parse
Expand Down
37 changes: 2 additions & 35 deletions src/views/Registration/RegistrationDefineBusiness.vue
Original file line number Diff line number Diff line change
Expand Up @@ -119,26 +119,6 @@
/>
</v-card>
</section>

<!-- Folio or Reference Number -->
<section class="mt-10" v-if="isPremiumAccount">
<header id="folio-number-header">
<h2>Folio or Reference Number</h2>
<p class="mt-4">
Add an optional Folio or Reference Number to this business for your own tracking purposes. This
information is not used by the BC Business Registry.
</p>
</header>

<v-card flat class="step-container" :class="{ 'invalid-section': getShowErrors && !folioNumberValid }">
<FolioNumber
:initialValue="getFolioNumber"
:isEditing="true"
@update="setFolioNumber($event)"
@valid="onFolioNumberValidEvent($event)"
/>
</v-card>
</section>
</div>
</template>

Expand All @@ -149,7 +129,6 @@ import BusinessAddresses from '@/components/Registration/BusinessAddresses.vue'
import BusinessContactInfo from '@/components/common/BusinessContactInfo.vue'
import BusinessNumber from '@/components/Registration/BusinessNumber.vue'
import BusinessTypeConfirm from '@/components/Registration/BusinessTypeConfirm.vue'
import FolioNumber from '@/components/common/FolioNumber.vue'
import NameRequestInfo from '@/components/common/NameRequestInfo.vue'
import NatureOfBusiness from '@/components/Registration/NatureOfBusiness.vue'
import StartDate from '@/components/Registration/StartDate.vue'
Expand All @@ -163,7 +142,6 @@ import { CommonMixin } from '@/mixins'
BusinessContactInfo,
BusinessNumber,
BusinessTypeConfirm,
FolioNumber,
NameRequestInfo,
NatureOfBusiness,
StartDate
Expand All @@ -173,13 +151,10 @@ export default class RegistrationDefineBusiness extends Mixins(CommonMixin) {
@Getter getBusinessContact!: ContactPointIF
@Getter getRegistration!: RegistrationStateIF
@Getter getShowErrors!: boolean
@Getter isPremiumAccount!: boolean
@Getter getFolioNumber!: string
@Getter isTypePartnership!: boolean
@Action setBusinessContact!: ActionBindingIF
@Action setRegistrationDefineBusinessValid!: ActionBindingIF
@Action setFolioNumber!: ActionBindingIF
@Action setRegistrationBusinessNumber!: ActionBindingIF
@Action setRegistrationBusinessTypeConfirm!: ActionBindingIF
Expand All @@ -190,7 +165,6 @@ export default class RegistrationDefineBusiness extends Mixins(CommonMixin) {
businessAddressesValid = false
businessContactValid = false
startDateValid = false
folioNumberValid = false
/** Object of valid flags. Must match validComponents. */
get validFlags (): object {
Expand All @@ -200,8 +174,7 @@ export default class RegistrationDefineBusiness extends Mixins(CommonMixin) {
businessNumberValid: this.isTypePartnership ? this.businessNumberValid : true,
businessAddressesValid: this.businessAddressesValid,
businessContactValid: this.businessContactValid,
businessStartDateValid: this.startDateValid,
folioNumberValid: !this.isPremiumAccount || this.folioNumberValid
businessStartDateValid: this.startDateValid
}
}
Expand All @@ -212,8 +185,7 @@ export default class RegistrationDefineBusiness extends Mixins(CommonMixin) {
'business-number-header',
'business-addresses-header',
'business-contact-header',
'business-start-date-header',
'folio-number-header'
'business-start-date-header'
]
/** True if all flags are valid. */
Expand Down Expand Up @@ -253,11 +225,6 @@ export default class RegistrationDefineBusiness extends Mixins(CommonMixin) {
this.setRegistrationDefineBusinessValid(this.allFlagsValid)
}
onFolioNumberValidEvent (valid: boolean): void {
this.folioNumberValid = valid
this.setRegistrationDefineBusinessValid(this.allFlagsValid)
}
@Watch('$route')
async scrollToInvalidComponent (): Promise<void> {
if (this.getShowErrors && this.$route.name === RouteNames.REGISTRATION_DEFINE_BUSINESS) {
Expand Down
33 changes: 32 additions & 1 deletion src/views/Registration/RegistrationReviewConfirm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,30 @@
</v-card>
</section>

<!-- Transactional Folio Number -->
<section id="folio-section" class="mt-10" v-if="isPremiumAccount">
<header>
<h2>Folio or Reference Number for this Filing</h2>
<p class="mt-4">
Enter the folio or reference number you want to use for this filing for your own tracking purposes.
The Business Folio or Reference Number is displayed below (if available).
Entering a different value below will not change the Business Folio or Reference Number.
Only the number below will appear on the transaction report and receipt for this filing.
</p>
</header>

<v-card flat class="mt-6">
<TransactionalFolioNumber
class="py-8 px-6"
:accountFolioNumber="getFolioNumber"
:transactionalFolioNumber="getTransactionalFolioNumber"
:doValidate="getValidateSteps"
@change="setTransactionalFolioNumber($event)"
@valid="setTransactionalFolioNumberValidity($event)"
/>
</v-card>
</section>

<!-- Certify -->
<section id="certify-section" class="mt-10">
<header>
Expand Down Expand Up @@ -112,6 +136,7 @@ import StaffPayment from '@/components/common/StaffPayment.vue'
import DefineRegistrationSummary from '@/components/Registration/DefineRegistrationSummary.vue'
import FeeAcknowledgement from '@/components/Registration/FeeAcknowledgement.vue'
import ListPeopleAndRoles from '@/components/common/ListPeopleAndRoles.vue'
import TransactionalFolioNumber from '@/components/common/TransactionalFolioNumber.vue'
@Component({
components: {
Expand All @@ -121,12 +146,16 @@ import ListPeopleAndRoles from '@/components/common/ListPeopleAndRoles.vue'
DocumentDelivery,
FeeAcknowledgement,
ListPeopleAndRoles,
StaffPayment
StaffPayment,
TransactionalFolioNumber
}
})
export default class RegistrationReviewConfirm extends Vue {
@Getter getBusinessContact!: ContactPointIF
@Getter getUserEmail!: string
@Getter getFolioNumber!: string
@Getter getTransactionalFolioNumber!: string
@Getter isPremiumAccount!: boolean
@Getter getCertifyState!: CertifyIF
@Getter isRoleStaff!: boolean
@Getter getValidateSteps!: boolean
Expand All @@ -137,6 +166,8 @@ export default class RegistrationReviewConfirm extends Vue {
@Getter getAddPeopleAndRoleStep!: PeopleAndRoleIF
@Action setDocumentOptionalEmailValidity!: ActionBindingIF
@Action setTransactionalFolioNumber!: ActionBindingIF
@Action setTransactionalFolioNumberValidity!: ActionBindingIF
/** The Document Delivery additional email label. */
get documentDeliveryAdditionalLabel (): string {
Expand Down
106 changes: 106 additions & 0 deletions tests/unit/RegistrationReviewConfirm.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
import { shallowWrapperFactory, wrapperFactory } from '../jest-wrapper-factory'
import { getVuexStore } from '@/store'
import { RegistrationReviewConfirm } from '@/views'
import { RegistrationResources } from '@/resources'

const store = getVuexStore()

// Test Case Data
const reviewConfirmTestCases = [
{
entityType: 'SP',
isPremium: false,
isStaff: false
},
{
entityType: 'SP',
isPremium: true,
isStaff: false
},
{
entityType: 'SP',
isPremium: false,
isStaff: true
},
{
entityType: 'GP',
isPremium: false,
isStaff: false
},
{
entityType: 'GP',
isPremium: true,
isStaff: false
},
{
entityType: 'GP',
isPremium: false,
isStaff: true
}
]

for (const test of reviewConfirmTestCases) {
const type = test.isPremium ? 'premium' : test.isStaff ? 'staff' : 'regular'

describe(`Registration Review and Confirm view for a ${test.entityType} as a ${type} user`, () => {
let wrapper: any

it('renders the component properly', () => {
wrapper = shallowWrapperFactory(
RegistrationReviewConfirm,
null,
{
entityType: test.entityType
},
null,
RegistrationResources
)

expect(wrapper.find('h2').text()).toBe('Review and Confirm')
})

it('displays Documents Delivery section', () => {
wrapper = shallowWrapperFactory(
RegistrationReviewConfirm,
null,
{
entityType: test.entityType
},
null,
RegistrationResources
)

expect(wrapper.find('#document-delivery-section').exists()).toBe(true)
})

it('displays Folio number section for premium users', () => {
wrapper = shallowWrapperFactory(
RegistrationReviewConfirm,
null,
{
entityType: test.entityType,
accountInformation: { accountType: test.isPremium ? 'PREMIUM' : 'BASIC' }
},
null,
RegistrationResources
)

expect(wrapper.find('#folio-section').exists()).toBe(test.isPremium)
})

it('displays Staff Payment section only for staff', () => {
wrapper = shallowWrapperFactory(
RegistrationReviewConfirm,
null,
{
entityType: test.entityType,
tombstone: { authRoles: test.isStaff ? ['staff'] : [] }
},
null,
RegistrationResources
)

expect(wrapper.find('#staff-payment-section').exists()).toBe(test.isStaff)
})
})
}

0 comments on commit a1660d9

Please sign in to comment.