Skip to content

Commit

Permalink
14789 Create UI throwing schema error when court order is not entered (
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-longe authored Jan 11, 2023
1 parent 4784a95 commit da5fccf
Show file tree
Hide file tree
Showing 8 changed files with 225 additions and 16 deletions.
4 changes: 4 additions & 0 deletions src/components/common/Actions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ export default class Actions extends Vue {
// clear flag
this.setHaveChanges(false)
} catch (error) {
console.log('Error on onClickSave(): ', error)
this.$root.$emit('save-error-event', error)
this.setIsSaving(false)
return
Expand Down Expand Up @@ -203,6 +204,7 @@ export default class Actions extends Vue {
// clear flag
this.setHaveChanges(false)
} catch (error) {
console.log('Error on onClickSaveResume(): ', error)
this.$root.$emit('save-error-event', error)
this.setIsSavingResuming(false)
return
Expand Down Expand Up @@ -246,6 +248,7 @@ export default class Actions extends Vue {
try {
await this.validateNameRequest(this.getNameRequestNumber)
} catch (error) {
console.log('Error on onClickFilePay(): ', error)
this.setIsFilingPaying(false)
return
}
Expand All @@ -261,6 +264,7 @@ export default class Actions extends Vue {
// clear flag
this.setHaveChanges(false)
} catch (error) {
console.log('Error on onClickFilePay(): ', error)
this.$root.$emit('save-error-event', error)
this.setIsFilingPaying(false)
return
Expand Down
17 changes: 7 additions & 10 deletions src/mixins/filing-template-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ export default class FilingTemplateMixin extends DateMixin {
@Getter getStaffPaymentStep!: StaffPaymentStepIF
@Getter getCourtOrderStep!: CourtOrderStepIF
@Getter isRoleStaff!: boolean
@Getter isTypeBcUlcCompany!: boolean
@Getter getDissolutionStatementStep!: DissolutionStatementIF
@Getter getDissolutionCustodian!: OrgPersonIF
@Getter getFolioNumber!: string
Expand Down Expand Up @@ -201,8 +200,8 @@ export default class FilingTemplateMixin extends DateMixin {
agreementType: this.getIncorporationAgreementStep.agreementType
}

if (this.isTypeBcUlcCompany) {
const courtOrder = this.getCourtOrderStep.courtOrder
const courtOrder = this.getCourtOrderStep.courtOrder
if (courtOrder && (courtOrder.hasPlanOfArrangement || courtOrder.fileNumber)) {
filing.incorporationApplication.courtOrder = {
fileNumber: courtOrder.fileNumber,
effectOfOrder: courtOrder.hasPlanOfArrangement ? EffectOfOrders.PLAN_OF_ARRANGEMENT : '',
Expand Down Expand Up @@ -318,11 +317,9 @@ export default class FilingTemplateMixin extends DateMixin {
this.setIncorporationAgreementStepData({
agreementType: draftFiling.incorporationApplication.incorporationAgreement?.agreementType
})

if (this.isTypeBcUlcCompany) {
this.setCourtOrderFileNumber(draftFiling.incorporationApplication.courtOrder?.fileNumber)
this.setHasPlanOfArrangement(draftFiling.incorporationApplication.courtOrder?.hasPlanOfArrangement)
}
// set courtOrder attribute
this.setCourtOrderFileNumber(draftFiling.incorporationApplication.courtOrder?.fileNumber || '')
this.setHasPlanOfArrangement(draftFiling.incorporationApplication.courtOrder?.hasPlanOfArrangement || false)
break
}

Expand Down Expand Up @@ -818,8 +815,8 @@ export default class FilingTemplateMixin extends DateMixin {
this.setAffidavit(uploadAffidavit)

// restore Court Order data
this.setCourtOrderFileNumber(draftFiling.dissolution.courtOrder?.fileNumber)
this.setHasPlanOfArrangement(draftFiling.dissolution.courtOrder?.hasPlanOfArrangement)
this.setCourtOrderFileNumber(draftFiling.dissolution.courtOrder?.fileNumber || '')
this.setHasPlanOfArrangement(draftFiling.dissolution.courtOrder?.hasPlanOfArrangement || false)

// NB: do not restore/overwrite Folio Number - just use the FN from auth info (see App.vue)

Expand Down
3 changes: 2 additions & 1 deletion src/store/getters/state-getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,8 @@ export const isIncorporationApplicationValid = (state: StateIF): boolean => {
const isBaseStepsValid = (
getCreateShareStructureStep(state).valid &&
getEffectiveDateTime(state).valid &&
getIncorporationAgreementStep(state).valid
getIncorporationAgreementStep(state).valid &&
getCourtOrderStep(state).valid
)

// Coop steps
Expand Down
4 changes: 2 additions & 2 deletions src/views/Incorporation/IncorporationReviewConfirm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
</section>

<!-- Court Order and Plan of Arrangement -->
<section id="court-order-poa-section" class="mt-10" v-if="isTypeBcUlcCompany">
<section id="court-order-poa-section" class="mt-10" v-if="isBaseCompany">
<header>
<h2>Court Order and Plan of Arrangement</h2>
<p class="mt-4">
Expand All @@ -142,7 +142,7 @@
:autoValidation="getValidateSteps"
:draftCourtOrderNumber="getCourtOrderStep.courtOrder.fileNumber"
:hasDraftPlanOfArrangement="getCourtOrderStep.courtOrder.hasPlanOfArrangement"
:courtOrderNumberRequired="true"
:courtOrderNumberRequired="false"
:invalidSection="isCourtOrderInvalid"
@emitCourtNumber="setCourtOrderFileNumber($event)"
@emitPoa="setHasPlanOfArrangement($event)"
Expand Down
1 change: 1 addition & 0 deletions tests/unit/Actions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ describe('Emits error event if NR validation fails in file and pay', () => {
store.state.stateModel.createShareStructureStep = { valid: true }
store.state.stateModel.incorporationAgreementStep = { valid: true }
store.state.stateModel.effectiveDateTime = { valid: true }
store.state.stateModel.courtOrderStep = { valid: true }

const localVue = createLocalVue()
localVue.use(VueRouter)
Expand Down
5 changes: 2 additions & 3 deletions tests/unit/IncorporationReviewConfirm.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ for (const test of reviewConfirmTestCases) {
expect(wrapper.find('#certify-section').exists()).toBe(true)
})

it('displays Court Order and Plan of Arrangement section only for ULC', () => {
it('displays Court Order and Plan of Arrangement section only for BEN, ULC, CC, BC', () => {
wrapper = shallowWrapperFactory(
IncorporationReviewConfirm,
null,
Expand All @@ -67,8 +67,7 @@ for (const test of reviewConfirmTestCases) {
IncorporationResources
)

const expected = (test.entityType === 'ULC')
expect(wrapper.find('#court-order-poa-section').exists()).toBe(test.entityType === 'ULC')
expect(wrapper.find('#court-order-poa-section').exists()).toBe(['BEN', 'ULC', 'CC', 'BC'].includes(test.entityType))
})

// FUTURE: Expand unit testing for validation on step 5. Include routing to appropriate steps from error links.
Expand Down
38 changes: 38 additions & 0 deletions tests/unit/filing-template-mixin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -493,3 +493,41 @@ describe('Staff Payment', () => {
})
})
})

for (const entityType of ['BEN', 'BC', 'CC', 'ULC']) {
describe('Base corporate incorporation filing: ' + entityType, () => {
// load coop filing data
let ia = require('./test-data/incorpApp.json')
ia.filing.business.legalType = entityType
ia.filing.incorporationApplication.nameRequest.legalType = entityType
let wrapper: any

beforeEach(() => {
wrapper = wrapperFactory(MixinTester, null, {})
})

afterEach(() => {
wrapper.destroy()
})

it('courtOrder attribute is not required', () => {
wrapper.vm.parseIncorporationDraft(ia.filing)
const filing = wrapper.vm.buildIncorporationFiling()
expect(filing.incorporationApplication).not.toHaveProperty('courtNumber')
})

it('can include courtOrder attribute', () => {
ia.filing.incorporationApplication.courtOrder = {
'fileNumber': '12034567',
'hasPlanOfArrangement': true
}
wrapper.vm.parseIncorporationDraft(ia.filing)
const filing = wrapper.vm.buildIncorporationFiling()
expect(filing.incorporationApplication.courtOrder).toEqual({
fileNumber: '12034567',
effectOfOrder: 'planOfArrangement',
hasPlanOfArrangement: true
})
})
})
}
169 changes: 169 additions & 0 deletions tests/unit/test-data/incorpApp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
{
"filing": {
"business": {
"identifier": "id123abc",
"legalType": "BC"
},
"documents": [],
"header": {
"affectedFilings": [],
"availableOnPaperOnly": false,
"certifiedBy": "BCREGTEST Rosette ELEVEN",
"colinIds": [],
"comments": [],
"date": "2021-10-26T20:30:00.230581+00:00",
"effectiveDate": "2021-10-26T20:30:00.230609+00:00",
"filingId": 112950,
"inColinOnly": false,
"isCorrected": false,
"isCorrectionPending": false,
"isFutureEffective": false,
"name": "incorporationApplication",
"paymentStatusCode": "COMPLETED",
"paymentToken": "13408",
"status": "PAID",
"submitter": "bcsc/iaptaestlb6ita56a3sqwhvvdulxqsl5"
},
"incorporationApplication": {
"contactPoint": {
"email": "[email protected]",
"phone": "(555) 555-5555"
},
"nameRequest": {
"legalName": "TEST INC IA",
"legalType": "CP",
"nrNumber": "NR 5269136"
},
"nameTranslations": [],
"offices": {
"registeredOffice": {
"deliveryAddress": {
"addressCity": "Victoria",
"addressCountry": "CA",
"addressRegion": "BC",
"deliveryInstructions": "",
"postalCode": "V8W 3H2",
"streetAddress": "735 Broughton St",
"streetAddressAdditional": ""
},
"mailingAddress": {
"addressCity": "Victoria",
"addressCountry": "CA",
"addressRegion": "BC",
"deliveryInstructions": "",
"postalCode": "V8W 3H2",
"streetAddress": "735 Broughton St",
"streetAddressAdditional": ""
}
}
},
"parties": [
{
"deliveryAddress": {
"addressCity": "Smithers",
"addressCountry": "CA",
"addressRegion": "BC",
"postalCode": "V0J 2N2",
"streetAddress": "5-6421 Airport Rd",
"streetAddressAdditional": ""
},
"mailingAddress": {
"addressCity": "Smithers",
"addressCountry": "CA",
"addressRegion": "BC",
"postalCode": "V0J 2N2",
"streetAddress": "5-6421 Airport Rd",
"streetAddressAdditional": ""
},
"officer": {
"email": "[email protected]",
"firstName": "BCREGTEST Rosette",
"id": "79825708-ca1d-41f6-86b0-fa7f30f93c5d",
"lastName": "ELEVEN",
"middleName": "",
"organizationName": "",
"partyType": "person"
},
"roles": [
{
"appointmentDate": "2021-10-26",
"roleType": "Completing Party"
},
{
"appointmentDate": "2021-10-26",
"roleType": "Director"
}
]
},
{
"deliveryAddress": {
"addressCity": "Victoria",
"addressCountry": "CA",
"addressRegion": "BC",
"deliveryInstructions": "",
"postalCode": "V8W 3H2",
"streetAddress": "735 Broughton St",
"streetAddressAdditional": ""
},
"mailingAddress": {
"addressCity": "Victoria",
"addressCountry": "CA",
"addressRegion": "BC",
"deliveryInstructions": "",
"postalCode": "V8W 3H2",
"streetAddress": "735 Broughton St",
"streetAddressAdditional": ""
},
"officer": {
"firstName": "John",
"id": "7b755f98-c183-4e04-96fd-027715f06c49",
"lastName": "Test",
"middleName": "",
"organizationName": "",
"partyType": "person"
},
"roles": [
{
"appointmentDate": "2021-10-26",
"roleType": "Director"
}
]
},
{
"deliveryAddress": {
"addressCity": "Victoria",
"addressCountry": "CA",
"addressRegion": "BC",
"deliveryInstructions": "",
"postalCode": "V8W 3H2",
"streetAddress": "735 Broughton St",
"streetAddressAdditional": ""
},
"mailingAddress": {
"addressCity": "Victoria",
"addressCountry": "CA",
"addressRegion": "BC",
"deliveryInstructions": "",
"postalCode": "V8W 3H2",
"streetAddress": "735 Broughton St",
"streetAddressAdditional": ""
},
"officer": {
"firstName": "Anna",
"id": "1d759481-7395-4826-87bc-666b5518d4d6",
"lastName": "Test",
"middleName": "",
"organizationName": "",
"partyType": "person"
},
"roles": [
{
"appointmentDate": "2021-10-26",
"roleType": "Director"
}
]
}
]
}
}
}

0 comments on commit da5fccf

Please sign in to comment.