From fabffb52671a05454b0f3d955e778b16c7707aa4 Mon Sep 17 00:00:00 2001 From: CameronEYDS <53542131+cameron-eyds@users.noreply.github.com> Date: Fri, 5 Apr 2024 15:32:34 -0700 Subject: [PATCH] Affe Enhancemnets and Fixes (#1810) --- .../src/components/common/CertifyInformation.vue | 2 +- .../HomeOwners/HomeOwnersTable.vue | 7 ++++++- .../mhrInformation/useTransferOwners.ts | 6 +++++- .../composables/mhrRegistration/useHomeOwners.ts | 3 ++- .../src/views/mhrInformation/MhrInformation.vue | 6 +++++- ppr-ui/tests/unit/CertifyInformation.spec.ts | 16 ++++++++++++++-- .../test-data/mock-registration-amendment.ts | 7 +++++++ 7 files changed, 40 insertions(+), 7 deletions(-) diff --git a/ppr-ui/src/components/common/CertifyInformation.vue b/ppr-ui/src/components/common/CertifyInformation.vue index 5e6d4047d..674f9fa0e 100644 --- a/ppr-ui/src/components/common/CertifyInformation.vue +++ b/ppr-ui/src/components/common/CertifyInformation.vue @@ -202,7 +202,7 @@ export default defineComponent({ const localState = reactive({ legalName: '', - certified: false, + certified: getCertifyInformation.value?.certified || false, infoText: props.content?.description || 'The following account information will be recorded by BC Registries upon registration and payment. ' + 'This information is used to confirm you have the authority to submit this registration.', diff --git a/ppr-ui/src/components/mhrRegistration/HomeOwners/HomeOwnersTable.vue b/ppr-ui/src/components/mhrRegistration/HomeOwners/HomeOwnersTable.vue index 20de2920b..7cfae1aa7 100644 --- a/ppr-ui/src/components/mhrRegistration/HomeOwners/HomeOwnersTable.vue +++ b/ppr-ui/src/components/mhrRegistration/HomeOwners/HomeOwnersTable.vue @@ -646,7 +646,12 @@ class="px-14 d-block" :class="{ 'border-error-left': isInvalidOwnerGroup(group.groupId) }" > - + + { owner.supportingDocument === SupportingDocumentsOptions.AFFIDAVIT) { hasValidSupportingDoc = owner.hasDeathCertificate && !!owner.deathCertificateNumber && owner.deathCertificateNumber?.length <= 20 && !!owner.deathDateTime + } else if (owner.partyType === HomeOwnerPartyTypes.OWNER_BUS) { + hasValidSupportingDoc = !!owner.deathCorpNumber && !!owner.deathDateTime } else { hasValidSupportingDoc = owner.supportingDocument === TransToExec.getSupportingDocForActiveTransfer() } @@ -501,8 +503,10 @@ export const useTransferOwners = (enableAllActions: boolean = false) => { .filter(owner => owner.groupId === groupId && owner.action !== ActionTypes.ADDED) .every(owner => { return owner.action === ActionTypes.REMOVED && + // Ensure owner is an individual before checking death certificate + (owner.partyType === HomeOwnerPartyTypes.OWNER_BUS || // Affidavit type also has Death Certificate - (owner.supportingDocument === SupportingDocumentsOptions.DEATH_CERT) + owner.supportingDocument === SupportingDocumentsOptions.DEATH_CERT) }) }, // Check if there's a deleted Owner with selected diff --git a/ppr-ui/src/composables/mhrRegistration/useHomeOwners.ts b/ppr-ui/src/composables/mhrRegistration/useHomeOwners.ts index e6a1d56df..d36ac0166 100644 --- a/ppr-ui/src/composables/mhrRegistration/useHomeOwners.ts +++ b/ppr-ui/src/composables/mhrRegistration/useHomeOwners.ts @@ -192,7 +192,8 @@ export function useHomeOwners (isMhrTransfer: boolean = false, isMhrCorrection: const hasMinimumGroups = (): boolean => { const groups = getTransferOrRegistrationHomeOwnerGroups().filter(group => group.action !== ActionTypes.REMOVED) - const hasNoGroups = [HomeTenancyTypes.SOLE, HomeTenancyTypes.JOINT].includes(getHomeTenancyType()) + const hasNoGroups = [HomeTenancyTypes.SOLE, HomeTenancyTypes.JOINT].includes(getHomeTenancyType()) || + groups.length === 0 return hasNoGroups || !groups || groups.length >= 2 || (!showGroups.value && groups.length === 1) } diff --git a/ppr-ui/src/views/mhrInformation/MhrInformation.vue b/ppr-ui/src/views/mhrInformation/MhrInformation.vue index 050028a55..0b26e96f9 100644 --- a/ppr-ui/src/views/mhrInformation/MhrInformation.vue +++ b/ppr-ui/src/views/mhrInformation/MhrInformation.vue @@ -704,7 +704,8 @@ export default defineComponent({ setStaffPayment, setEmptyMhrTransportPermit, setMhrTransportPermit, - setMhrInformationDraftId + setMhrInformationDraftId, + setCertifyInformation } = useStore() const { // Getters @@ -1166,6 +1167,9 @@ export default defineComponent({ // Affidavit Transfer has a different flow if (isTransferToExecutorUnder25Will.value) { + // Clear state for Sale or Gift Transfer + setEmptyMhrTransfer(initMhrTransfer()) + setCertifyInformation({ ...getCertifyInformation.value, certified: false }) localState.validate = false localState.staffPayment.option = StaffPaymentOptions.NONE diff --git a/ppr-ui/tests/unit/CertifyInformation.spec.ts b/ppr-ui/tests/unit/CertifyInformation.spec.ts index 6e0d86d07..d5eb7642d 100644 --- a/ppr-ui/tests/unit/CertifyInformation.spec.ts +++ b/ppr-ui/tests/unit/CertifyInformation.spec.ts @@ -2,7 +2,7 @@ import { useStore } from '@/store/store' import { nextTick } from 'vue' import { CertifyInformation } from '@/components/common' import { CertifyIF } from '@/interfaces' -import { mockedAmendmentCertified, mockedRegisteringParty1 } from './test-data' +import { mockedAmendmentCertified, mockedAmendmentCertifiedInvalid, mockedRegisteringParty1 } from './test-data' import { createComponent } from './utils' const store = useStore() @@ -62,8 +62,20 @@ describe('Certify Information on the confirmation page', () => { }) it('renders the certify information transition from initial to valid state', async () => { + await store.setCertifyInformation(mockedAmendmentCertifiedInvalid) wrapper = await createComponent(CertifyInformation, { setShowErrors: true }) - wrapper.find('#checkbox-certified').trigger('click') + await nextTick() + + // verify invalid states + expect(wrapper.vm.valid).toBeFalsy() + expect(wrapper.emitted().certifyValid).toBeFalsy() + expect(wrapper.vm.showErrorComponent).toBeTruthy() + + const checkbox = await wrapper.find('#checkbox-certified') + checkbox.setValue(true) + await nextTick() + + // verify valid states expect(wrapper.vm.valid).toBeTruthy() expect(wrapper.emitted().certifyValid).toBeTruthy() expect(wrapper.vm.showErrorComponent).toBeFalsy() diff --git a/ppr-ui/tests/unit/test-data/mock-registration-amendment.ts b/ppr-ui/tests/unit/test-data/mock-registration-amendment.ts index 5741a4b37..73b6310d4 100644 --- a/ppr-ui/tests/unit/test-data/mock-registration-amendment.ts +++ b/ppr-ui/tests/unit/test-data/mock-registration-amendment.ts @@ -35,6 +35,13 @@ export const mockedAmendmentCertified: CertifyIF = { registeringParty: mockedRegisteringParty1 } +export const mockedAmendmentCertifiedInvalid: CertifyIF = { + valid: false, + certified: false, + legalName: 'Authorizing Name', + registeringParty: mockedRegisteringParty1 +} + export const mockedGeneralCollateralAdd: GeneralCollateralIF[] = [ { addedDateTime: '2021-09-16T05:56:20Z',