account-lookup-service 15.6.0-snapshot.2 → 15.6.0-snapshot.4
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/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "account-lookup-service",
|
3
3
|
"description": "Account Lookup Service is used to validate Party and Participant lookups.",
|
4
|
-
"version": "15.6.0-snapshot.
|
4
|
+
"version": "15.6.0-snapshot.4",
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"author": "ModusBox",
|
7
7
|
"contributors": [
|
@@ -94,7 +94,7 @@
|
|
94
94
|
"@mojaloop/central-services-health": "15.0.0",
|
95
95
|
"@mojaloop/central-services-logger": "11.5.1",
|
96
96
|
"@mojaloop/central-services-metrics": "12.1.0",
|
97
|
-
"@mojaloop/central-services-shared": "18.11.
|
97
|
+
"@mojaloop/central-services-shared": "18.11.2",
|
98
98
|
"@mojaloop/central-services-stream": "11.3.1",
|
99
99
|
"@mojaloop/database-lib": "11.0.6",
|
100
100
|
"@mojaloop/event-sdk": "14.1.1",
|
@@ -38,13 +38,13 @@ const Metrics = require('@mojaloop/central-services-metrics')
|
|
38
38
|
const oracle = require('../../models/oracle/facade')
|
39
39
|
const participant = require('../../models/participantEndpoint/facade')
|
40
40
|
const { ERROR_MESSAGES } = require('../../constants')
|
41
|
-
const {
|
41
|
+
const { logger } = require('../../lib')
|
42
42
|
const Config = require('../../lib/config')
|
43
43
|
const utils = require('./utils')
|
44
44
|
const getPartiesByTypeAndID = require('./getPartiesByTypeAndID')
|
45
45
|
|
46
|
-
const
|
47
|
-
const handleErrorOnSendingCallback = utils.createErrorHandlerOnSendingCallback(Config,
|
46
|
+
const log = logger.child('domain:put-parties')
|
47
|
+
const handleErrorOnSendingCallback = utils.createErrorHandlerOnSendingCallback(Config, log)
|
48
48
|
|
49
49
|
/**
|
50
50
|
* @function putPartiesByTypeAndID
|
@@ -71,7 +71,7 @@ const putPartiesByTypeAndID = async (headers, params, method, payload, dataUri,
|
|
71
71
|
const destination = headers[Headers.FSPIOP.DESTINATION]
|
72
72
|
const proxy = headers[Headers.FSPIOP.PROXY]
|
73
73
|
const proxyEnabled = !!(Config.PROXY_CACHE_CONFIG.enabled && proxyCache)
|
74
|
-
|
74
|
+
log.info('parties::putPartiesByTypeAndID::begin', { source, destination, proxy, params })
|
75
75
|
|
76
76
|
let sendTo
|
77
77
|
try {
|
@@ -83,21 +83,21 @@ const putPartiesByTypeAndID = async (headers, params, method, payload, dataUri,
|
|
83
83
|
}
|
84
84
|
const isCached = await proxyCache.addDfspIdToProxyMapping(source, proxy)
|
85
85
|
// think,if we should throw error if isCached === false?
|
86
|
-
|
86
|
+
log.info('addDfspIdToProxyMapping is done', { source, proxy, isCached })
|
87
87
|
}
|
88
88
|
|
89
89
|
if (proxyEnabled && proxy) {
|
90
90
|
const alsReq = utils.alsRequestDto(destination, params) // or source?
|
91
91
|
const isExists = await proxyCache.receivedSuccessResponse(alsReq)
|
92
92
|
if (!isExists) {
|
93
|
-
|
93
|
+
log.warn('destination is NOT in scheme, and no cached sendToProxiesList', { destination, alsReq })
|
94
94
|
// think, if we need to throw an error here
|
95
95
|
} else {
|
96
96
|
const mappingPayload = {
|
97
97
|
fspId: source
|
98
98
|
}
|
99
99
|
await oracle.oracleRequest(headers, RestMethods.POST, params, null, mappingPayload, cache)
|
100
|
-
|
100
|
+
log.info('oracle was updated with mappingPayload', { mappingPayload, params })
|
101
101
|
}
|
102
102
|
}
|
103
103
|
|
@@ -122,7 +122,7 @@ const putPartiesByTypeAndID = async (headers, params, method, payload, dataUri,
|
|
122
122
|
}
|
123
123
|
await participant.sendRequest(headers, sendTo, callbackEndpointType, RestMethods.PUT, decodedPayload.body.toString(), options)
|
124
124
|
|
125
|
-
|
125
|
+
log.info('parties::putPartiesByTypeAndID::callback was sent', { sendTo, options })
|
126
126
|
histTimerEnd({ success: true })
|
127
127
|
} catch (err) {
|
128
128
|
await handleErrorOnSendingCallback(err, headers, params, sendTo)
|
@@ -168,14 +168,14 @@ const putPartiesErrorByTypeAndID = async (headers, params, payload, dataUri, spa
|
|
168
168
|
getPartiesByTypeAndID(swappedHeaders, params, RestMethods.GET, {}, span, cache, proxyCache)
|
169
169
|
// todo: - think if we need to send errorCallback?
|
170
170
|
// - or sentCallback after getPartiesByTypeAndID is done
|
171
|
-
|
171
|
+
log.info('notValidPayee case - deleted Participants and run getPartiesByTypeAndID:', { proxy, params, payload })
|
172
172
|
return
|
173
173
|
}
|
174
174
|
|
175
175
|
const alsReq = utils.alsRequestDto(destination, params) // or source?
|
176
176
|
const isLast = await proxyCache.receivedErrorResponse(alsReq, proxy)
|
177
177
|
if (!isLast) {
|
178
|
-
|
178
|
+
log.info('got NOT last error callback from proxy:', { proxy, alsReq })
|
179
179
|
return
|
180
180
|
}
|
181
181
|
}
|
@@ -195,7 +195,7 @@ const putPartiesErrorByTypeAndID = async (headers, params, payload, dataUri, spa
|
|
195
195
|
const decodedPayload = decodePayload(dataUri, { asParsed: false })
|
196
196
|
await participant.sendErrorToParticipant(sendTo, callbackEndpointType, decodedPayload.body.toString(), headers, params, childSpan)
|
197
197
|
|
198
|
-
|
198
|
+
log.info('putPartiesErrorByTypeAndID callback was sent', { sendTo })
|
199
199
|
histTimerEnd({ success: true })
|
200
200
|
} catch (err) {
|
201
201
|
fspiopError = await handleErrorOnSendingCallback(err, headers, params, sendTo)
|
package/src/handlers/index.js
CHANGED
@@ -35,7 +35,7 @@ const Package = require('../../package.json')
|
|
35
35
|
const Server = require('../server')
|
36
36
|
const { HANDLER_TYPES } = require('../constants')
|
37
37
|
const Config = require('../lib/config')
|
38
|
-
const
|
38
|
+
const log = require('../lib').logger.child('ALS-timeout-handler')
|
39
39
|
|
40
40
|
const Program = new Command()
|
41
41
|
|
@@ -51,16 +51,16 @@ Program.command('handlers')
|
|
51
51
|
const handlers = []
|
52
52
|
|
53
53
|
if (args.timeout) {
|
54
|
-
|
54
|
+
log.debug('CLI: Executing --timeout')
|
55
55
|
handlers.push(HANDLER_TYPES.TIMEOUT)
|
56
56
|
}
|
57
57
|
|
58
58
|
if (handlers.length === 0) {
|
59
|
-
|
59
|
+
log.debug('CLI: No handlers specified')
|
60
60
|
return
|
61
61
|
}
|
62
62
|
|
63
|
-
module.exports = await Server.initializeHandlers(handlers, Config,
|
63
|
+
module.exports = await Server.initializeHandlers(handlers, Config, log)
|
64
64
|
})
|
65
65
|
|
66
66
|
if (Array.isArray(process.argv) && process.argv.length > 2) {
|
@@ -1,12 +1,12 @@
|
|
1
1
|
const axiosLib = require('axios')
|
2
|
-
const
|
2
|
+
const lib = require('../../../src/lib')
|
3
3
|
const fixtures = require('../../fixtures')
|
4
4
|
|
5
5
|
class BasicApiClient {
|
6
6
|
constructor ({
|
7
7
|
baseURL,
|
8
8
|
axios = axiosLib.create({ baseURL }),
|
9
|
-
logger =
|
9
|
+
logger = lib.logger.child(this.constructor.name)
|
10
10
|
} = {}) {
|
11
11
|
this.baseURL = baseURL
|
12
12
|
this.axios = axios
|