Skip to content

Commit

Permalink
Revert "fix: fix abort callback" (#1109)
Browse files Browse the repository at this point in the history
Revert "fix: fix abort callback (#1106)"

This reverts commit b6e9e2b.
  • Loading branch information
vijayg10 authored Sep 17, 2024
1 parent b6e9e2b commit 99d94df
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/domain/position/abort.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ const processPositionAbortBin = async (
accumulatedTransferStatesCopy[positionChangeToBeProcessed.transferId] = transferStateId
}
binItem.result = { success: true }
const from = binItem.message.value.from
cyrilResult.positionChanges[positionChangeIndex].isDone = true
const nextIndex = cyrilResult.positionChanges.findIndex(positionChange => !positionChange.isDone)
if (nextIndex === -1) {
Expand All @@ -92,11 +91,11 @@ const processPositionAbortBin = async (
for (const positionChange of cyrilResult.positionChanges) {
if (positionChange.isFxTransferStateChange) {
// Construct notification message for fx transfer state change
const resultMessage = _constructAbortResultMessage(binItem, positionChange.commitRequestId, from, positionChange.notifyTo)
const resultMessage = _constructAbortResultMessage(binItem, positionChange.commitRequestId, Config.HUB_NAME, positionChange.notifyTo)
resultMessages.push({ binItem, message: resultMessage })
} else {
// Construct notification message for transfer state change
const resultMessage = _constructAbortResultMessage(binItem, positionChange.transferId, from, positionChange.notifyTo)
const resultMessage = _constructAbortResultMessage(binItem, positionChange.transferId, Config.HUB_NAME, positionChange.notifyTo)
resultMessages.push({ binItem, message: resultMessage })
}
}
Expand Down Expand Up @@ -128,9 +127,7 @@ const processPositionAbortBin = async (

const _constructAbortResultMessage = (binItem, id, from, notifyTo) => {
let apiErrorCode = ErrorHandler.Enums.FSPIOPErrorCodes.PAYEE_REJECTION
let fromCalculated = from
if (binItem.message?.value.metadata.event.action === Enum.Events.Event.Action.FX_ABORT_VALIDATION || binItem.message?.value.metadata.event.action === Enum.Events.Event.Action.ABORT_VALIDATION) {
fromCalculated = Config.HUB_NAME
if (binItem.message?.value.metadata.event.action === Enum.Events.Event.Action.FX_ABORT_VALIDATION) {
apiErrorCode = ErrorHandler.Enums.FSPIOPErrorCodes.VALIDATION_ERROR
}
const fspiopError = ErrorHandler.Factory.createFSPIOPError(
Expand All @@ -156,8 +153,8 @@ const _constructAbortResultMessage = (binItem, id, from, notifyTo) => {
)
const resultMessage = Utility.StreamingProtocol.createMessage(
id,
from,
notifyTo,
fromCalculated,
metadata,
binItem.message.value.content.headers, // Headers don't really matter here. ml-api-adapter will ignore them and create their own.
fspiopError,
Expand Down

0 comments on commit 99d94df

Please sign in to comment.