From 7a2ab809e6a1c2ea7df0aeb7afdf3ddbce33a20f Mon Sep 17 00:00:00 2001 From: Maria Traskowsky Date: Tue, 3 Sep 2024 19:52:11 +0000 Subject: [PATCH 1/6] set ReceivedByGexAt when processing 997s --- pkg/services/invoice/process_edi997.go | 3 +++ pkg/services/invoice/process_edi997_test.go | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/pkg/services/invoice/process_edi997.go b/pkg/services/invoice/process_edi997.go index c67fbc1227b..27f65603b2a 100644 --- a/pkg/services/invoice/process_edi997.go +++ b/pkg/services/invoice/process_edi997.go @@ -2,6 +2,7 @@ package invoice import ( "fmt" + "time" "github.com/gofrs/uuid" "go.uber.org/zap" @@ -105,6 +106,8 @@ func (e *edi997Processor) ProcessFile(appCtx appcontext.AppContext, _ string, st } paymentRequest.Status = models.PaymentRequestStatusTppsReceived + ReceivedByGexAt := time.Now() + paymentRequest.ReceivedByGexAt = &ReceivedByGexAt err = txnAppCtx.DB().Update(&paymentRequest) if err != nil { txnAppCtx.Logger().Error("failure updating payment request", zap.Error(err)) diff --git a/pkg/services/invoice/process_edi997_test.go b/pkg/services/invoice/process_edi997_test.go index 7287b043c7f..39d4c34cba3 100644 --- a/pkg/services/invoice/process_edi997_test.go +++ b/pkg/services/invoice/process_edi997_test.go @@ -196,6 +196,7 @@ IEA*1*000000995 err = suite.DB().Where("id = ?", paymentRequest.ID).First(&updatedPR) suite.NoError(err) suite.Equal(models.PaymentRequestStatusTppsReceived, updatedPR.Status) + suite.NotNil(updatedPR.ReceivedByGexAt) }) suite.Run("can handle 997 and 858 with same ICN", func() { @@ -250,6 +251,7 @@ IEA*1*000000995 err = suite.DB().Where("id = ?", paymentRequest.ID).First(&updatedPR) suite.FatalNoError(err) suite.Equal(models.PaymentRequestStatusTppsReceived, updatedPR.Status) + suite.NotNil(updatedPR.ReceivedByGexAt) }) suite.Run("does not error out if edi with same icn is processed for the same payment request", func() { @@ -304,6 +306,7 @@ IEA*1*000000995 err = suite.DB().Where("id = ?", paymentRequest.ID).First(&updatedPR) suite.FatalNoError(err) suite.Equal(models.PaymentRequestStatusTppsReceived, updatedPR.Status) + suite.NotNil(updatedPR.ReceivedByGexAt) }) suite.Run("doesn't update a payment request status after processing an invalid EDI997", func() { @@ -345,6 +348,7 @@ IEA*1*000000022 err = suite.DB().Where("id = ?", paymentRequest.ID).First(&updatedPR) suite.NoError(err) suite.Equal(models.PaymentRequestStatusSentToGex, updatedPR.Status) + suite.Nil(updatedPR.ReceivedByGexAt) }) suite.Run("throw an error when edi997 is missing a transaction set", func() { From ccc8c66b56241533be70512f18fb24d79eb39eca Mon Sep 17 00:00:00 2001 From: Maria Traskowsky Date: Tue, 3 Sep 2024 21:23:27 +0000 Subject: [PATCH 2/6] refactor payment request status details to always show approved rejected --- .../PaymentRequestCard/PaymentRequestCard.jsx | 72 ++++++------------- 1 file changed, 23 insertions(+), 49 deletions(-) diff --git a/src/components/Office/PaymentRequestCard/PaymentRequestCard.jsx b/src/components/Office/PaymentRequestCard/PaymentRequestCard.jsx index 8e1ed250eec..1095ee87bd1 100644 --- a/src/components/Office/PaymentRequestCard/PaymentRequestCard.jsx +++ b/src/components/Office/PaymentRequestCard/PaymentRequestCard.jsx @@ -265,12 +265,8 @@ const PaymentRequestCard = ({ ); }; - const renderPaymentRequestDetailsForStatus = (paymentRequestStatus) => { - if ( - (paymentRequestStatus === PAYMENT_REQUEST_STATUS.PAID || - paymentRequestStatus === PAYMENT_REQUEST_STATUS.EDI_ERROR) && - tppsInvoiceSellerPaidDate - ) { + const renderApprovedRejectedPaymentRequestDetails = () => { + if (approvedAmount > 0 || rejectedAmount > 0) { return (
{approvedAmount > 0 && ( @@ -293,6 +289,20 @@ const PaymentRequestCard = ({
)} + + ); + } + return
; + }; + + const renderPaymentRequestDetailsForStatus = (paymentRequestStatus) => { + if ( + (paymentRequestStatus === PAYMENT_REQUEST_STATUS.PAID || + paymentRequestStatus === PAYMENT_REQUEST_STATUS.EDI_ERROR) && + tppsInvoiceSellerPaidDate + ) { + return ( +
{tppsInvoiceAmountPaidTotalMillicents > 0 && (
@@ -313,22 +323,12 @@ const PaymentRequestCard = ({ ) { return (
- {approvedAmount > 0 && ( + {paymentRequest.receivedByGexAt && (

{toDollarString(formatCents(approvedAmount))}

- Received - on {formatDateFromIso(paymentRequest.receivedByGexAt, 'DD MMM YYYY')} -
-
- )} - {rejectedAmount > 0 && ( -
- -
-

{toDollarString(formatCents(rejectedAmount))}

- Rejected + TPPS Received on {formatDateFromIso(paymentRequest.receivedByGexAt, 'DD MMM YYYY')}
@@ -336,36 +336,7 @@ const PaymentRequestCard = ({
); } - if ( - paymentRequestStatus === PAYMENT_REQUEST_STATUS.REVIEWED || - paymentRequestStatus === PAYMENT_REQUEST_STATUS.REVIEWED_AND_ALL_SERVICE_ITEMS_REJECTED || - paymentRequestStatus === PAYMENT_REQUEST_STATUS.EDI_ERROR - ) { - return ( -
- {approvedAmount > 0 && ( -
- -
-

{toDollarString(formatCents(approvedAmount))}

- Accepted - on {formatDateFromIso(paymentRequest.reviewedAt, 'DD MMM YYYY')} -
-
- )} - {rejectedAmount > 0 && ( -
- -
-

{toDollarString(formatCents(rejectedAmount))}

- Rejected - on {formatDateFromIso(paymentRequest.reviewedAt, 'DD MMM YYYY')} -
-
- )} -
- ); - } + if ( paymentRequestStatus === PAYMENT_REQUEST_STATUS.SENT_TO_GEX || (paymentRequestStatus === PAYMENT_REQUEST_STATUS.EDI_ERROR && approvedAmount > 0) @@ -420,7 +391,10 @@ const PaymentRequestCard = ({
-
{paymentRequest.status && renderPaymentRequestDetailsForStatus(paymentRequest.status)}
+
+ {paymentRequest.status && renderApprovedRejectedPaymentRequestDetails(paymentRequest)} + {paymentRequest.status && renderPaymentRequestDetailsForStatus(paymentRequest.status)} +
{paymentRequest.status === PAYMENT_REQUEST_STATUS.PENDING && renderReviewServiceItemsBtnForTIOandTOO()}
{ediErrorsExistForPaymentRequest && renderEDIErrorDetails()} From 01dd01846fa0823b64575a30e186e7119c043795 Mon Sep 17 00:00:00 2001 From: Maria Traskowsky Date: Wed, 4 Sep 2024 15:37:37 +0000 Subject: [PATCH 3/6] updated tests --- .../PaymentRequestCard/PaymentRequestCard.jsx | 4 ++-- .../PaymentRequestCard.test.jsx | 23 +++++++++++++++++-- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/components/Office/PaymentRequestCard/PaymentRequestCard.jsx b/src/components/Office/PaymentRequestCard/PaymentRequestCard.jsx index 1095ee87bd1..c6316d20230 100644 --- a/src/components/Office/PaymentRequestCard/PaymentRequestCard.jsx +++ b/src/components/Office/PaymentRequestCard/PaymentRequestCard.jsx @@ -326,7 +326,7 @@ const PaymentRequestCard = ({ {paymentRequest.receivedByGexAt && (
-
+

{toDollarString(formatCents(approvedAmount))}

TPPS Received on {formatDateFromIso(paymentRequest.receivedByGexAt, 'DD MMM YYYY')} @@ -344,7 +344,7 @@ const PaymentRequestCard = ({ return (
-
+

{toDollarString(formatCents(approvedAmount))}

Sent to GEX diff --git a/src/components/Office/PaymentRequestCard/PaymentRequestCard.test.jsx b/src/components/Office/PaymentRequestCard/PaymentRequestCard.test.jsx index 04486d323c7..1443e72d928 100644 --- a/src/components/Office/PaymentRequestCard/PaymentRequestCard.test.jsx +++ b/src/components/Office/PaymentRequestCard/PaymentRequestCard.test.jsx @@ -601,7 +601,7 @@ describe('PaymentRequestCard', () => { createdAt: '2020-12-01T00:00:00.000Z', mtoServiceItemID: 'f8c2f97f-99e7-4fb1-9cc4-473debd24dbc', priceCents: 2000001, - status: 'DENIED', + status: 'APPROVED', }, { id: '39474c6a-69b6-4501-8e08-670a12512a5f', @@ -626,6 +626,14 @@ describe('PaymentRequestCard', () => { ); expect(sentToGex.find({ 'data-testid': 'tag' }).contains('Sent to GEX')).toBe(true); expect(sentToGex.find({ 'data-testid': 'sentToGexDetails' }).exists()).toBe(true); + // displays the sent to gex sum, milmove accepted amount, and milmove rejected amount + expect(sentToGex.find({ 'data-testid': 'sentToGexDetailsDollarAmountTotal' }).contains('$20,000.01')).toBe(true); + expect(sentToGex.find({ 'data-testid': 'milMoveAcceptedDetailsDollarAmountTotal' }).contains('$20,000.01')).toBe( + true, + ); + expect(sentToGex.find({ 'data-testid': 'milMoveRejectedDetailsDollarAmountTotal' }).contains('$40,000.01')).toBe( + true, + ); }); it('renders - for the date it was sent to gex if sentToGexAt is null', () => { @@ -653,13 +661,14 @@ describe('PaymentRequestCard', () => { paymentRequestNumber: '1843-9061-2', status: 'TPPS_RECEIVED', moveTaskOrder: move, + receivedByGexAt: '2020-12-01T00:00:00.000Z', serviceItems: [ { id: '09474c6a-69b6-4501-8e08-670a12512a5f', createdAt: '2020-12-01T00:00:00.000Z', mtoServiceItemID: 'f8c2f97f-99e7-4fb1-9cc4-473debd24dbc', priceCents: 2000001, - status: 'DENIED', + status: 'APPROVED', }, { id: '39474c6a-69b6-4501-8e08-670a12512a5f', @@ -681,6 +690,16 @@ describe('PaymentRequestCard', () => { , ); expect(receivedByGex.find({ 'data-testid': 'tag' }).contains('TPPS Received')).toBe(true); + // displays the tpps received sum, milmove accepted amount, and milmove rejected amount + expect(receivedByGex.find({ 'data-testid': 'tppsReceivedDetailsDollarAmountTotal' }).contains('$20,000.01')).toBe( + true, + ); + expect( + receivedByGex.find({ 'data-testid': 'milMoveAcceptedDetailsDollarAmountTotal' }).contains('$20,000.01'), + ).toBe(true); + expect( + receivedByGex.find({ 'data-testid': 'milMoveRejectedDetailsDollarAmountTotal' }).contains('$40,000.01'), + ).toBe(true); }); it('renders the paid status tag for paid request', () => { From 49a9c47213d3335d1035bc7409a53bf225446649 Mon Sep 17 00:00:00 2001 From: Maria Traskowsky Date: Wed, 4 Sep 2024 16:20:30 +0000 Subject: [PATCH 4/6] flaky test fix --- .../ServicesCounselingEditShipmentDetails.test.jsx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/pages/Office/ServicesCounselingEditShipmentDetails/ServicesCounselingEditShipmentDetails.test.jsx b/src/pages/Office/ServicesCounselingEditShipmentDetails/ServicesCounselingEditShipmentDetails.test.jsx index de1ac1b0ead..0532d35b1d5 100644 --- a/src/pages/Office/ServicesCounselingEditShipmentDetails/ServicesCounselingEditShipmentDetails.test.jsx +++ b/src/pages/Office/ServicesCounselingEditShipmentDetails/ServicesCounselingEditShipmentDetails.test.jsx @@ -324,11 +324,9 @@ describe('ServicesCounselingEditShipmentDetails component', () => { await userEvent.click(saveButton); - await waitFor(() => { - expect( - screen.getByText('Something went wrong, and your changes were not saved. Please try again.'), - ).toBeVisible(); - }); + expect( + await screen.findByText('Something went wrong, and your changes were not saved. Please try again.'), + ).toBeVisible(); }); it('routes to the move details page when the cancel button is clicked', async () => { From c2e8da62381abb86ece8ec878ada0e286c32cb64 Mon Sep 17 00:00:00 2001 From: Maria Traskowsky Date: Wed, 4 Sep 2024 16:25:43 +0000 Subject: [PATCH 5/6] Revert "flaky test fix" This reverts commit 49a9c47213d3335d1035bc7409a53bf225446649. --- .../ServicesCounselingEditShipmentDetails.test.jsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/pages/Office/ServicesCounselingEditShipmentDetails/ServicesCounselingEditShipmentDetails.test.jsx b/src/pages/Office/ServicesCounselingEditShipmentDetails/ServicesCounselingEditShipmentDetails.test.jsx index 0532d35b1d5..de1ac1b0ead 100644 --- a/src/pages/Office/ServicesCounselingEditShipmentDetails/ServicesCounselingEditShipmentDetails.test.jsx +++ b/src/pages/Office/ServicesCounselingEditShipmentDetails/ServicesCounselingEditShipmentDetails.test.jsx @@ -324,9 +324,11 @@ describe('ServicesCounselingEditShipmentDetails component', () => { await userEvent.click(saveButton); - expect( - await screen.findByText('Something went wrong, and your changes were not saved. Please try again.'), - ).toBeVisible(); + await waitFor(() => { + expect( + screen.getByText('Something went wrong, and your changes were not saved. Please try again.'), + ).toBeVisible(); + }); }); it('routes to the move details page when the cancel button is clicked', async () => { From 19ec6a12d3e9755ce355f01d42305c9f930a3399 Mon Sep 17 00:00:00 2001 From: Maria Traskowsky Date: Thu, 5 Sep 2024 14:12:37 +0000 Subject: [PATCH 6/6] return null instead of empty div --- .../Office/PaymentRequestCard/PaymentRequestCard.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Office/PaymentRequestCard/PaymentRequestCard.jsx b/src/components/Office/PaymentRequestCard/PaymentRequestCard.jsx index c6316d20230..88ab4ab916d 100644 --- a/src/components/Office/PaymentRequestCard/PaymentRequestCard.jsx +++ b/src/components/Office/PaymentRequestCard/PaymentRequestCard.jsx @@ -292,7 +292,7 @@ const PaymentRequestCard = ({
); } - return
; + return null; }; const renderPaymentRequestDetailsForStatus = (paymentRequestStatus) => { @@ -366,7 +366,7 @@ const PaymentRequestCard = ({
); } - return
; + return null; }; return (