Skip to content

Commit

Permalink
Merge branch 'main' into B-20492-Download-Files
Browse files Browse the repository at this point in the history
  • Loading branch information
pambecker authored Sep 20, 2024
2 parents 6bc8f18 + a4faf0c commit fe98efa
Show file tree
Hide file tree
Showing 10 changed files with 211 additions and 145 deletions.
3 changes: 3 additions & 0 deletions pkg/services/invoice/process_edi997.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package invoice

import (
"fmt"
"time"

"github.com/gofrs/uuid"
"go.uber.org/zap"
Expand Down Expand Up @@ -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))
Expand Down
4 changes: 4 additions & 0 deletions pkg/services/invoice/process_edi997_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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() {
Expand Down
78 changes: 26 additions & 52 deletions src/components/Office/PaymentRequestCard/PaymentRequestCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<div data-testid="tppsPaidDetails">
{approvedAmount > 0 && (
Expand All @@ -293,6 +289,20 @@ const PaymentRequestCard = ({
</div>
</div>
)}
</div>
);
}
return null;
};

const renderPaymentRequestDetailsForStatus = (paymentRequestStatus) => {
if (
(paymentRequestStatus === PAYMENT_REQUEST_STATUS.PAID ||
paymentRequestStatus === PAYMENT_REQUEST_STATUS.EDI_ERROR) &&
tppsInvoiceSellerPaidDate
) {
return (
<div data-testid="tppsPaidDetails">
{tppsInvoiceAmountPaidTotalMillicents > 0 && (
<div className={styles.amountAccepted}>
<FontAwesomeIcon icon="check" />
Expand All @@ -313,67 +323,28 @@ const PaymentRequestCard = ({
) {
return (
<div>
{approvedAmount > 0 && (
{paymentRequest.receivedByGexAt && (
<div className={styles.amountAccepted}>
<FontAwesomeIcon icon="check" />
<div>
<div data-testid="tppsReceivedDetailsDollarAmountTotal">
<h2>{toDollarString(formatCents(approvedAmount))}</h2>
<span>Received</span>
<span> on {formatDateFromIso(paymentRequest.receivedByGexAt, 'DD MMM YYYY')}</span>
</div>
</div>
)}
{rejectedAmount > 0 && (
<div className={styles.amountRejected}>
<FontAwesomeIcon icon="times" />
<div>
<h2>{toDollarString(formatCents(rejectedAmount))}</h2>
<span>Rejected</span>
<span>TPPS Received</span>
<span> on {formatDateFromIso(paymentRequest.receivedByGexAt, 'DD MMM YYYY')}</span>
</div>
</div>
)}
</div>
);
}
if (
paymentRequestStatus === PAYMENT_REQUEST_STATUS.REVIEWED ||
paymentRequestStatus === PAYMENT_REQUEST_STATUS.REVIEWED_AND_ALL_SERVICE_ITEMS_REJECTED ||
paymentRequestStatus === PAYMENT_REQUEST_STATUS.EDI_ERROR
) {
return (
<div>
{approvedAmount > 0 && (
<div className={styles.amountAccepted}>
<FontAwesomeIcon icon="check" />
<div>
<h2>{toDollarString(formatCents(approvedAmount))}</h2>
<span>Accepted</span>
<span> on {formatDateFromIso(paymentRequest.reviewedAt, 'DD MMM YYYY')}</span>
</div>
</div>
)}
{rejectedAmount > 0 && (
<div className={styles.amountRejected}>
<FontAwesomeIcon icon="times" />
<div>
<h2>{toDollarString(formatCents(rejectedAmount))}</h2>
<span>Rejected</span>
<span> on {formatDateFromIso(paymentRequest.reviewedAt, 'DD MMM YYYY')}</span>
</div>
</div>
)}
</div>
);
}

if (
paymentRequestStatus === PAYMENT_REQUEST_STATUS.SENT_TO_GEX ||
(paymentRequestStatus === PAYMENT_REQUEST_STATUS.EDI_ERROR && approvedAmount > 0)
) {
return (
<div className={styles.amountAccepted} data-testid="sentToGexDetails">
<FontAwesomeIcon icon="check" />
<div>
<div data-testid="sentToGexDetailsDollarAmountTotal">
<h2>{toDollarString(formatCents(approvedAmount))}</h2>
<span>Sent to GEX </span>
<span data-testid="sentToGexDate">
Expand All @@ -395,7 +366,7 @@ const PaymentRequestCard = ({
</div>
);
}
return <div />;
return null;
};

return (
Expand All @@ -420,7 +391,10 @@ const PaymentRequestCard = ({
</span>
</div>
<div className={styles.totalReviewed}>
<div>{paymentRequest.status && renderPaymentRequestDetailsForStatus(paymentRequest.status)}</div>
<div>
{paymentRequest.status && renderApprovedRejectedPaymentRequestDetails(paymentRequest)}
{paymentRequest.status && renderPaymentRequestDetailsForStatus(paymentRequest.status)}
</div>
{paymentRequest.status === PAYMENT_REQUEST_STATUS.PENDING && renderReviewServiceItemsBtnForTIOandTOO()}
</div>
{ediErrorsExistForPaymentRequest && renderEDIErrorDetails()}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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', () => {
Expand Down Expand Up @@ -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',
Expand All @@ -681,6 +690,16 @@ describe('PaymentRequestCard', () => {
</MockProviders>,
);
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', () => {
Expand Down
9 changes: 2 additions & 7 deletions src/components/Table/SearchResultsTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,7 @@ import DateSelectFilter from 'components/Table/Filters/DateSelectFilter';
import LoadingPlaceholder from 'shared/LoadingPlaceholder';
import SomethingWentWrong from 'shared/SomethingWentWrong';
import TextBoxFilter from 'components/Table/Filters/TextBoxFilter';
import {
BRANCH_OPTIONS_WITH_MARINE_CORPS,
MOVE_STATUS_LABELS,
SEARCH_QUEUE_STATUS_FILTER_OPTIONS,
SortShape,
} from 'constants/queues';
import { BRANCH_OPTIONS, MOVE_STATUS_LABELS, SEARCH_QUEUE_STATUS_FILTER_OPTIONS, SortShape } from 'constants/queues';
import { DATE_FORMAT_STRING } from 'shared/constants';
import { formatDateFromIso, serviceMemberAgencyLabel } from 'utils/formatters';
import MultiSelectCheckBoxFilter from 'components/Table/Filters/MultiSelectCheckBoxFilter';
Expand Down Expand Up @@ -107,7 +102,7 @@ const moveSearchColumns = (moveLockFlag, handleEditProfileClick) => [
isFilterable: true,
Filter: (props) => (
// eslint-disable-next-line react/jsx-props-no-spreading
<SelectFilter options={BRANCH_OPTIONS_WITH_MARINE_CORPS} {...props} />
<SelectFilter options={BRANCH_OPTIONS} {...props} />
),
},
),
Expand Down
9 changes: 0 additions & 9 deletions src/constants/queues.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,6 @@ export const BRANCH_OPTIONS = [
{ value: 'AIR_FORCE', label: 'Air Force' },
{ value: 'COAST_GUARD', label: 'Coast Guard' },
{ value: 'SPACE_FORCE', label: 'Space Force' },
];

export const BRANCH_OPTIONS_WITH_MARINE_CORPS = [
{ value: '', label: 'All' },
{ value: 'ARMY', label: 'Army' },
{ value: 'NAVY', label: 'Navy' },
{ value: 'AIR_FORCE', label: 'Air Force' },
{ value: 'COAST_GUARD', label: 'Coast Guard' },
{ value: 'SPACE_FORCE', label: 'Space Force' },
{ value: 'MARINES', label: 'Marine Corps' },
];

Expand Down
2 changes: 1 addition & 1 deletion src/pages/Office/MoveQueue/MoveQueue.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { getMovesQueue } from 'services/ghcApi';
import { formatDateFromIso, serviceMemberAgencyLabel } from 'utils/formatters';
import MultiSelectCheckBoxFilter from 'components/Table/Filters/MultiSelectCheckBoxFilter';
import SelectFilter from 'components/Table/Filters/SelectFilter';
import { BRANCH_OPTIONS, MOVE_STATUS_OPTIONS, GBLOC, MOVE_STATUS_LABELS } from 'constants/queues';
import { MOVE_STATUS_OPTIONS, GBLOC, MOVE_STATUS_LABELS, BRANCH_OPTIONS } from 'constants/queues';
import TableQueue from 'components/Table/TableQueue';
import LoadingPlaceholder from 'shared/LoadingPlaceholder';
import SomethingWentWrong from 'shared/SomethingWentWrong';
Expand Down
Loading

0 comments on commit fe98efa

Please sign in to comment.