Skip to content

Commit

Permalink
Merging subsub into develop (#1500)
Browse files Browse the repository at this point in the history
* OY2 23552: Latest Package Activity - Package Details Page + Dashboard (#1353)

Co-authored-by: Valencia McMurray <[email protected]>

* Oy2 23798 - Subsequent Submissions (#1342)

* add subsequent submission action (form not yet implemented)

* fix error in action delegate and corresponding tests

* add new forms and config for subsequent submission

* not sure where that came from???

* Add custom success banner

* placeholder in one stream to build parent so that submit can release lock

* fix Cover Letter filter and attachment link for medicaid

* fix navigational back button on form

Let back nav button return you to details page if that is where you came from or to proper tab in package list if that is where you came from

* fix attachment language text per figma - despite nothing in the ACs ;)

* tests to cover subsequent submissions

* consolidate more of the Config

* Update submitWaiverAmendmentSubsequentSubmission.js

* tune required markings

* test updates

had the wrong message in the success banner but realized I maybe shouldn't automate the actual submission without some extra seed data (and holding off on that until reverse chrono seed data is pushed up).

* OY2 24868: Update NOSOs Admin Package Change Log Language (#1352)

* move secondClockStatuses to common configs (#1346)

* Bump @adobe/css-tools from 4.2.0 to 4.3.1 in /services/ui-src (#1355)

Bumps [@adobe/css-tools](https://github.com/adobe/css-tools) from 4.2.0 to 4.3.1.
- [Changelog](https://github.com/adobe/css-tools/blob/main/History.md)
- [Commits](https://github.com/adobe/css-tools/commits)

---
updated-dependencies:
- dependency-name: "@adobe/css-tools"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* keep current status after subsequent submission

* Bump tough-cookie and @cypress/request (#1332)

Bumps [tough-cookie](https://github.com/salesforce/tough-cookie) and [@cypress/request](https://github.com/cypress-io/request). These dependencies needed to be updated together.

Updates `tough-cookie` from 2.5.0 to 4.1.3
- [Release notes](https://github.com/salesforce/tough-cookie/releases)
- [Changelog](https://github.com/salesforce/tough-cookie/blob/master/CHANGELOG.md)
- [Commits](salesforce/tough-cookie@v2.5.0...v4.1.3)

Updates `@cypress/request` from 2.88.11 to 2.88.12
- [Release notes](https://github.com/cypress-io/request/releases)
- [Changelog](https://github.com/cypress-io/request/blob/master/CHANGELOG.md)
- [Commits](cypress-io/request@v2.88.11...v2.88.12)

---
updated-dependencies:
- dependency-name: tough-cookie
  dependency-type: indirect
- dependency-name: "@cypress/request"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kristin Grue <[email protected]>

* fix and update subsub tests

* final test update

some pending packages have actions because of the enable withdraw (unrelated to this work) story. Updated those. The tests failing because they can't find a package will be left and those are fixed elsewhere.

* OY2 24628: OneMAC Package Details - Reverse Chronological order (#1338)

Co-authored-by: Valencia McMurray <[email protected]>

* some of the tests

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Valencia McMurray <[email protected]>
Co-authored-by: Kristin Grue <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Valencia McMurray <[email protected]>

* merge develop to sub-sub

* OY2-25114 - subsequent submission reverse chrono (#1372)

* initial implementation of subsequent submission chronological order

* Update actionDelegate.test.js

* test Subsequent Documentation in reverse chrono

---------

Co-authored-by: Valencia McMurray <[email protected]>

* Oy2 23799 - add emails for subsequent submissions (#1368)

* add emails for subsequent submissions

* lint

* rebuild package lock just to force a build

* Update package-lock.json

* fix lint

* test refactor

* add subsequent submission maps

* test updates: latest activity

re-adding latest activity and updating some attachment steps to match current dev.

* Mege latest develop (#1479)

* Update serverless.yml

changed x-content-type-options to lowercase to see if the value will change

* Update api-gateway.yml

Another addition to set the x-Content-Type-Options to nosniff

* Update api-gateway.yml

Fix error where code was placed

* Add aws-sdk, esbuild, and configuration to fix the legacy source to kafka

* set default timeout to 2.5minutes for all api lambda (#1475)

* continue pipeline even if issues with seed data (#1478)

---------

Co-authored-by: Dark-Knight-1313 <[email protected]>
Co-authored-by: Mike Dial <[email protected]>

* add changes for Oy2 28890 to sub sub (#1480)

* Update serverless.yml

changed x-content-type-options to lowercase to see if the value will change

* Update api-gateway.yml

Another addition to set the x-Content-Type-Options to nosniff

* Update api-gateway.yml

Fix error where code was placed

* ignore email records for package builder

---------

Co-authored-by: Dark-Knight-1313 <[email protected]>

* OY2-28810 - keep substatus after subsequent submission

* Update buildAnyPackage.js

* oy2-28987 - update email notification text to state for sub sub (#1484)

updated email notification text to state for subsequent submissions

* oy2-28988: sub sub CMS email fix (#1491)

updated text in email notification for cms for subsequent submissions

* added same text change from the other broken branch (#1488)

* oy2-28672 - update sub sub confirmation popup text (#1486)

* oy2-28671 - update subsequent submission additional information text (#1482)

* update subsequent submission additional information text

* added conditional text on the package details page for sub subs

---------

Co-authored-by: Andie Swift <[email protected]>

* update build package to add latest activity timestamp

* remove submissionTimestamp from subsequent submission config

* Merge branch 'subsub2' into develop

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Kristin Grue <[email protected]>
Co-authored-by: Valencia McMurray <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Valencia McMurray <[email protected]>
Co-authored-by: Dark-Knight-1313 <[email protected]>
Co-authored-by: Mike Dial <[email protected]>
Co-authored-by: Andie Swift <[email protected]>
Co-authored-by: Andie Swift <[email protected]>
  • Loading branch information
9 people authored Aug 28, 2024
1 parent 75ce829 commit 638c3d0
Show file tree
Hide file tree
Showing 112 changed files with 2,913 additions and 126 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,13 @@ jobs:
Withdraw_Package_Form_Medicaid_SPA.spec.feature,
Withdraw_Package_Form_Waiver_Amendment.spec.feature,
Withdraw_Package_Form_Waiver_Renewal.spec.feature,
Subsequent_Submission_1915b_Amendment_Waiver.spec.feature,
Subsequent_Submission_1915c_Appendix_K.spec.feature,
Subsequent_Submission_CHIP_Spa.spec.feature,
Subsequent_Submission_Initial_Waiver.spec.feature,
Subsequent_Submission_Medicaid_Spa.spec.feature,
Subsequent_Submission_Renewal_Waiver.spec.feature,
Dashboard_RAI_Withdraw_Enabled_Actions.spec.feature,
]
steps:
- name: set branch_name
Expand Down
60 changes: 60 additions & 0 deletions services/app-api/email/CMSSubsequentSubmissionNotice.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { formatPackageDetails } from "./formatPackageDetails.js";
import { getCPOCandSRTEmailAddresses } from "../utils/getCpocAndSrtEmail.js";

/**
* Package Submission email to CMS
* @param {Object} data from the package.
* @returns {Object} email parameters in generic format.
*/
export const CMSSubsequentSubmissionNotice = async (data, config) => {
data.submitterName = ""; // remove this bc we dont want it on the cms email
const CMSEmailItem = await getCPOCandSRTEmailAddresses(data.componentId);

const ToAddresses = CMSEmailItem.reviewTeamEmailList
? [...CMSEmailItem.reviewTeamEmailList]
: [];

CMSEmailItem?.cpocEmail && ToAddresses.push(CMSEmailItem.cpocEmail);
// changing config to match the docs in this one instance
if (config.idLabel === "SPA ID") {
let typeLabel = config.typeLabel;
// cut the type label at sub sub and set that at the new idLabel
typeLabel = typeLabel
.substring(0, typeLabel.indexOf("Subsequent Submission"))
.trim();
config.idLabel = `${typeLabel} Package ID`;
}

return {
ToAddresses: ToAddresses,
CcAddresses: [],
Subject: `Action required: review new documents for ${config.typeLabel} ${data.componentId}`,
HTML: `
<p>New documents have been submitted for ${config.typeLabel} ${
data.componentId
} in OneMAC.</p>
${formatPackageDetails(data, config)}
<p><b>How to access:</b></p>
<ul>
<li>
These documents can be found in OneMAC through <a href="${
process.env.applicationEndpoint
}/dashboard">this link</a>.
</li>
<li>
If you are not already logged in, please click the "Login" link at the
top of the page and log in using your Enterprise User Administration
(EUA) credentials.
</li>
<li>
After you have logged in, you will be taken to the OneMAC application.
The submission will be listed on the dashboard page, and you can view
its details by clicking on its ID number.
</li>
</ul>
<br>
<p>If the contents of this email seem suspicious, do not open them, and instead forward this email to <a href="mailto:[email protected]">[email protected]</a>.</p>
<p>Thank you!</p>
`,
};
};
26 changes: 26 additions & 0 deletions services/app-api/email/CMSSubsequentSubmissionNotice.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { CMSSubsequentSubmissionNotice } from "./CMSSubsequentSubmissionNotice";

it("builds the CMS Submission Notice Email", async () => {
const testData = {
submitterName: "name",
componentId: "MI-11-1111-22",
proposedEffectiveDate: "2022-06-07",
};
const testConfig = {
typeLabel: "Test Type",
};
const warnings = [];

Check failure on line 13 in services/app-api/email/CMSSubsequentSubmissionNotice.test.js

View workflow job for this annotation

GitHub Actions / Unit Test

Error: expect(received).toBe(expected) // Object.is equality Expected: "Subsequent Documentation for Test Type MI-11-1111-22" Received: "Action required: review new documents for Test Type MI-11-1111-22" at Object.<anonymous> (/home/runner/work/macpro-onemac/macpro-onemac/services/app-api/email/CMSSubsequentSubmissionNotice.test.js:13:29) at processTicksAndRejections (node:internal/process/task_queues:95:5)
const response2 = await CMSSubsequentSubmissionNotice(testData, testConfig);

expect(response2.Subject).toBe(
"Subsequent Documentation for " +
testConfig.typeLabel +
" " +
testData.componentId
);

expect(response2.HTML.includes(testData.componentId)).toBe(true);
expect(response2.HTML.includes(process.env.applicationEndpoint)).toBe(true);
expect(response2.HTML.length).toBe(1293);
});
23 changes: 1 addition & 22 deletions services/app-api/email/CMSWithdrawRaiNotice.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,6 @@
import dynamoDb from "../libs/dynamodb-lib";

import { ONEMAC_TYPE } from "cmscommonlib/workflow.js";
import { formatPackageDetails } from "./formatPackageDetails.js";

export const getCPOCandSRTEmailAddresses = async (packageId) => {
let returnObj = {};
const qParams = {
TableName: process.env.oneMacTableName,
Key: {
pk: `${packageId}`,
sk: "Package",
},
ProjectionExpression: "cpocEmail, reviewTeamEmailList",
};
try {
const packageItem = await dynamoDb.get(qParams);

returnObj = packageItem.Item;
} catch (e) {
console.log("query error: ", e.message);
}
return returnObj;
};
import { getCPOCandSRTEmailAddresses } from "../utils/getCpocAndSrtEmail";

/**
* RAI Response withdrawal email to CMS
Expand Down
6 changes: 2 additions & 4 deletions services/app-api/email/CMSWithdrawalRaiNotice.test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import dynamoDb from "../libs/dynamodb-lib";
import { ONEMAC_TYPE } from "cmscommonlib/workflow.js";

import {
CMSWithdrawRaiNotice,
getCPOCandSRTEmailAddresses,
} from "./CMSWithdrawRaiNotice";
import { CMSWithdrawRaiNotice } from "./CMSWithdrawRaiNotice";
import { getCPOCandSRTEmailAddresses } from "../utils/getCpocAndSrtEmail";

jest.mock("../libs/dynamodb-lib");

Expand Down
31 changes: 31 additions & 0 deletions services/app-api/email/stateSubsequentSubmissionReceipt.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { formatPackageDetails } from "./formatPackageDetails.js";

/**
* Package submission receipt email to state user(s)
* @param {Object} data from the package.
* @returns {Object} email parameters in generic format.
*/
export const stateSubsequentSubmissionReceipt = (data, config) => {
// changing config to match the docs in this one instance
if (config.idLabel === "SPA ID") {
let typeLabel = config.typeLabel;
// cut the type label at sub sub and set that at the new idLabel
typeLabel = typeLabel
.substring(0, typeLabel.indexOf("Subsequent Submission"))
.trim();
config.idLabel = `${typeLabel} Package ID`;
}

return {
ToAddresses: [`${data.submitterName} <${data.submitterEmail}>`],
CcAddresses: [],
Subject: `Additional documents submitted for ${config.typeLabel} ${data.componentId}`,
HTML: `
<p> You’ve successfully submitted the following to CMS reviewers for ${
config.typeLabel
} ${data.componentId}:</p>
${formatPackageDetails(data, config)}
<p>If you have questions or did not expect this email, please contact <a href="mailto:[email protected]">[email protected]</a>.</p>
<p>Thank you.</p>`,
};
};
19 changes: 19 additions & 0 deletions services/app-api/email/stateSubsequentSubmissionReceipt.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { stateSubsequentSubmissionReceipt } from "./stateSubsequentSubmissionReceipt";

it("builds the State Submission Receipt Email", async () => {
const testData = {
submitterName: "name",
submitterEmail: "[email protected]",
componentId: "MI-11-1111-22",
clockEndTimestamp: 1631626754502,
};
const testConfig = {
typeLabel: "Test Type",
};
try {
const response2 = stateSubsequentSubmissionReceipt(testData, testConfig);
expect(response2.HTML.length).toBe(999);
} catch (e) {
console.log("reeived error: ", e);
}
});
27 changes: 27 additions & 0 deletions services/app-api/form/defaultFormConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import Joi from "joi";
import { RESPONSE_CODE, Workflow } from "cmscommonlib";
import { CMSWithdrawalNotice } from "../email/CMSWithdrawalNotice";
import { stateWithdrawalReceipt } from "../email/stateWithdrawalReceipt";
import { CMSSubsequentSubmissionNotice } from "../email/CMSSubsequentSubmissionNotice";
import { stateSubsequentSubmissionReceipt } from "../email/stateSubsequentSubmissionReceipt";

export const defaultFormConfig = {
CMSToAddresses: [process.env.reviewerEmail, process.env.testingEmail].filter(
Expand All @@ -28,6 +30,31 @@ export const defaultWaiverSchema = {
proposedEffectiveDate: defaultProposedEffectiveDateSchema,
};

export const defaultSubsequentSubmissionSchema = {
parentId: defaultParentId,
parentType: defaultParentType,
};

export const defaultSubsequentSubmissionConfig = {
...defaultFormConfig,
newStatus: null, //use parent's current package status
successResponseCode:
RESPONSE_CODE.SUCCESSFULLY_SUBMITTED_SUBSEQUENT_SUBMISSION,
buildCMSNotice: CMSSubsequentSubmissionNotice,
buildStateReceipt: stateSubsequentSubmissionReceipt,
appendToSchema: {
...defaultSubsequentSubmissionSchema,
},
};

export const defaultWaiverSubsequentSubmissionConfig = {
...defaultSubsequentSubmissionConfig,
appendToSchema: {
...defaultSubsequentSubmissionSchema,
waiverAuthority: defaultWaiverAuthoritySchema,
},
};

export const defaultWithdrawConfig = {
...defaultFormConfig,
successResponseCode: RESPONSE_CODE.WITHDRAW_REQUESTED,
Expand Down
13 changes: 9 additions & 4 deletions services/app-api/form/submitAny.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import { getUser } from "../getUser";
import { validateSubmission } from "./validateSubmission";
import packageExists from "../utils/packageExists";
import { newEvent } from "../utils/newEvent";
import { getPackage } from "../utils/getPackage";
import { saveEmail } from "../utils/saveEmail";
import { getPackageType } from "../utils/getPackageType";

import { CMSSubmissionNotice } from "../email/CMSSubmissionNotice";
import { stateSubmissionReceipt } from "../email/stateSubmissionReceipt";
Expand Down Expand Up @@ -82,7 +82,13 @@ export const submitAny = async (event, config) => {
// if a parent ID is included, need to validate parent and grab type
if (data.parentId) {
try {
data.parentType = await getPackageType(data.parentId);
const parentPackage = await getPackage(data.parentId);
console.log("got package", parentPackage);
data.parentType = parentPackage.componentType;
// if no new status is provided, use the parent's current status
if (!config.newStatus) {
config.newStatus = parentPackage.currentStatus;
}
} catch (e) {
console.log(
"%s parent ID %s validation failed: ",
Expand All @@ -98,9 +104,8 @@ export const submitAny = async (event, config) => {
// Add the details from this submission action
data.submissionTimestamp = rightNowNormalized;
data.eventTimestamp = rightNowNormalized;

data.currentStatus = config.newStatus;
data.componentType = config.componentType;
data.currentStatus = config.newStatus;

// record the current end timestamp (can be start/stopped/changed)
// 90 days is current CMS review period and it is based on CMS time!!
Expand Down
13 changes: 13 additions & 0 deletions services/app-api/form/submitChipSPASubsequentSubmission.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { chipSPASubsequentSubmission } from "cmscommonlib";
import handler from "../libs/handler-lib";
import { submitAny } from "./submitAny";
import { defaultSubsequentSubmissionConfig } from "./defaultFormConfig";

export const chipSPASubsequentSubmissionFormConfig = {
...defaultSubsequentSubmissionConfig,
...chipSPASubsequentSubmission,
};

export const main = handler(async (event) =>
submitAny(event, chipSPASubsequentSubmissionFormConfig)
);
39 changes: 39 additions & 0 deletions services/app-api/form/submitInitialWaiverSubsequentSubmission.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import handler from "../libs/handler-lib";
import { submitAny } from "./submitAny";
import { defaultWaiverSubsequentSubmissionConfig } from "./defaultFormConfig";
import {
initialWaiverB4SubsequentSubmission,
initialWaiverBSubsequentSubmission,
waiverAuthorityB,
waiverAuthorityB4,
} from "cmscommonlib";

export const initialWaiverB4SubsequentFormConifg = {
...defaultWaiverSubsequentSubmissionConfig,
...initialWaiverB4SubsequentSubmission,
};

export const initialWaiverBSubsequentFormConifg = {
...defaultWaiverSubsequentSubmissionConfig,
...initialWaiverBSubsequentSubmission,
};

export const main = handler(async (event) => {
let data, formConfig;
try {
data = JSON.parse(event.body);
} catch (error) {
console.log("event couldn't parse: ", error);
throw error;
}

if (data.waiverAuthority === waiverAuthorityB4.value) {
formConfig = initialWaiverB4SubsequentFormConifg;
} else if (data.waiverAuthority === waiverAuthorityB.value) {
formConfig = initialWaiverBSubsequentFormConifg;
} else {
throw new Error("Waiver Authority not found");
}

return await submitAny(event, formConfig);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import {
main,
initialWaiverB4SubsequentFormConifg,
initialWaiverBSubsequentFormConifg,
} from "./submitInitialWaiverSubsequentSubmission";
import { waiverAuthorityB4, waiverAuthorityB } from "cmscommonlib";
import { submitAny } from "./submitAny";
import handler from "../libs/handler-lib";

//jest.mock("../libs/handler-lib");
jest.mock("./submitAny");

const testResult = {
body: "submitAny result",
headers: {
"Access-Control-Allow-Credentials": true,
"Access-Control-Allow-Origin": "*",
},
statusCode: 200,
};

describe("main function", () => {
beforeEach(() => {
//handler.mockImplementation((func) => func);
submitAny.mockResolvedValue(testResult);
});

it("should call submitAny with B4 form config when waiverAuthority is B4", async () => {
const event = {
body: JSON.stringify({ waiverAuthority: waiverAuthorityB4.value }),
};
const result = await main(event);
expect(submitAny).toHaveBeenCalledWith(
event,
initialWaiverB4SubsequentFormConifg
);
});

it("should call submitAny with B form config when waiverAuthority is B", async () => {
const event = {
body: JSON.stringify({ waiverAuthority: waiverAuthorityB.value }),
};
const result = await main(event);
expect(submitAny).toHaveBeenCalledWith(
event,
initialWaiverBSubsequentFormConifg
);
});

it("should throw an error when waiverAuthority is not found", async () => {
const event = { body: JSON.stringify({ waiverAuthority: "not-found" }) };
const result = await main(event);
expect(result.statusCode).toEqual(500);
//await expect(main(event)).rejects.toThrow("Waiver Authority not found");
});

// it("should throw an error when body is not a valid JSON", async () => {
// const event = { body: "invalid json" };
// await expect(main(event)).rejects.toThrow();
// });
});
Loading

0 comments on commit 638c3d0

Please sign in to comment.