forked from ustaxcourt/ef-cms
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'staging' of https://github.com/ustaxcourt/ef-cms into 1…
…0049-display-wip-cav-submitted-cases
- Loading branch information
Showing
67 changed files
with
1,171 additions
and
609 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
cypress/cypress-integration/integration/private-practitioner-mobile.cy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { navigateTo as navigateToDashboard } from '../support/pages/dashboard'; | ||
|
||
describe('Private practitioner mobile', () => { | ||
beforeEach(() => { | ||
cy.viewport('iphone-6'); | ||
}); | ||
|
||
it('should have access to case, order, and opinion advanced searches (and NOT practitioner advanced search)', () => { | ||
navigateToDashboard('privatePractitioner'); | ||
|
||
cy.get('[data-test="advanced-search-link"]').click(); | ||
|
||
cy.get('[data-test="advanced-search-type-mobile-selector"]') | ||
.children() | ||
.then(options => { | ||
const actualAdvancedSearchOptions: string[] = [...options].map( | ||
o => o.innerText, | ||
); | ||
|
||
const expectedAdvancedSearchOptions = ['Case', 'Order', 'Opinion']; | ||
expect(actualAdvancedSearchOptions).to.deep.eq( | ||
expectedAdvancedSearchOptions, | ||
); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash -e | ||
|
||
# Sets the redaction acknowledgement enabled feature flag to "false" in the dynamo deploy table | ||
|
||
# Usage | ||
# ENV=dev ./setup-redaction-acknowledgement-enabled-flag.sh | ||
|
||
./check-env-variables.sh \ | ||
"ENV" \ | ||
"AWS_SECRET_ACCESS_KEY" \ | ||
"AWS_ACCESS_KEY_ID" | ||
|
||
aws dynamodb put-item --region us-east-1 --table-name "efcms-deploy-${ENV}" --item '{"pk":{"S":"use-change-of-address-lambda"},"sk":{"S":"use-change-of-address-lambda"},"current":{"BOOL":true}}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
196 changes: 196 additions & 0 deletions
196
shared/src/business/useCaseHelper/generateChangeOfAddressHelper.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,196 @@ | ||
import { Case } from '@shared/business/entities/cases/Case'; | ||
import { Practitioner } from '../entities/Practitioner'; | ||
import { | ||
ROLES, | ||
SERVICE_INDICATOR_TYPES, | ||
} from '@shared/business/entities/EntityConstants'; | ||
import { TUserContact } from '@shared/business/useCases/users/generateChangeOfAddress'; | ||
import { aggregatePartiesForService } from '@shared/business/utilities/aggregatePartiesForService'; | ||
import { clone } from 'lodash'; | ||
import { generateAndServeDocketEntry } from '@shared/business/useCaseHelper/service/createChangeItems'; | ||
|
||
/** | ||
* generateChangeOfAddressHelper | ||
* | ||
* @param {object} applicationContext the application context | ||
* @param {string} providers.deadlineDate the date of the deadline to generated | ||
* @param {string} providers.description the description of the deadline | ||
* @param {Case} providers.subjectCaseEntity the subjectCaseEntity | ||
*/ | ||
export const generateChangeOfAddressHelper = async ({ | ||
applicationContext, | ||
bypassDocketEntry, | ||
contactInfo, | ||
docketNumber, | ||
firmName, | ||
jobId, | ||
requestUserId, | ||
updatedEmail, | ||
updatedName, | ||
user, | ||
websocketMessagePrefix, | ||
}: { | ||
applicationContext: IApplicationContext; | ||
docketNumber: string; | ||
bypassDocketEntry: boolean; | ||
contactInfo: TUserContact; | ||
firmName: string; | ||
updatedEmail?: string; | ||
updatedName?: string; | ||
jobId: string; | ||
user: RawPractitioner; | ||
requestUserId?: string; | ||
websocketMessagePrefix: string; | ||
}) => { | ||
try { | ||
const newData = contactInfo; | ||
|
||
const userCase = await applicationContext | ||
.getPersistenceGateway() | ||
.getCaseByDocketNumber({ | ||
applicationContext, | ||
docketNumber, | ||
}); | ||
let caseEntity = new Case(userCase, { applicationContext }); | ||
|
||
const practitionerName = updatedName || user.name; | ||
const practitionerObject = caseEntity.privatePractitioners | ||
.concat(caseEntity.irsPractitioners) | ||
.find(practitioner => practitioner.userId === user.userId); | ||
|
||
if (!practitionerObject) { | ||
throw new Error( | ||
`Could not find user|${user.userId} barNumber: ${user.barNumber} on ${docketNumber}`, | ||
); | ||
} | ||
|
||
const oldData = clone(practitionerObject.contact); | ||
|
||
// This updates the case by reference! | ||
practitionerObject.contact = contactInfo; | ||
practitionerObject.firmName = firmName; | ||
practitionerObject.name = practitionerName; | ||
|
||
if (!oldData.email && updatedEmail) { | ||
practitionerObject.serviceIndicator = | ||
SERVICE_INDICATOR_TYPES.SI_ELECTRONIC; | ||
practitionerObject.email = updatedEmail; | ||
} | ||
|
||
if (!bypassDocketEntry && caseEntity.shouldGenerateNoticesForCase()) { | ||
await prepareToGenerateAndServeDocketEntry({ | ||
applicationContext, | ||
caseEntity, | ||
newData, | ||
oldData, | ||
practitionerName, | ||
user, | ||
}); | ||
} | ||
|
||
await applicationContext.getUseCaseHelpers().updateCaseAndAssociations({ | ||
applicationContext, | ||
caseToUpdate: caseEntity, | ||
}); | ||
} catch (error) { | ||
applicationContext.logger.error(error); | ||
} | ||
|
||
await applicationContext.getNotificationGateway().sendNotificationToUser({ | ||
applicationContext, | ||
message: { | ||
action: `${websocketMessagePrefix}_contact_update_progress`, | ||
}, | ||
userId: requestUserId || user.userId, | ||
}); | ||
|
||
const updatedJob = await applicationContext | ||
.getPersistenceGateway() | ||
.setChangeOfAddressCaseAsDone({ applicationContext, docketNumber, jobId }); | ||
|
||
const isDoneProcessing = updatedJob.remaining === 0; | ||
|
||
if (isDoneProcessing) { | ||
applicationContext.logger.info( | ||
`"change-of-address-job|${jobId}" job finished`, | ||
); | ||
|
||
if (websocketMessagePrefix === 'user') { | ||
const userEntity = new Practitioner({ | ||
...user, | ||
isUpdatingInformation: false, | ||
}); | ||
|
||
await applicationContext.getPersistenceGateway().updateUser({ | ||
applicationContext, | ||
user: userEntity.validate().toRawObject(), | ||
}); | ||
} | ||
|
||
await applicationContext.getNotificationGateway().sendNotificationToUser({ | ||
applicationContext, | ||
message: { | ||
action: `${websocketMessagePrefix}_contact_full_update_complete`, | ||
}, | ||
userId: requestUserId || user.userId, | ||
}); | ||
} | ||
}; | ||
|
||
/** | ||
* This function prepares data to be passed to generateAndServeDocketEntry | ||
* | ||
* @param {object} providers the providers object | ||
* @param {object} providers.applicationContext the application context | ||
* @param {object} providers.caseEntity the instantiated Case class | ||
* @param {object} providers.newData the new practitioner contact information | ||
* @param {object} providers.oldData the old practitioner contact information (for comparison) | ||
* @param {object} providers.practitionerName the name of the practitioner | ||
* @param {object} providers.user the user object that includes userId, barNumber etc. | ||
* @returns {Promise<*>} resolves upon completion of docket entry service | ||
*/ | ||
const prepareToGenerateAndServeDocketEntry = async ({ | ||
applicationContext, | ||
caseEntity, | ||
newData, | ||
oldData, | ||
practitionerName, | ||
user, | ||
}) => { | ||
const documentType = applicationContext | ||
.getUtilities() | ||
.getDocumentTypeForAddressChange({ | ||
newData, | ||
oldData, | ||
}); | ||
|
||
if (!documentType) return; | ||
|
||
const servedParties = aggregatePartiesForService(caseEntity); | ||
|
||
const docketMeta = {} as any; | ||
if (user.role === ROLES.privatePractitioner) { | ||
docketMeta.privatePractitioners = [ | ||
{ | ||
name: practitionerName, | ||
}, | ||
]; | ||
} else if (user.role === ROLES.irsPractitioner) { | ||
docketMeta.partyIrsPractitioner = true; | ||
} | ||
|
||
newData.name = practitionerName; | ||
const { changeOfAddressDocketEntry } = await generateAndServeDocketEntry({ | ||
applicationContext, | ||
barNumber: user.barNumber, | ||
caseEntity, | ||
docketMeta, | ||
documentType, | ||
newData, | ||
oldData, | ||
servedParties, | ||
user, | ||
}); | ||
|
||
caseEntity.updateDocketEntry(changeOfAddressDocketEntry); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.