diff --git a/utilities/log-validation-utility/utils/retail/retOnInit.js b/utilities/log-validation-utility/utils/retail/retOnInit.js index ea346bd..8e67fdf 100644 --- a/utilities/log-validation-utility/utils/retail/retOnInit.js +++ b/utilities/log-validation-utility/utils/retail/retOnInit.js @@ -150,7 +150,7 @@ const checkOnInit = (dirPath, msgIdSet) => { let itemkey = `item_FFErr${i}`; onInitObj[ itemkey - ] = `items[${i}].fulfillment_id mismatches for Item ${itemId}} in /${constants.RET_ONSELECT} and /${constants.RET_ONINIT}`; + ] = `items[${i}].fulfillment_id mismatches for Item ${itemId} in /${constants.RET_ONSELECT} and /${constants.RET_ONINIT}`; } } else { let itemkey = `item_FFErr${i}`; @@ -177,9 +177,13 @@ const checkOnInit = (dirPath, msgIdSet) => { ); const billing = dao.getValue("billing"); - if (utils.isObjectEqual(billing, on_init.billing).length>0) { - const billingMismatch= utils.isObjectEqual(billing, on_init.billing); - onInitObj.bill = `${billingMismatch.join(", ")} mismatches in /billing in /${constants.RET_INIT} and /${constants.RET_ONINIT}`; + if (utils.isObjectEqual(billing, on_init.billing).length > 0) { + const billingMismatch = utils.isObjectEqual(billing, on_init.billing); + onInitObj.bill = `${billingMismatch.join( + ", " + )} mismatches in /billing in /${constants.RET_INIT} and /${ + constants.RET_ONINIT + }`; } } catch (error) { logger.error( diff --git a/utilities/log-validation-utility/utils/retail/retOnSelect.js b/utilities/log-validation-utility/utils/retail/retOnSelect.js index da571d2..3cada93 100644 --- a/utilities/log-validation-utility/utils/retail/retOnSelect.js +++ b/utilities/log-validation-utility/utils/retail/retOnSelect.js @@ -338,7 +338,7 @@ const checkOnSelect = (dirPath, msgIdSet) => { } if (["tax", "discount", "packing", "misc"].includes(titleType)) { if (parseFloat(element.price.value) == 0) { - let key = `breakupItem${titletype}`; + let key = `breakupItem${titleType}`; onSlctObj[ key ] = `${titleType} line item should not be present if price=0`; diff --git a/utilities/log-validation-utility/utils/retail/retOnUpdate.js b/utilities/log-validation-utility/utils/retail/retOnUpdate.js index 1bc1d22..0e56d51 100644 --- a/utilities/log-validation-utility/utils/retail/retOnUpdate.js +++ b/utilities/log-validation-utility/utils/retail/retOnUpdate.js @@ -376,9 +376,11 @@ const checkOnUpdate = (msgIdSet, on_update, state) => { //Checking if item can be updated? (if update_type is return, fulfillment state should be Order-delivered ) let itemff = on_update.fulfillments.find( - (ff) => ff.id === itemFulfillmentId + (ff) => ff.id === itemFulfillmentId && ff.type === "Delivery" ); + if ( + itemff && itemff.type === "Delivery" && itemff.state.descriptor.code != "Order-delivered" ) { @@ -479,7 +481,7 @@ const checkOnUpdate = (msgIdSet, on_update, state) => { } if (_.gte(on_update.created_at, on_update.updated_at)) { - onStatObj.ordrTmstmp = `order created_at timestamp must always be earlier than the updated_at timestamp`; + onUpdtObj.ordrTmstmp = `order created_at timestamp must always be earlier than the updated_at timestamp`; } } catch (error) { logger.error( diff --git a/utilities/log-validation-utility/utils/retail/retUpdate.js b/utilities/log-validation-utility/utils/retail/retUpdate.js index d7adf44..58ceac3 100644 --- a/utilities/log-validation-utility/utils/retail/retUpdate.js +++ b/utilities/log-validation-utility/utils/retail/retUpdate.js @@ -73,11 +73,11 @@ const checkUpdate = (dirPath, msgIdSet) => { `Comparing transaction Ids of /${constants.RET_SELECT} and /${constants.RET_UPDATE}` ); if (!_.isEqual(dao.getValue("txnId"), update.context.transaction_id)) { - statObj.txnId = `Transaction Id should be same from /${constants.RET_SELECT} onwards`; + updtObj.txnId = `Transaction Id should be same from /${constants.RET_SELECT} onwards`; } } catch (error) { logger.error( - `!!Error while comparing transaction ids for /${constants.RET_SELECT} and /${constants.RET_UPDATE} api` + `!!Error while comparing transaction ids for /${constants.RET_SELECT} and /${constants.RET_UPDATE} api, ${error.stack}` ); } try {