Skip to content

Commit

Permalink
[MCR-2539] CMS notified when a state is sent questions (#2096)
Browse files Browse the repository at this point in the history
* email template created

* add new emailer function sendQuestionCMSEmail

* use sendQuestionCMSEmail in createQuestionResolver

* add test from sendQuestionCMSEmail function

* add test for createQuestion resolver

* update the state email to link to the QA tab

* add round number

* PR fixes to pass question from the resolver, update error messages and field name for questionResponseURL

* get rid of extra linebreak in email template

* update email configuration to use dmcpReview and dmcpSubmission

* fix web test

* update docs

* update CreatQuestion resolver to find all questions for a contract and update emailer functions to expect an array of questions

* calculate round number by division
  • Loading branch information
pearl-truss authored Dec 6, 2023
1 parent 4de1e03 commit d37eab1
Show file tree
Hide file tree
Showing 35 changed files with 716 additions and 90 deletions.
10 changes: 8 additions & 2 deletions docs/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,14 @@ We plan to move this to the DB down the road. Until then, know that if these val

*[same in prod/val]* This the help address displayed in state emails for contacting the analyst review team.

#### `/configuration/email/dmcp`
#### `/configuration/email/dmcpSubmission`

*[environment specific]* This contains the DMCP primary inbox. The DMCP team is focused on policy issues related to managed care. They review all submissions, excluding CHIP and state of PR. This inbox is also primarily used for internal communication between DMCP, OACT, and DMCO.

#### `/configuration/email/dmcpReview`

*[environment specific]* This contains the DMCP inbox for external communication and Q&A notifications.

*[environment specific]* This contains the DMCP primary inbox. The DMCP team is focused on policy issues related to managed care. They review all submissions, excluding CHIP and state of PR.

#### `/configuration/email/oact`

Expand All @@ -223,6 +228,7 @@ We plan to move this to the DB down the road. Until then, know that if these val

*[environment specific]* This contains the DMCO primary inbox. The DMCO team is focused on managed care contracts and they review all submissions.


#### `/configuration/email/reviewTeamAddresses`

*[environment specific]* List of emails for dev teams/individuals that want to follow all emails. In prod, this is two addresses associated with MC-Review dev team.
Expand Down
40 changes: 32 additions & 8 deletions services/app-api/src/emailer/emailer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
resubmitPackageStateEmail,
resubmitPackageCMSEmail,
sendQuestionStateEmail,
sendQuestionCMSEmail,
} from './'
import type {
LockedHealthPlanFormDataType,
Expand All @@ -17,8 +18,8 @@ import type {
import type {
UpdateInfoType,
ProgramType,
CMSUserType,
ContractRevisionWithRatesType,
Question,
} from '../domain-models'
import { SESServiceException } from '@aws-sdk/client-ses'

Expand All @@ -36,7 +37,8 @@ type EmailConfiguration = {
*/
devReviewTeamEmails: string[] // added by default to all incoming submissions
oactEmails: string[] // OACT division emails
dmcpEmails: string[] // DMCP division emails
dmcpReviewEmails: string[] // DMCP division emails for reviews
dmcpSubmissionEmails: string[] // DMCP division emails for submissions
dmcoEmails: string[] // DMCO division emails

/* Email addresses used in display text
Expand Down Expand Up @@ -91,10 +93,15 @@ type Emailer = {
) => Promise<void | Error>
sendQuestionsStateEmail: (
contract: ContractRevisionWithRatesType,
cmsRequesor: CMSUserType,
submitterEmails: string[],
statePrograms: ProgramType[],
dateAsked: Date
questions: Question[]
) => Promise<void | Error>
sendQuestionsCMSEmail: (
contract: ContractRevisionWithRatesType,
stateAnalystsEmails: StateAnalystsEmails,
statePrograms: ProgramType[],
questions: Question[]
) => Promise<void | Error>
sendResubmittedStateEmail: (
formData: LockedHealthPlanFormDataType,
Expand Down Expand Up @@ -198,18 +205,35 @@ function emailer(
},
sendQuestionsStateEmail: async function (
contract,
cmsRequestor,
submitterEmails,
statePrograms,
dateAsked
questions
) {
const emailData = await sendQuestionStateEmail(
contract,
submitterEmails,
cmsRequestor,
config,
statePrograms,
dateAsked
questions
)
if (emailData instanceof Error) {
return emailData
} else {
return await this.sendEmail(emailData)
}
},
sendQuestionsCMSEmail: async function (
contract,
stateAnalystsEmails,
statePrograms,
questions
) {
const emailData = await sendQuestionCMSEmail(
contract,
stateAnalystsEmails,
config,
statePrograms,
questions
)
if (emailData instanceof Error) {
return emailData
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`renders overall email for a new question as expected 1`] = `
"DMCO sent questions to the state for submission MCR-MN-0003-SNBC<br />
<b>Sent by:</b> Ronald McDonald (DMCO) <a href="cms@email.com">cms@email.com</a>
<br />
<b>Round:</b> 1<br />
<b>Date:</b> 01/01/2024<br />
<br />
<a href="http://localhost/submissions/12345/question-and-answers">View submission Q&A</a>"
`;
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ exports[`renders overall email for a new question as expected 1`] = `
<br />
You must answer the question before CMS can continue reviewing it.<br />
<br />
<a href="http://localhost/submissions/12345">Open the submission in MC-Review to answer questions</a>
<a href="http://localhost/submissions/12345/question-and-answers">Open the submission in MC-Review to answer questions</a>
"
`;
1 change: 1 addition & 0 deletions services/app-api/src/emailer/emails/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ export { unlockPackageStateEmail } from './unlockPackageStateEmail'
export { resubmitPackageCMSEmail } from './resubmitPackageCMSEmail'
export { resubmitPackageStateEmail } from './resubmitPackageStateEmail'
export { sendQuestionStateEmail } from './sendQuestionStateEmail'
export { sendQuestionCMSEmail } from './sendQuestionCMSEmail'
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ test('to addresses list includes OACT and DMCP group emails for contract and rat
)
})

testEmailConfig().dmcpEmails.forEach((emailAddress) => {
testEmailConfig().dmcpSubmissionEmails.forEach((emailAddress) => {
expect(template).toEqual(
expect.objectContaining({
toAddresses: expect.arrayContaining([emailAddress]),
Expand Down Expand Up @@ -101,7 +101,7 @@ test('to addresses list does not include OACT and DMCP group emails for CHIP su
)
})

testEmailConfig().dmcpEmails.forEach((emailAddress) => {
testEmailConfig().dmcpSubmissionEmails.forEach((emailAddress) => {
expect(template).not.toEqual(
expect.objectContaining({
toAddresses: expect.arrayContaining([emailAddress]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ describe('with rates', () => {
throw template
}

testEmailConfig().dmcpEmails.forEach((emailAddress) => {
testEmailConfig().dmcpSubmissionEmails.forEach((emailAddress) => {
expect(template).toEqual(
expect.objectContaining({
toAddresses: expect.arrayContaining([emailAddress]),
Expand Down
Loading

0 comments on commit d37eab1

Please sign in to comment.