From bfd5397cbd8034db663763913e0b25a5c7c5188b Mon Sep 17 00:00:00 2001 From: jsimonVA <88905347+jsimonVA@users.noreply.github.com> Date: Mon, 29 Apr 2024 12:20:35 -0500 Subject: [PATCH] #VYE-360 #comment new format for enrollment logic (#29459) * #VYE-360 #comment new format for enrollment logic * #VYE-360 #comment updated unit tests * #VYE-360 #comment updated e2e test * #VYE-360 #comment update mock data * #VYE-360 #comment update enrollment-verification cypress test * #VYE-360 #comment removed old code not in use --- .../verify-your-enrollment/actions/index.js | 4 +- .../components/Enrollmentcard.jsx | 34 +- .../components/PeriodsToVerify.jsx | 32 +- .../PreviousEnrollmentVerifications.jsx | 163 +++- .../constants/mockData.js | 768 ++++++------------ .../containers/VerificationReviewWrapper.jsx | 52 +- .../verify-your-enrollment/helpers.jsx | 366 +++++---- .../reducers/mockData.js | 6 +- .../components/PeriodsToVerify.unit.spec.js | 23 +- ...eviousEnrollmentVerifications.unit.spec.js | 48 +- .../enrollment-verification.cypress.spec.js | 4 +- .../helpers/getPeriodsToVerify.unit.spec.js | 69 +- 12 files changed, 696 insertions(+), 873 deletions(-) diff --git a/src/applications/verify-your-enrollment/actions/index.js b/src/applications/verify-your-enrollment/actions/index.js index 5261654f67e1..4d1574af9422 100644 --- a/src/applications/verify-your-enrollment/actions/index.js +++ b/src/applications/verify-your-enrollment/actions/index.js @@ -1,6 +1,6 @@ import { apiRequest } from '@department-of-veterans-affairs/platform-utilities/api'; import environment from '@department-of-veterans-affairs/platform-utilities/environment'; -import { USER_MOCK_DATA } from '../constants/mockData'; +import { UPDATED_USER_MOCK_DATA } from '../constants/mockData'; // Action Types export const UPDATE_PENDING_VERIFICATIONS = 'UPDATE_PENDING_VERIFICATIONS'; export const UPDATE_VERIFICATIONS = 'UPDATE_VERIFICATIONS'; @@ -67,7 +67,7 @@ export const getData = () => { setTimeout(() => { disptach({ type: GET_DATA_SUCCESS, - response: USER_MOCK_DATA, + response: UPDATED_USER_MOCK_DATA, }); }, 1000); }; diff --git a/src/applications/verify-your-enrollment/components/Enrollmentcard.jsx b/src/applications/verify-your-enrollment/components/Enrollmentcard.jsx index 8c693280cb16..dd6c0a0177bf 100644 --- a/src/applications/verify-your-enrollment/components/Enrollmentcard.jsx +++ b/src/applications/verify-your-enrollment/components/Enrollmentcard.jsx @@ -7,11 +7,7 @@ import { getPeriodsToVerify, } from '../helpers'; -const EnrollmentCard = ({ - enrollmentPeriods, - confirmationPage = false, - confirmedEnrollment = false, -}) => { +const EnrollmentCard = ({ enrollmentPeriods, confirmationPage = false }) => { const getCards = () => { const combinedEnrollmentsObj = combineEnrollmentsWithStartMonth( enrollmentPeriods, @@ -23,10 +19,10 @@ const EnrollmentCard = ({ // if there are more than one enrollment periods that startd in the same month // then the records are combined into the same array // if else is in place to take account for arrays that have multiple objects - return combinedEnrollmentsValues.map(enrollment => { + return combinedEnrollmentsValues.map((enrollment, index) => { if (enrollment.length > 1) { return ( -
You currently have no enrollments. diff --git a/src/applications/verify-your-enrollment/constants/mockData.js b/src/applications/verify-your-enrollment/constants/mockData.js index 33f50efa5496..e4d65c41bcc4 100644 --- a/src/applications/verify-your-enrollment/constants/mockData.js +++ b/src/applications/verify-your-enrollment/constants/mockData.js @@ -1,4 +1,4 @@ -export const USER_MOCK_DATA = { +export const UPDATED_USER_MOCK_DATA = { 'vye::UserInfo': { suffix: 'CPA', fullName: 'Ben Simonis MD', @@ -10,315 +10,169 @@ export const USER_MOCK_DATA = { zip: '46786-3217', remEnt: '2854321', // 28(first 2 numbers) for months .54321 * 30 = res needs to be rounded certIssueDate: '2019-06-28T00:00:00.000Z', - delDate: '2021-09-03T00:00:00.000Z', - dateLastCertified: '2018-06-21T00:00:00.000Z', + delDate: '2026-09-03T00:00:00.000Z', + dateLastCertified: '2024-03-01', paymentAmt: '3989.36', indicator: 'B', - awards: [ - { - id: 7, - curAwardInd: 'example', - awardBeginDate: '2023-12-15T16:12:43.447Z', - awardEndDate: '2024-01-22T16:12:43.447Z', - trainingTime: 40, - paymentDate: '2024-01-01T16:12:43.447Z', - monthlyRate: '3200.0', - beginRsn: 'reason', - endRsn: 'reason', - typeTraining: 'type', - numberHours: 6, - typeHours: 'type', - }, - { - id: 8, - curAwardInd: 'example', - awardBeginDate: '2023-12-15T16:12:43.447Z', - awardEndDate: '2024-01-15T16:12:43.447Z', - trainingTime: 40, - paymentDate: '2024-01-01T16:12:43.447Z', - monthlyRate: '3200.0', - beginRsn: 'reason', - endRsn: 'reason', - typeTraining: 'type', - numberHours: 6, - typeHours: 'type', - }, - { - id: 9, - curAwardInd: 'example', - awardBeginDate: '2024-01-15T16:12:43.447Z', - awardEndDate: '2024-02-15T16:12:43.447Z', - trainingTime: 40, - paymentDate: '2024-01-02T16:12:43.447Z', - monthlyRate: '1250.0', - beginRsn: 'reason', - endRsn: 'reason', - typeTraining: 'type', - numberHours: 6, - typeHours: 'type', - }, - { - id: 10, - curAwardInd: 'example', - awardBeginDate: '2024-02-15T16:12:43.447Z', - awardEndDate: '2024-03-15T16:12:43.447Z', - trainingTime: 40, - paymentDate: '2024-03-03T16:12:43.447Z', - monthlyRate: '420.36', - beginRsn: 'reason', - endRsn: 'reason', - typeTraining: 'type', - numberHours: 6, - typeHours: 'type', - }, - { - id: 11, - curAwardInd: 'example', - awardBeginDate: '2024-03-15T16:12:43.447Z', - awardEndDate: '2024-04-15T16:12:43.447Z', - trainingTime: 40, - paymentDate: '2024-04-15T16:12:43.447Z', - monthlyRate: '760.0', - beginRsn: 'reason', - endRsn: 'reason', - typeTraining: 'type', - numberHours: 6, - typeHours: 'type', - }, - { - id: 12, - curAwardInd: 'P', - awardBeginDate: '2024-04-15T16:12:43.447Z', - awardEndDate: '2024-05-15T16:12:43.447Z', - trainingTime: 40, - paymentDate: '2024-05-31T16:12:43.447Z', - monthlyRate: '1100.0', - beginRsn: 'reason', - endRsn: 'reason', - typeTraining: 'type', - numberHours: 6, - typeHours: 'type', - }, - { - id: 13, - curAwardInd: 'C', - awardBeginDate: '2024-05-15T16:12:43.447Z', - awardEndDate: '2024-06-15T16:12:43.447Z', - trainingTime: 40, - paymentDate: '2024-06-07T16:12:43.447Z', - monthlyRate: '250.0', - beginRsn: 'reason', - endRsn: 'reason', - typeTraining: 'type', - numberHours: 6, - typeHours: 'type', - }, - { - id: 14, - curAwardInd: 'C', - awardBeginDate: '2024-06-15T16:12:43.447Z', - awardEndDate: '2024-07-15T16:12:43.447Z', - trainingTime: 40, - paymentDate: '2024-07-21T16:12:43.447Z', - monthlyRate: '1100.0', - beginRsn: 'reason', - endRsn: 'reason', - typeTraining: 'type', - numberHours: 6, - typeHours: 'type', - }, - { - id: 15, - curAwardInd: 'C', - awardBeginDate: '2024-07-15T16:12:43.447Z', - awardEndDate: '2024-08-15T16:12:43.447Z', - trainingTime: 40, - paymentDate: '2024-08-21T16:12:43.447Z', - monthlyRate: '1100.0', - beginRsn: 'reason', - endRsn: 'reason', - typeTraining: 'type', - numberHours: 6, - typeHours: 'type', - }, - { - id: 16, - curAwardInd: 'C', - awardBeginDate: '2024-08-15T16:12:43.447Z', - awardEndDate: '2024-09-15T16:12:43.447Z', - trainingTime: 40, - paymentDate: '2024-09-18T16:12:43.447Z', - monthlyRate: '611.0', - beginRsn: 'reason', - endRsn: 'reason', - typeTraining: 'type', - numberHours: 6, - typeHours: 'type', - }, - { - id: 17, - curAwardInd: 'C', - awardBeginDate: '2024-09-15T16:12:43.447Z', - awardEndDate: '2024-10-15T16:12:43.447Z', - trainingTime: 40, - paymentDate: '2024-10-23T16:12:43.447Z', - monthlyRate: '400.0', - beginRsn: 'reason', - endRsn: 'reason', - typeTraining: 'type', - numberHours: 6, - typeHours: 'type', - }, - { - id: 18, - curAwardInd: 'C', - awardBeginDate: '2024-11-15T16:12:43.447Z', - awardEndDate: '2024-12-15T16:12:43.447Z', - trainingTime: 40, - paymentDate: '2024-12-15T16:12:43.447Z', - monthlyRate: '1000.0', - beginRsn: 'reason', - endRsn: 'reason', - typeTraining: 'type', - numberHours: 6, - typeHours: 'type', - }, - { - id: 19, - curAwardInd: 'C', - awardBeginDate: '2024-12-15T16:12:43.447Z', - awardEndDate: '2025-01-15T16:12:43.447Z', - trainingTime: 40, - paymentDate: '2025-01-15T16:12:43.447Z', - monthlyRate: '1000.0', - beginRsn: 'reason', - endRsn: 'reason', - typeTraining: 'type', - numberHours: 6, - typeHours: 'type', - }, - { - id: 20, - curAwardInd: 'C', - awardBeginDate: '2025-01-15T16:12:43.447Z', - awardEndDate: '2025-02-15T16:12:43.447Z', - trainingTime: 40, - paymentDate: '2025-02-15T16:12:43.447Z', - monthlyRate: '675.0', - beginRsn: 'reason', - endRsn: 'reason', - typeTraining: 'type', - numberHours: 6, - typeHours: 'type', - }, - { - id: 21, - curAwardInd: 'C', - awardBeginDate: '2025-02-15T16:12:43.447Z', - awardEndDate: '2025-03-15T16:12:43.447Z', - trainingTime: 40, - paymentDate: '2025-03-01T16:12:43.447Z', - monthlyRate: '590.0', - beginRsn: 'reason', - endRsn: 'reason', - typeTraining: 'type', - numberHours: 6, - typeHours: 'type', - }, - { - id: 22, - curAwardInd: 'C', - awardBeginDate: '2025-02-20T16:12:43.447Z', - awardEndDate: '2025-03-20T16:12:43.447Z', - trainingTime: 30, - paymentDate: '2025-03-01T16:12:43.447Z', - monthlyRate: '200.0', - beginRsn: 'reason', - endRsn: 'reason', - typeTraining: 'type', - numberHours: 6, - typeHours: 'type', - }, - ], + pendingDocuments: [ { docType: '1990', queueDate: '2023-12-04T22:24:20.000Z', }, ], - pendingVerifications: { - awardIds: [18, 19, 20, 21, 22], - }, + pendingVerifications: [ + { + awardId: '00001', + awardBeginDate: '2024-03-01', + awardEndDate: '2024-03-24', + numberHours: 10, + monthlyRate: 600.0, + caseTrace: 'CASE 1b', + }, + { + awardId: '00002', + awardBeginDate: '2024-03-25', + awardEndDate: '2024-03-31', + numberHours: 12, + monthlyRate: 1400.0, + caseTrace: 'CASE 7', + }, + { + awardId: '00003', + awardBeginDate: '2024-02-05', + awardEndDate: '2024-02-31', + numberHours: 12, + monthlyRate: 1400.0, + caseTrace: 'CASE 7', + }, + ], verifications: [ { - createdOn: '2024-01-15T16:12:43.491Z', - awardIds: [7], + verifiedDate: '2020-06-01', + awardBeginDate: null, + awardEndDate: '2020-05-31', + numberHours: null, + monthlyRate: null, + paymentDate: '2020-06-01', + caseTrace: 'CASE 1b', + }, + { + verifiedDate: '2020-05-15', + awardBeginDate: null, + // "awardBeginDate":'2020-04-01', + awardEndDate: '2020-04-30', + numberHours: 4, + monthlyRate: null, + paymentDate: '2020-05-15', + caseTrace: 'CASE 1b', + }, + { + verifiedDate: '2023-03-01', + // "awardBeginDate":'2023-02-06', + awardBeginDate: '2020-04-06', + awardEndDate: null, + // "awardEndDate":'2023-02-28', + numberHours: 6, + monthlyRate: 800.0, + paymentDate: '2023-03-01', + caseTrace: 'CASE 1b', }, { - createdOn: '2024-01-15T16:12:43.491Z', - awardIds: [8], + verifiedDate: '2023-03-01', + awardBeginDate: '2019-02-06', + awardEndDate: '2023-02-28', + numberHours: 6, + monthlyRate: 800.0, + paymentDate: '2023-03-01', + caseTrace: 'CASE 1b', }, { - createdOn: '2024-02-15T16:12:43.491Z', - awardIds: [9], + verifiedDate: '2023-03-01', + awardBeginDate: '2018-02-06', + awardEndDate: '2023-02-28', + numberHours: 6, + monthlyRate: 800.0, + paymentDate: '2023-03-01', + caseTrace: 'CASE 1b', }, { - createdOn: '2024-03-15T16:12:43.491Z', - awardIds: [10], + verifiedDate: '2023-03-01', + awardBeginDate: '2017-02-06', + awardEndDate: '2023-02-28', + numberHours: 6, + monthlyRate: 800.0, + paymentDate: '2023-03-01', + caseTrace: 'CASE 1b', }, { - createdOn: '2024-04-15T16:12:43.491Z', - awardIds: [11], + verifiedDate: '2023-03-01', + awardBeginDate: '2016-02-06', + awardEndDate: '2023-02-28', + numberHours: 6, + monthlyRate: 800.0, + paymentDate: '2023-03-01', + caseTrace: 'CASE 1b', }, { - createdOn: '2024-05-15T16:12:43.491Z', - awardIds: [12], + verifiedDate: '2023-03-01', + awardBeginDate: '2015-02-06', + awardEndDate: '2023-02-28', + numberHours: 6, + monthlyRate: 800.0, + paymentDate: '2023-03-01', + caseTrace: 'CASE 1b', }, { - createdOn: '2024-06-15T16:12:43.491Z', - awardIds: [13], + verifiedDate: '2023-03-01', + awardBeginDate: '2014-02-06', + awardEndDate: '2023-02-28', + numberHours: 6, + monthlyRate: 800.0, + paymentDate: '2023-03-01', + caseTrace: 'CASE 1b', }, { - createdOn: '2024-07-15T16:12:43.491Z', - awardIds: [14], + verifiedDate: '2023-03-01', + awardBeginDate: '2013-02-06', + awardEndDate: '2023-02-28', + numberHours: 6, + monthlyRate: 800.0, + paymentDate: '2023-03-01', + caseTrace: 'CASE 1b', }, { - createdOn: '2024-08-15T16:12:43.491Z', - awardIds: [15], + verifiedDate: '2023-03-01', + awardBeginDate: '2012-02-06', + awardEndDate: '2023-02-28', + numberHours: 6, + monthlyRate: 800.0, + paymentDate: '2023-03-01', + caseTrace: 'CASE 1b', }, { - createdOn: '2024-09-15T16:12:43.491Z', - awardIds: [16], + verifiedDate: '2023-03-01', + awardBeginDate: '2011-02-06', + awardEndDate: '2023-02-28', + numberHours: 6, + monthlyRate: 800.0, + paymentDate: '2023-03-01', + caseTrace: 'CASE 1b', }, { - createdOn: '2024-08-15T16:12:43.491Z', - awardIds: [17], + verifiedDate: '2023-03-01', + awardBeginDate: '2010-02-06', + awardEndDate: '2023-02-28', + numberHours: 6, + monthlyRate: 800.0, + paymentDate: '2023-03-01', + caseTrace: 'CASE 1b', }, - // { - // createdOn: '2024-07-15T16:12:43.491Z', - // awardIds: [18], - // }, - // { - // createdOn: '2024-09-15T16:12:43.491Z', - // awardIds: [19], - // }, - // { - // createdOn: '2024-10-15T16:12:43.491Z', - // awardIds: [20], - // }, - // { - // createdOn: '2024-11-15T16:12:43.491Z', - // awardIds: [21], - // }, - // { - // createdOn: '2024-11-15T16:12:43.491Z', - // awardIds: [22], - // }, ], }, }; -export const USER_PENDINGVERIFICATION_MOCK_DATA = { +export const PAGINATION_USER_MOCK_DATA = { 'vye::UserInfo': { suffix: 'CPA', fullName: 'Ben Simonis MD', @@ -328,275 +182,171 @@ export const USER_PENDINGVERIFICATION_MOCK_DATA = { addressLine5: 'Montana', addressLine6: '03729-2762', zip: '46786-3217', - remEnt: 'earum', + remEnt: '2854321', // 28(first 2 numbers) for months .54321 * 30 = res needs to be rounded certIssueDate: '2019-06-28T00:00:00.000Z', - delDate: '2021-09-03T00:00:00.000Z', - dateLastCertified: '2018-06-21T00:00:00.000Z', + delDate: '2026-09-03T00:00:00.000Z', + dateLastCertified: '2024-03-01', paymentAmt: '3989.36', - indicator: 'perferendis', - awards: [ - { - id: 8, - curAwardInd: 'example', - awardBeginDate: '2023-12-15T16:12:43.447Z', - awardEndDate: '2024-01-15T16:12:43.447Z', - trainingTime: 40, - paymentDate: '2024-01-01T16:12:43.447Z', - monthlyRate: '684.0', - beginRsn: 'reason', - endRsn: 'reason', - typeTraining: 'type', - numberHours: 6, - typeHours: 'type', - }, - { - id: 9, - curAwardInd: 'example', - awardBeginDate: '2024-01-15T16:12:43.447Z', - awardEndDate: '2024-02-15T16:12:43.447Z', - trainingTime: 40, - paymentDate: '2024-01-02T16:12:43.447Z', - monthlyRate: '1250.0', - beginRsn: 'reason', - endRsn: 'reason', - typeTraining: 'type', - numberHours: 6, - typeHours: 'type', - }, - { - id: 10, - curAwardInd: 'example', - awardBeginDate: '2024-02-15T16:12:43.447Z', - awardEndDate: '2024-03-15T16:12:43.447Z', - trainingTime: 40, - paymentDate: '2024-03-03T16:12:43.447Z', - monthlyRate: '420.36', - beginRsn: 'reason', - endRsn: 'reason', - typeTraining: 'type', - numberHours: 6, - typeHours: 'type', - }, - { - id: 11, - curAwardInd: 'example', - awardBeginDate: '2024-03-15T16:12:43.447Z', - awardEndDate: '2024-04-15T16:12:43.447Z', - trainingTime: 40, - paymentDate: '2024-04-15T16:12:43.447Z', - monthlyRate: '760.0', - beginRsn: 'reason', - endRsn: 'reason', - typeTraining: 'type', - numberHours: 6, - typeHours: 'type', - }, - { - id: 12, - curAwardInd: 'P', - awardBeginDate: '2024-04-15T16:12:43.447Z', - awardEndDate: '2024-05-15T16:12:43.447Z', - trainingTime: 40, - paymentDate: '2024-05-31T16:12:43.447Z', - monthlyRate: '1100.0', - beginRsn: 'reason', - endRsn: 'reason', - typeTraining: 'type', - numberHours: 6, - typeHours: 'type', - }, - { - id: 13, - curAwardInd: 'C', - awardBeginDate: '2024-05-15T16:12:43.447Z', - awardEndDate: '2024-06-15T16:12:43.447Z', - trainingTime: 40, - paymentDate: '2024-06-07T16:12:43.447Z', - monthlyRate: '250.0', - beginRsn: 'reason', - endRsn: 'reason', - typeTraining: 'type', - numberHours: 6, - typeHours: 'type', - }, - { - id: 14, - curAwardInd: 'C', - awardBeginDate: '2024-06-15T16:12:43.447Z', - awardEndDate: '2024-07-15T16:12:43.447Z', - trainingTime: 40, - paymentDate: '2024-07-21T16:12:43.447Z', - monthlyRate: '1100.0', - beginRsn: 'reason', - endRsn: 'reason', - typeTraining: 'type', - numberHours: 6, - typeHours: 'type', - }, - { - id: 15, - curAwardInd: 'C', - awardBeginDate: '2024-07-15T16:12:43.447Z', - awardEndDate: '2024-08-15T16:12:43.447Z', - trainingTime: 40, - paymentDate: '2024-08-21T16:12:43.447Z', - monthlyRate: '1100.0', - beginRsn: 'reason', - endRsn: 'reason', - typeTraining: 'type', - numberHours: 6, - typeHours: 'type', - }, - { - id: 16, - curAwardInd: 'C', - awardBeginDate: '2024-08-15T16:12:43.447Z', - awardEndDate: '2024-09-15T16:12:43.447Z', - trainingTime: 40, - paymentDate: '2024-09-18T16:12:43.447Z', - monthlyRate: '611.0', - beginRsn: 'reason', - endRsn: 'reason', - typeTraining: 'type', - numberHours: 6, - typeHours: 'type', - }, - { - id: 17, - curAwardInd: 'C', - awardBeginDate: '2024-09-15T16:12:43.447Z', - awardEndDate: '2024-10-15T16:12:43.447Z', - trainingTime: 40, - paymentDate: '2024-10-23T16:12:43.447Z', - monthlyRate: '400.0', - beginRsn: 'reason', - endRsn: 'reason', - typeTraining: 'type', - numberHours: 6, - typeHours: 'type', - }, - { - id: 18, - curAwardInd: 'C', - awardBeginDate: '2024-11-15T16:12:43.447Z', - awardEndDate: '2024-12-15T16:12:43.447Z', - trainingTime: 40, - paymentDate: '2024-12-15T16:12:43.447Z', - monthlyRate: '1000.0', - beginRsn: 'reason', - endRsn: 'reason', - typeTraining: 'type', - numberHours: 6, - typeHours: 'type', - }, - { - id: 19, - curAwardInd: 'C', - awardBeginDate: '2024-12-15T16:12:43.447Z', - awardEndDate: '2025-01-15T16:12:43.447Z', - trainingTime: 40, - paymentDate: '2025-01-15T16:12:43.447Z', - monthlyRate: '1000.0', - beginRsn: 'reason', - endRsn: 'reason', - typeTraining: 'type', - numberHours: 6, - typeHours: 'type', - }, - { - id: 20, - curAwardInd: 'C', - awardBeginDate: '2025-01-15T16:12:43.447Z', - awardEndDate: '2025-02-15T16:12:43.447Z', - trainingTime: 40, - paymentDate: '2025-02-15T16:12:43.447Z', - monthlyRate: '675.0', - beginRsn: 'reason', - endRsn: 'reason', - typeTraining: 'type', - numberHours: 6, - typeHours: 'type', - }, - { - id: 21, - curAwardInd: 'C', - awardBeginDate: '2025-02-15T16:12:43.447Z', - awardEndDate: '2025-03-15T16:12:43.447Z', - trainingTime: 40, - paymentDate: '2025-03-01T16:12:43.447Z', - monthlyRate: '590.0', - beginRsn: 'reason', - endRsn: 'reason', - typeTraining: 'type', - numberHours: 6, - typeHours: 'type', - }, - ], + indicator: 'B', + pendingDocuments: [ { - docType: 'voluptatem', + docType: '1990', queueDate: '2023-12-04T22:24:20.000Z', }, ], - pendingVerifications: { - awardIds: [], - }, + pendingVerifications: [ + { + awardId: '00001', + awardBeginDate: '2024-03-01', + awardEndDate: '2024-03-24', + numberHours: 10, + monthlyRate: 600.0, + caseTrace: 'CASE 1b', + }, + { + awardId: '00002', + awardBeginDate: '2024-03-25', + awardEndDate: '2024-03-31', + numberHours: 12, + monthlyRate: 1400.0, + caseTrace: 'CASE 7', + }, + { + awardId: '00003', + awardBeginDate: '2024-02-05', + awardEndDate: '2024-02-31', + numberHours: 12, + monthlyRate: 1400.0, + caseTrace: 'CASE 7', + }, + ], verifications: [ { - createdOn: '2024-01-15T16:12:43.491Z', - awardIds: [8], + verifiedDate: '2023-03-01', + awardBeginDate: '2023-02-06', + awardEndDate: '2023-02-28', + numberHours: 6, + monthlyRate: 800.0, + paymentDate: '2023-03-01', + caseTrace: 'CASE 1b', }, { - createdOn: '2024-02-15T16:12:43.491Z', - awardIds: [9], + verifiedDate: '2023-03-01', + awardBeginDate: '2022-02-06', + awardEndDate: '2023-02-28', + numberHours: 6, + monthlyRate: 800.0, + paymentDate: '2023-03-01', + caseTrace: 'CASE 1b', }, { - createdOn: '2024-03-15T16:12:43.491Z', - awardIds: [10], + verifiedDate: '2023-03-01', + awardBeginDate: '2021-02-06', + awardEndDate: '2023-02-28', + numberHours: 6, + monthlyRate: 800.0, + paymentDate: '2023-03-01', + caseTrace: 'CASE 1b', }, { - createdOn: '2024-04-15T16:12:43.491Z', - awardIds: [11], + verifiedDate: '2023-03-01', + awardBeginDate: '2020-02-06', + awardEndDate: '2023-02-28', + numberHours: 6, + monthlyRate: 800.0, + paymentDate: '2023-03-01', + caseTrace: 'CASE 1b', }, { - createdOn: '2024-05-15T16:12:43.491Z', - awardIds: [12], + verifiedDate: '2023-03-01', + awardBeginDate: '2019-02-06', + awardEndDate: '2023-02-28', + numberHours: 6, + monthlyRate: 800.0, + paymentDate: '2023-03-01', + caseTrace: 'CASE 1b', }, { - createdOn: '2024-06-15T16:12:43.491Z', - awardIds: [13], + verifiedDate: '2023-03-01', + awardBeginDate: '2018-02-06', + awardEndDate: '2023-02-28', + numberHours: 6, + monthlyRate: 800.0, + paymentDate: '2023-03-01', + caseTrace: 'CASE 1b', }, { - createdOn: '2024-07-15T16:12:43.491Z', - awardIds: [14], + verifiedDate: '2023-03-01', + awardBeginDate: '2017-02-06', + awardEndDate: '2023-02-28', + numberHours: 6, + monthlyRate: 800.0, + paymentDate: '2023-03-01', + caseTrace: 'CASE 1b', }, { - createdOn: '2024-08-15T16:12:43.491Z', - awardIds: [15], + verifiedDate: '2023-03-01', + awardBeginDate: '2016-02-06', + awardEndDate: '2023-02-28', + numberHours: 6, + monthlyRate: 800.0, + paymentDate: '2023-03-01', + caseTrace: 'CASE 1b', }, { - createdOn: '2024-09-15T16:12:43.491Z', - awardIds: [16], + verifiedDate: '2023-03-01', + awardBeginDate: '2015-02-06', + awardEndDate: '2023-02-28', + numberHours: 6, + monthlyRate: 800.0, + paymentDate: '2023-03-01', + caseTrace: 'CASE 1b', }, { - createdOn: '2024-08-15T16:12:43.491Z', - awardIds: [17], + verifiedDate: '2023-03-01', + awardBeginDate: '2014-02-06', + awardEndDate: '2023-02-28', + numberHours: 6, + monthlyRate: 800.0, + paymentDate: '2023-03-01', + caseTrace: 'CASE 1b', }, { - PendingVerificationSubmitted: '2024-01-02T21:06:10.238Z', - awardIds: [18], + verifiedDate: '2023-03-01', + awardBeginDate: '2013-02-06', + awardEndDate: '2023-02-28', + numberHours: 6, + monthlyRate: 800.0, + paymentDate: '2023-03-01', + caseTrace: 'CASE 1b', }, { - PendingVerificationSubmitted: '2024-01-02T21:06:10.238Z', - awardIds: [19], + verifiedDate: '2023-03-01', + awardBeginDate: '2012-02-06', + awardEndDate: '2023-02-28', + numberHours: 6, + monthlyRate: 800.0, + paymentDate: '2023-03-01', + caseTrace: 'CASE 1b', }, { - PendingVerificationSubmitted: '2024-01-02T21:06:10.238Z', - awardIds: [20], + verifiedDate: '2023-03-01', + awardBeginDate: '2011-02-06', + awardEndDate: '2023-02-28', + numberHours: 6, + monthlyRate: 800.0, + paymentDate: '2023-03-01', + caseTrace: 'CASE 1b', }, { - PendingVerificationSubmitted: '2024-01-02T21:06:10.238Z', - awardIds: [21], + verifiedDate: '2023-03-01', + awardBeginDate: '2010-02-06', + awardEndDate: '2023-02-28', + numberHours: 6, + monthlyRate: 800.0, + paymentDate: '2023-03-01', + caseTrace: 'CASE 1b', }, ], }, diff --git a/src/applications/verify-your-enrollment/containers/VerificationReviewWrapper.jsx b/src/applications/verify-your-enrollment/containers/VerificationReviewWrapper.jsx index d773ca409a83..b720ef1211d0 100644 --- a/src/applications/verify-your-enrollment/containers/VerificationReviewWrapper.jsx +++ b/src/applications/verify-your-enrollment/containers/VerificationReviewWrapper.jsx @@ -21,6 +21,7 @@ import { updateVerifications, verifyEnrollmentAction, } from '../actions'; +import { toLocalISOString } from '../helpers'; const VerificationReviewWrapper = ({ children, @@ -40,8 +41,7 @@ const VerificationReviewWrapper = ({ const [enrollmentPeriodsToVerify, setEnrollmentPeriodsToVerify] = useState( [], ); - const [currentPendingAwardIDs, setCurrentPendingAwardIDs] = useState([]); - // const userData = isUserLoggedIn ? loggedIEnenrollmentData : enrollmentData; + const history = useHistory(); const handleBackClick = () => { @@ -56,16 +56,17 @@ const VerificationReviewWrapper = ({ // used with mock data to mock what happens after // successfully verifying const handleVerification = () => { - const currentDateTime = new Date().toISOString(); - // update awardIds to a blank array - dispatchUpdatePendingVerifications({ awardIds: [] }); - const newVerifiedIDS = currentPendingAwardIDs?.map(id => { + const currentDateTime = toLocalISOString(new Date()); + // update pendingVerifications to a blank array + dispatchUpdatePendingVerifications([]); + const newVerifiedEnrollments = enrollmentPeriodsToVerify.map(period => { return { - PendingVerificationSubmitted: currentDateTime, - awardIds: [id], + ...period, + verifiedDate: currentDateTime, + paymentDate: null, }; }); - dispatchUpdateVerifications(newVerifiedIDS); + dispatchUpdateVerifications(newVerifiedEnrollments); dispatchVerifyEnrollmentAction(); }; @@ -77,27 +78,9 @@ const VerificationReviewWrapper = ({ useEffect( () => { - if ( - enrollmentData?.['vye::UserInfo']?.awards && - enrollmentData?.['vye::UserInfo']?.pendingVerifications - ) { - const { awards, pendingVerifications } = enrollmentData?.[ - 'vye::UserInfo' - ]; - // add all previouslyVerified data into single array - const { awardIds } = pendingVerifications; - const toBeVerifiedEnrollmentsArray = []; - setCurrentPendingAwardIDs(awardIds); - awardIds.forEach(id => { - // check for each id inside award_ids array - if (awards.some(award => award.id === id)) { - toBeVerifiedEnrollmentsArray.push( - awards.find(award => award.id === id), - ); - } - }); - - setEnrollmentPeriodsToVerify(toBeVerifiedEnrollmentsArray); + if (enrollmentData?.['vye::UserInfo']?.pendingVerifications) { + const { pendingVerifications } = enrollmentData?.['vye::UserInfo']; + setEnrollmentPeriodsToVerify(pendingVerifications); } }, [enrollmentData], @@ -137,16 +120,15 @@ const VerificationReviewWrapper = ({ {' '} please do not submit the form. Instead, work with your School Certifying Official (SCO) to ensure your enrollment - information is updated with the VA before submitting this - form. + information is updated with the VA.
Note:{' '} - Please note that providing false reports concerning your - benefits may result in a fine, imprisonment or both. + Providing false reports concerning your benefits may result + in a fine, imprisonment or both.
{ Total Credit Hours: {' '} - {numberHours} + {numberHours === null ? 'Data unavailable' : numberHours}
{ } > Monthly Rate:{' '} - {formatCurrency(monthlyRate)} + {monthlyRate === null + ? 'Data unavailable' + : formatCurrency(monthlyRate)}
Payment for this month was processed.
+Payment for this month has been processed.
{translateDatePeriod( monthAward.awardBeginDate, @@ -245,20 +283,16 @@ export const getGroupedPreviousEnrollments = month => { Total Credit Hours: {' '} - {numberHours} + {numberHours === null ? 'Data unavailable' : numberHours}
Monthly Rate: {' '} - {formatCurrency(monthlyRate)} + {monthlyRate === null + ? 'Data unavailable' + : formatCurrency(monthlyRate)}
- {/*- - Payment Deposited on: - {' '} - {translateDateIntoMonthDayYearFormat(paymentDate)} -
*/}{translateDatePeriod( monthAward.awardBeginDate, @@ -310,18 +346,20 @@ export const getGroupedPreviousEnrollments = month => { Total Credit Hours: {' '} - {numberHours} + {numberHours === null ? 'Data unavailable' : numberHours}
Monthly Rate: {' '} - {formatCurrency(monthlyRate)} + {monthlyRate === null + ? 'Data unavailable' + : formatCurrency(monthlyRate)}
+
This month has not yet been verified.
Payment for this month has been processed.
-- {translateDatePeriod(awards.awardBeginDate, awards.awardEndDate)} -
-
-
- Total Credit Hours:
+
- Monthly Rate:{' '}
- {formatCurrency(awards.monthlyRate)}
-
- {translateDatePeriod(awards.awardBeginDate, awards.awardEndDate)}
-
-
- Total Credit Hours:
+ Verified
+
+ Payment for this month has been processed.
+ {translateDatePeriod(
+ awards.awardBeginDate,
+ awards.awardEndDate,
+ )}
+
+
+ Total Credit Hours:
+ {' '}
+ {awards.numberHours === null
+ ? 'Data unavailable'
+ : awards.numberHours}
+
+ Monthly Rate:{' '}
+ {awards.monthlyRate === null
+ ? 'Data unavailable'
+ : formatCurrency(awards.monthlyRate)}
+
- Monthly Rate:{' '}
- {formatCurrency(awards.monthlyRate)}
-
+ {translateDatePeriod(
+ awards.awardBeginDate,
+ awards.awardEndDate,
+ )}
+
+
+ Total Credit Hours:
+ {' '}
+ {awards.numberHours === null
+ ? 'Data unavailable'
+ : awards.numberHours}
+
+ Monthly Rate:{' '}
+ {awards.monthlyRate === null
+ ? 'Data unavailable'
+ : formatCurrency(awards.monthlyRate)}
+
+
+ {awards.awardBeginDate !== null
+ ? translateDateIntoMonthYearFormat(awards.awardBeginDate)
+ : translateDateIntoMonthYearFormat(awards.awardEndDate)}
{' '}
- {awards.numberHours}
-
-
-
- {translateDateIntoMonthYearFormat(awards.awardBeginDate)}
- {' '}
- {' '}
- Verified
-
-
+
+ {awards.awardBeginDate !== null
+ ? translateDateIntoMonthYearFormat(awards.awardBeginDate)
+ : translateDateIntoMonthYearFormat(awards.awardEndDate)}
{' '}
- {awards.numberHours}
-
{' '}
+
{translateDateIntoMonthYearFormat(awards.awardBeginDate)}
@@ -477,28 +538,30 @@ export const getSignlePreviousEnrollments = awards => {
};
export const combineEnrollmentsWithStartMonth = enrollmentPeriods => {
- const trackEndDate = [];
- const combineMonths = {};
+ const isArray = Array.isArray(enrollmentPeriods);
- enrollmentPeriods.forEach(period => {
- const tempMonthYear = translateDateIntoMonthYearFormat(
- period.awardBeginDate,
- );
- if (trackEndDate.includes(tempMonthYear)) {
- combineMonths[tempMonthYear].push({
- id: period.id,
- awardBeginDate: period.awardBeginDate,
- awardEndDate: period.awardEndDate,
- numberHours: period.numberHours,
- monthlyRate: period.monthlyRate,
- verifiedDate: period.verifiedDate,
- PendingVerificationSubmitted: period.PendingVerificationSubmitted,
- paymentDate: period.paymentDate,
- });
- } else {
- trackEndDate.push(tempMonthYear);
- combineMonths[tempMonthYear] = [
- {
+ const trackDate = [];
+ const combineMonths = {};
+ const dateUnavailable = 'Date unavailable';
+
+ if (isArray) {
+ enrollmentPeriods.forEach(period => {
+ // if award begin date is null, assign value as Date unavailable
+ let tempMonthYear =
+ period.awardBeginDate !== null
+ ? translateDateIntoMonthYearFormat(period.awardBeginDate)
+ : dateUnavailable;
+
+ // if value is Date unavailable and there is an award end date, use the award end date instead
+ if (tempMonthYear === dateUnavailable) {
+ tempMonthYear =
+ period.awardEndDate !== null
+ ? translateDateIntoMonthYearFormat(period.awardEndDate)
+ : dateUnavailable;
+ }
+
+ if (trackDate.includes(tempMonthYear)) {
+ combineMonths[tempMonthYear].push({
id: period.id,
awardBeginDate: period.awardBeginDate,
awardEndDate: period.awardEndDate,
@@ -507,11 +570,26 @@ export const combineEnrollmentsWithStartMonth = enrollmentPeriods => {
verifiedDate: period.verifiedDate,
PendingVerificationSubmitted: period.PendingVerificationSubmitted,
paymentDate: period.paymentDate,
- },
- ];
- }
- });
- return combineMonths;
+ });
+ } else {
+ trackDate.push(tempMonthYear);
+ combineMonths[tempMonthYear] = [
+ {
+ id: period.id,
+ awardBeginDate: period.awardBeginDate,
+ awardEndDate: period.awardEndDate,
+ numberHours: period.numberHours,
+ monthlyRate: period.monthlyRate,
+ verifiedDate: period.verifiedDate,
+ PendingVerificationSubmitted: period.PendingVerificationSubmitted,
+ paymentDate: period.paymentDate,
+ },
+ ];
+ }
+ });
+ return combineMonths;
+ }
+ return enrollmentPeriods;
};
export const isMobileDevice = () => {
diff --git a/src/applications/verify-your-enrollment/reducers/mockData.js b/src/applications/verify-your-enrollment/reducers/mockData.js
index b341afee6135..9cc87508ce9b 100644
--- a/src/applications/verify-your-enrollment/reducers/mockData.js
+++ b/src/applications/verify-your-enrollment/reducers/mockData.js
@@ -1,10 +1,12 @@
// import _ from 'lodash';
-import { USER_MOCK_DATA } from '../constants/mockData';
+// import { USER_MOCK_DATA } from '../constants/mockData';
+import { UPDATED_USER_MOCK_DATA } from '../constants/mockData';
import { UPDATE_PENDING_VERIFICATIONS, UPDATE_VERIFICATIONS } from '../actions';
const INITIAL_STATE = {
- mockData: USER_MOCK_DATA,
+ // mockData: USER_MOCK_DATA,
+ mockData: UPDATED_USER_MOCK_DATA,
};
const mockData = (state = INITIAL_STATE, action) => {
diff --git a/src/applications/verify-your-enrollment/tests/components/PeriodsToVerify.unit.spec.js b/src/applications/verify-your-enrollment/tests/components/PeriodsToVerify.unit.spec.js
index 3ecc2a1234f5..9c44dd4fef01 100644
--- a/src/applications/verify-your-enrollment/tests/components/PeriodsToVerify.unit.spec.js
+++ b/src/applications/verify-your-enrollment/tests/components/PeriodsToVerify.unit.spec.js
@@ -5,14 +5,14 @@ import { Provider } from 'react-redux';
import configureMockStore from 'redux-mock-store';
import { mount, shallow } from 'enzyme';
import { waitFor } from '@testing-library/react';
-import { USER_MOCK_DATA } from '../../constants/mockData';
+import { UPDATED_USER_MOCK_DATA } from '../../constants/mockData';
import PeriodsToVerify from '../../components/PeriodsToVerify';
const mockStore = configureMockStore();
const initialState = {
getDataReducer: {
data: {
- ...USER_MOCK_DATA,
+ ...UPDATED_USER_MOCK_DATA,
},
},
personalInfo: {
@@ -105,13 +105,11 @@ describe('