diff --git a/pkg/handlers/internalapi/internal/payloads/model_to_payload.go b/pkg/handlers/internalapi/internal/payloads/model_to_payload.go index 464d36267e9..f0b5fd06ed3 100644 --- a/pkg/handlers/internalapi/internal/payloads/model_to_payload.go +++ b/pkg/handlers/internalapi/internal/payloads/model_to_payload.go @@ -104,6 +104,7 @@ func PPMShipment(storer storage.FileStorer, ppmShipment *models.PPMShipment) *in AdvanceAmountRequested: handlers.FmtCost(ppmShipment.AdvanceAmountRequested), HasReceivedAdvance: ppmShipment.HasReceivedAdvance, AdvanceAmountReceived: handlers.FmtCost(ppmShipment.AdvanceAmountReceived), + AdvanceStatus: (*internalmessages.PPMAdvanceStatus)(ppmShipment.AdvanceStatus), WeightTickets: WeightTickets(storer, ppmShipment.WeightTickets), MovingExpenses: MovingExpenses(storer, ppmShipment.MovingExpenses), ProGearWeightTickets: ProGearWeightTickets(storer, ppmShipment.ProgearWeightTickets), diff --git a/playwright/tests/my/milmove/ppms/customerPpmTestFixture.js b/playwright/tests/my/milmove/ppms/customerPpmTestFixture.js index 35f5d59400c..392ea75d374 100644 --- a/playwright/tests/my/milmove/ppms/customerPpmTestFixture.js +++ b/playwright/tests/my/milmove/ppms/customerPpmTestFixture.js @@ -908,7 +908,12 @@ export class CustomerPpmPage extends CustomerPage { await expect(this.page.locator('.usa-alert--success')).toContainText('You submitted documentation for review.'); - const stepContainer = this.page.locator('[data-testid="stepContainer5"]'); + let stepContainer = this.page.locator('[data-testid="stepContainer6"]'); + + if (stepContainer == null) { + stepContainer = this.page.locator('[data-testid="stepContainer5"]'); + } + await expect(stepContainer.getByRole('button', { name: 'Download Incentive Packet' })).toBeDisabled(); await expect(stepContainer.getByText(/PPM documentation submitted: \d{2} \w{3} \d{4}/)).toBeVisible(); } diff --git a/playwright/tests/my/milmove/ppms/entireShipmentOnboarding.spec.js b/playwright/tests/my/milmove/ppms/entireShipmentOnboarding.spec.js index d330106d3c7..ea57a703ae2 100644 --- a/playwright/tests/my/milmove/ppms/entireShipmentOnboarding.spec.js +++ b/playwright/tests/my/milmove/ppms/entireShipmentOnboarding.spec.js @@ -45,11 +45,16 @@ class CustomerPpmOnboardingPage extends CustomerPpmPage { /** */ - async verifyStep5ExistsAndBtnIsDisabled() { - const stepContainer5 = this.page.locator('[data-testid="stepContainer5"]'); - await expect(stepContainer5.getByRole('button', { name: 'Upload PPM Documents' })).toBeDisabled(); + async verifyManagePPMStepExistsAndBtnIsDisabled() { + const stepContainer = this.page.locator('[data-testid="stepContainer6"]'); + + if (stepContainer == null) { + this.page.locator('[data-testid="stepContainer5"]'); + } + + await expect(stepContainer.getByRole('button', { name: 'Upload PPM Documents' })).toBeDisabled(); await expect( - stepContainer5.locator('p').getByText('After a counselor approves your PPM, you will be able to:'), + stepContainer.locator('p').getByText('After a counselor approves your PPM, you will be able to:'), ).toBeVisible(); } @@ -119,7 +124,7 @@ test.describe('Entire PPM onboarding flow', () => { await customerPpmOnboardingPage.submitsAdvancePage({ addAdvance: true, isMobile }); await customerPpmOnboardingPage.navigateToAgreementAndSign(); await customerPpmOnboardingPage.submitMove(); - await customerPpmOnboardingPage.verifyStep5ExistsAndBtnIsDisabled(); + await customerPpmOnboardingPage.verifyManagePPMStepExistsAndBtnIsDisabled(); }); test('happy path with edits and backs', async () => { @@ -138,7 +143,7 @@ test.describe('Entire PPM onboarding flow', () => { await customerPpmOnboardingPage.navigateToAgreementAndSign(); await customerPpmOnboardingPage.submitMove(); - await customerPpmOnboardingPage.verifyStep5ExistsAndBtnIsDisabled(); + await customerPpmOnboardingPage.verifyManagePPMStepExistsAndBtnIsDisabled(); }); }); }); diff --git a/playwright/tests/my/milmove/ppms/navigateToUploadDocs.spec.js b/playwright/tests/my/milmove/ppms/navigateToUploadDocs.spec.js index bc12f20a022..a40b8dfe36d 100644 --- a/playwright/tests/my/milmove/ppms/navigateToUploadDocs.spec.js +++ b/playwright/tests/my/milmove/ppms/navigateToUploadDocs.spec.js @@ -16,9 +16,14 @@ test.describe('PPM Request Payment - Begin providing documents flow', () => { test('has upload documents button enabled', async ({ page }) => { await expect(page.getByRole('heading', { name: 'Your move is in progress.' })).toBeVisible(); - const stepContainer5 = page.getByTestId('stepContainer5'); - await expect(stepContainer5.locator('p').getByText('15 Apr 2022')).toBeVisible(); - await stepContainer5.getByRole('button', { name: 'Upload PPM Documents' }).click(); + let stepContainer = page.getByTestId('stepContainer6'); + + if (stepContainer == null) { + stepContainer = page.getByTestId('stepContainer5'); + } + + await expect(stepContainer.locator('p').getByText('15 Apr 2022')).toBeVisible(); + await stepContainer.getByRole('button', { name: 'Upload PPM Documents' }).click(); await expect(page).toHaveURL(/\/moves\/[^/]+\/shipments\/[^/]+\/about/); }); }); diff --git a/src/pages/MyMove/Home/index.jsx b/src/pages/MyMove/Home/index.jsx index 293c1ce9db6..f89ab76078a 100644 --- a/src/pages/MyMove/Home/index.jsx +++ b/src/pages/MyMove/Home/index.jsx @@ -54,6 +54,7 @@ import { formatCustomerDate, formatWeight } from 'utils/formatters'; import { isPPMAboutInfoComplete, isPPMShipmentComplete, isWeightTicketComplete } from 'utils/shipments'; import withRouter from 'utils/routing'; import { RouterShape } from 'types/router'; +import { ADVANCE_STATUSES } from 'constants/ppms'; const Description = ({ className, children, dataTestId }) => (
@@ -141,6 +142,30 @@ export class Home extends Component {
return mtoShipments?.filter((s) => s.shipmentType === SHIPMENT_OPTIONS.PPM)?.every((s) => isPPMShipmentComplete(s));
}
+ get hasAdvanceApproved() {
+ const { mtoShipments } = this.props;
+ // determine if at least one advance was APPROVED (advance_status in ppm_shipments table is not nil)
+ const appovedAdvances = mtoShipments.filter(
+ (shipment) => shipment?.ppmShipment?.advanceStatus === ADVANCE_STATUSES.APPROVED.apiValue,
+ );
+ return !!appovedAdvances.length;
+ }
+
+ get hasAllAdvancesRejected() {
+ // check to see if all advance_status are REJECTED
+ const { mtoShipments } = this.props;
+ const rejectedAdvances = mtoShipments.filter(
+ (shipment) => shipment?.ppmShipment?.advanceStatus === ADVANCE_STATUSES.REJECTED.apiValue,
+ );
+ return !this.hasAdvanceApproved && rejectedAdvances.length > 0;
+ }
+
+ get hasAdvanceRequested() {
+ const { mtoShipments } = this.props;
+ const requestedAdvances = mtoShipments.filter((shipment) => shipment?.ppmShipment?.hasRequestedAdvance);
+ return !!requestedAdvances.length;
+ }
+
get isMoveApproved() {
const { move } = this.props;
return move.status === MOVE_STATUSES.APPROVED;
@@ -384,6 +409,7 @@ export class Home extends Component {
// eslint-disable-next-line camelcase
const currentLocation = current_location;
+ const shipmentNumbersByType = {};
return (
<>
@@ -535,8 +561,88 @@ export class Home extends Component {
)}
+ {!!ppmShipments.length && this.hasSubmittedMove && this.hasAdvanceRequested && (
+
+
+ Download AOA Paperwork (PDF)
+
+
+
The amount you receive will be deducted from your PPM incentive payment. If your
+ incentive ends up being less than your advance, you will be required to pay back the
+ difference.
+
+
+
+
The amount you receive will be deducted from your PPM incentive payment. If your
+ incentive ends up being less than your advance, you will be required to pay back the
+ difference.
+