@mojaloop/central-ledger 16.3.1-snapshot.0 → 16.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/package.json +3 -3
- package/src/handlers/bulk/fulfil/handler.js +7 -2
- package/src/handlers/bulk/get/handler.js +6 -1
- package/src/handlers/bulk/prepare/handler.js +7 -2
- package/src/handlers/bulk/processing/handler.js +5 -0
- package/src/handlers/bulk/shared/validator.js +2 -2
- package/src/lib/config.js +1 -1
- package/src/shared/setup.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [16.3.2](https://github.com/mojaloop/central-ledger/compare/v16.3.1...v16.3.2) (2022-11-24)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **mojaloop/#3020:** add checks for when mongodb is disabled ([#927](https://github.com/mojaloop/central-ledger/issues/927)) ([7461d9b](https://github.com/mojaloop/central-ledger/commit/7461d9bcd4341fbb37f32f42684108acef9ba0f4)), closes [mojaloop/#3020](https://github.com/mojaloop/project/issues/3020)
|
|
11
|
+
|
|
12
|
+
### [16.3.1](https://github.com/mojaloop/central-ledger/compare/v16.3.0...v16.3.1) (2022-11-21)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* **mojaloop/#3024:** post /bulkTransfers from Switch to PayeeFSP to use Switch as fspiop-source ([#926](https://github.com/mojaloop/central-ledger/issues/926)) ([bce2a23](https://github.com/mojaloop/central-ledger/commit/bce2a23b0e130f3ae3037ae5a31379237468fd23)), closes [mojaloop/#3024](https://github.com/mojaloop/project/issues/3024)
|
|
18
|
+
|
|
5
19
|
## [16.3.0](https://github.com/mojaloop/central-ledger/compare/v16.2.0...v16.3.0) (2022-09-08)
|
|
6
20
|
|
|
7
21
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mojaloop/central-ledger",
|
|
3
|
-
"version": "16.3.
|
|
3
|
+
"version": "16.3.2",
|
|
4
4
|
"description": "Central ledger hosted by a scheme to record and settle transfers",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "ModusBox",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"@mojaloop/central-services-database": "10.7.0",
|
|
84
84
|
"@mojaloop/central-services-error-handling": "12.0.5",
|
|
85
85
|
"@mojaloop/central-services-health": "14.0.1",
|
|
86
|
-
"@mojaloop/central-services-logger": "11.
|
|
86
|
+
"@mojaloop/central-services-logger": "11.2.0",
|
|
87
87
|
"@mojaloop/central-services-metrics": "12.0.5",
|
|
88
88
|
"@mojaloop/central-services-shared": "17.3.1",
|
|
89
89
|
"@mojaloop/central-services-stream": "11.0.0",
|
|
@@ -124,7 +124,7 @@
|
|
|
124
124
|
"jsdoc": "4.0.0",
|
|
125
125
|
"jsonpath": "1.1.1",
|
|
126
126
|
"nodemon": "2.0.20",
|
|
127
|
-
"npm-check-updates": "16.4.
|
|
127
|
+
"npm-check-updates": "16.4.3",
|
|
128
128
|
"nyc": "15.1.0",
|
|
129
129
|
"pre-commit": "1.2.2",
|
|
130
130
|
"proxyquire": "2.1.3",
|
|
@@ -307,6 +307,11 @@ const sendIndividualTransfer = async (message, messageId, kafkaTopic, headers, p
|
|
|
307
307
|
*/
|
|
308
308
|
const registerBulkFulfilHandler = async () => {
|
|
309
309
|
try {
|
|
310
|
+
if (Config.MONGODB_DISABLED) {
|
|
311
|
+
throw ErrorHandler.Factory.createFSPIOPError(
|
|
312
|
+
ErrorHandler.Enums.FSPIOPErrorCodes.INTERNAL_SERVER_ERROR,
|
|
313
|
+
'Cannot register BulkFulfilHandler as Mongo Database is disabled in configuration')
|
|
314
|
+
}
|
|
310
315
|
const bulkFulfilHandler = {
|
|
311
316
|
command: bulkFulfil,
|
|
312
317
|
topicName: Kafka.transformGeneralTopicName(Config.KAFKA_CONFIG.TOPIC_TEMPLATES.GENERAL_TOPIC_TEMPLATE.TEMPLATE, Enum.Events.Event.Type.BULK, Enum.Events.Event.Action.FULFIL),
|
|
@@ -317,7 +322,7 @@ const registerBulkFulfilHandler = async () => {
|
|
|
317
322
|
return true
|
|
318
323
|
} catch (err) {
|
|
319
324
|
Logger.isErrorEnabled && Logger.error(err)
|
|
320
|
-
throw err
|
|
325
|
+
throw ErrorHandler.Factory.reformatFSPIOPError(err)
|
|
321
326
|
}
|
|
322
327
|
}
|
|
323
328
|
|
|
@@ -335,7 +340,7 @@ const registerAllHandlers = async () => {
|
|
|
335
340
|
return true
|
|
336
341
|
} catch (err) {
|
|
337
342
|
Logger.isErrorEnabled && Logger.error(err)
|
|
338
|
-
throw err
|
|
343
|
+
throw ErrorHandler.Factory.reformatFSPIOPError(err)
|
|
339
344
|
}
|
|
340
345
|
}
|
|
341
346
|
|
|
@@ -37,10 +37,10 @@ const Consumer = require('@mojaloop/central-services-stream').Util.Consumer
|
|
|
37
37
|
const Enum = require('@mojaloop/central-services-shared').Enum
|
|
38
38
|
const Metrics = require('@mojaloop/central-services-metrics')
|
|
39
39
|
const ErrorHandler = require('@mojaloop/central-services-error-handling')
|
|
40
|
+
const Config = require('../../../lib/config')
|
|
40
41
|
const BulkTransferService = require('../../../domain/bulkTransfer')
|
|
41
42
|
const BulkTransferModel = require('../../../models/bulkTransfer/bulkTransfer')
|
|
42
43
|
const Validator = require('../shared/validator')
|
|
43
|
-
const Config = require('../../../lib/config')
|
|
44
44
|
const { ERROR_HANDLING } = require('../../../lib/config')
|
|
45
45
|
|
|
46
46
|
const location = { module: 'BulkGetHandler', method: '', path: '' }
|
|
@@ -160,6 +160,11 @@ const getBulkTransfer = async (error, messages) => {
|
|
|
160
160
|
*/
|
|
161
161
|
const registerGetBulkTransferHandler = async () => {
|
|
162
162
|
try {
|
|
163
|
+
if (Config.MONGODB_DISABLED) {
|
|
164
|
+
throw ErrorHandler.Factory.createFSPIOPError(
|
|
165
|
+
ErrorHandler.Enums.FSPIOPErrorCodes.INTERNAL_SERVER_ERROR,
|
|
166
|
+
'Cannot register GetBulkTransferHandler as Mongo Database is disabled in configuration')
|
|
167
|
+
}
|
|
163
168
|
const bulkGetHandler = {
|
|
164
169
|
command: getBulkTransfer,
|
|
165
170
|
topicName: Kafka.transformGeneralTopicName(Config.KAFKA_CONFIG.TOPIC_TEMPLATES.GENERAL_TOPIC_TEMPLATE.TEMPLATE, Enum.Events.Event.Type.BULK, Enum.Events.Event.Action.GET),
|
|
@@ -287,6 +287,11 @@ const bulkPrepare = async (error, messages) => {
|
|
|
287
287
|
*/
|
|
288
288
|
const registerBulkPrepareHandler = async () => {
|
|
289
289
|
try {
|
|
290
|
+
if (Config.MONGODB_DISABLED) {
|
|
291
|
+
throw ErrorHandler.Factory.createFSPIOPError(
|
|
292
|
+
ErrorHandler.Enums.FSPIOPErrorCodes.INTERNAL_SERVER_ERROR,
|
|
293
|
+
'Cannot register BulkPrepareHandler as Mongo Database is disabled in configuration')
|
|
294
|
+
}
|
|
290
295
|
const bulkPrepareHandler = {
|
|
291
296
|
command: bulkPrepare,
|
|
292
297
|
topicName: Kafka.transformGeneralTopicName(Config.KAFKA_CONFIG.TOPIC_TEMPLATES.GENERAL_TOPIC_TEMPLATE.TEMPLATE, Enum.Events.Event.Type.BULK, Enum.Events.Event.Action.PREPARE),
|
|
@@ -297,7 +302,7 @@ const registerBulkPrepareHandler = async () => {
|
|
|
297
302
|
return true
|
|
298
303
|
} catch (err) {
|
|
299
304
|
Logger.isErrorEnabled && Logger.error(err)
|
|
300
|
-
throw err
|
|
305
|
+
throw ErrorHandler.Factory.reformatFSPIOPError(err)
|
|
301
306
|
}
|
|
302
307
|
}
|
|
303
308
|
|
|
@@ -315,7 +320,7 @@ const registerAllHandlers = async () => {
|
|
|
315
320
|
return true
|
|
316
321
|
} catch (err) {
|
|
317
322
|
Logger.isErrorEnabled && Logger.error(err)
|
|
318
|
-
throw err
|
|
323
|
+
throw ErrorHandler.Factory.reformatFSPIOPError(err)
|
|
319
324
|
}
|
|
320
325
|
}
|
|
321
326
|
|
|
@@ -390,6 +390,11 @@ const bulkProcessing = async (error, messages) => {
|
|
|
390
390
|
*/
|
|
391
391
|
const registerBulkProcessingHandler = async () => {
|
|
392
392
|
try {
|
|
393
|
+
if (Config.MONGODB_DISABLED) {
|
|
394
|
+
throw ErrorHandler.Factory.createFSPIOPError(
|
|
395
|
+
ErrorHandler.Enums.FSPIOPErrorCodes.INTERNAL_SERVER_ERROR,
|
|
396
|
+
'Cannot register BulkProcessingHandler as Mongo Database is disabled in configuration')
|
|
397
|
+
}
|
|
393
398
|
const bulkProcessingHandler = {
|
|
394
399
|
command: bulkProcessing,
|
|
395
400
|
topicName: Kafka.transformGeneralTopicName(Config.KAFKA_CONFIG.TOPIC_TEMPLATES.GENERAL_TOPIC_TEMPLATE.TEMPLATE, Enum.Events.Event.Type.BULK, Enum.Events.Event.Action.PROCESSING),
|
|
@@ -93,8 +93,8 @@ const validateFspiopSourceAndDestination = async (payload, headers) => {
|
|
|
93
93
|
// The following was added for fix(mojaloop/##3024): [core bulk] POST /bulkTransfers from Switch --> PayeeFSP to use Switch as fspiop-source - https://github.com/mojaloop/project/issues/3024
|
|
94
94
|
// Notes:
|
|
95
95
|
// Due to the Bulk [Design Considerations](https://docs.mojaloop.io/technical/central-bulk-transfers/#_2-design-considerations),
|
|
96
|
-
// it is possible that the Switch may send a POST Request to the
|
|
97
|
-
// and the Payee thus responding with a PUT Callback
|
|
96
|
+
// it is possible that the Switch may send a POST Request to the Payee FSP with the Source Header containing "Switch",
|
|
97
|
+
// and the Payee FSP thus responding with a PUT Callback and destination header containing the same value (Switch).
|
|
98
98
|
(headers[Enum.Http.Headers.FSPIOP.DESTINATION] === Enum.Http.Headers.FSPIOP.SWITCH.value)
|
|
99
99
|
)
|
|
100
100
|
)
|
package/src/lib/config.js
CHANGED
|
@@ -6,7 +6,7 @@ module.exports = {
|
|
|
6
6
|
MAX_FULFIL_TIMEOUT_DURATION_SECONDS: RC.MAX_FULFIL_TIMEOUT_DURATION_SECONDS || 300,
|
|
7
7
|
MONGODB_URI: RC.MONGODB.URI,
|
|
8
8
|
MONGODB_DEBUG: (RC.MONGODB.DEBUG === true || RC.MONGODB.DEBUG === 'true'),
|
|
9
|
-
MONGODB_DISABLED: RC.MONGODB.DISABLED,
|
|
9
|
+
MONGODB_DISABLED: (RC.MONGODB.DISABLED === true || RC.MONGODB.DISABLED === 'true'),
|
|
10
10
|
AMOUNT: RC.AMOUNT,
|
|
11
11
|
EXPIRES_TIMEOUT: RC.EXPIRES_TIMEOUT,
|
|
12
12
|
ERROR_HANDLING: RC.ERROR_HANDLING,
|
package/src/shared/setup.js
CHANGED
|
@@ -70,7 +70,7 @@ const connectMongoose = async () => {
|
|
|
70
70
|
Logger.isWarnEnabled && Logger.warn('Enabling debug for Mongoose...')
|
|
71
71
|
ObjStoreDb.Mongoose.set('debug', Config.MONGODB_DEBUG) // enable debug
|
|
72
72
|
}
|
|
73
|
-
return ObjStoreDb.connect(Config.MONGODB_URI)
|
|
73
|
+
return await ObjStoreDb.connect(Config.MONGODB_URI)
|
|
74
74
|
} catch (err) {
|
|
75
75
|
throw ErrorHandler.Factory.reformatFSPIOPError(err)
|
|
76
76
|
// TODO: review as code is being changed from returning null to returning a FSPIOPError
|