diff --git a/services/app-api/src/postgres/contractAndRates/withdrawRate.ts b/services/app-api/src/postgres/contractAndRates/withdrawRate.ts index 589cb08893..f92bd19074 100644 --- a/services/app-api/src/postgres/contractAndRates/withdrawRate.ts +++ b/services/app-api/src/postgres/contractAndRates/withdrawRate.ts @@ -141,7 +141,7 @@ const withdrawRateInsideTransaction = async ( const unlockedContract = await unlockContractInsideTransaction(tx, { contractID: contract.id, unlockedByUserID: updatedByID, - unlockReason: `CMS withdrawing rate ${latestRateRev.rateCertificationName} from this submission`, + unlockReason: `CMS withdrawing rate ${latestRateRev.rateCertificationName} from this submission. ${updatedReason}`, }) if (unlockedContract instanceof Error) { @@ -259,7 +259,7 @@ const withdrawRateInsideTransaction = async ( const resubmitContractArgs: SubmitContractArgsType = { contractID: contract.id, submittedByUserID: updatedByID, - submittedReason: `CMS has withdrawn rate ${latestRateRev.rateCertificationName} from this submission`, + submittedReason: `CMS has withdrawn rate ${latestRateRev.rateCertificationName} from this submission. ${updatedReason}`, } const resubmitResult = await submitContractInsideTransaction( tx, @@ -276,7 +276,7 @@ const withdrawRateInsideTransaction = async ( rateID, formData: undefined, submittedByUserID: updatedByID, - submittedReason: 'CMS has withdrawn this rate', + submittedReason: 'CMS has withdrawn this rate. ' + updatedReason, }) if (submitRate instanceof Error) { diff --git a/services/app-api/src/resolvers/rate/withdrawRate.test.ts b/services/app-api/src/resolvers/rate/withdrawRate.test.ts index c784ef97bc..2e3a74918e 100644 --- a/services/app-api/src/resolvers/rate/withdrawRate.test.ts +++ b/services/app-api/src/resolvers/rate/withdrawRate.test.ts @@ -76,11 +76,15 @@ describe('withdrawRate', () => { }) const contract = await createAndSubmitTestContractWithRate(stateServer) - const rateID = contract.packageSubmissions[0].rateRevisions[0].rateID + const rate = contract.packageSubmissions[0].rateRevisions[0] + const rateID = rate.rateID + const rateName = rate.formData.rateCertificationName + const updatedReason = 'Withdraw invalid rate' + const withdrawnRate = await withdrawTestRate( cmsServer, rateID, - 'Withdraw invalid rate' + updatedReason ) // expect rate to contain contract in withdrawn join table @@ -120,6 +124,20 @@ describe('withdrawRate', () => { ]) ) + const latestRateRev = withdrawnRate.packageSubmissions[0].rateRevision + const rateUnlockInfo = latestRateRev.unlockInfo + const rateSubmitInfo = latestRateRev.submitInfo + + // expect the rate latest unlock info to contain default text and withdraw reason + expect(rateUnlockInfo?.updatedReason).toBe( + `CMS withdrawing rate ${rateName} from this submission. ${updatedReason}` + ) + + // expect rate latest submission to contain default text and withdraw reason + expect(rateSubmitInfo?.updatedReason).toBe( + `CMS has withdrawn this rate. ${updatedReason}` + ) + const contractWithWithdrawnRate = await fetchTestContractWithQuestions( stateServer, contract.id @@ -141,6 +159,10 @@ describe('withdrawRate', () => { ) const packageSubmissions = contractWithWithdrawnRate.packageSubmissions + const contractSubmitInfo = + packageSubmissions[0].contractRevision.submitInfo + const contractUnlockInfo = + packageSubmissions[0].contractRevision.unlockInfo // expect withdrawn rate is no longer in latest package submission expect(packageSubmissions[0].rateRevisions).not.toEqual( @@ -151,6 +173,16 @@ describe('withdrawRate', () => { ]) ) + // expect the contacts latest unlock info to contain default text and withdraw reason + expect(contractUnlockInfo?.updatedReason).toBe( + `CMS withdrawing rate ${rateName} from this submission. ${updatedReason}` + ) + + // expect contracts latest submission to contain default text and withdraw reason + expect(contractSubmitInfo?.updatedReason).toBe( + `CMS has withdrawn rate ${rateName} from this submission. ${updatedReason}` + ) + // expect the withdrawn rate is on the previous packageSubmission expect(packageSubmissions[1].rateRevisions).toEqual( expect.arrayContaining([ diff --git a/services/app-web/src/components/ChangeHistory/ChangeHistory.test.tsx b/services/app-web/src/components/ChangeHistory/ChangeHistory.test.tsx index 16ef1e94bb..09d7b1884c 100644 --- a/services/app-web/src/components/ChangeHistory/ChangeHistory.test.tsx +++ b/services/app-web/src/components/ChangeHistory/ChangeHistory.test.tsx @@ -11,6 +11,7 @@ import { mockValidCMSUser, mockValidStateUser, mockContractPackageApproved, + mockContractWithLinkedRateSubmitted, } from '@mc-review/mocks' import { renderWithProviders } from '../../testHelpers' import { formatToPacificTime } from '@mc-review/dates' @@ -95,6 +96,127 @@ describe('Change History', () => { expect(screen.getByText('Approved')).toBeInTheDocument() }) + it('has expected text in the accordion titles and content for rate withdrawal', () => { + const contractWithWithdrawnRate = mockContractWithLinkedRateSubmitted({ + packageSubmissions: [ + { + cause: 'CONTRACT_SUBMISSION', + __typename: 'ContractPackageSubmission', + submitInfo: { + updatedAt: new Date('12/18/2023'), + updatedBy: { + email: 'example@state.com', + role: 'STATE_USER', + givenName: 'John', + familyName: 'Vila', + }, + updatedReason: 'withdraw rate', + }, + submittedRevisions: [], + contractRevision: { + contractName: 'MCR-MN-0005-SNBC', + createdAt: new Date('01/01/2024'), + updatedAt: new Date('12/31/2024'), + id: '123', + contractID: 'test-abc-123', + submitInfo: { + updatedAt: new Date('12/18/2023'), + updatedBy: { + email: 'example@state.com', + role: 'STATE_USER', + givenName: 'John', + familyName: 'Vila', + }, + updatedReason: 'withdraw rate', + }, + unlockInfo: { + updatedAt: new Date('12/18/2023'), + updatedBy: { + email: 'example@state.com', + role: 'STATE_USER', + givenName: 'John', + familyName: 'Vila', + }, + updatedReason: 'withdraw rate', + }, + formData: { + programIDs: [ + 'abbdf9b0-c49e-4c4c-bb6f-040cb7b51cce', + ], + populationCovered: 'MEDICAID', + submissionType: 'CONTRACT_AND_RATES', + riskBasedContract: true, + submissionDescription: 'A real submission', + supportingDocuments: [ + { + s3URL: 's3://bucketname/key/contractsupporting1', + sha256: 'fakesha', + name: 'contractSupporting1', + dateAdded: new Date('01/15/2024'), + }, + { + s3URL: 's3://bucketname/key/contractSupporting2', + sha256: 'fakesha', + name: 'contractSupporting2', + dateAdded: new Date('01/13/2024'), + }, + ], + stateContacts: [], + contractType: 'AMENDMENT', + contractExecutionStatus: 'EXECUTED', + contractDocuments: [ + { + s3URL: 's3://bucketname/key/contract', + sha256: 'fakesha', + name: 'contract', + dateAdded: new Date('01/01/2024'), + }, + ], + contractDateStart: new Date(), + contractDateEnd: new Date(), + managedCareEntities: ['MCO'], + federalAuthorities: ['STATE_PLAN'], + inLieuServicesAndSettings: true, + modifiedBenefitsProvided: true, + modifiedGeoAreaServed: false, + modifiedMedicaidBeneficiaries: true, + modifiedRiskSharingStrategy: true, + modifiedIncentiveArrangements: false, + modifiedWitholdAgreements: false, + modifiedStateDirectedPayments: true, + modifiedPassThroughPayments: true, + modifiedPaymentsForMentalDiseaseInstitutions: false, + modifiedMedicalLossRatioStandards: true, + modifiedOtherFinancialPaymentIncentive: false, + modifiedEnrollmentProcess: true, + modifiedGrevienceAndAppeal: false, + modifiedNetworkAdequacyStandards: true, + modifiedLengthOfContract: false, + modifiedNonRiskPaymentArrangements: true, + statutoryRegulatoryAttestation: true, + statutoryRegulatoryAttestationDescription: + 'everything meets regulatory attestation', + }, + }, + rateRevisions: [], + }, + ], + }) + renderWithProviders( + + ) + const submitInfo = + contractWithWithdrawnRate.packageSubmissions[0].submitInfo + const updatedAt = submitInfo.updatedAt + // API returns UTC timezone, we display timestamped dates in PT timezone so 1 day before on these tests. + expect( + screen.getByRole('button', { + name: `${formatToPacificTime(updatedAt)} - Submission`, + }) + ).toBeInTheDocument() + expect(screen.getAllByText(/withdraw rate/)).toHaveLength(2) + }) + it('has expected text in the accordion titles and content for ADMIN events', () => { const submittedContract = mockContractPackageSubmittedWithRevisions({ packageSubmissions: [