Skip to content

Commit e612b90

Browse files
Merge pull request #14320 from transcom/MAIN-B-21415-Prime-Sim-update-for-payment-requests
MAIN - B-21415 Prime Sim update for payment requests
2 parents 01dbbe5 + b054e4f commit e612b90

File tree

5 files changed

+122
-3
lines changed

5 files changed

+122
-3
lines changed

pkg/payment_request/service_param_value_lookups/service_param_value_lookups.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ func ServiceParamLookupInitialize(
134134
var serviceItemDimensions models.MTOServiceItemDimensions
135135

136136
switch mtoServiceItem.ReService.Code {
137-
case models.ReServiceCodeDCRT, models.ReServiceCodeDUCRT, models.ReServiceCodeDCRTSA:
137+
case models.ReServiceCodeDCRT, models.ReServiceCodeDUCRT, models.ReServiceCodeDCRTSA, models.ReServiceCodeICRT, models.ReServiceCodeIUCRT:
138138
err := appCtx.DB().Load(&mtoServiceItem, "Dimensions")
139139
if err != nil {
140140
return nil, err

pkg/services/move_task_order/move_task_order_fetcher.go

+6
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,12 @@ func (f moveTaskOrderFetcher) FetchMoveTaskOrder(appCtx appcontext.AppContext, s
280280
if loadErr != nil {
281281
return &models.Move{}, apperror.NewQueryError("CustomerContacts", loadErr, "")
282282
}
283+
} else if serviceItem.ReService.Code == models.ReServiceCodeICRT || // use address.isOconus to get 'market' value for intl crating
284+
serviceItem.ReService.Code == models.ReServiceCodeIUCRT {
285+
loadErr := appCtx.DB().Load(&mto.MTOServiceItems[i], "MTOShipment.PickupAddress", "MTOShipment.DestinationAddress")
286+
if loadErr != nil {
287+
return &models.Move{}, apperror.NewQueryError("MTOShipment.PickupAddress, MTOShipment.DestinationAddress", loadErr, "")
288+
}
283289
}
284290

285291
loadedServiceItems = append(loadedServiceItems, mto.MTOServiceItems[i])

pkg/services/move_task_order/move_task_order_fetcher_test.go

+37
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,38 @@ func (suite *MoveTaskOrderServiceSuite) TestMoveTaskOrderFetcher() {
238238
},
239239
},
240240
}, nil)
241+
factory.BuildMTOServiceItemBasic(suite.DB(), []factory.Customization{
242+
{
243+
Model: models.MTOServiceItem{
244+
Status: models.MTOServiceItemStatusApproved,
245+
},
246+
},
247+
{
248+
Model: expectedMTO,
249+
LinkOnly: true,
250+
},
251+
{
252+
Model: models.ReService{
253+
Code: models.ReServiceCodeICRT,
254+
},
255+
},
256+
}, nil)
257+
factory.BuildMTOServiceItemBasic(suite.DB(), []factory.Customization{
258+
{
259+
Model: models.MTOServiceItem{
260+
Status: models.MTOServiceItemStatusApproved,
261+
},
262+
},
263+
{
264+
Model: expectedMTO,
265+
LinkOnly: true,
266+
},
267+
{
268+
Model: models.ReService{
269+
Code: models.ReServiceCodeIUCRT,
270+
},
271+
},
272+
}, nil)
241273
serviceRequestDocumentUpload := factory.BuildServiceRequestDocumentUpload(suite.DB(), []factory.Customization{
242274
{
243275
Model: serviceItemBasic,
@@ -275,6 +307,11 @@ func (suite *MoveTaskOrderServiceSuite) TestMoveTaskOrderFetcher() {
275307
found = true
276308
break
277309
}
310+
if serviceItem.ReService.Code == models.ReServiceCodeICRT || serviceItem.ReService.Code == models.ReServiceCodeIUCRT {
311+
suite.NotNil(serviceItem.MTOShipment.PickupAddress)
312+
suite.NotNil(serviceItem.MTOShipment.DestinationAddress)
313+
break
314+
}
278315
}
279316
// Verify that the expected service item was found
280317
suite.True(found, "Expected service item with ReServiceCodeDDFSIT not found")

src/components/PrimeUI/ServiceItem/ServiceItem.jsx

+41-2
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@ import React from 'react';
33
import descriptionListStyles from '../../../styles/descriptionList.module.scss';
44
import { MTOServiceItemShape } from '../../../types';
55

6-
import { SERVICE_ITEMS_ALLOWED_WEIGHT_BILLED_PARAM } from 'constants/serviceItems';
6+
import { SERVICE_ITEMS_ALLOWED_WEIGHT_BILLED_PARAM, SERVICE_ITEM_CODES } from 'constants/serviceItems';
7+
import { convertFromThousandthInchToInch } from 'utils/formatters';
78

89
const ServiceItem = ({ serviceItem, mtoShipment }) => {
910
return (
1011
<dl className={descriptionListStyles.descriptionList}>
11-
<h3>{serviceItem.reServiceName}</h3>
12+
<h3>
13+
{serviceItem.reServiceName} {serviceItem.standaloneCrate && '- Standalone'}
14+
</h3>
1215
<div className={descriptionListStyles.row}>
1316
<dt>Status:</dt>
1417
<dd>{serviceItem.status}</dd>
@@ -35,6 +38,42 @@ const ServiceItem = ({ serviceItem, mtoShipment }) => {
3538
<dd>{mtoShipment.primeActualWeight || 'Not provided'}</dd>
3639
</div>
3740
)}
41+
{(serviceItem.reServiceCode === SERVICE_ITEM_CODES.ICRT ||
42+
serviceItem.reServiceCode === SERVICE_ITEM_CODES.IUCRT ||
43+
serviceItem.reServiceCode === SERVICE_ITEM_CODES.DCRT ||
44+
serviceItem.reServiceCode === SERVICE_ITEM_CODES.DUCRT) && (
45+
<>
46+
<div className={descriptionListStyles.row}>
47+
<dt>Item Size:</dt>
48+
<dd>
49+
{convertFromThousandthInchToInch(serviceItem.item?.length)}&quot; x&nbsp;
50+
{convertFromThousandthInchToInch(serviceItem.item?.width)}&quot; x&nbsp;
51+
{convertFromThousandthInchToInch(serviceItem.item?.height)}&quot;
52+
</dd>
53+
</div>
54+
<div className={descriptionListStyles.row}>
55+
<dt>Crate Size:</dt>
56+
<dd>
57+
{convertFromThousandthInchToInch(serviceItem.crate?.length)}&quot; x&nbsp;
58+
{convertFromThousandthInchToInch(serviceItem.crate?.width)}&quot; x&nbsp;
59+
{convertFromThousandthInchToInch(serviceItem.crate?.height)}&quot;
60+
</dd>
61+
</div>
62+
</>
63+
)}
64+
{(serviceItem.reServiceCode === SERVICE_ITEM_CODES.ICRT ||
65+
serviceItem.reServiceCode === SERVICE_ITEM_CODES.IUCRT) && (
66+
<>
67+
<div className={descriptionListStyles.row}>
68+
<dt>External Crate:</dt>
69+
<dd>{serviceItem.externalCrate ? 'Yes' : 'No'}</dd>
70+
</div>
71+
<div className={descriptionListStyles.row}>
72+
<dt>Market:</dt>
73+
<dd>{serviceItem.market || 'Not provided'}</dd>
74+
</div>
75+
</>
76+
)}
3877
</dl>
3978
);
4079
};

src/components/PrimeUI/ServiceItem/ServiceItem.test.jsx

+37
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,26 @@ const mockSITServiceItem = {
2020
eTag: 'abc123',
2121
};
2222

23+
const mockCratingServiceItem = {
24+
reServiceName: 'Test Service',
25+
status: 'APPROVED',
26+
id: '456',
27+
reServiceCode: 'ICRT',
28+
eTag: 'abc123',
29+
item: {
30+
height: 33,
31+
length: 33,
32+
width: 33,
33+
},
34+
crate: {
35+
height: 44,
36+
length: 44,
37+
width: 44,
38+
},
39+
market: 'OCONUS',
40+
externalCrate: true,
41+
};
42+
2343
const mockMtoShipment = {
2444
primeActualWeight: 500,
2545
};
@@ -52,4 +72,21 @@ describe('ServiceItem Component', () => {
5272
expect(getByText('eTag:')).toBeInTheDocument();
5373
expect(getByText('Shipment Weight (pounds):')).toBeInTheDocument();
5474
});
75+
76+
it.each([
77+
{ reServiceCode: 'ICRT', description: 'international crating service item' },
78+
{ reServiceCode: 'IUCRT', description: 'international uncrating service item' },
79+
])('renders info for international crate service item', ({ reServiceCode }) => {
80+
const { getByText } = render(
81+
<ServiceItem serviceItem={{ ...mockCratingServiceItem, reServiceCode }} mtoShipment={mockMtoShipment} />,
82+
);
83+
expect(getByText('Item Size:')).toBeInTheDocument();
84+
expect(getByText('0.033" x 0.033" x 0.033"')).toBeInTheDocument();
85+
expect(getByText('Crate Size:')).toBeInTheDocument();
86+
expect(getByText('0.044" x 0.044" x 0.044"')).toBeInTheDocument();
87+
expect(getByText('External Crate:')).toBeInTheDocument();
88+
expect(getByText('Yes')).toBeInTheDocument();
89+
expect(getByText('Market:')).toBeInTheDocument();
90+
expect(getByText('OCONUS')).toBeInTheDocument();
91+
});
5592
});

0 commit comments

Comments
 (0)