Skip to content

Commit

Permalink
on_update fulfillment deliveryObj and location,id check
Browse files Browse the repository at this point in the history
  • Loading branch information
Jagannath-Padhy committed May 3, 2024
1 parent 8377ead commit d1d0e84
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
2 changes: 1 addition & 1 deletion schema/Retail/Update/on_update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ export const onUpdateSchema = {
required: ['locality', 'city', 'area_code', 'state'],
},
},
required: ['id', 'gps', 'address'],
required: ['gps', 'address'],
},
time: {
type: 'object',
Expand Down
32 changes: 31 additions & 1 deletion utils/Retail/Update/onUpdate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,38 @@ export const checkOnUpdate = (data: any, msgIdSet: any, apiSeq: any, settlementD
logger.error(`Error while checking for item IDs for /${apiSeq}, ${error.stack}`)
}

// Compare return_request object
try {
// For Delivery Object
const DELobj = _.filter(on_update.fulfillments, { type: 'Delivery' })
let del_start_location: any = {}
if (!DELobj.length) {
logger.error(`Delivery object is mandatory for ${apiSeq}`)
const key = `missingDelivery`
onupdtObj[key] = `Delivery object is mandatory for ${apiSeq}`
} else {
// Checking for start object inside Delivery
if (!_.isEmpty(DELobj[0]?.start)) {
const del_obj_start = DELobj[0]?.start
if (!_.isEmpty(del_obj_start?.location)) {
del_start_location = del_obj_start.location
if (!del_start_location.id) {
onupdtObj['Delivery.start.location.id'] = `Delivery fulfillment start location id is missing in ${apiSeq}`
}
}
else {
onupdtObj['Delivery.start.location'] = `Delivery fulfillment start location object is missing in ${apiSeq}`
logger.error(`Delivery fulfillment start location is missing in ${apiSeq}`)
}
} else {
onupdtObj['DeliveryFulfillment.start'] = `Delivery fulfillment start object is missing in ${apiSeq}`
}
}
} catch (error: any) {
logger.error(`Error while checking Fulfillments Delivery Obj in /${apiSeq}, ${error.stack}`)
}


// Compare return_request object
if (flow === '6-b') {
// Checking for quote_trail price and item quote price
try {
Expand Down

0 comments on commit d1d0e84

Please sign in to comment.