diff --git a/src/handlers/notification/index.js b/src/handlers/notification/index.js index a5461516..c5807e26 100644 --- a/src/handlers/notification/index.js +++ b/src/handlers/notification/index.js @@ -146,9 +146,9 @@ const processMessage = async (msg) => { } else if (action.toLowerCase() === 'commit' && status.toLowerCase() === 'success') { let callbackURLFrom = await Participant.getEndpoint(from, FSPIOP_CALLBACK_URL_TRANSFER_PUT, id) let callbackURLTo = await Participant.getEndpoint(to, FSPIOP_CALLBACK_URL_TRANSFER_PUT, id) - headers = Object.assign({}, content.headers, { 'FSPIOP-Destination': from }) + headers = Object.assign({}, content.headers, { 'FSPIOP-Destination': from }, { 'FSPIOP-Source': to }) await Callback.sendCallback(callbackURLFrom, 'put', headers, content.payload, id, from) - headers = Object.assign({}, content.headers, { 'FSPIOP-Destination': to }) + headers = Object.assign({}, content.headers, { 'FSPIOP-Destination': to }, { 'FSPIOP-Source': from }) return Callback.sendCallback(callbackURLTo, 'put', headers, content.payload, id, to) } else if (action.toLowerCase() === 'commit' && status.toLowerCase() !== 'success') { let callbackURL = await Participant.getEndpoint(from, FSPIOP_CALLBACK_URL_TRANSFER_ERROR, id) @@ -156,16 +156,16 @@ const processMessage = async (msg) => { } else if (action.toLowerCase() === 'reject') { let callbackURLFrom = await Participant.getEndpoint(from, FSPIOP_CALLBACK_URL_TRANSFER_PUT, id) let callbackURLTo = await Participant.getEndpoint(to, FSPIOP_CALLBACK_URL_TRANSFER_PUT, id) - headers = Object.assign({}, content.headers, { 'FSPIOP-Destination': from }) + headers = Object.assign({}, content.headers, { 'FSPIOP-Destination': from }, { 'FSPIOP-Source': to }) await Callback.sendCallback(callbackURLFrom, 'put', headers, content.payload, id, from) - headers = Object.assign({}, content.headers, { 'FSPIOP-Destination': to }) + headers = Object.assign({}, content.headers, { 'FSPIOP-Destination': to }, { 'FSPIOP-Source': from }) return Callback.sendCallback(callbackURLTo, 'put', headers, content.payload, id, to) } else if (action.toLowerCase() === 'abort') { let callbackURLFrom = await Participant.getEndpoint(from, FSPIOP_CALLBACK_URL_TRANSFER_ERROR, id) let callbackURLTo = await Participant.getEndpoint(to, FSPIOP_CALLBACK_URL_TRANSFER_ERROR, id) - headers = Object.assign({}, content.headers, { 'FSPIOP-Destination': from }) + headers = Object.assign({}, content.headers, { 'FSPIOP-Destination': from }, { 'FSPIOP-Source': to }) await Callback.sendCallback(callbackURLFrom, 'put', headers, content.payload, id, from) - headers = Object.assign({}, content.headers, { 'FSPIOP-Destination': to }) + headers = Object.assign({}, content.headers, { 'FSPIOP-Destination': to }, { 'FSPIOP-Source': from }) return Callback.sendCallback(callbackURLTo, 'put', headers, content.payload, id, to) } else if (action.toLowerCase() === 'timeout-received') { let callbackURL = await Participant.getEndpoint(from, FSPIOP_CALLBACK_URL_TRANSFER_ERROR, id) diff --git a/test/unit/handlers/notification/index.test.js b/test/unit/handlers/notification/index.test.js index ec840536..a7ffcab8 100644 --- a/test/unit/handlers/notification/index.test.js +++ b/test/unit/handlers/notification/index.test.js @@ -238,8 +238,8 @@ Test('Notification Service tests', notificationTest => { const urlPayer = await Participant.getEndpoint(msg.value.from, FSPIOP_CALLBACK_URL_TRANSFER_PUT, msg.value.id) const urlPayee = await Participant.getEndpoint(msg.value.to, FSPIOP_CALLBACK_URL_TRANSFER_PUT, msg.value.id) const method = 'put' - const headersFrom = { 'FSPIOP-Destination': msg.value.from } - const headersTo = { 'FSPIOP-Destination': msg.value.to } + const headersFrom = { 'FSPIOP-Destination': msg.value.from, 'FSPIOP-Source': msg.value.to } + const headersTo = { 'FSPIOP-Destination': msg.value.to, 'FSPIOP-Source': msg.value.from } const message = {} const expected = 200 @@ -364,8 +364,8 @@ Test('Notification Service tests', notificationTest => { const fromUrl = await Participant.getEndpoint(msg.value.from, FSPIOP_CALLBACK_URL_TRANSFER_PUT, msg.value.id) const toUrl = await Participant.getEndpoint(msg.value.to, FSPIOP_CALLBACK_URL_TRANSFER_PUT, msg.value.id) const method = 'put' - const headersFrom = { 'FSPIOP-Destination': msg.value.from } - const headersTo = { 'FSPIOP-Destination': msg.value.to } + const headersFrom = { 'FSPIOP-Destination': msg.value.from, 'FSPIOP-Source': msg.value.to } + const headersTo = { 'FSPIOP-Destination': msg.value.to, 'FSPIOP-Source': msg.value.from } const message = {} const expected = 200 @@ -405,8 +405,8 @@ Test('Notification Service tests', notificationTest => { const fromUrl = await Participant.getEndpoint(msg.value.from, FSPIOP_CALLBACK_URL_TRANSFER_ERROR, msg.value.id) const toUrl = await Participant.getEndpoint(msg.value.to, FSPIOP_CALLBACK_URL_TRANSFER_ERROR, msg.value.id) const method = 'put' - const headersFrom = { 'FSPIOP-Destination': msg.value.from } - const headersTo = { 'FSPIOP-Destination': msg.value.to } + const headersFrom = { 'FSPIOP-Destination': msg.value.from, 'FSPIOP-Source': msg.value.to } + const headersTo = { 'FSPIOP-Destination': msg.value.to, 'FSPIOP-Source': msg.value.from } const message = {} const expected = 200