From 5fffa2dd0a40e0d21b354d761d8d8b93a854a991 Mon Sep 17 00:00:00 2001 From: Nechama Krigsman Date: Tue, 3 Sep 2024 11:25:19 -0400 Subject: [PATCH 01/13] 10339: remove "A minor or legally incompetent person" filing option for private practitioner; --- .../updatedFilePetitionHelper.test.ts | 27 ++++++++++++++++++- .../computeds/updatedFilePetitionHelper.ts | 24 +++++++++++++++++ .../src/views/StartCaseUpdated/OtherInfo.tsx | 9 ++----- .../UpdatedFilePetitionStep1.tsx | 1 + 4 files changed, 53 insertions(+), 8 deletions(-) diff --git a/web-client/src/presenter/computeds/updatedFilePetitionHelper.test.ts b/web-client/src/presenter/computeds/updatedFilePetitionHelper.test.ts index f4e7d93b395..b9ed215461c 100644 --- a/web-client/src/presenter/computeds/updatedFilePetitionHelper.test.ts +++ b/web-client/src/presenter/computeds/updatedFilePetitionHelper.test.ts @@ -118,6 +118,32 @@ describe('updatedFilePetitionHelper', () => { ]); }); }); + describe('otherFilingOptions', () => { + it('should return the other filing options for petitioner', () => { + const result = runCompute(updatedFilePetitionHelper, { + state: { form: {} }, + }); + expect(result.otherFilingOptions).toEqual([ + 'An estate or trust', + 'A minor or legally incompetent person', + 'Donor', + 'Transferee', + 'Deceased Spouse', + ]); + }); + it('should return other filing options for practitioner', () => { + user = privatePractitionerUser; + const result = runCompute(updatedFilePetitionHelper, { + state: { form: {}, user: privatePractitionerUser }, + }); + expect(result.otherFilingOptions).toEqual([ + 'An estate or trust', + 'Donor', + 'Transferee', + 'Deceased Spouse', + ]); + }); + }); describe('showContactInformationForOtherPartyType', () => { const partyTypesWithOtherPartyTypeContactInfo = [ PARTY_TYPES.donor, @@ -158,7 +184,6 @@ describe('updatedFilePetitionHelper', () => { expect(result.showContactInformationForOtherPartyType).toBeFalsy(); }); }); - describe('otherContactNameLabel', () => { it('should return correct labels for survivingSpouse', () => { const result = runCompute(updatedFilePetitionHelper, { diff --git a/web-client/src/presenter/computeds/updatedFilePetitionHelper.ts b/web-client/src/presenter/computeds/updatedFilePetitionHelper.ts index 7af0bb4903e..a9dbf2b7e76 100644 --- a/web-client/src/presenter/computeds/updatedFilePetitionHelper.ts +++ b/web-client/src/presenter/computeds/updatedFilePetitionHelper.ts @@ -26,6 +26,7 @@ type UpdatedFilePetitionHelper = { isPractitioner: boolean; businessFieldNames: IBusinessFields | {}; otherContactNameLabel?: IOtherContactNameLabel; + otherFilingOptions: string[]; showContactInformationForOtherPartyType: boolean; }; @@ -49,17 +50,40 @@ export const updatedFilePetitionHelper = ( const isPetitioner = user.role === ROLES.petitioner; const isPractitioner = user.role === ROLES.privatePractitioner; + const otherFilingOptions = getOtherFilingOptions(isPractitioner); + return { businessFieldNames, filingOptions, isPetitioner, isPractitioner, otherContactNameLabel, + otherFilingOptions, showContactInformationForOtherPartyType: getShowContactInformationForOtherPartyType(partyType, PARTY_TYPES), }; }; +function getOtherFilingOptions(isPractitioner) { + const estateOrTrust = 'An estate or trust'; + const minorOrIncompetentPerson = 'A minor or legally incompetent person'; + const donor = 'Donor'; + const transferee = 'Transferee'; + const deceasedSpouse = 'Deceased Spouse'; + + const otherFilingOptions = isPractitioner + ? [estateOrTrust, donor, transferee, deceasedSpouse] + : [ + estateOrTrust, + minorOrIncompetentPerson, + donor, + transferee, + deceasedSpouse, + ]; + + return otherFilingOptions; +} + function formatFilingTypes(filingOptions) { return filingOptions.map(option => { if (option === 'Individual petitioner') { diff --git a/web-client/src/views/StartCaseUpdated/OtherInfo.tsx b/web-client/src/views/StartCaseUpdated/OtherInfo.tsx index 7530c7c421a..f7b9f6d711e 100644 --- a/web-client/src/views/StartCaseUpdated/OtherInfo.tsx +++ b/web-client/src/views/StartCaseUpdated/OtherInfo.tsx @@ -8,6 +8,7 @@ export function OtherInfo({ form, isPetitioner, otherContactNameLabel, + otherFilingOptions, petitionGenerationLiveValidationSequence, registerRef, showContactInformationForOtherPartyType, @@ -30,13 +31,7 @@ export function OtherInfo({ What other type of taxpayer are you filing for? - {[ - 'An estate or trust', - 'A minor or legally incompetent person', - 'Donor', - 'Transferee', - 'Deceased Spouse', - ].map((otherType, idx) => ( + {otherFilingOptions.map((otherType, idx) => (
Date: Tue, 3 Sep 2024 22:15:22 -0400 Subject: [PATCH 02/13] 10339: fix type errors; remove getCurrentUser; --- .../generateDocketRecordPdfInteractor.test.ts | 1 + .../actions/formatPetitionAction.test.ts | 32 ++++--------------- .../internalPetitionPartiesHelper.test.ts | 6 ++-- .../computeds/startCaseHelper.test.ts | 10 ++---- .../updatedFilePetitionHelper.test.ts | 2 -- web-client/src/views/BeforeStartingCase.tsx | 6 +++- 6 files changed, 16 insertions(+), 41 deletions(-) diff --git a/web-api/src/business/useCases/generateDocketRecordPdfInteractor.test.ts b/web-api/src/business/useCases/generateDocketRecordPdfInteractor.test.ts index 2e228f6515c..eadf7622b7a 100644 --- a/web-api/src/business/useCases/generateDocketRecordPdfInteractor.test.ts +++ b/web-api/src/business/useCases/generateDocketRecordPdfInteractor.test.ts @@ -125,6 +125,7 @@ describe('generateDocketRecordPdfInteractor', () => { it('sets counsel name to `None` when there is no counsel representing the petitioner', async () => { const mockPractitionerOnCase = { ...privatePractitionerUser, + email: 'privatePractitioner@example.com', representing: ['b4302f61-2cff-4a57-bacf-1f817ffbaf8d'], }; diff --git a/web-client/src/presenter/actions/formatPetitionAction.test.ts b/web-client/src/presenter/actions/formatPetitionAction.test.ts index 32a950701cf..55495ae78a9 100644 --- a/web-client/src/presenter/actions/formatPetitionAction.test.ts +++ b/web-client/src/presenter/actions/formatPetitionAction.test.ts @@ -1,10 +1,10 @@ -import { - CASE_TYPES_MAP, - ROLES, -} from '@shared/business/entities/EntityConstants'; +import { CASE_TYPES_MAP } from '@shared/business/entities/EntityConstants'; import { applicationContextForClient as applicationContext } from '@web-client/test/createClientTestApplicationContext'; import { formatPetitionAction } from '@web-client/presenter/actions/formatPetitionAction'; -import { mockPetitionerUser } from '@shared/test/mockAuthUsers'; +import { + mockPetitionerUser, + mockPrivatePractitionerUser, +} from '@shared/test/mockAuthUsers'; import { presenter } from '../presenter-mock'; import { runAction } from '@web-client/presenter/test.cerebral'; @@ -162,23 +162,6 @@ describe('formatPetitionAction', () => { }); it('should set counsel contact if user is a private practitioner', async () => { - applicationContext.getCurrentUser.mockImplementation(() => ({ - barNumber: 'TEST_barNumber', - contact: { - address1: 'TEST_address1', - address2: 'TEST_address2', - address3: 'TEST_address3', - city: 'TEST_city', - phone: 'TEST_phone', - postalCode: 'TEST_postalCode', - state: 'TEST_state', - }, - email: TEST_EMAIL, - firmName: 'TEST_firmName', - name: 'TEST_Name', - role: ROLES.privatePractitioner, - })); - const results = await runAction(formatPetitionAction, { modules: { presenter, @@ -186,10 +169,7 @@ describe('formatPetitionAction', () => { props: PROPS, state: { petitionFormatted: undefined, - user: { - ...mockPetitionerUser, - email: TEST_EMAIL, - }, + user: mockPrivatePractitionerUser, }, }); diff --git a/web-client/src/presenter/computeds/internalPetitionPartiesHelper.test.ts b/web-client/src/presenter/computeds/internalPetitionPartiesHelper.test.ts index f45164e88a0..5c32dbda3b1 100644 --- a/web-client/src/presenter/computeds/internalPetitionPartiesHelper.test.ts +++ b/web-client/src/presenter/computeds/internalPetitionPartiesHelper.test.ts @@ -496,8 +496,6 @@ describe('internalPetitionPartiesHelper', () => { describe('showSecondaryContactEmailFieldAndConsentBox', () => { it('should display secondary contact email field when petition is filed by a petitioner', () => { - applicationContext.getCurrentUser.mockReturnValue(petitionsClerkUser); - const result = runCompute(internalPetitionPartiesHelper, { state: { featureFlags: { @@ -508,14 +506,13 @@ describe('internalPetitionPartiesHelper', () => { filingType: FILING_TYPES.petitioner[1], isPaper: false, }, + user: petitionsClerkUser, }, }); expect(result.showSecondaryContactEmailFieldAndConsentBox).toEqual(true); }); it('should display secondary contact email field when petition is filed by a private practitioner', () => { - applicationContext.getCurrentUser.mockReturnValue(petitionsClerkUser); - const result = runCompute(internalPetitionPartiesHelper, { state: { featureFlags: { @@ -526,6 +523,7 @@ describe('internalPetitionPartiesHelper', () => { filingType: FILING_TYPES.privatePractitioner[1], isPaper: false, }, + user: petitionsClerkUser, }, }); diff --git a/web-client/src/presenter/computeds/startCaseHelper.test.ts b/web-client/src/presenter/computeds/startCaseHelper.test.ts index 16d26286646..01bdde5064c 100644 --- a/web-client/src/presenter/computeds/startCaseHelper.test.ts +++ b/web-client/src/presenter/computeds/startCaseHelper.test.ts @@ -299,15 +299,12 @@ describe('startCaseHelper', () => { }); it('should set notice legend correctly when user is petitioner', () => { - applicationContext.getCurrentUser = () => - ({ - role: ROLES.petitioner, - }) as RawUser; const result = runCompute(startCaseHelper, { state: { form: { hasIrsNotice: false, }, + user: petitionerUser, }, }); expect(result.noticeLegend).toEqual( @@ -316,15 +313,12 @@ describe('startCaseHelper', () => { }); it('should set notice legend correctly when user is private practitioner', () => { - applicationContext.getCurrentUser = () => - ({ - role: ROLES.privatePractitioner, - }) as RawUser; const result = runCompute(startCaseHelper, { state: { form: { hasIrsNotice: false, }, + user: privatePractitionerUser, }, }); expect(result.noticeLegend).toEqual( diff --git a/web-client/src/presenter/computeds/updatedFilePetitionHelper.test.ts b/web-client/src/presenter/computeds/updatedFilePetitionHelper.test.ts index 3f07ee77320..041fcc5d7cd 100644 --- a/web-client/src/presenter/computeds/updatedFilePetitionHelper.test.ts +++ b/web-client/src/presenter/computeds/updatedFilePetitionHelper.test.ts @@ -99,7 +99,6 @@ describe('updatedFilePetitionHelper', () => { ]); }); it('should return filing options for practitioner', () => { - user = privatePractitionerUser; const result = runCompute(updatedFilePetitionHelper, { state: { form: {}, user: privatePractitionerUser }, }); @@ -128,7 +127,6 @@ describe('updatedFilePetitionHelper', () => { ]); }); it('should return other filing options for practitioner', () => { - user = privatePractitionerUser; const result = runCompute(updatedFilePetitionHelper, { state: { form: {}, user: privatePractitionerUser }, }); diff --git a/web-client/src/views/BeforeStartingCase.tsx b/web-client/src/views/BeforeStartingCase.tsx index 8874d22c036..dc75602ec40 100644 --- a/web-client/src/views/BeforeStartingCase.tsx +++ b/web-client/src/views/BeforeStartingCase.tsx @@ -14,6 +14,8 @@ import { sequences } from '@web-client/presenter/app.cerebral'; import { state } from '@web-client/presenter/app.cerebral'; import React from 'react'; +type PetitionCreationRoles = 'petitioner' | 'privatePractitioner'; + export const BeforeStartingCase = connect( { closeModalAndReturnToDashboardSequence: @@ -30,7 +32,9 @@ export const BeforeStartingCase = connect( }) { const redirectUrl = petitionFlowUpdated && - [ROLES.petitioner, ROLES.privatePractitioner].includes(user.role) + [ROLES.petitioner, ROLES.privatePractitioner].includes( + user.role as PetitionCreationRoles, + ) ? '/file-a-petition/new' : '/file-a-petition/step-1'; From 410fc9178dc3f1c7e49a3c837cc6201059581e1e Mon Sep 17 00:00:00 2001 From: Nechama Krigsman Date: Tue, 3 Sep 2024 22:18:47 -0400 Subject: [PATCH 03/13] 10339: add types; --- .../src/business/entities/contacts/ContactFactoryUpdated.ts | 4 ++-- .../src/presenter/computeds/updatedFilePetitionHelper.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/shared/src/business/entities/contacts/ContactFactoryUpdated.ts b/shared/src/business/entities/contacts/ContactFactoryUpdated.ts index 3c7fc709a72..c1c7ec26d72 100644 --- a/shared/src/business/entities/contacts/ContactFactoryUpdated.ts +++ b/shared/src/business/entities/contacts/ContactFactoryUpdated.ts @@ -1,5 +1,5 @@ import { BusinessContact } from './BusinessContact'; -import { CONTACT_TYPES, PARTY_TYPES } from '../EntityConstants'; +import { CONTACT_TYPES, FilingType, PARTY_TYPES } from '../EntityConstants'; import { ContactUpdated } from '@shared/business/entities/contacts/ContactUpdated'; import { DeceasedSpouseContact } from '@shared/business/entities/contacts/DeceasedSpouseContact'; import { OtherContact } from '@shared/business/entities/contacts/OtherContact'; @@ -15,7 +15,7 @@ export function ContactFactoryUpdated({ }: { contactInfoPrimary: {}; contactInfoSecondary: {}; - filingType: string; + filingType: FilingType; partyType: string; petitionType: string; hasSpouseConsent: boolean; diff --git a/web-client/src/presenter/computeds/updatedFilePetitionHelper.ts b/web-client/src/presenter/computeds/updatedFilePetitionHelper.ts index 89f37e74e86..abd10e6f173 100644 --- a/web-client/src/presenter/computeds/updatedFilePetitionHelper.ts +++ b/web-client/src/presenter/computeds/updatedFilePetitionHelper.ts @@ -1,6 +1,6 @@ import { ClientApplicationContext } from '@web-client/applicationContext'; +import { FilingType, ROLES } from '@shared/business/entities/EntityConstants'; import { Get } from 'cerebral'; -import { ROLES } from '@shared/business/entities/EntityConstants'; import { state } from '@web-client/presenter/app.cerebral'; interface IBusinessFields { @@ -84,7 +84,7 @@ function getOtherFilingOptions(isPractitioner) { return otherFilingOptions; } -function formatFilingTypes(filingOptions) { +function formatFilingTypes(filingOptions: FilingType[]) { return filingOptions.map(option => { if (option === 'Individual petitioner') { return { From 7641de4ec7b380b6d7dc97ee365541d56b9f3a15 Mon Sep 17 00:00:00 2001 From: Nechama Krigsman Date: Tue, 3 Sep 2024 22:36:33 -0400 Subject: [PATCH 04/13] 10339: update test around minor/incompetent option for private practitioner; --- ...-other--minor-or-legally-incompetent.cy.ts | 37 +++++++++++-------- .../src/views/StartCaseUpdated/OtherInfo.tsx | 2 - .../SecondaryMinorIncompetentOptions.tsx | 6 +-- .../UpdatedFilePetitionStep1.tsx | 1 - 4 files changed, 24 insertions(+), 22 deletions(-) diff --git a/cypress/local-only/tests/integration/fileAPetitionUpdated/file-a-petition-step-1-other--minor-or-legally-incompetent.cy.ts b/cypress/local-only/tests/integration/fileAPetitionUpdated/file-a-petition-step-1-other--minor-or-legally-incompetent.cy.ts index a1899d22d7d..5e336d77885 100644 --- a/cypress/local-only/tests/integration/fileAPetitionUpdated/file-a-petition-step-1-other--minor-or-legally-incompetent.cy.ts +++ b/cypress/local-only/tests/integration/fileAPetitionUpdated/file-a-petition-step-1-other--minor-or-legally-incompetent.cy.ts @@ -687,21 +687,28 @@ describe('File a petition: Step 1 - Petitioner Information', () => { }); describe('Practitioner', () => { - beforeEach(() => { - loginAsPrivatePractitioner(); - cy.visit('/file-a-petition/new'); - cy.get('[data-testid="step-indicator-current-step-1-icon"]'); - cy.get('[data-testid="filing-type-3"').click(); - }); - describe('Other', () => { - describe('A minor or legally incompetent person', () => { - it('should display correct other type title', () => { - cy.get('[data-testid="other-type-radio-option-1"]').click(); - cy.get('[data-testid="estate-type-legend"]').should( - 'have.text', - 'What is the petitioner’s role in filing for this minor or legally incompetent person?', - ); - }); + describe('Other Filing Options', () => { + it('should display other filing options', () => { + loginAsPrivatePractitioner(); + cy.visit('/file-a-petition/new'); + cy.get('[data-testid="filing-type-3"').click(); + + cy.get('[data-testid="other-type-radio-option-0"]').should( + 'have.text', + 'An estate or trust', + ); + cy.get('[data-testid="other-type-radio-option-1"]').should( + 'have.text', + 'Donor', + ); + cy.get('[data-testid="other-type-radio-option-2"]').should( + 'have.text', + 'Transferee', + ); + cy.get('[data-testid="other-type-radio-option-3"]').should( + 'have.text', + 'Deceased Spouse', + ); }); }); }); diff --git a/web-client/src/views/StartCaseUpdated/OtherInfo.tsx b/web-client/src/views/StartCaseUpdated/OtherInfo.tsx index f7b9f6d711e..40d74ddc5c0 100644 --- a/web-client/src/views/StartCaseUpdated/OtherInfo.tsx +++ b/web-client/src/views/StartCaseUpdated/OtherInfo.tsx @@ -6,7 +6,6 @@ import React from 'react'; export function OtherInfo({ form, - isPetitioner, otherContactNameLabel, otherFilingOptions, petitionGenerationLiveValidationSequence, @@ -69,7 +68,6 @@ export function OtherInfo({ )} {selectedOtherType === 'A minor or legally incompetent person' && (
- {isPetitioner - ? 'What is your role in filing for this minor or legally incompetent person?' - : 'What is the petitioner’s role in filing for this minor or legally incompetent person?'} + What is your role in filing for this minor or legally incompetent + person? {[ OTHER_TYPES.conservator, diff --git a/web-client/src/views/StartCaseUpdated/UpdatedFilePetitionStep1.tsx b/web-client/src/views/StartCaseUpdated/UpdatedFilePetitionStep1.tsx index e6168bfd38c..aee2327da0d 100644 --- a/web-client/src/views/StartCaseUpdated/UpdatedFilePetitionStep1.tsx +++ b/web-client/src/views/StartCaseUpdated/UpdatedFilePetitionStep1.tsx @@ -147,7 +147,6 @@ export const UpdatedFilePetitionStep1 = connect( {form.filingType === 'Other' && ( Date: Tue, 3 Sep 2024 23:51:43 -0400 Subject: [PATCH 05/13] 10339: text updates for private practitioner; ux feedback updates; --- .../documentTemplates/Petition.tsx | 10 +- .../actions/saveAndSubmitCaseAction.ts | 10 +- web-client/src/views/BeforeStartingCase.tsx | 163 +++++++++--------- .../StartCaseUpdated/CounselInformation.tsx | 2 +- .../PetitionerInformation.tsx | 16 +- .../src/views/StartCaseUpdated/Spouse.tsx | 6 +- 6 files changed, 119 insertions(+), 88 deletions(-) diff --git a/shared/src/business/utilities/pdfGenerator/documentTemplates/Petition.tsx b/shared/src/business/utilities/pdfGenerator/documentTemplates/Petition.tsx index 7939beb3657..11b82a23958 100644 --- a/shared/src/business/utilities/pdfGenerator/documentTemplates/Petition.tsx +++ b/shared/src/business/utilities/pdfGenerator/documentTemplates/Petition.tsx @@ -288,8 +288,14 @@ export const Petition = ({ {contactCounsel.city}, {contactCounsel.state}{' '} {contactCounsel.postalCode}
-
{contactCounsel.phone}
-
{contactCounsel.email}
+
+ Phone: + {contactCounsel.phone} +
+
+ Email: + {contactCounsel.email} +
Tax Court Bar No.: diff --git a/web-client/src/presenter/actions/saveAndSubmitCaseAction.ts b/web-client/src/presenter/actions/saveAndSubmitCaseAction.ts index 52eebd0e098..283f6ecc681 100644 --- a/web-client/src/presenter/actions/saveAndSubmitCaseAction.ts +++ b/web-client/src/presenter/actions/saveAndSubmitCaseAction.ts @@ -3,6 +3,7 @@ import { FileUploadProgressType, FileUploadProgressValueType, PETITION_TYPES, + ROLES, } from '@shared/business/entities/EntityConstants'; import { state } from '@web-client/presenter/app.cerebral'; @@ -82,11 +83,14 @@ export const saveAndSubmitCaseAction = async ({ await Promise.all(documentsThatNeedCoverSheet.map(addCoversheet)); + const isPetitioner = user.role === ROLES.petitioner; + const successTitle = `${isPetitioner ? 'Your' : 'The'} case has been assigned docket number ${caseDetail.docketNumberWithSuffix || caseDetail.docketNumber}`; + const successMessage = `${isPetitioner ? 'Your' : 'The'} case has been created and ${isPetitioner ? 'your' : ''} documents sent to the U.S. Tax Court.`; + return path.success({ alertSuccess: { - message: - 'Your case has been created and your documents sent to the U.S. Tax Court.', - title: `Your case has been assigned docket number ${caseDetail.docketNumberWithSuffix || caseDetail.docketNumber}`, + message: successMessage, + title: successTitle, }, caseDetail, }); diff --git a/web-client/src/views/BeforeStartingCase.tsx b/web-client/src/views/BeforeStartingCase.tsx index dc75602ec40..90f60866153 100644 --- a/web-client/src/views/BeforeStartingCase.tsx +++ b/web-client/src/views/BeforeStartingCase.tsx @@ -213,7 +213,8 @@ export const BeforeStartingCase = connect( > If {isPetitioner ? 'you' : 'the petitioner'} received a notice in the mail from the IRS, it may show the last date to file or the - number of days you have to file a Petition.{' '} + number of days {isPetitioner ? 'you have' : ''} to file a + Petition.{' '} In most cases, the Court must receive{' '} {isPetitioner ? 'your' : 'the'} electronically filed Petition no @@ -223,85 +224,7 @@ export const BeforeStartingCase = connect( {isPetitioner ? 'your' : 'the'} case may be dismissed.
-
- {isPetitioner && ( - - -
- { - "To file a joint Petition with your spouse, you must have the spouse's consent. If you do not have your spouse's consent, select “Myself” as the person who is filing." - } -
-
-
- )} - {isPetitioner && ( - - -
- To file a case on behalf of someone else, you must be - authorized to practice before this Court as provided by the{' '} - - { - '. Enrolled agents, certified public accountants, and attorneys who are not admitted to practice before the Court are not eligible to represent a party.' - } -
-
-
- )} - - -
- {`If ${isPetitioner ? "you're filing for" : 'the petitioner is'} a business, you'll need to complete and - submit the Corporate Disclosure Statement.`} -
-
- { - "Download and fill out the form if you haven't already done so:" - } -
- -
-
-
+ + { + '. Enrolled agents, certified public accountants, and attorneys who are not admitted to practice before the Court are not eligible to represent a party.' + } + + + + )} + + +
+ {`If ${isPetitioner ? "you're filing for" : 'the petitioner is'} a business, you'll need to complete and + submit the Corporate Disclosure Statement.`} +
+
+ {"Download and fill out the form if you haven't already done so:"} +
+ +
+
+ + ); +} diff --git a/web-client/src/views/StartCaseUpdated/CounselInformation.tsx b/web-client/src/views/StartCaseUpdated/CounselInformation.tsx index 452f958f981..72dcf9b840d 100644 --- a/web-client/src/views/StartCaseUpdated/CounselInformation.tsx +++ b/web-client/src/views/StartCaseUpdated/CounselInformation.tsx @@ -39,7 +39,7 @@ export function CounselInformation({ userInfo }) {
Party type -
{petitionFormatted.partyType}
+
+ {getPartyType(petitionFormatted.partyType, isPetitioner)} +
{petitionFormatted.corporateDisclosureFile && (
@@ -165,3 +172,10 @@ export function PetitionerInformation({ isPetitioner, petitionFormatted }) {
); } + +function getPartyType(partyType: PartyType, isPetitioner: boolean) { + if (!isPetitioner && partyType === PARTY_TYPES.petitionerSpouse) { + return 'Petitioner & petitioner spouse'; + } + return partyType; +} diff --git a/web-client/src/views/StartCaseUpdated/Spouse.tsx b/web-client/src/views/StartCaseUpdated/Spouse.tsx index 5054139b133..2d4f0c3cb12 100644 --- a/web-client/src/views/StartCaseUpdated/Spouse.tsx +++ b/web-client/src/views/StartCaseUpdated/Spouse.tsx @@ -74,7 +74,11 @@ export function Spouse({ handleBlur={petitionGenerationLiveValidationSequence} handleChange={updateFormValueUpdatedSequence} handleChangeCountryType={updateFormValueCountryTypeSequence} - nameLabel="Full name of spouse" + nameLabel={ + isPetitioner + ? 'Full name of spouse' + : 'Full name of petitioner spouse' + } registerRef={registerRef} showElectronicServiceConsent={isPetitioner} showSameAsPrimaryCheckbox={true} From 2b921f54419a594710f6dadc5241a34a9002a1bb Mon Sep 17 00:00:00 2001 From: Nechama Krigsman Date: Wed, 4 Sep 2024 10:03:32 -0400 Subject: [PATCH 06/13] 10339: update tests that were using getCurrentUser; update petition generation test include labels for phone and email; --- .../file-a-petition-generate-petition.cy.ts | 10 +++++----- .../actions/formatPetitionAction.test.ts | 19 ++++++++++++++++--- .../updatedFilePetitionHelper.test.ts | 2 +- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/cypress/local-only/tests/integration/fileAPetitionUpdated/file-a-petition-generate-petition.cy.ts b/cypress/local-only/tests/integration/fileAPetitionUpdated/file-a-petition-generate-petition.cy.ts index bccfa5c57cd..d7317d5f8be 100644 --- a/cypress/local-only/tests/integration/fileAPetitionUpdated/file-a-petition-generate-petition.cy.ts +++ b/cypress/local-only/tests/integration/fileAPetitionUpdated/file-a-petition-generate-petition.cy.ts @@ -363,15 +363,15 @@ describe('File a petition', () => { "Petitioner's contact information: John Cruz 123 Test Drive Boulder, CO 12345 Phone: Test Phone", ); expect(text).to.include( - "Counsel's contact information: Test Private Practitioner Bogus Barristers 234 Main St Apartment 4 Under the stairs Chicago, IL 61234 +1 (555) 555-5555 privatePractitioner1@example.com Tax Court Bar No.: PT5432", + "Counsel's contact information: Test Private Practitioner Bogus Barristers 234 Main St Apartment 4 Under the stairs Chicago, IL 61234 Phone: +1 (555) 555-5555 Email: privatePractitioner1@example.com Tax Court Bar No.: PT5432", + ); + expect(text).not.to.include('Service Email'); + expect(text).not.to.include( + 'Register for electronic filing and service', ); }, ); }); - - // should not display Service Email - // should not display Register for electronic filing and service: - // should display counsel contact information }); }); }); diff --git a/web-client/src/presenter/actions/formatPetitionAction.test.ts b/web-client/src/presenter/actions/formatPetitionAction.test.ts index 55495ae78a9..47cf1918d21 100644 --- a/web-client/src/presenter/actions/formatPetitionAction.test.ts +++ b/web-client/src/presenter/actions/formatPetitionAction.test.ts @@ -169,7 +169,20 @@ describe('formatPetitionAction', () => { props: PROPS, state: { petitionFormatted: undefined, - user: mockPrivatePractitionerUser, + user: { + ...mockPrivatePractitionerUser, + barNumber: 'TEST_barNumber', + contact: { + address1: 'TEST_address1', + address2: 'TEST_address2', + address3: 'TEST_address3', + city: 'TEST_city', + phone: 'TEST_phone', + postalCode: 'TEST_postalCode', + state: 'TEST_state', + }, + firmName: 'TEST_firmName', + }, }, }); @@ -179,9 +192,9 @@ describe('formatPetitionAction', () => { address3: 'TEST_address3', barNumber: 'TEST_barNumber', city: 'TEST_city', - email: 'TEST_EMAIL', + email: 'mockPrivatePractitioner@example.com', firmName: 'TEST_firmName', - name: 'TEST_Name', + name: 'Reginald Barclay', phone: 'TEST_phone', postalCode: 'TEST_postalCode', state: 'TEST_state', diff --git a/web-client/src/presenter/computeds/updatedFilePetitionHelper.test.ts b/web-client/src/presenter/computeds/updatedFilePetitionHelper.test.ts index 041fcc5d7cd..b2aa17d4844 100644 --- a/web-client/src/presenter/computeds/updatedFilePetitionHelper.test.ts +++ b/web-client/src/presenter/computeds/updatedFilePetitionHelper.test.ts @@ -116,7 +116,7 @@ describe('updatedFilePetitionHelper', () => { describe('otherFilingOptions', () => { it('should return the other filing options for petitioner', () => { const result = runCompute(updatedFilePetitionHelper, { - state: { form: {} }, + state: { form: {}, user: petitionerUser }, }); expect(result.otherFilingOptions).toEqual([ 'An estate or trust', From 626f5e83c0220f7f5a8eee2e3fc74b0aede27216 Mon Sep 17 00:00:00 2001 From: Nechama Krigsman Date: Wed, 4 Sep 2024 15:16:47 -0400 Subject: [PATCH 07/13] 10339: add email field for primary contact when filing as private practitioner; --- .../documentTemplates/Petition.tsx | 6 +++ .../useCases/createCaseInteractor.test.ts | 49 +++++++++++++++++++ .../business/useCases/createCaseInteractor.ts | 3 +- .../actions/formatPetitionAction.test.ts | 39 +++++++++++++++ .../presenter/actions/formatPetitionAction.ts | 5 +- web-client/src/presenter/state.ts | 5 +- .../views/StartCase/ContactPrimaryUpdated.tsx | 36 ++++++++++++++ .../views/StartCaseUpdated/BusinessInfo.tsx | 2 + .../OtherContactInformation.tsx | 2 + .../src/views/StartCaseUpdated/OtherInfo.tsx | 2 + .../PetitionerInformation.tsx | 8 ++- .../UpdatedFilePetitionStep1.tsx | 4 ++ 12 files changed, 155 insertions(+), 6 deletions(-) diff --git a/shared/src/business/utilities/pdfGenerator/documentTemplates/Petition.tsx b/shared/src/business/utilities/pdfGenerator/documentTemplates/Petition.tsx index 11b82a23958..6b4fa620452 100644 --- a/shared/src/business/utilities/pdfGenerator/documentTemplates/Petition.tsx +++ b/shared/src/business/utilities/pdfGenerator/documentTemplates/Petition.tsx @@ -199,6 +199,12 @@ export const Petition = ({ Phone: {contactPrimary.phone}
+ {!isPetitioner && ( +
+ Email: + {contactPrimary.email || 'Email not provided'} +
+ )} {contactPrimary.placeOfLegalResidence && (
{BUSINESS_TYPE_VALUES.includes(partyType) ? ( diff --git a/web-api/src/business/useCases/createCaseInteractor.test.ts b/web-api/src/business/useCases/createCaseInteractor.test.ts index 2316cffa311..638c9af2dae 100644 --- a/web-api/src/business/useCases/createCaseInteractor.test.ts +++ b/web-api/src/business/useCases/createCaseInteractor.test.ts @@ -596,4 +596,53 @@ describe('createCaseInteractor', () => { expect(p.serviceIndicator).toBe(SERVICE_INDICATOR_TYPES.SI_NONE); }); }); + + it('should set email to the petitioners email when case is created by a private petitioner', async () => { + user = new PrivatePractitioner({ + barNumber: 'BN1234', + email: 'kb@example.com', + name: 'Karen Baskinostan', + role: ROLES.privatePractitioner, + userId: 'c54ba5a9-b37b-479d-9201-067ec6e335bb', + }); + + const result = await createCaseInteractor( + applicationContext, + { + petitionFileId: '6722d660-d241-45ad-b7b2-0326cbfee40d', + petitionMetadata: { + caseType: 'Deficiency', + contactPrimary: { + address1: '25 Second Lane', + address2: 'Adipisci qui et est ', + address3: 'Cumque reprehenderit', + city: 'Consequatur Iusto e', + countryType: 'domestic', + email: 'petitioner@example.com', + name: 'Inez Martinez', + phone: '+1 (756) 271-3574', + postalCode: '68964', + state: 'VA', + }, + contactSecondary: {}, + filingType: 'Individual petitioner', + hasIrsNotice: true, + partyType: 'Petitioner', + petitionFile: new File([], 'test.pdf'), + petitionFileSize: 13264, + preferredTrialCity: 'Birmingham, Alabama', + procedureType: 'Regular', + stinFile: new File([], 'test.pdf'), + stinFileSize: 13264, + wizardStep: '5', + }, + stinFileId: 'e8bd0522-84ec-41fb-b490-0f4b8aa8a430', + } as any, + user, + ); + + result.petitioners.forEach(p => { + expect(p.email).toBe('petitioner@example.com'); + }); + }); }); diff --git a/web-api/src/business/useCases/createCaseInteractor.ts b/web-api/src/business/useCases/createCaseInteractor.ts index 930ed3039cc..2881b8354bc 100644 --- a/web-api/src/business/useCases/createCaseInteractor.ts +++ b/web-api/src/business/useCases/createCaseInteractor.ts @@ -110,8 +110,7 @@ export const createCaseInteractor = async ( ); } - // remove the email from contactPrimary since the practitioners array should have a service email - delete petitionEntity.getContactPrimary().email; + // remove the serviceIndicator since the practitioners array should have the service email delete petitionEntity.getContactPrimary().serviceIndicator; privatePractitioners = [practitionerUser]; diff --git a/web-client/src/presenter/actions/formatPetitionAction.test.ts b/web-client/src/presenter/actions/formatPetitionAction.test.ts index 47cf1918d21..59ac2c1e56b 100644 --- a/web-client/src/presenter/actions/formatPetitionAction.test.ts +++ b/web-client/src/presenter/actions/formatPetitionAction.test.ts @@ -200,4 +200,43 @@ describe('formatPetitionAction', () => { state: 'TEST_state', }); }); + + it('should set primary contact email to user email when the user is a petitioner', async () => { + const results = await runAction(formatPetitionAction, { + modules: { + presenter, + }, + props: PROPS, + state: { + petitionFormatted: undefined, + user: mockPetitionerUser, + }, + }); + + expect(results.state.petitionFormatted?.contactPrimary?.email).toEqual( + 'mockPetitioner@example.com', + ); + }); + + it('should not set primary contact email to user email when the user is a private practitioner', async () => { + const results = await runAction(formatPetitionAction, { + modules: { + presenter, + }, + props: { + ...PROPS, + createPetitionStep1Data: { + contactPrimary: { email: 'test@example.com' }, + }, + }, + state: { + petitionFormatted: undefined, + user: mockPrivatePractitionerUser, + }, + }); + + expect(results.state.petitionFormatted?.contactPrimary?.email).toEqual( + 'test@example.com', + ); + }); }); diff --git a/web-client/src/presenter/actions/formatPetitionAction.ts b/web-client/src/presenter/actions/formatPetitionAction.ts index 2e29f97bb32..ca4b5dbdcef 100644 --- a/web-client/src/presenter/actions/formatPetitionAction.ts +++ b/web-client/src/presenter/actions/formatPetitionAction.ts @@ -37,7 +37,10 @@ export const formatPetitionAction = ({ const { contactPrimary, irsNotices } = petitionInfo; const user = get(state.user); - contactPrimary.email = user.email; + + if (user.role === ROLES.petitioner) { + contactPrimary.email = user.email; + } const irsNoticesWithCaseTypes = irsNotices.map(irsNotice => { return { diff --git a/web-client/src/presenter/state.ts b/web-client/src/presenter/state.ts index f347532494a..34381b38fe0 100644 --- a/web-client/src/presenter/state.ts +++ b/web-client/src/presenter/state.ts @@ -1,4 +1,5 @@ /* eslint-disable max-lines */ +import { Contact } from '@shared/business/useCases/generatePetitionPdfInteractor'; import { FormattedPendingMotionWithWorksheet } from '@web-api/business/useCases/pendingMotion/getPendingMotionDocketEntriesForCurrentJudgeInteractor'; import { GetCasesByStatusAndByJudgeResponse } from '@web-api/business/useCases/judgeActivityReport/getCaseWorksheetsByJudgeInteractor'; import { @@ -759,8 +760,8 @@ export const baseState = { caseTitle: undefined, caseType: undefined, contactCounsel: undefined, - contactPrimary: undefined, - contactSecondary: undefined, + contactPrimary: undefined as Contact | undefined, + contactSecondary: undefined as Contact | undefined, corporateDisclosureFile: undefined, corporateDisclosureFileUrl: undefined, hasIrsNotice: undefined, diff --git a/web-client/src/views/StartCase/ContactPrimaryUpdated.tsx b/web-client/src/views/StartCase/ContactPrimaryUpdated.tsx index e4fc365f62e..6091ad02432 100644 --- a/web-client/src/views/StartCase/ContactPrimaryUpdated.tsx +++ b/web-client/src/views/StartCase/ContactPrimaryUpdated.tsx @@ -25,6 +25,7 @@ type ContactPrimaryUpdate = { registerRef?: Function; secondaryLabel?: string; secondaryLabelNote?: string; + showEmail?: boolean; showInCareOf?: boolean; showInCareOfOptional?: boolean; titleLabel?: string; @@ -52,6 +53,7 @@ export const ContactPrimaryUpdated = connect< registerRef, secondaryLabel, secondaryLabelNote, + showEmail, showInCareOf, showInCareOfOptional, titleLabel, @@ -271,6 +273,40 @@ export const ContactPrimaryUpdated = connect< }} /> + {showEmail && ( + + + { + handleBlur({ + validationKey: ['contactPrimary', 'email'], + }); + }} + onChange={e => { + handleChange({ + key: e.target.name, + value: e.target.value, + }); + }} + /> + + )}
); diff --git a/web-client/src/views/StartCaseUpdated/BusinessInfo.tsx b/web-client/src/views/StartCaseUpdated/BusinessInfo.tsx index 3f0f526cddc..d031d63cbbc 100644 --- a/web-client/src/views/StartCaseUpdated/BusinessInfo.tsx +++ b/web-client/src/views/StartCaseUpdated/BusinessInfo.tsx @@ -7,6 +7,7 @@ import React from 'react'; export function BusinessInfo({ businessFieldNames, form, + isPractitioner, petitionGenerationLiveValidationSequence, registerRef, updateFilingTypeSequence, @@ -71,6 +72,7 @@ export function BusinessInfo({ placeOfLegalResidenceTitle="Place of business" registerRef={registerRef} secondaryLabel={businessFieldNames.secondary} + showEmail={isPractitioner} showInCareOf={businessFieldNames.showInCareOf} showInCareOfOptional={businessFieldNames.showInCareOfOptional} /> diff --git a/web-client/src/views/StartCaseUpdated/OtherContactInformation.tsx b/web-client/src/views/StartCaseUpdated/OtherContactInformation.tsx index 718e40187b8..ef8c791a684 100644 --- a/web-client/src/views/StartCaseUpdated/OtherContactInformation.tsx +++ b/web-client/src/views/StartCaseUpdated/OtherContactInformation.tsx @@ -3,6 +3,7 @@ import React from 'react'; export function OtherContactInformation({ form, + isPractitioner, otherContactNameLabel, petitionGenerationLiveValidationSequence, registerRef, @@ -18,6 +19,7 @@ export function OtherContactInformation({ nameLabel={otherContactNameLabel.primaryLabel} registerRef={registerRef} secondaryLabel={otherContactNameLabel.secondaryLabel} + showEmail={isPractitioner} showInCareOf={otherContactNameLabel.showInCareOf} showInCareOfOptional={otherContactNameLabel.showInCareOfOptional} titleLabel={otherContactNameLabel.titleLabel} diff --git a/web-client/src/views/StartCaseUpdated/OtherInfo.tsx b/web-client/src/views/StartCaseUpdated/OtherInfo.tsx index 40d74ddc5c0..52fcd2610e0 100644 --- a/web-client/src/views/StartCaseUpdated/OtherInfo.tsx +++ b/web-client/src/views/StartCaseUpdated/OtherInfo.tsx @@ -6,6 +6,7 @@ import React from 'react'; export function OtherInfo({ form, + isPractitioner, otherContactNameLabel, otherFilingOptions, petitionGenerationLiveValidationSequence, @@ -76,6 +77,7 @@ export function OtherInfo({ {showContactInformationForOtherPartyType && ( {petitionFormatted.contactPrimary.placeOfLegalResidence && (
diff --git a/web-client/src/views/StartCaseUpdated/UpdatedFilePetitionStep1.tsx b/web-client/src/views/StartCaseUpdated/UpdatedFilePetitionStep1.tsx index aee2327da0d..eaa01aaee7f 100644 --- a/web-client/src/views/StartCaseUpdated/UpdatedFilePetitionStep1.tsx +++ b/web-client/src/views/StartCaseUpdated/UpdatedFilePetitionStep1.tsx @@ -93,6 +93,7 @@ export const UpdatedFilePetitionStep1 = connect( handleChangeCountryType={updateFormValueCountryTypeSequence} nameLabel={isPetitioner ? 'Full Name' : 'Petitioner’s full name'} registerRef={registerRef} + showEmail={isPractitioner} /> )} {(form.filingType === 'Myself and my spouse' || @@ -106,6 +107,7 @@ export const UpdatedFilePetitionStep1 = connect( handleChangeCountryType={updateFormValueCountryTypeSequence} nameLabel={isPetitioner ? 'Full Name' : 'Petitioner’s full name'} registerRef={registerRef} + showEmail={isPractitioner} />

{isPetitioner ? "Your spouse's" : 'Petitioner Spouse'} information @@ -132,6 +134,7 @@ export const UpdatedFilePetitionStep1 = connect( Date: Wed, 4 Sep 2024 15:34:06 -0400 Subject: [PATCH 08/13] 10339: add user to tests; --- .../src/presenter/actions/saveAndSubmitCaseAction.test.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/web-client/src/presenter/actions/saveAndSubmitCaseAction.test.ts b/web-client/src/presenter/actions/saveAndSubmitCaseAction.test.ts index ecd812683b2..ed932172e66 100644 --- a/web-client/src/presenter/actions/saveAndSubmitCaseAction.test.ts +++ b/web-client/src/presenter/actions/saveAndSubmitCaseAction.test.ts @@ -1,5 +1,6 @@ import { PETITION_TYPES } from '@shared/business/entities/EntityConstants'; import { applicationContextForClient as applicationContext } from '@web-client/test/createClientTestApplicationContext'; +import { mockPetitionerUser } from '@shared/test/mockAuthUsers'; import { presenter } from '@web-client/presenter/presenter-mock'; import { runAction } from '@web-client/presenter/test.cerebral'; import { saveAndSubmitCaseAction } from '@web-client/presenter/actions/saveAndSubmitCaseAction'; @@ -68,6 +69,7 @@ describe('saveAndSubmitCaseAction', () => { petitionFormatted: 'petitionFormattedData', petitionType: PETITION_TYPES.userUploaded, }, + user: mockPetitionerUser, }, }); @@ -150,6 +152,7 @@ describe('saveAndSubmitCaseAction', () => { petitionFormatted: 'petitionFormattedData', petitionType: PETITION_TYPES.autoGenerated, }, + user: mockPetitionerUser, }, }); @@ -234,6 +237,7 @@ describe('saveAndSubmitCaseAction', () => { petitionFormatted: 'petitionFormattedData', petitionType: PETITION_TYPES.autoGenerated, }, + user: mockPetitionerUser, }, }); From 60b7c7532024bfa8edb4c7dbcff7ec63671e067e Mon Sep 17 00:00:00 2001 From: Nechama Krigsman Date: Wed, 4 Sep 2024 23:57:13 -0400 Subject: [PATCH 09/13] 10339: save petitioner email as paperPetitionEmail since its not used for service or e-access; --- .../useCases/generatePetitionPdfInteractor.ts | 1 + .../documentTemplates/Petition.tsx | 2 +- .../useCases/createCaseInteractor.test.ts | 52 +------------------ .../business/useCases/createCaseInteractor.ts | 5 +- .../presenter/actions/formatPetitionAction.ts | 4 +- .../views/StartCase/ContactPrimaryUpdated.tsx | 19 ++++--- .../PetitionerInformation.tsx | 2 +- 7 files changed, 21 insertions(+), 64 deletions(-) diff --git a/shared/src/business/useCases/generatePetitionPdfInteractor.ts b/shared/src/business/useCases/generatePetitionPdfInteractor.ts index e2b3e6f2d1b..8b67bfc7dbb 100644 --- a/shared/src/business/useCases/generatePetitionPdfInteractor.ts +++ b/shared/src/business/useCases/generatePetitionPdfInteractor.ts @@ -27,6 +27,7 @@ export interface Contact { address2?: string; address3?: string; city: string; + paperPetitionEmail: string; postalCode: string; phone: string; state: string; diff --git a/shared/src/business/utilities/pdfGenerator/documentTemplates/Petition.tsx b/shared/src/business/utilities/pdfGenerator/documentTemplates/Petition.tsx index 6b4fa620452..dbd83b4aaf0 100644 --- a/shared/src/business/utilities/pdfGenerator/documentTemplates/Petition.tsx +++ b/shared/src/business/utilities/pdfGenerator/documentTemplates/Petition.tsx @@ -202,7 +202,7 @@ export const Petition = ({ {!isPetitioner && (
Email: - {contactPrimary.email || 'Email not provided'} + {contactPrimary.paperPetitionEmail || 'Email not provided'}
)} {contactPrimary.placeOfLegalResidence && ( diff --git a/web-api/src/business/useCases/createCaseInteractor.test.ts b/web-api/src/business/useCases/createCaseInteractor.test.ts index 638c9af2dae..03595fd9a9f 100644 --- a/web-api/src/business/useCases/createCaseInteractor.test.ts +++ b/web-api/src/business/useCases/createCaseInteractor.test.ts @@ -548,7 +548,7 @@ describe('createCaseInteractor', () => { }); }); - it('should set serviceIndicator to none for petitioner when case is created by a private petitioner', async () => { + it('should remove email and serviceIndicator for petitioner when case is created by a private petitioner', async () => { user = new PrivatePractitioner({ barNumber: 'BN1234', email: 'kb@example.com', @@ -594,55 +594,7 @@ describe('createCaseInteractor', () => { result.petitioners.forEach(p => { expect(p.serviceIndicator).toBe(SERVICE_INDICATOR_TYPES.SI_NONE); - }); - }); - - it('should set email to the petitioners email when case is created by a private petitioner', async () => { - user = new PrivatePractitioner({ - barNumber: 'BN1234', - email: 'kb@example.com', - name: 'Karen Baskinostan', - role: ROLES.privatePractitioner, - userId: 'c54ba5a9-b37b-479d-9201-067ec6e335bb', - }); - - const result = await createCaseInteractor( - applicationContext, - { - petitionFileId: '6722d660-d241-45ad-b7b2-0326cbfee40d', - petitionMetadata: { - caseType: 'Deficiency', - contactPrimary: { - address1: '25 Second Lane', - address2: 'Adipisci qui et est ', - address3: 'Cumque reprehenderit', - city: 'Consequatur Iusto e', - countryType: 'domestic', - email: 'petitioner@example.com', - name: 'Inez Martinez', - phone: '+1 (756) 271-3574', - postalCode: '68964', - state: 'VA', - }, - contactSecondary: {}, - filingType: 'Individual petitioner', - hasIrsNotice: true, - partyType: 'Petitioner', - petitionFile: new File([], 'test.pdf'), - petitionFileSize: 13264, - preferredTrialCity: 'Birmingham, Alabama', - procedureType: 'Regular', - stinFile: new File([], 'test.pdf'), - stinFileSize: 13264, - wizardStep: '5', - }, - stinFileId: 'e8bd0522-84ec-41fb-b490-0f4b8aa8a430', - } as any, - user, - ); - - result.petitioners.forEach(p => { - expect(p.email).toBe('petitioner@example.com'); + expect(p.email).toBeUndefined(); }); }); }); diff --git a/web-api/src/business/useCases/createCaseInteractor.ts b/web-api/src/business/useCases/createCaseInteractor.ts index 2881b8354bc..76b3a49ea9c 100644 --- a/web-api/src/business/useCases/createCaseInteractor.ts +++ b/web-api/src/business/useCases/createCaseInteractor.ts @@ -110,7 +110,10 @@ export const createCaseInteractor = async ( ); } - // remove the serviceIndicator since the practitioners array should have the service email + // remove the email from contactPrimary + // since the practitioners array should have a service email + // and paperPetitionEmail is used as email for the petitioner + delete petitionEntity.getContactPrimary().email; delete petitionEntity.getContactPrimary().serviceIndicator; privatePractitioners = [practitionerUser]; diff --git a/web-client/src/presenter/actions/formatPetitionAction.ts b/web-client/src/presenter/actions/formatPetitionAction.ts index ca4b5dbdcef..65ffd156b9f 100644 --- a/web-client/src/presenter/actions/formatPetitionAction.ts +++ b/web-client/src/presenter/actions/formatPetitionAction.ts @@ -38,9 +38,7 @@ export const formatPetitionAction = ({ const user = get(state.user); - if (user.role === ROLES.petitioner) { - contactPrimary.email = user.email; - } + contactPrimary.email = user.email; const irsNoticesWithCaseTypes = irsNotices.map(irsNotice => { return { diff --git a/web-client/src/views/StartCase/ContactPrimaryUpdated.tsx b/web-client/src/views/StartCase/ContactPrimaryUpdated.tsx index 6091ad02432..d8bdaa87380 100644 --- a/web-client/src/views/StartCase/ContactPrimaryUpdated.tsx +++ b/web-client/src/views/StartCase/ContactPrimaryUpdated.tsx @@ -278,24 +278,27 @@ export const ContactPrimaryUpdated = connect< errorMessageId="email-error-message" errorText={ validationErrors.contactPrimary && - validationErrors.contactPrimary.email + validationErrors.contactPrimary.paperPetitionEmail } > -