Skip to content

Commit

Permalink
Fixed: discrepacny in state updation of void label shipments (hotwax#786
Browse files Browse the repository at this point in the history
)
  • Loading branch information
amansinghbais committed Sep 25, 2024
1 parent e404388 commit 47875e5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/services/OrderService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,9 @@ const fetchShipmentPackages = async (shipmentIds: Array<string>, isTrackingRequi
if(!isTrackingRequired) {
trackingCodeFilters = {
"trackingCode_op": "empty",
"trackingCode_grp": "1",
"fetchShipmentPackages_op": "SHRSCS_VOIDED",
"fetchShipmentPackages_grp": "2"
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/store/modules/order/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ const actions: ActionTree<OrderState, RootState> = {
}, []);

// If there is any shipment package with missing tracking code, retry shipping label
const missingLabelImage = this.state.util.productStoreShipmentMethCount > 0 ? currentShipmentPackages.some((shipmentPackage:any) => shipmentPackage.trackingCode === null) : false;
const missingLabelImage = this.state.util.productStoreShipmentMethCount > 0 ? currentShipmentPackages.some((shipmentPackage:any) => shipmentPackage.trackingCode === null || shipmentPackage.trackingCode === '') : false;

return {
...order,
Expand Down
11 changes: 10 additions & 1 deletion src/store/modules/orderLookup/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ const actions: ActionTree<OrderLookupState, RootState> = {
return orderSegmentInfo
}, {}) : []

let orderShipmentPackages = []
let orderShipmentPackages = [] as any
const shipmentIds = Object.values(orderRouteSegmentInfo).flatMap((routes: any) => routes.map((route: any) => route.shipmentId));

try {
Expand All @@ -359,6 +359,15 @@ const actions: ActionTree<OrderLookupState, RootState> = {
return shipment;
}, {});

Object.values(orderRouteSegmentInfo).map((segments: any) => {
segments.map((segment: any) => {
const currentPackage = orderShipmentPackages.find((shipmentPackage: any) => shipmentPackage.shipmentId === segment.shipmentId)
if(currentPackage && currentPackage.carrierServiceStatusId === "SHRSCS_VOIDED") {
segment.trackingIdNumber = ""
}
})
})

order["shipmentPackages"] = shipmentPackages;
const carrierPartyIds = [] as any;

Expand Down

0 comments on commit 47875e5

Please sign in to comment.