From 0c246fc89ca240eb997d126fcdd0f63c80bb5fa4 Mon Sep 17 00:00:00 2001 From: Steven Oderayi Date: Thu, 16 Jul 2020 12:24:55 +0100 Subject: [PATCH] Fix notification error (#39) --- package-lock.json | 43 +++++++++++++++++++++++++----- package.json | 4 +-- src/handlers/notification/index.js | 6 ++--- 3 files changed, 40 insertions(+), 13 deletions(-) diff --git a/package-lock.json b/package-lock.json index f3f883b..ffe42f4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@mojaloop/bulk-api-adapter", - "version": "10.6.0", + "version": "10.6.1", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1004,9 +1004,9 @@ } }, "@jsdevtools/ono": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/@jsdevtools/ono/-/ono-7.1.2.tgz", - "integrity": "sha512-qS/a24RA5FEoiJS9wiv6Pwg2c/kiUo3IVUQcfeM9JvsR6pM8Yx+yl/6xWYLckZCT5jpLNhslgjiA8p/XcGyMRQ==" + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/@jsdevtools/ono/-/ono-7.1.3.tgz", + "integrity": "sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==" }, "@korzio/djv-draft-04": { "version": "2.0.1", @@ -1290,6 +1290,35 @@ "@hapi/bourne": "2.x.x", "@hapi/hoek": "9.x.x" } + }, + "@mojaloop/central-services-shared": { + "version": "10.6.1", + "resolved": "https://registry.npmjs.org/@mojaloop/central-services-shared/-/central-services-shared-10.6.1.tgz", + "integrity": "sha512-xUGiZgrpRW9uWshHHmHm3ecvJtJrJNv8BlYcbV9vo+1M5a5336WLd97Zwe/2/o9DwYyCFuNMjz/7JS6tfYEoUw==", + "requires": { + "@hapi/catbox": "11.1.0", + "@hapi/catbox-memory": "5.0.0", + "@mojaloop/central-services-error-handling": "10.6.0", + "@mojaloop/central-services-logger": "10.6.0", + "@mojaloop/central-services-metrics": "9.5.0", + "@mojaloop/event-sdk": "10.6.0", + "ajv": "6.12.3", + "ajv-keywords": "3.5.1", + "axios": "0.19.2", + "base64url": "3.0.1", + "clone": "2.1.2", + "data-urls": "2.0.0", + "immutable": "3.8.2", + "lodash": "4.17.19", + "mustache": "4.0.1", + "openapi-backend": "3.5.1", + "raw-body": "2.4.1" + } + }, + "immutable": { + "version": "3.8.2", + "resolved": "https://registry.npmjs.org/immutable/-/immutable-3.8.2.tgz", + "integrity": "sha1-wkOZUUVbs5kT2vKBN28VMOEErfM=" } } }, @@ -1312,9 +1341,9 @@ } }, "@mojaloop/central-services-shared": { - "version": "10.6.1", - "resolved": "https://registry.npmjs.org/@mojaloop/central-services-shared/-/central-services-shared-10.6.1.tgz", - "integrity": "sha512-xUGiZgrpRW9uWshHHmHm3ecvJtJrJNv8BlYcbV9vo+1M5a5336WLd97Zwe/2/o9DwYyCFuNMjz/7JS6tfYEoUw==", + "version": "10.6.2", + "resolved": "https://registry.npmjs.org/@mojaloop/central-services-shared/-/central-services-shared-10.6.2.tgz", + "integrity": "sha512-16fEcpaB0dYt+2acYJOtm95IQEtkXDgZSucHAYgZcqrpH6C7Tx9SmMJ/smXR6fDg88uIB6Hs9J4zE/61BhlFlw==", "requires": { "@hapi/catbox": "11.1.0", "@hapi/catbox-memory": "5.0.0", diff --git a/package.json b/package.json index 2ada6c5..2ded5f9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@mojaloop/bulk-api-adapter", - "version": "10.6.0", + "version": "10.6.1", "description": "Mojaloop Bulk API Adapter", "license": "Apache-2.0", "author": "ModusBox", @@ -28,7 +28,7 @@ "@mojaloop/central-services-health": "10.6.0", "@mojaloop/central-services-logger": "10.6.0", "@mojaloop/central-services-metrics": "9.5.0", - "@mojaloop/central-services-shared": "10.6.1", + "@mojaloop/central-services-shared": "10.6.2", "@mojaloop/central-services-stream": "10.6.0", "@mojaloop/event-sdk": "10.6.0", "@now-ims/hapi-now-auth": "2.0.2", diff --git a/src/handlers/notification/index.js b/src/handlers/notification/index.js index 0d1194b..c6f5223 100644 --- a/src/handlers/notification/index.js +++ b/src/handlers/notification/index.js @@ -231,12 +231,10 @@ const processMessage = async (msg, span) => { if (actionLower === ENUM.Events.Event.Action.BULK_GET && statusLower === ENUM.Events.EventStatus.SUCCESS.status) { const responsePayload = JSON.parse(payloadForCallback) - id = responsePayload.bulkTransferId + id = responsePayload.bulkTransferId || content.uriParams.id delete responsePayload.bulkTransferId const callbackURLTo = await Participant.getEndpoint(to, ENUM.EndPoints.FspEndpointTypes.FSPIOP_CALLBACK_URL_BULK_TRANSFER_PUT, id) - const bulkResponseMessage = await BulkTransfer.getBulkTransferResultByMessageIdDestination(messageId, to) - responsePayload.individualTransferResults = bulkResponseMessage.individualTransferResults - callbackHeaders = createCallbackHeaders({ dfspId: to, transferId: id, headers: content.headers, httpMethod: ENUM.Http.RestMethods.PUT, endpointTemplate: ENUM.EndPoints.FspEndpointTemplates.BULK_TRANSFERS_PUT }) + callbackHeaders = createCallbackHeaders({ dfspId: to, bulkTransferId: id, headers: content.headers, httpMethod: ENUM.Http.RestMethods.PUT, endpointTemplate: ENUM.EndPoints.FspEndpointTemplates.BULK_TRANSFERS_PUT }) Logger.debug(`Notification::processMessage - Callback.sendRequest(${callbackURLTo}, ${ENUM.Http.RestMethods.PUT}, ${JSON.stringify(callbackHeaders)}, ${JSON.stringify(responsePayload)}, ${id}, ${from}, ${to})`) return Util.Request.sendRequest(callbackURLTo, callbackHeaders, from, to, ENUM.Http.RestMethods.PUT, responsePayload) }